/* Kalyon — काल + नियोजन
   Night-ops console for Indian Railways: a tactical HUD (angled glass panels, corner
   brackets, scan lines) with the yellow station nameboard as the one warm, familiar object. */

@font-face { font-family: "Rajdhani"; font-weight: 500; font-display: swap; src: url(../fonts/rajdhani-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+2190-21FF, U+2212; }
@font-face { font-family: "Rajdhani"; font-weight: 600; font-display: swap; src: url(../fonts/rajdhani-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+2190-21FF, U+2212; }
@font-face { font-family: "Rajdhani"; font-weight: 700; font-display: swap; src: url(../fonts/rajdhani-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+2190-21FF, U+2212; }
@font-face { font-family: "Rajdhani"; font-weight: 500; font-display: swap; src: url(../fonts/rajdhani-devanagari-500-normal.woff2) format("woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC, U+A8E0-A8FF; }
@font-face { font-family: "Rajdhani"; font-weight: 600; font-display: swap; src: url(../fonts/rajdhani-devanagari-600-normal.woff2) format("woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC, U+A8E0-A8FF; }
@font-face { font-family: "Rajdhani"; font-weight: 700; font-display: swap; src: url(../fonts/rajdhani-devanagari-700-normal.woff2) format("woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC, U+A8E0-A8FF; }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url(../fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2"); }

:root {
  --bg: #090c0b;
  --bg-2: #0f1513;
  --glass: rgba(14, 20, 18, 0.78);
  --glass-2: rgba(22, 30, 27, 0.86);
  --line: rgba(214, 232, 220, 0.11);
  --line-2: rgba(214, 232, 220, 0.24);
  --text: #e9ede6;
  --muted: #94a19a;
  --faint: #5e6b65;
  --amber: #ffc21a;
  --amber-2: #ffd75a;
  --amber-dim: rgba(255, 194, 26, 0.14);
  --green: #3cf0a0;
  --red: #ff4d3d;
  --cyan: #5fd4ff;
  --today: #cfc6b6;
  --board-ink: #15130a;
  /* chart semantics used by the JS */
  --panel: #0f1513; --panel-2: #141c19; --panel-3: #1a2420; --rule: rgba(214,232,220,0.12); --track: #355247;
  --chalk: var(--text); --board: var(--amber); --go: var(--green); --warn: var(--amber); --stop: var(--red);
  --kalyon: var(--amber); --band: rgba(255, 194, 26, 0.17); --sched: #73867c; --actual: var(--green);
  --display: "Rajdhani", "Barlow", system-ui, sans-serif;
  --font: "Barlow", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --hi: "Rajdhani", "Noto Sans Devanagari", sans-serif;
  --cut: 14px;
  --gutter: clamp(16px, 3vw, 44px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5;
  font-variant-numeric: tabular-nums; min-height: 100vh; overflow-x: hidden;
}
body::before { /* scan lines + vignette over everything, never blocks input */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
}
body.console-mode { background:
  radial-gradient(ellipse at 70% -20%, rgba(95, 212, 255, 0.07), transparent 50%),
  radial-gradient(ellipse at 0% 120%, rgba(255, 194, 26, 0.06), transparent 50%),
  linear-gradient(rgba(214,232,220,0.025) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(90deg, rgba(214,232,220,0.025) 1px, transparent 1px) 0 0 / 40px 40px,
  var(--bg); }
.hi { font-family: var(--hi); }
a { color: var(--amber); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { overflow: visible; }

/* ---------- Boot sequence ---------- */
.boot { position: fixed; inset: 0; z-index: 200; background: #050706; display: grid; place-items: center; transition: opacity .6s, visibility .6s; }
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { width: min(560px, calc(100vw - 32px)); display: grid; gap: 18px; justify-items: start; }
.boot-log { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--muted); min-height: 9.5em; white-space: pre-wrap; }
.boot-log b { color: var(--green); font-weight: 600; }
.boot-bar { width: 100%; height: 3px; background: var(--line); }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--amber); box-shadow: 0 0 12px var(--amber); transition: width .25s linear; }
.boot-skip { background: none; border: 0; color: var(--faint); cursor: pointer; font-family: var(--display); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; padding: 0; }
.boot-skip:hover { color: var(--text); }

/* ---------- Nameboard (Indian Railways station sign) ---------- */
.nameboard {
  display: inline-grid; align-items: center; background: var(--amber); color: var(--board-ink);
  padding: 3px 12px 4px; text-decoration: none; position: relative; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--board-ink), inset 0 0 0 3.5px var(--amber), 0 0 24px rgba(255,194,26,0.25);
}
.nameboard .hi { font-weight: 700; font-size: 0.86rem; }
.nameboard .en { font-family: var(--display); font-weight: 700; letter-spacing: .14em; font-size: 1.12rem; }
.nameboard.big { padding: 8px 20px 10px; }
.nameboard.big .hi { font-size: 1.5rem; }
.nameboard.big .en { font-size: 2.2rem; }

/* ---------- Top HUD ---------- */
.hud-top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 22px;
  padding: 9px var(--gutter); background: rgba(9, 12, 11, 0.82); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer; position: relative;
  display: flex; align-items: center; gap: 8px; padding: 9px 12px 10px; white-space: nowrap;
  color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 0.98rem; letter-spacing: .03em;
  transition: color .2s;
}
.tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--amber); transform: scaleX(0); transition: transform .35s var(--ease); box-shadow: 0 0 10px var(--amber); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"] svg { stroke: var(--amber); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.hud-right { display: flex; align-items: center; gap: 14px; }
.sys { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.sys i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.repo-link { color: var(--muted); display: grid; place-items: center; }
.repo-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.repo-link:hover { color: var(--text); }
.mode-strip {
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; text-align: center;
  padding: 6px var(--gutter); font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--line); background: rgba(255,194,26,0.04);
}
.mode-strip .tag { font-family: var(--display); font-weight: 700; color: var(--board-ink); background: var(--amber); padding: 1px 8px; letter-spacing: .1em; text-transform: uppercase; font-size: .72rem;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }

/* ---------- Generic type & controls ---------- */
main { min-height: 70vh; }
.view { display: none; }
.view.active { display: block; }
.console { padding: 26px var(--gutter) 70px; max-width: 1560px; margin: 0 auto; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.02; letter-spacing: .01em; }
h1 { font-size: clamp(2.6rem, 6.6vw, 6.4rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.6rem); }
h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: .02em; }
p { margin: 0; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 62ch; line-height: 1.6; }
.small { font-size: 0.85rem; color: var(--muted); }
.faint { color: var(--faint); }
.num, .mono { font-family: var(--mono); }
.kicker { font-family: var(--mono); font-size: 11.5px; color: var(--amber); letter-spacing: .06em; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 32px; margin-bottom: 22px; }
.view-head .lede { margin-top: 8px; }
.view-head h2 { display: flex; align-items: baseline; gap: 14px; }
.view-head h2 .hi { font-size: .55em; color: var(--amber); font-weight: 600; }

.panel {
  position: relative; background: var(--glass); backdrop-filter: blur(10px);
  border: 1px solid var(--line); padding: 18px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.panel::before, .panel::after { /* corner brackets */
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; transition: all .35s var(--ease);
}
.panel::before { top: 6px; left: 6px; border-top: 1.5px solid var(--line-2); border-left: 1.5px solid var(--line-2); }
.panel::after { bottom: 6px; right: 6px; border-bottom: 1.5px solid var(--line-2); border-right: 1.5px solid var(--line-2); }
.panel:hover::before, .panel:hover::after { border-color: var(--amber); width: 20px; height: 20px; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-title h3 { display: flex; align-items: center; gap: 9px; }
.panel-title h3::before { content: ""; width: 6px; height: 6px; background: var(--amber); transform: rotate(45deg); box-shadow: 0 0 8px var(--amber); flex: none; }
.grid { display: grid; gap: 16px; }

.btn {
  appearance: none; cursor: pointer; position: relative; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line-2); background: rgba(255,255,255,0.03); color: var(--text);
  padding: 10px 18px; font-family: var(--display); font-weight: 700; font-size: 0.98rem; letter-spacing: .06em;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: color .25s, border-color .25s, transform .12s;
}
.btn::before { content: ""; position: absolute; inset: 0; background: var(--text); transform: translateX(-102%); transition: transform .35s var(--ease); z-index: -1; }
.btn:hover { color: var(--bg); border-color: var(--text); }
.btn:hover::before { transform: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--board-ink); box-shadow: 0 0 28px rgba(255,194,26,0.25); }
.btn.primary::before { background: #fff3c4; }
.btn.ghost { border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn .arr { display: inline-block; transition: transform .3s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.seg { display: inline-flex; border: 1px solid var(--line-2); background: rgba(0,0,0,.25); }
.seg button { appearance: none; border: 0; background: transparent; padding: 8px 13px; cursor: pointer; color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 0.93rem; letter-spacing: .04em; transition: background .2s, color .2s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--amber); color: var(--board-ink); }
select { background: rgba(0,0,0,.35); border: 1px solid var(--line-2); padding: 8px 10px; font-weight: 600; max-width: 100%; color: var(--text); }
select option { background: #121a17; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.82rem; color: var(--muted); }
.key { display: inline-flex; align-items: center; gap: 7px; }
.key i { display: inline-block; width: 18px; height: 3px; }
.key i.sched { background: repeating-linear-gradient(90deg, var(--sched) 0 4px, transparent 4px 7px); }
.key i.today { background: repeating-linear-gradient(90deg, var(--today) 0 6px, transparent 6px 9px); }
.key i.kal { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.key i.band { height: 10px; background: var(--band); border: 1px solid rgba(255,194,26,.5); }
.key i.act { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }

.next-step { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border: 1px dashed var(--line-2); }
.next-step p { color: var(--muted); }
.next-step b { color: var(--text); font-family: var(--display); font-size: 1.1rem; letter-spacing: .03em; }
.help-line { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--muted); background: rgba(95,212,255,0.06); border-left: 2px solid var(--cyan); padding: 9px 12px; margin-bottom: 16px; }
.help-line svg { flex: none; width: 18px; height: 18px; stroke: var(--cyan); fill: none; stroke-width: 1.8; margin-top: 1px; }

/* =================== STORY (overview) =================== */
.story { position: relative; }
.hero { position: relative; height: 100vh; min-height: 620px; overflow: hidden; }
.hero canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(5,8,7,.85) 0%, rgba(5,8,7,.35) 45%, transparent 70%), linear-gradient(0deg, var(--bg) 0%, transparent 30%); }
.hero-copy { position: absolute; left: var(--gutter); bottom: 14vh; max-width: min(760px, 90vw); z-index: 2; }
.hero-copy .hi-line { font-family: var(--hi); font-size: clamp(1.3rem, 2.4vw, 2rem); color: var(--amber); font-weight: 700; text-shadow: 0 0 22px rgba(255,194,26,.4); }
.hero-copy h1 { margin: 10px 0 18px; text-transform: uppercase; text-shadow: 0 4px 40px rgba(0,0,0,.6); }
.hero-copy h1 .ln { display: block; overflow: hidden; }
.hero-copy h1 .ln > span { display: inline-block; }
.hero-copy .lede { color: #c3cbc5; font-size: 1.15rem; }
.hero-copy .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hud-corner { position: absolute; width: 34px; height: 34px; border-color: rgba(255,255,255,.35); border-style: solid; z-index: 2; pointer-events: none; }
.hud-corner.tl { top: 22px; left: 22px; border-width: 2px 0 0 2px; } .hud-corner.tr { top: 22px; right: 22px; border-width: 2px 2px 0 0; }
.hud-corner.bl { bottom: 22px; left: 22px; border-width: 0 0 2px 2px; } .hud-corner.br { bottom: 22px; right: 22px; border-width: 0 2px 2px 0; }
.hero-readout { position: absolute; right: var(--gutter); top: 50px; z-index: 2; font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; line-height: 1.9; }
.hero-readout b { color: var(--text); font-weight: 600; }
.hero-readout .live { color: var(--green); }
.scroll-cue { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 2; display: grid; justify-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.scroll-cue i { width: 1px; height: 42px; background: linear-gradient(var(--amber), transparent); animation: cue 1.8s infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.chapter { position: relative; padding: 0 var(--gutter); }
.chapter-inner { max-width: 1400px; margin: 0 auto; }
.pin { min-height: 100vh; display: grid; align-items: center; padding: 70px 0; }
.chapter-label { font-family: var(--mono); font-size: 12px; color: var(--amber); display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.chapter-label::before { content: ""; width: 28px; height: 1px; background: var(--amber); }

.problem-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: 48px; align-items: center; }
.beats { position: relative; min-height: 300px; }
.beat { position: absolute; inset: 0 0 auto 0; opacity: 0; }
.beat h2 { margin-bottom: 14px; }
.beat .lede { font-size: 1.12rem; }
.beat .big { font-family: var(--display); font-weight: 700; font-size: clamp(3rem, 7vw, 6rem); color: var(--red); line-height: 1; text-shadow: 0 0 30px rgba(255,77,61,.35); }
.chart-card { padding: 22px; }
.chart-card svg { width: 100%; height: auto; display: block; }

.resched { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.dial { width: min(460px, 80vw); aspect-ratio: 1; margin: 0 auto; position: relative; }
.dial svg { width: 100%; height: 100%; }
.dial .readout { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.dial .readout b { display: block; font-family: var(--display); font-size: clamp(2.6rem, 5vw, 4.2rem); font-weight: 700; line-height: 1; color: var(--amber); text-shadow: 0 0 24px rgba(255,194,26,.45); }

.engine { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.5fr); gap: 40px; align-items: center; }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: st; }
.stage-list li { padding: 14px 16px 14px 54px; position: relative; border-left: 2px solid var(--line); color: var(--faint); transition: all .4s var(--ease); counter-increment: st; }
.stage-list li::before { content: "0" counter(st); position: absolute; left: 16px; top: 15px; font-family: var(--mono); font-size: 12px; }
.stage-list li b { display: block; font-family: var(--display); font-size: 1.22rem; color: inherit; letter-spacing: .02em; }
.stage-list li span { font-size: .92rem; display: block; max-height: 0; overflow: hidden; transition: max-height .5s var(--ease); }
.stage-list li.on { border-left-color: var(--amber); color: var(--text); background: linear-gradient(90deg, var(--amber-dim), transparent 70%); }
.stage-list li.on span { max-height: 6em; color: var(--muted); margin-top: 4px; }
.stage-list li.done { color: var(--muted); border-left-color: rgba(255,194,26,.4); }
.engine-stage { position: relative; aspect-ratio: 16 / 10; min-height: 360px; }
.engine-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.chip { font-family: var(--display); font-weight: 600; font-size: 13px; }

.results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 30px; }
.result { padding: 24px 22px; }
.result .big { font-family: var(--display); font-weight: 700; font-size: clamp(3rem, 5.4vw, 5rem); line-height: .95; color: var(--amber); text-shadow: 0 0 26px rgba(255,194,26,.3); }
.result .big small { font-size: .45em; color: var(--text); margin-left: 4px; text-shadow: none; }
.result p { color: var(--muted); margin-top: 10px; font-size: .95rem; }
.result .meter { height: 4px; background: var(--line); margin-top: 16px; position: relative; overflow: hidden; }
.result .meter span { position: absolute; inset: 0 auto 0 0; background: var(--amber); width: 0; box-shadow: 0 0 10px var(--amber); }

.missions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.mission { cursor: pointer; padding: 0; display: grid; grid-template-rows: 150px auto; text-align: left; color: inherit; font: inherit; border: 1px solid var(--line); }
.mission .art { position: relative; overflow: hidden; background: radial-gradient(ellipse at 30% 30%, rgba(255,194,26,.12), transparent 60%), #0b100e; border-bottom: 1px solid var(--line); }
.mission .art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mission .body { padding: 16px 18px 18px; }
.mission .body b { font-family: var(--display); font-size: 1.3rem; display: block; letter-spacing: .02em; }
.mission .body p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.mission .go { margin-top: 12px; font-family: var(--display); font-weight: 700; color: var(--amber); letter-spacing: .06em; font-size: .92rem; }
.mission:hover .art { background: radial-gradient(ellipse at 30% 30%, rgba(255,194,26,.22), transparent 60%), #0b100e; }
.mission:hover .go { color: var(--amber-2); }
.mission .art .sweep { transform-origin: 50% 50%; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.team { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: start; padding-bottom: 90px; }
.team ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }
.team li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.team li span { color: var(--faint); font-family: var(--mono); font-size: .8rem; }

/* =================== CONTROL ROOM (3D) =================== */
.ops { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.ops-map { position: relative; height: calc(100vh - 190px); min-height: 560px; padding: 0; overflow: hidden; background: #070a09; }
.ops-map canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.ops-map canvas:active { cursor: grabbing; }
.ops-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl3d { position: absolute; left: 0; top: 0; white-space: nowrap; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--text); text-shadow: 0 1px 6px #000, 0 0 2px #000; transform-origin: 0 0; }
.lbl3d .hi { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.lbl3d.stn { pointer-events: auto; cursor: pointer; }
.lbl3d.stn:hover { color: var(--amber); }
.lbl3d.trn { padding: 1px 6px; color: var(--board-ink); font-size: 11.5px; pointer-events: auto; cursor: pointer; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.lbl3d.trn.sel { outline: 2px solid #fff; }
.ops-hud { position: absolute; z-index: 3; pointer-events: none; }
.ops-hud.tl { top: 14px; left: 16px; }
.ops-hud.tr { top: 14px; right: 16px; text-align: right; }
.ops-hud.bl { left: 16px; bottom: 16px; }
.clock { font-family: var(--display); font-size: 2.6rem; font-weight: 700; line-height: 1; text-shadow: 0 0 20px rgba(255,255,255,.15); }
.clock-date { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.radar { width: 92px; height: 92px; border-radius: 50%; border: 1px solid rgba(60,240,160,.35); position: relative; background: radial-gradient(circle, rgba(60,240,160,.08), transparent 70%); margin-left: auto; overflow: hidden; }
.radar::before { content: ""; position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(60,240,160,.5), transparent 25%); animation: spin 3s linear infinite; border-radius: 50%; }
.radar::after { content: ""; position: absolute; inset: 30%; border: 1px solid rgba(60,240,160,.3); border-radius: 50%; }
.map-tools { position: absolute; right: 14px; bottom: 14px; z-index: 3; display: flex; gap: 6px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--muted); background: rgba(5,8,7,.7); padding: 8px 10px; border: 1px solid var(--line); }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px; clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%); }
.timeline { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; }
.timeline .scrub { flex: 1 1 260px; }
.play-btn { width: 52px; height: 42px; padding: 0; display: grid; place-items: center; }
.play-btn svg { width: 18px; height: 18px; fill: currentColor; }
input[type=range] { appearance: none; -webkit-appearance: none; background: transparent; height: 22px; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--amber) var(--p, 0%), rgba(255,255,255,.12) var(--p, 0%)); }
input[type=range]::-moz-range-track { height: 4px; background: rgba(255,255,255,.12); }
input[type=range]::-moz-range-progress { height: 4px; background: var(--amber); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 18px; margin-top: -7px; background: var(--text); clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); box-shadow: 0 0 10px rgba(255,255,255,.5); }
input[type=range]::-moz-range-thumb { width: 14px; height: 18px; border: 0; border-radius: 0; background: var(--text); }
input[type=range]:disabled { opacity: .35; cursor: not-allowed; }
.side { display: grid; gap: 14px; align-content: start; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--glass-2); border: 1px solid var(--line); padding: 10px 12px; position: relative; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--amber); opacity: .7; }
.kpi b { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1.05; font-weight: 700; }
.kpi span { font-size: 0.78rem; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; display: grid; gap: 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.feed li { background: rgba(255,255,255,0.03); padding: 9px 11px; font-size: 0.86rem; border-left: 2px solid var(--green); animation: feedIn .5s var(--ease); cursor: pointer; transition: background .2s; }
.feed li:hover { background: rgba(255,255,255,0.07); }
.feed li.late { border-left-color: var(--amber); }
.feed li.vlate { border-left-color: var(--red); }
.feed li .t { color: var(--faint); font-family: var(--mono); font-size: 0.74rem; }
.feed li .gain { color: var(--amber); font-weight: 600; }
@keyframes feedIn { from { opacity: 0; transform: translateX(16px); background: rgba(255,194,26,.15); } to { opacity: 1; transform: none; } }
.empty { color: var(--faint); font-size: 0.9rem; padding: 10px 0; }
.trainplate { display: flex; align-items: center; gap: 12px; }
.trainplate .no { background: var(--text); color: var(--bg); font-family: var(--display); font-weight: 700; padding: 3px 9px; font-size: 1.05rem; letter-spacing: .05em; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.trainplate .nm { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: .02em; }
.trainplate .nm .hi { display: block; color: var(--muted); font-size: 0.92rem; font-weight: 600; }

/* =================== JOURNEY =================== */
.journey { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
.journey-head { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-bottom: 16px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis text { fill: var(--faint); font-size: 11px; font-family: var(--mono); }
.chart .axis line, .chart .grid line { stroke: var(--rule); }
.chart .lbl { fill: var(--text); font-size: 13px; font-weight: 700; font-family: var(--display); }
.chart .lbl-hi { fill: var(--faint); font-size: 11.5px; font-family: var(--hi); font-weight: 600; }
.chart .row-hit { fill: transparent; cursor: pointer; }
.chart .row-hit:hover, .chart .row-hit.sel { fill: rgba(255,194,26,0.06); }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper input[type=range] { flex: 1 1 160px; }
.why-list { display: grid; gap: 5px; }
.why-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 34%) 64px; gap: 10px; align-items: center; font-size: 0.88rem; }
.why-row .bar { height: 12px; position: relative; }
.why-row .bar span { position: absolute; top: 0; height: 100%; transition: left .5s var(--ease), width .5s var(--ease); }
.why-row .bar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.why-row .v { text-align: right; font-family: var(--mono); font-weight: 600; font-size: .82rem; }
.why-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 0.92rem; }
.callout { background: linear-gradient(90deg, var(--amber-dim), transparent 80%); border-left: 2px solid var(--amber); padding: 14px 16px; font-size: 0.94rem; }
.callout b { color: var(--amber); font-family: var(--display); font-size: 1.15rem; letter-spacing: .02em; }

/* =================== STATION BOARD =================== */
.board-wrap { background: #050706; border: 1px solid var(--line-2); padding: 6px 0 12px; overflow-x: auto; box-shadow: 0 0 0 6px #0c110f, 0 0 0 7px var(--line), 0 30px 80px rgba(0,0,0,.6); }
.board-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.board-title .stn-name { font-family: var(--display); font-size: clamp(1.8rem, 3.4vw, 2.9rem); font-weight: 700; color: var(--amber); line-height: 1; letter-spacing: .04em; text-shadow: 0 0 18px rgba(255,194,26,.35); }
.board-title .stn-name .hi { display: block; font-size: 0.6em; }
table.flap { width: 100%; border-collapse: separate; border-spacing: 0 6px; min-width: 900px; }
table.flap th { text-align: left; font-size: 0.74rem; color: var(--faint); font-weight: 600; padding: 8px 10px 2px; font-family: var(--mono); }
table.flap td { padding: 0 4px; }
table.flap td:first-child { padding-left: 16px; } table.flap td:last-child { padding-right: 16px; }
.cell { display: flex; gap: 2px; }
.ch { display: inline-grid; place-items: center; min-width: 0.82em; height: 1.75em; padding: 0 1px; background: linear-gradient(#1b2220 49%, #070a09 50%, #161d1b 51%); color: #f6ecc9; font-family: var(--mono); font-weight: 600; font-size: 1.02rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.7); }
.ch.flip { animation: flap .34s steps(3) both; }
@keyframes flap { 0% { transform: scaleY(1); } 50% { transform: scaleY(0.08); filter: brightness(1.8); } 100% { transform: scaleY(1); } }
.cell.yel .ch { color: var(--amber); text-shadow: 0 0 8px rgba(255,194,26,.5); }
.cell.grn .ch { color: var(--green); text-shadow: 0 0 8px rgba(60,240,160,.45); }
.cell.red .ch { color: var(--red); text-shadow: 0 0 8px rgba(255,77,61,.5); }
.cell.dim .ch { color: #8d9a94; }
.trn-name { font-size: 0.85rem; color: var(--muted); padding-left: 2px; margin-top: 3px; }
.trn-name .hi { color: var(--faint); }

/* =================== WHAT-IF =================== */
.whatif { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 16px; }
.controls { display: grid; gap: 15px; align-content: start; }
.ctl label { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; gap: 10px; }
.ctl label output { color: var(--amber); font-family: var(--mono); font-size: .82rem; font-weight: 600; text-align: right; }
.ctl input[type=range] { width: 100%; }
.ctl .hint { font-size: 0.78rem; color: var(--faint); }
.presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.preset { cursor: pointer; text-align: left; padding: 12px 14px; display: grid; gap: 6px; align-content: start; color: inherit; font: inherit; border: 1px solid var(--line); }
.preset svg { width: 30px; height: 30px; stroke: var(--amber); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.preset b { font-family: var(--display); font-size: 1.02rem; letter-spacing: .02em; }
.preset span { font-size: .8rem; color: var(--muted); }
.preset[aria-pressed="true"] { border-color: var(--amber); background: linear-gradient(160deg, var(--amber-dim), transparent 70%), var(--glass); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.switch { appearance: none; width: 44px; height: 22px; background: rgba(255,255,255,.12); position: relative; cursor: pointer; transition: background .2s; flex: none; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.switch::after { content: ""; position: absolute; top: 3px; left: 6px; width: 14px; height: 16px; background: var(--text); transition: transform .25s var(--ease); }
.switch:checked { background: var(--amber); }
.switch:checked::after { transform: translateX(18px); background: var(--board-ink); }
.delta { font-family: var(--display); font-size: clamp(2.2rem, 3.6vw, 3.2rem); font-weight: 700; line-height: 1; }
.delta.up { color: var(--red); text-shadow: 0 0 18px rgba(255,77,61,.4); } .delta.down { color: var(--green); text-shadow: 0 0 18px rgba(60,240,160,.35); }

/* =================== LAB & METHOD =================== */
.lab { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-12 { grid-column: span 12; } .span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--faint); font-weight: 600; font-size: 0.74rem; font-family: var(--mono); }
table.data td { font-family: var(--mono); font-size: .84rem; }
table.data td:first-child { font-family: var(--font); font-size: .9rem; }
table.data tr.best td { color: var(--amber); font-weight: 600; }
table.data tr.best { background: linear-gradient(90deg, var(--amber-dim), transparent 85%); }
table.data tbody tr { transition: background .2s; }
table.data tbody tr:hover { background: rgba(255,255,255,.03); }
.tablewrap { overflow-x: auto; }
.hyp { display: grid; gap: 12px; }
.hyp div { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; font-size: 0.9rem; }
.hyp b { color: var(--amber); font-family: var(--display); font-size: 1.05rem; }
.verdict { font-family: var(--display); font-size: 0.82rem; font-weight: 700; letter-spacing: .06em; padding: 2px 9px; background: rgba(60,240,160,0.13); color: var(--green); white-space: nowrap; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.verdict.part { background: var(--amber-dim); color: var(--amber); }
.impbar { display: grid; grid-template-columns: 1fr 2fr 48px; gap: 10px; align-items: center; font-size: 0.86rem; margin-bottom: 6px; }
.impbar div { height: 8px; background: rgba(255,255,255,.06); overflow: hidden; }
.impbar div span { display: block; height: 100%; background: linear-gradient(90deg, rgba(255,194,26,.4), var(--amber)); width: 0; transition: width 1.1s var(--ease); box-shadow: 0 0 10px rgba(255,194,26,.5); }
.impbar em { font-style: normal; text-align: right; color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; counter-reset: pipe; }
.pipe { background: var(--glass); border: 1px solid var(--line); padding: 16px; position: relative; }
.pipe::after { content: ""; position: absolute; right: -14px; top: 50%; width: 14px; height: 2px; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pipe:last-child::after { display: none; }
.pipe h3 { font-size: 1.05rem; margin-bottom: 6px; }
.pipe h3::before { counter-increment: pipe; content: "0" counter(pipe) " "; color: var(--amber); font-family: var(--mono); font-size: .8rem; }
.pipe p { font-size: 0.86rem; color: var(--muted); }
.pipe code { font-family: var(--mono); font-size: 0.76rem; color: var(--cyan); }
pre.code { background: #050706; border: 1px solid var(--line); padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; color: #d9e3dc; margin: 0; }
pre.code .k { color: var(--amber); } pre.code .c { color: var(--faint); } pre.code .s { color: var(--green); }
.obs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.obs .panel h3 { margin-bottom: 8px; }
.obs .panel p { color: var(--muted); font-size: 0.93rem; }
.dq-table td.flag { color: var(--red); font-weight: 600; font-family: var(--display); font-size: .95rem; letter-spacing: .04em; }
.dq-table td.ok { color: var(--green); font-family: var(--font); }
.dq-table tr.fixed td { background: rgba(60,240,160,0.05); }
.dq-table td, .dq-table th { text-align: left !important; font-family: var(--font) !important; }

footer { border-top: 1px solid var(--line); padding: 26px var(--gutter) 40px; color: var(--muted); font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 12px 40px; justify-content: space-between; }
footer .hi { color: var(--amber); font-weight: 700; }

.tip { position: fixed; z-index: 120; pointer-events: none; background: rgba(5,8,7,.94); border: 1px solid var(--line-2); padding: 9px 11px; font-size: 0.83rem; max-width: 290px; opacity: 0; transition: opacity .15s; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.tip.on { opacity: 1; }
.tip b { color: var(--amber); }

/* =================== GUIDED TOUR =================== */
.tour { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.tour.on { pointer-events: auto; }
.tour-hole { position: fixed; border: 2px solid var(--amber); box-shadow: 0 0 0 9999px rgba(3,5,4,.72), 0 0 30px rgba(255,194,26,.5); transition: all .45s var(--ease); pointer-events: none; }
.tour-card { position: fixed; width: min(380px, calc(100vw - 32px)); padding: 18px 20px; background: rgba(10,14,12,.97); border: 1px solid var(--amber); transition: all .45s var(--ease); }
.tour-card .kicker { margin-bottom: 6px; display: block; }
.tour-card h3 { font-size: 1.35rem; margin-bottom: 8px; }
.tour-card p { color: #c3cbc5; font-size: .95rem; }
.tour-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 16px; height: 3px; background: var(--line-2); }
.tour-dots i.on { background: var(--amber); }

@media (max-width: 1180px) {
  .ops, .journey, .whatif { grid-template-columns: 1fr; }
  .ops-map { height: 70vh; min-height: 460px; }
  .lab > * { grid-column: span 12 !important; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .pipe::after { display: none; }
  .presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .problem-grid, .resched, .engine { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .engine-stage { min-height: 0; }
  .beats { min-height: 230px; }
  .sys { display: none; }
}
@media (max-width: 760px) {
  .hud-top { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 4px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tab span { font-size: .92rem; }
  .results, .missions, .obs, .team { grid-template-columns: 1fr; }
  .team ul { grid-template-columns: 1fr; }
  .pipeline, .presets { grid-template-columns: 1fr 1fr; }
  .why-row { grid-template-columns: 1fr 90px 54px; }
  .hero-readout { display: none; }
  .hero-copy { bottom: 10vh; }
  .ops-map { height: 62vh; }
  .kpi b { font-size: 1.5rem; }
  .hud-corner { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- 3D overlays ---------- */
.waypoint { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; display: grid; gap: 1px; min-width: 190px; padding: 10px 14px 12px; background: rgba(6,9,8,.78); border: 1px solid rgba(255,194,26,.7); box-shadow: 0 0 24px rgba(255,194,26,.18); opacity: 0; font-size: .86rem; backdrop-filter: blur(6px); }
.waypoint::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 1px; height: 9px; background: var(--amber); }
.waypoint .wp-k { font-family: var(--mono); font-size: 10.5px; color: var(--amber); }
.waypoint b { font-family: var(--display); font-size: 1.35rem; line-height: 1.05; }
.waypoint .wp-hi { font-family: var(--hi); color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.waypoint .wp-row { display: flex; justify-content: space-between; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--amber); }
.waypoint .wp-row em { font-style: normal; font-family: var(--font); color: var(--muted); font-size: .82rem; }
.waypoint .wp-row.dim { color: var(--today); }
.lbl3d.grid { font-family: var(--mono); font-weight: 400; font-size: 10.5px; color: var(--faint); text-shadow: none; }
.lbl3d.river { font-family: var(--display); font-weight: 600; font-size: 12px; color: #5fb7d8; letter-spacing: .08em; }
.lbl3d.river .hi { display: inline; color: #5fb7d8; font-size: 12px; margin-right: 4px; }
.lbl3d.way { display: grid; padding: 5px 9px 6px; background: rgba(6,9,8,.85); border: 1px solid rgba(255,194,26,.75); font-weight: 600; text-shadow: none; }
.lbl3d.way.first { box-shadow: 0 0 18px rgba(255,194,26,.35); }
.lbl3d.way .wk { font-family: var(--display); font-size: 12px; color: var(--muted); }
.lbl3d.way b { font-family: var(--display); font-size: 17px; color: var(--amber); line-height: 1.05; }
.lbl3d.way .wr { font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-weight: 400; }
.preset > span:first-child { display: block; height: 30px; }
.team li.designer { grid-column: 1 / -1; align-items: center; padding: 12px 14px; margin-bottom: 6px; border: 1px solid rgba(255,194,26,.55); border-bottom-width: 1px; background: linear-gradient(90deg, var(--amber-dim), transparent 80%); box-shadow: 0 0 22px rgba(255,194,26,.12); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.team li.designer div { display: grid; gap: 1px; }
.team li.designer em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--amber); letter-spacing: .06em; }
.team li.designer b { font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: .02em; line-height: 1.1; }
.team li.designer span { color: var(--amber); }
