:root {
  --bg: #090d13;
  --bg-soft: #10161f;
  --panel: #131b26;
  --panel-2: #1a2431;
  --line: #263243;
  --line-soft: #1d2836;
  --text: #eaf0f7;
  --muted: #7f8ea1;
  --accent: #35c871;
  --accent-2: #8ee8b2;
  --accent-soft: rgba(53, 200, 113, .12);
  --ok: #2fbf71;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
::selection { background: rgba(53, 200, 113, .35); }

/* ambient backdrop: grid + glows */
.bg-fx {
  position: fixed; inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 85% -8%, rgba(53, 200, 113, .10), transparent 65%),
    radial-gradient(700px 400px at -10% 20%, rgba(30, 160, 110, .09), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(122, 150, 184, .05) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(122, 150, 184, .05) 47px 48px);
  mask-image: linear-gradient(180deg, #000 0, #000 70%, transparent 100%);
}

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #2c3a4e transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #2c3a4e; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(9, 13, 19, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(53, 200, 113, .65) 30%, rgba(53, 200, 113, .65) 70%, transparent);
  opacity: .5;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 16px 18px 10px;
  display: flex; align-items: center;
  gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(53, 200, 113, .22), rgba(53, 200, 113, .06));
  border: 1px solid rgba(53, 200, 113, .5);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
}
.brand-mark span {
  font-size: 24px; font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(53, 200, 113, .6);
}
.brand-text h1 {
  margin: 0; font-size: 19px; font-weight: 900;
  letter-spacing: .12em;
}
.tagline {
  margin: 0; font-size: 10px; letter-spacing: .28em;
  color: var(--muted); font-family: var(--mono);
}
.data-meta {
  margin-left: auto;
  font-size: 12px; color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  flex: 1 1 300px; max-width: 560px;
  display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 14px;
  width: 18px; height: 18px;
  color: var(--muted); pointer-events: none;
  transition: color .15s;
}
.search-input {
  width: 100%;
  padding: 12px 40px 12px 44px;
  font-size: 15px; color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .2s;
}
.search-input:focus {
  border-color: rgba(53, 200, 113, .7);
  box-shadow: 0 0 0 3px rgba(53, 200, 113, .14), inset 0 0 24px rgba(53, 200, 113, .05);
}
.search-input:focus ~ .search-icon,
.search-wrap:focus-within .search-icon { color: var(--accent); }
.search-input::placeholder { color: #55637a; }
.search-clear {
  position: absolute; right: 10px;
  width: 26px; height: 26px;
  border: none; border-radius: 8px;
  background: var(--panel-2); color: var(--muted);
  cursor: pointer; font-size: 12px;
}
.search-clear:hover { color: var(--text); background: #24314200; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- category chips ---------- */
.cat-bar {
  max-width: 1200px; margin: 0 auto;
  padding: 2px 18px 12px;
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  padding: 6px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.cat-chip:hover { color: var(--text); border-color: #3a4c64; transform: translateY(-1px); }
.cat-chip.active {
  color: #0d1117;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(53, 200, 113, .35);
}

/* ---------- layout ---------- */
.layout {
  max-width: 1200px; margin: 0 auto;
  padding: 20px 18px 48px;
  display: grid;
  grid-template-columns: 224px 1fr;
  gap: 20px; align-items: start;
}

.gun-panel {
  position: sticky; top: 148px;
  background: linear-gradient(180deg, var(--panel), #101823);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gun-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  font-size: 12px; font-weight: 800;
  letter-spacing: .18em;
  color: var(--accent-2);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(53, 200, 113, .08), transparent);
}
.gun-list {
  list-style: none; margin: 0; padding: 8px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}
.gun-item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; color: var(--text);
  transition: background .12s, color .12s;
}
.gun-item::before {
  content: "";
  position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; border-radius: 3px;
  background: var(--accent);
  opacity: 0; transition: opacity .12s;
}
.gun-item small { margin-left: auto; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.gun-item:hover { background: var(--panel-2); }
.gun-item.active { background: var(--accent-soft); color: var(--accent-2); }
.gun-item.active::before { opacity: 1; }
.gun-item.active small { color: var(--accent); }

/* ---------- result head ---------- */
.result-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 4px 2px 16px; flex-wrap: wrap;
}
.result-head h2 {
  margin: 0; font-size: 24px; font-weight: 900;
  letter-spacing: .03em;
  position: relative; padding-left: 14px;
}
.result-head h2::before {
  content: "";
  position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 5px; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
#resultSub { font-size: 13px; margin: 0; }
.muted { color: var(--muted); }

/* ---------- cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), #111823);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow);
  transition: border-color .18s, transform .18s, box-shadow .18s;
  animation: rise .35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.card::before {
  content: "";
  position: absolute; top: -1px; left: 18px; right: 40%;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(53, 200, 113, .8), transparent);
  opacity: .7;
}
.card:hover {
  border-color: rgba(53, 200, 113, .45);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45), 0 0 24px rgba(53, 200, 113, .08);
}
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-gun {
  display: inline-block;
  font-size: 10.5px; font-weight: 800;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(53, 200, 113, .3);
  border-radius: 6px;
  padding: 1px 8px;
  margin-bottom: 4px;
}
.card h3 { margin: 0; font-size: 17.5px; font-weight: 800; }
.card-scene { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-size: 11.5px; color: #b9c6d6;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 10px;
}
.tag::before { content: "#"; color: var(--accent); margin-right: 2px; }

/* code panel — terminal style */
.code-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #0b1119;
}
.code-panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  font-size: 11px; letter-spacing: .1em;
  color: var(--muted);
  background: linear-gradient(90deg, rgba(53, 200, 113, .10), transparent);
  border-bottom: 1px dashed var(--line);
  font-family: var(--mono);
}
.code-panel-head .dots { display: inline-flex; gap: 4px; margin-right: 2px; }
.code-panel-head .dots i { width: 7px; height: 7px; border-radius: 50%; background: #33465e; }
.code-panel-head .dots i:first-child { background: rgba(53, 200, 113, .8); }
.code-panel-head .code-tag {
  margin-left: auto; font-style: normal;
  color: var(--accent-2);
  border: 1px solid rgba(53, 200, 113, .3);
  border-radius: 5px; padding: 0 6px;
}
.code-row { display: flex; align-items: stretch; }
.code-text {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13.5px; line-height: 1.5;
  color: #d7f8de;
  word-break: break-all;
  display: flex; align-items: center;
}
.copy-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 18px;
  border: none;
  font-size: 14px; font-weight: 800;
  color: #06150c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: filter .12s, background .2s;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover { filter: brightness(1.12); }
.copy-btn.copied {
  background: linear-gradient(135deg, #5fd894, #a9f0c4);
  color: #04120a;
}

.parts-toggle {
  align-self: flex-start;
  background: none; border: none;
  color: var(--muted); font-size: 12.5px;
  cursor: pointer; padding: 2px 0; margin-bottom: 4px;
  transition: color .12s;
}
.parts-toggle:hover { color: var(--accent-2); }
.parts {
  margin: 2px 0 10px; padding: 10px 14px;
  font-size: 13px; list-style: none;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.parts li { padding: 3px 0; color: #c3cedb; display: flex; }
.parts li::before { content: "›"; color: var(--accent); margin-right: 8px; font-weight: 900; }

.card-foot {
  margin-top: auto;
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--line-soft);
  padding-top: 9px;
  font-family: var(--mono);
}
mark {
  background: rgba(53, 200, 113, .3);
  color: #e2ffee;
  border-radius: 3px; padding: 0 2px;
}

.empty { padding: 70px 0; text-align: center; color: var(--muted); }
.empty-mark {
  font-size: 42px; color: #2b3b52;
  margin-bottom: 8px;
}

.notice {
  grid-column: 1 / -1;
  font-size: 12.5px; color: #e6c07a;
  background: rgba(216, 180, 106, .08);
  border: 1px solid rgba(216, 180, 106, .28);
  border-left: 3px solid #d8b46a;
  border-radius: 10px;
  padding: 10px 14px;
}

.foot {
  max-width: 1200px; margin: 0 auto;
  padding: 0 18px 34px;
  font-size: 12px; color: #55637a;
}
.foot code { font-family: var(--mono); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 9px;
  padding: 11px 22px;
  background: rgba(15, 22, 31, .95);
  border: 1px solid rgba(47, 191, 113, .5);
  color: var(--text);
  font-size: 14px; font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 50;
}
.toast .toast-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding-top: 14px; }
  .gun-panel { position: static; }
  .gun-list {
    display: flex; gap: 8px;
    max-height: none; overflow-x: auto;
    padding: 10px;
  }
  .gun-list::-webkit-scrollbar { display: none; }
  .gun-item { flex: 0 0 auto; border: 1px solid var(--line); }
  .gun-item::before { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .result-head h2 { font-size: 20px; }
  .data-meta { display: none; }
  .tagline { letter-spacing: .18em; }
}
