:root {
  --bg: #04060c;
  --bg2: #070c18;
  --panel: rgba(11, 18, 34, 0.74);
  --panel-solid: #0b1222;
  --line: rgba(130, 180, 255, 0.13);
  --line-strong: rgba(130, 180, 255, 0.3);
  --text: #dfe8ff;
  --muted: #8d9cbd;
  --dim: #56648a;

  --holo: #57d8ff;
  --nemesis: #ff5a43;
  --warp: #b38cff;
  --gold: #ffc861;
  --green: #4fe39b;
  --amber: #ffad4d;
  --pink: #ff7ab8;

  --display: 'Chakra Petch', ui-sans-serif, system-ui, sans-serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r: 14px;
  --gutter: 24px;
  --maxw: 1200px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 80% -10%, rgba(87, 216, 255, 0.07), transparent 60%),
              radial-gradient(900px 700px at -10% 40%, rgba(179, 140, 255, 0.06), transparent 60%),
              var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--holo); }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
::selection { background: rgba(87, 216, 255, 0.3); }

#starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(4, 6, 12, 0.92), rgba(4, 6, 12, 0.7));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 15px/1 var(--display); letter-spacing: 0.04em; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.brand ellipse { fill: none; stroke: var(--holo); stroke-width: 2; }
.brand circle { fill: #ffe2a8; }
.brand .brand-nem { fill: var(--nemesis); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); text-decoration: none; font: 500 13px/1 var(--mono);
  padding: 8px 10px; border-radius: 8px; white-space: nowrap; transition: color .2s, background .2s;
}
.nav a:hover, .nav a.active { color: var(--text); background: rgba(87, 216, 255, 0.08); }
.nav a.active { color: var(--holo); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--holo), var(--warp), var(--nemesis)); }

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(14, 24, 46, 0.7);
  color: var(--text); text-decoration: none; font: 600 14px/1 var(--sans);
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--holo); background: rgba(87, 216, 255, 0.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #3bc6f0, #1e9ccd); border-color: transparent; color: #031018; box-shadow: 0 0 24px rgba(87, 216, 255, 0.25); }
.btn-primary:hover { background: linear-gradient(180deg, #6ee0ff, #2eb2e3); box-shadow: 0 0 32px rgba(87, 216, 255, 0.4); }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(10, 18, 34, 0.6); color: var(--muted);
  font: 500 12px/1.2 var(--mono); transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--holo); }
.chip.on { color: var(--text); border-color: var(--c, var(--holo)); background: color-mix(in srgb, var(--c, var(--holo)) 14%, transparent); }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.chip.off { opacity: .45; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(6, 12, 24, 0.8);
  color: var(--text); font: 600 16px/1 var(--mono);
}
.icon-btn:hover { border-color: var(--holo); color: var(--holo); }
:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; border-radius: 6px; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; min-height: max(640px, 100svh); display: flex; align-items: flex-end; overflow: hidden; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, var(--bg) 2%, rgba(4, 6, 12, 0.55) 34%, transparent 62%),
              linear-gradient(to right, rgba(4, 6, 12, 0.75), transparent 55%); }
.hero-copy { position: relative; z-index: 2; max-width: 680px; padding: 0 var(--gutter) 13vh calc(var(--gutter) + max(0px, (100vw - var(--maxw)) / 2)); }
.kicker { margin: 0 0 12px; font: 600 12px/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--k, var(--holo)); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: 0.01em; }
.hero h1 { font-size: clamp(44px, 8vw, 96px); font-weight: 700; letter-spacing: -0.01em; text-shadow: 0 0 40px rgba(87, 216, 255, 0.25); }
.lede { font-size: clamp(16px, 1.6vw, 19px); color: #c7d3f0; margin: 20px 0 28px; max-width: 600px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { color: var(--dim); font-size: 12px; margin-top: 22px; letter-spacing: 0.06em; }
.hero-label { position: absolute; z-index: 2; pointer-events: none; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); transform: translate(-50%, 0); opacity: 0; transition: opacity .6s; }
.hero-label.show { opacity: 1; }
.hero-label span { color: var(--nemesis); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; }
.hero-label small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.scroll-cue { position: absolute; z-index: 2; left: 50%; bottom: 22px; transform: translateX(-50%); width: 26px; height: 42px; border: 1.5px solid var(--line-strong); border-radius: 14px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--holo); animation: cue 1.8s infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- sections ---------- */
.section { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 110px var(--gutter) 40px; }
.section-head { max-width: 760px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(32px, 4.6vw, 52px); margin-bottom: 16px; }
.lead { color: #b9c6e4; font-size: 17px; margin: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.panel h3 { font-size: 22px; margin-bottom: 8px; }
.panel p { color: #b9c6e4; margin: 0 0 14px; }

/* HUD corners for canvases */
.hud { position: relative; }
.hud::before, .hud::after { content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none; z-index: 3; border-color: var(--holo); border-style: solid; opacity: .7; }
.hud::before { top: 8px; left: 8px; border-width: 1.5px 0 0 1.5px; }
.hud::after { bottom: 8px; right: 8px; border-width: 0 1.5px 1.5px 0; }

/* ---------- setup stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, transparent), rgba(10, 16, 30, 0.7)); position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); box-shadow: 0 0 18px var(--c); }
.stat-num { font: 700 30px/1.1 var(--display); color: var(--c); margin: 0 0 14px; }
.stat-num small { font: 500 13px var(--mono); color: var(--muted); }
.stat h3 { font-size: 17px; margin-bottom: 6px; }
.stat p:last-child { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- story timeline ---------- */
.lanes-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tl-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: rgba(6, 11, 22, 0.75); }
.tl-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-color: var(--dim) transparent; }
.tl-scroll:focus-visible { outline-offset: -2px; }
#timeline { display: block; max-width: none; }
#timeline .lane-label { font: 600 12px var(--display); letter-spacing: 0.04em; }
#timeline .lane-who { font: 400 10px var(--mono); fill: var(--dim); }
#timeline .month-label { font: 500 10.5px var(--mono); fill: var(--muted); letter-spacing: 0.04em; }
#timeline .node { cursor: pointer; outline: none; }
#timeline .node circle { transition: r .2s, stroke-width .2s; }
#timeline .node text { font: 600 9.5px var(--mono); fill: #04060c; pointer-events: none; }
#timeline .node:hover circle { stroke: #fff; stroke-width: 2; }
#timeline .node.sel circle { stroke: #fff; stroke-width: 2.5; }
#timeline .lane-dim { opacity: .14; }

.chapter-card {
  position: relative; display: grid; grid-template-columns: 120px 1fr; gap: 28px; margin-top: 18px;
  padding: 28px 28px 32px; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--lc, var(--holo)) 10%, transparent), rgba(10, 16, 30, 0.82) 45%);
  overflow: hidden; transition: background .4s;
}
.cc-num { font: 700 68px/1 var(--display); color: var(--lc, var(--holo)); text-shadow: 0 0 30px color-mix(in srgb, var(--lc, var(--holo)) 50%, transparent); }
.cc-meta { color: var(--lc, var(--holo)); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin: 4px 0 8px; }
.chapter-card h3 { font-size: 30px; margin-bottom: 12px; }
.chapter-card p#cc-text { color: #c6d2ee; font-size: 17px; margin: 0 0 22px; max-width: 760px; }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cc-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.04); }
.cc-progress span { display: block; height: 100%; width: 0; background: var(--lc, var(--holo)); transition: width .35s, background .35s; }
.chapter-card.flash { animation: flash .5s; }
@keyframes flash { from { box-shadow: 0 0 0 1px var(--lc), 0 0 40px color-mix(in srgb, var(--lc) 30%, transparent); } to { box-shadow: none; } }

/* ---------- holotank ---------- */
.holo-grid { display: grid; grid-template-columns: 1fr 330px; gap: 16px; }
.holo { border: 1px solid var(--line); border-radius: var(--r); background: radial-gradient(circle at 50% 50%, rgba(20, 40, 80, 0.35), rgba(4, 7, 14, 0.95) 70%); overflow: hidden; aspect-ratio: 16 / 11; min-height: 380px; }
#map-canvas { touch-action: pan-y; }
#map-canvas { width: 100%; height: 100%; cursor: grab; }
#map-canvas.dragging { cursor: grabbing; }
#map-canvas.hover { cursor: pointer; }
.holo-tip { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); padding: 6px 10px; border-radius: 8px; background: rgba(4, 8, 16, 0.92); border: 1px solid var(--line-strong); font: 500 12px var(--mono); white-space: nowrap; }
.holo-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.holo-legend { position: absolute; left: 14px; bottom: 12px; z-index: 4; display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--muted); }
.holo-legend i { display: inline-block; width: 16px; height: 2px; background: var(--c); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 6px var(--c); }
.holo-legend i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.holo-panel { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 6px; overflow: auto; contain: size; scrollbar-width: thin; }
.holo-panel h3 { font-size: 22px; margin-bottom: 4px; }
.holo-panel > p { color: #b9c6e4; font-size: 15px; margin: 0 0 6px; }
.hp-chapters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hp-month { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.hp-month-label { font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 8px; }
.hp-month ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hp-month li button { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: #c3cfeb; padding: 3px 0; }
.hp-month li button:hover { color: #fff; }
.hp-month li button:focus-visible { outline: 2px solid var(--holo); }
.hp-month li b { font: 600 11px var(--mono); color: var(--c); min-width: 22px; }
.time-bar { display: flex; align-items: center; gap: 16px; margin-top: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.time-bar output { min-width: 78px; text-align: right; color: var(--holo); font-size: 14px; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--holo) var(--p, 100%), rgba(130, 180, 255, 0.18) var(--p, 100%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(130, 180, 255, 0.18); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--holo); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #e8f9ff; border: 3px solid var(--holo); box-shadow: 0 0 14px var(--holo); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #e8f9ff; border: 3px solid var(--holo); box-shadow: 0 0 14px var(--holo); }

/* ---------- lab ---------- */
.rigs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rig { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.rig.fired { border-color: color-mix(in srgb, var(--rc) 55%, transparent); box-shadow: 0 0 30px color-mix(in srgb, var(--rc) 14%, transparent); }
.rig-view { position: relative; height: 150px; background: radial-gradient(circle at 50% 55%, rgba(30, 40, 80, 0.5), rgba(3, 5, 10, 0.95) 75%); border-bottom: 1px solid var(--line); }
.rig-view canvas { width: 100%; height: 100%; }
.rig-tag { position: absolute; left: 10px; top: 8px; font: 600 11px var(--mono); color: var(--muted); letter-spacing: .1em; }
.rig-readout { position: absolute; right: 10px; top: 8px; font: 500 11px var(--mono); color: var(--rc); text-align: right; }
.rig-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rig-body h4 { font-size: 19px; color: var(--muted); transition: color .3s; }
.rig.fired h4 { color: var(--rc); }
.rig-body p { margin: 0; font-size: 13.5px; color: #b9c6e4; }
.rig-body .rig-use { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 9px; }
.rig-body .rig-use b { color: var(--text); font-weight: 600; }
.rig-hidden { display: none; }
.rig.fired .rig-hidden { display: block; animation: rise .4s; }
.rig .btn { margin-top: auto; align-self: flex-start; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.warp-dial { margin-top: 22px; padding: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; }
.wd-head { grid-column: 1 / -1; max-width: 820px; }
.wd-controls { display: flex; flex-direction: column; gap: 12px; }
.wd-controls label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.wd-controls input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--warp) var(--p, 100%), rgba(130, 180, 255, 0.18) var(--p, 100%)); }
.wd-controls input[type=range]::-webkit-slider-thumb { border-color: var(--warp); box-shadow: 0 0 14px var(--warp); }
.wd-controls input[type=range]::-moz-range-progress { background: var(--warp); }
.wd-controls input[type=range]::-moz-range-thumb { border-color: var(--warp); }
.wd-big { font: 700 64px/1 var(--display); color: var(--warp); margin: 0; text-shadow: 0 0 30px rgba(179, 140, 255, 0.4); }
.wd-big small { font: 500 18px var(--mono); color: var(--muted); margin-left: 6px; }
.wd-tos { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.wd-tos span { color: var(--text); }
.wd-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.wd-presets .chip { --c: var(--warp); }
.wd-table { display: flex; flex-direction: column; gap: 14px; }
.wd-row h5 { margin: 0 0 6px; font: 500 13px var(--sans); color: #c6d2ee; }
.wd-bars { display: grid; grid-template-columns: 74px 1fr 92px; align-items: center; gap: 4px 10px; font: 500 11px var(--mono); color: var(--muted); }
.wd-bar { height: 8px; border-radius: 4px; background: rgba(130, 180, 255, 0.08); overflow: hidden; }
.wd-bar span { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.wd-bar.out span { background: var(--holo); }
.wd-bar.in span { background: var(--nemesis); }
.wd-val { text-align: right; color: var(--text); }

/* ---------- war ---------- */
.war-board { padding: 22px; }
.wb-stages { position: relative; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: thin; }
.wb-stage { flex: 1 0 auto; min-width: 96px; text-align: left; cursor: pointer; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 14, 28, 0.6); color: var(--muted); }
.wb-stage small { display: block; font: 500 10px var(--mono); color: var(--dim); letter-spacing: .06em; }
.wb-stage span { font: 600 13px var(--display); }
.wb-stage:hover { border-color: var(--line-strong); color: var(--text); }
.wb-stage[aria-selected=true] { border-color: var(--nemesis); color: var(--text); background: rgba(255, 90, 67, 0.1); }
.wb-stage[aria-selected=true] small { color: var(--nemesis); }
.wb-main { display: grid; grid-template-columns: 330px 1fr; gap: 24px; align-items: start; }
.wb-date { color: var(--nemesis); font-size: 12px; letter-spacing: .1em; margin: 0 0 6px; }
.wb-text h3 { font-size: 26px; margin-bottom: 10px; }
.wb-text p { color: #b9c6e4; margin: 0 0 16px; }
.wb-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11px; color: var(--muted); }
.wb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wb-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.wb-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.colony { position: relative; padding: 12px 12px 11px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, rgba(6, 10, 20, 0.8)); min-height: 74px; transition: background .5s, border-color .5s; overflow: hidden; }
.colony h4 { font: 600 13.5px/1.2 var(--display); margin: 0 0 6px; }
.colony p { margin: 0; font: 500 10.5px var(--mono); color: var(--c); letter-spacing: .03em; }
.colony.s-a::after { content: ''; position: absolute; inset: 0; border-radius: 10px; box-shadow: inset 0 0 18px var(--c); animation: pulse 1.6s infinite; pointer-events: none; }
.colony.s-o { background: repeating-linear-gradient(-45deg, rgba(120, 20, 20, 0.35) 0 6px, rgba(30, 6, 6, 0.6) 6px 12px); }
.colony.s-x::after { content: ''; position: absolute; right: -14px; top: -14px; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #fff3c2, #ff8a3d 30%, #a01e10 60%, transparent 70%); animation: pulse 1s infinite; }
.colony.changed { animation: pop .5s; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }

.scope-wrap { display: grid; grid-template-columns: 1fr minmax(280px, 520px); gap: 28px; align-items: center; margin-top: 22px; }
.scope-copy h3 { font-size: 26px; margin-bottom: 12px; }
.scope-copy p { color: #b9c6e4; margin: 0 0 14px; }
.scope-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.scope-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.scope-stats span { display: block; font: 700 26px/1 var(--display); color: var(--text); }
.scope-stats small { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.scope-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scope { aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line-strong); background: radial-gradient(circle, rgba(10, 40, 30, 0.35), rgba(2, 8, 8, 0.95) 70%); overflow: hidden; box-shadow: 0 0 60px rgba(79, 227, 155, 0.08), inset 0 0 50px rgba(0, 0, 0, 0.8); }
.scope.hud::before, .scope.hud::after { display: none; }
#scope-canvas { width: 100%; height: 100%; cursor: crosshair; }

.gambit { margin-top: 22px; padding: 26px; }
.gambit-head { max-width: 720px; margin-bottom: 16px; }
.gambit-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; counter-reset: g; }
.gambit-steps li button { width: 100%; text-align: left; cursor: pointer; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 14, 28, 0.6); color: var(--muted); font: 600 13px var(--display); }
.gambit-steps li button::before { counter-increment: g; content: '0' counter(g); display: block; font: 500 10px var(--mono); color: var(--dim); margin-bottom: 2px; }
.gambit-steps li button:hover { color: var(--text); border-color: var(--line-strong); }
.gambit-steps li button[aria-current=step] { color: var(--text); border-color: var(--gold); background: rgba(255, 200, 97, 0.08); }
.gambit-steps li button[aria-current=step]::before { color: var(--gold); }
.gambit-steps li button.done { color: #c4cde3; }
.gambit-stage { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; }
#palace { width: 100%; height: auto; border-radius: 12px; background: linear-gradient(to bottom, #0a1228, #12224a 70%, #1b3a2a 70.5%, #0e2418); }
.gambit-card p.mono { color: var(--gold); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px; }
.gambit-card h4 { font-size: 26px; margin-bottom: 10px; }
.gambit-card p:not(.mono) { color: #c6d2ee; margin: 0 0 18px; font-size: 16px; }

/* ---------- earth ---------- */
.vegas { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 7; min-height: 300px; }
#vegas-canvas { width: 100%; height: 100%; cursor: crosshair; }
.vegas-hud { position: absolute; left: 16px; right: 16px; top: 14px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #d9e6ff; text-shadow: 0 1px 6px #000; pointer-events: none; }
.vegas-hud b { color: var(--green); font-size: 15px; }
.vegas-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(4, 10, 8, 0.75); border: 1px solid rgba(79, 227, 155, 0.4); color: var(--green); font-size: 12px; pointer-events: none; transition: opacity .5s; white-space: nowrap; }
.earth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.earth-grid .panel { padding: 24px; }
.vote-list { list-style: none; margin: 4px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 6px; position: relative; }
.vote-list li { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 14, 28, 0.6); transition: transform .6s cubic-bezier(.2, .8, .2, 1), border-color .4s, background .4s; }
.vote-list li span { font: 600 15px var(--display); }
.vote-list li em { font: 400 12px var(--mono); color: var(--muted); font-style: normal; }
.vote-list.counted li { color: var(--muted); }
.vote-list.counted li[data-rank="1"] { border-color: var(--green); background: rgba(79, 227, 155, 0.1); color: var(--text); }
.vote-list.counted li[data-rank="1"] em { color: var(--green); }
.vote-list.counted li[data-rank="2"] { border-color: var(--line-strong); color: var(--text); }
.clark-art { height: 120px; display: grid; place-items: center; margin: 4px 0 14px; perspective: 600px; }
.cyl { position: relative; width: 78%; height: 62px; border-radius: 31px / 31px; background: linear-gradient(180deg, #2a3a5a, #a5c0e8 30%, #4b6a96 52%, #1a2640); box-shadow: 0 0 30px rgba(87, 216, 255, 0.15); overflow: hidden; }
.cyl::before { content: ''; position: absolute; inset: 8px 20px; border-radius: 22px; background: repeating-linear-gradient(90deg, rgba(79, 227, 155, 0.35) 0 22px, rgba(87, 216, 255, 0.15) 22px 30px); mix-blend-mode: screen; }
.cyl span { position: absolute; top: 50%; left: 6%; right: 6%; height: 2px; margin-top: -1px; background: linear-gradient(90deg, transparent, #fff8d6, transparent); box-shadow: 0 0 12px #fff2b0; animation: shaft 4s ease-in-out infinite; }
@keyframes shaft { 50% { opacity: .55; } }
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.specs div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.specs dt { font-size: 10px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.specs dd { margin: 2px 0 0; font-size: 15px; color: var(--text); }

/* ---------- nemesis ---------- */
.nem-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.nem-scale { margin: 0; padding: 22px; }
.nem-scale-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
#nem-svg { width: 100%; height: auto; border-radius: 10px; background: radial-gradient(circle at 50% 50%, #0b1428, #03060c 75%); }
.nem-scale figcaption { font-size: 14px; margin-top: 12px; }
.nem-numbers { display: flex; flex-direction: column; gap: 16px; }
.big-num { padding: 20px 22px; position: relative; overflow: hidden; }
.big-num::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); box-shadow: 0 0 16px var(--c); }
.bn { font: 700 34px/1.1 var(--display); color: var(--c); margin: 0 0 4px !important; }
.big-num h4 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.big-num p:last-child { font-size: 14px; color: var(--muted); margin: 0; }
.pipeline { margin-top: 16px; padding: 24px; }
.pl-head { max-width: 760px; }
.pl-track { position: relative; height: 70px; margin: 18px 0 10px; }
.pl-track .pl-line { position: absolute; left: 30px; right: 30px; top: 50%; height: 2px; background: linear-gradient(90deg, var(--holo), var(--nemesis)); opacity: .35; }
.pl-track .pl-end { position: absolute; top: 50%; transform: translate(-50%, -50%); font: 600 11px var(--mono); }
.pl-track .pl-end b { display: block; width: 22px; height: 22px; border-radius: 50%; margin: 0 auto 4px; }
.pl-track .pl-hop { position: absolute; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--holo); box-shadow: 0 0 6px var(--holo); opacity: 0; animation: hop .4s forwards; }
@keyframes hop { to { opacity: 1; } }
.pl-result { margin: 0; font-size: 16px; color: #c6d2ee; }
.pl-result .mono { font: 700 30px var(--display); color: var(--holo); margin-right: 4px; }

/* ---------- mysteries ---------- */
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.case { perspective: 1000px; min-height: 220px; }
.case:last-child { grid-column: 1 / -1; min-height: 200px; }
.case button { all: unset; cursor: pointer; display: block; position: relative; width: 100%; height: 100%; min-height: inherit; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .2, 1); }
.case button:focus-visible { outline: 2px solid var(--holo); outline-offset: 3px; border-radius: var(--r); }
.case.open button { transform: rotateY(180deg); }
.case-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r); border: 1px solid var(--line); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-solid); }
.case-front { background: linear-gradient(160deg, rgba(20, 30, 56, 0.9), rgba(8, 12, 24, 0.95)); }
.case-front h4 { font-size: 20px; line-height: 1.2; }
.case-front .open-hint { margin-top: auto; font: 500 11px var(--mono); color: var(--dim); letter-spacing: .08em; }
.case-back { transform: rotateY(180deg); background: linear-gradient(160deg, color-mix(in srgb, var(--sc) 12%, #0b1222), #070b16); border-color: color-mix(in srgb, var(--sc) 40%, transparent); }
.case-back p { margin: 0; color: #cfd9f2; font-size: 14.5px; }
.status { align-self: flex-start; font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; color: var(--sc); border: 1px solid color-mix(in srgb, var(--sc) 50%, transparent); }
.case.reveal .case-front { border-color: rgba(255, 200, 97, 0.5); background: radial-gradient(circle at 80% 20%, rgba(255, 200, 97, 0.18), transparent 50%), linear-gradient(160deg, #1a1608, #080a12); }
.case.reveal .case-front h4 { font-size: clamp(24px, 3vw, 34px); color: var(--gold); }
.case.reveal .case-back { background: radial-gradient(circle at 20% 30%, rgba(255, 200, 97, 0.25), transparent 55%), #0d0b06; }
.case.reveal .case-back p { font-size: 17px; max-width: 800px; }
.spark { position: absolute; right: 30px; top: 50%; width: 90px; height: 90px; margin-top: -45px; border-radius: 50%; background: radial-gradient(circle, #fffbe8 0 8%, #ffe08a 18%, rgba(255, 200, 97, 0.35) 40%, transparent 70%); filter: blur(.3px); animation: spark 2.4s ease-in-out infinite; pointer-events: none; }
.spark::before, .spark::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 1px solid rgba(255, 240, 200, 0.55); animation: spin 5s linear infinite; }
.spark::after { inset: 32%; border-style: dashed; animation-duration: 3s; animation-direction: reverse; }
@keyframes spark { 50% { transform: scale(1.12); filter: blur(.8px) brightness(1.2); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cast ---------- */
.cast { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.person { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); transition: opacity .3s, transform .3s, border-color .3s; }
.person:hover { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.person.hide { display: none; }
.person-head { display: flex; align-items: center; gap: 12px; }
.badge { flex: none; width: 46px; height: 46px; }
.person h4 { font-size: 18px; }
.person .aka { font: 500 11px var(--mono); color: var(--c); letter-spacing: .04em; }
.person p { margin: 0; font-size: 13.5px; color: #b9c6e4; }
.person .chs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.person .chs button { cursor: pointer; font: 600 10.5px var(--mono); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); }
.person .chs button:hover { color: var(--text); border-color: var(--c); }

.footer { max-width: var(--maxw); margin: 80px auto 0; padding: 30px var(--gutter) 60px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
.footer p { max-width: 760px; margin: 0; }

/* chapter chip used in a few places */
.ch-chip { cursor: pointer; font: 600 11px var(--mono); padding: 4px 9px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--c, var(--holo)) 50%, transparent); background: color-mix(in srgb, var(--c, var(--holo)) 10%, transparent); color: var(--text); }
.ch-chip:hover { background: color-mix(in srgb, var(--c, var(--holo)) 22%, transparent); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .rigs { grid-template-columns: repeat(2, 1fr); }
  .holo-grid { grid-template-columns: 1fr; }
  .holo-panel { contain: none; }
  .wb-main { grid-template-columns: 1fr; }
  .wb-grid { grid-template-columns: repeat(4, 1fr); }
  .cast { grid-template-columns: repeat(3, 1fr); }
  .nem-grid { grid-template-columns: 1fr; }
  .nem-numbers { display: grid; grid-template-columns: repeat(3, 1fr); }
  .gambit-steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  :root { --gutter: 16px; }
  .topbar { gap: 12px; }
  .brand span { display: none; }
  .section { padding-top: 84px; }
  .chapter-card { grid-template-columns: 1fr; gap: 6px; padding: 22px 18px 26px; }
  .cc-num { font-size: 44px; }
  .chapter-card h3 { font-size: 24px; }
  .chapter-card p#cc-text { font-size: 16px; }
  .warp-dial { grid-template-columns: 1fr; padding: 20px; }
  .scope-wrap { grid-template-columns: 1fr; }
  .scope { max-width: 460px; width: 100%; margin: 0 auto; }
  .gambit { padding: 20px; }
  .gambit-stage { grid-template-columns: 1fr; }
  .earth-grid { grid-template-columns: 1fr; }
  .vegas { aspect-ratio: 4 / 3; }
  .cases { grid-template-columns: 1fr 1fr; }
  .cast { grid-template-columns: repeat(2, 1fr); }
  .nem-numbers { grid-template-columns: 1fr; }
  .wb-grid { grid-template-columns: repeat(3, 1fr); }
  .holo { aspect-ratio: 1 / 1; }
  .hero-copy { padding-bottom: 96px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .rigs { grid-template-columns: 1fr; }
  .cases { grid-template-columns: 1fr; }
  .case { min-height: 240px; }
  .cast { grid-template-columns: 1fr; }
  .wb-grid { grid-template-columns: repeat(2, 1fr); }
  .gambit-steps { grid-template-columns: repeat(2, 1fr); }
  .specs { grid-template-columns: repeat(2, 1fr); }
  .time-bar { gap: 10px; padding: 10px 12px; }
  .time-bar output { min-width: 64px; font-size: 12px; }
  .spark { display: none; }
  .hero-label small { display: none; }
  .vegas-hud { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
