/* ─────────────────────────────────────────────────────────────
   SkyRing · retro mission control.
   The sky is the whole screen; the UI is printed paper on top of it:
   cream panels, ink outlines, hard offset shadows, flat signal colours.
   ───────────────────────────────────────────────────────────── */
:root {
  --ink: #1b1a17;
  --ink-2: #3a372f;
  --paper: #f4ecda;
  --paper-2: #e9dfc8;
  --paper-3: #ddd1b5;
  --muted: #6e675a;
  --faint: #a59d8b;
  --signal: #e8541e;        /* launch orange */
  --signal-2: #c2410c;
  --navy: #1f3b73;
  --sun: #ffc93c;
  --danger: #c62f2f;
  --brass: var(--signal);   /* legacy name used in a few templates */
  --brass-2: var(--signal-2);
  --card: var(--paper);
  --card-solid: var(--paper);
  --rule: rgba(27, 26, 23, 0.16);
  --rule-2: var(--ink);
  /* rarity: Ignition → Hyperdrive */
  --t0: #9a9282; --t1: #b8662e; --t2: #c99200; --t3: #2f8a57; --t4: #2a5fc4; --t5: #7a3bd0;
  /* solved on clue 1 / 2 / 3 */
  --l1: #7a3bd0; --l2: #2a5fc4; --l3: #2f8a57;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --app-h: 100dvh;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d1424; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { overflow: hidden; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
a { color: var(--signal-2); text-underline-offset: 3px; font-weight: 600; }
[hidden] { display: none !important; }

/* ── Shell ─────────────────────────────────────────────────── */
#app { position: fixed; inset: 0 0 auto 0; z-index: 1; height: var(--app-h); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); pointer-events: none; }
#app > * { pointer-events: auto; }
.topbar { flex: none; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar-side { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s; }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.icon-btn svg { width: 18px; height: 18px; }
.brand { display: flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; font: 900 17px var(--display); letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 12px 5px 7px; border-radius: 4px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.brand svg { width: 22px; height: 22px; }
#test-banner { flex: none; align-self: center; font: 700 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; color: var(--ink); background: var(--sun); border: 2px solid var(--ink); border-radius: 3px; }
#screen { flex: 1 1 auto; min-height: 0; position: relative; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; pointer-events: none; }
#screen > * { pointer-events: auto; }
.screen { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none; animation: fade 0.3s ease both; }
.screen > * { pointer-events: auto; width: 100%; max-width: 540px; }
@keyframes fade { from { opacity: 0; } }
.boot { height: 100%; display: grid; place-items: center; font: 900 22px var(--display); letter-spacing: 0.3em; color: #fff; }

/* ── Primitives ────────────────────────────────────────────── */
.label { font: 700 10.5px/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.label.brass { color: var(--signal-2); }
.muted { color: var(--muted); }
.card, .panel { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 16px; box-shadow: var(--shadow); position: relative; }
.panel { padding: 14px 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 20px; border-radius: 5px; font: 800 19px var(--display); letter-spacing: 0.08em; text-transform: uppercase; border: 2px solid var(--ink); color: var(--ink); background: var(--paper); box-shadow: var(--shadow-sm); transition: transform 0.07s, box-shadow 0.07s, background 0.15s; user-select: none; }
.btn:hover { background: #fff8e8; }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--signal); color: #fff; }
.btn.primary:hover { background: #f2632c; }
.btn.light { background: #fff; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 22px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.link-btn { color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }
.link-btn:hover { color: var(--ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--t0); flex: none; border: 1.5px solid var(--ink); }
.dot.t1 { background: var(--t1); } .dot.t2 { background: var(--t2); } .dot.t3 { background: var(--t3); } .dot.t4 { background: var(--t4); } .dot.t5 { background: var(--t5); }
.dot.bb { background: var(--ink); border-radius: 1px; transform: rotate(45deg); }
.dot.t0 { background: transparent; border-color: var(--faint); }
.c-t0 { color: var(--muted); } .c-t1 { color: var(--t1); } .c-t2 { color: var(--t2); } .c-t3 { color: var(--t3); } .c-t4 { color: var(--t4); } .c-t5 { color: var(--t5); } .c-bb { color: var(--signal-2); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; border: 1.5px solid var(--ink); }
.fine { margin: 0; font-size: 13px; font-weight: 500; color: #fff; line-height: 1.5; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.card .fine, .modal .fine, .panel .fine { color: var(--muted); text-shadow: none; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip { font: 700 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 9px; border-radius: 3px; background: var(--paper); border: 2px solid var(--ink); color: var(--ink); }
.chip.bb { background: var(--ink); color: var(--paper); }
code { font: 600 12px var(--mono); color: var(--signal-2); background: var(--paper-2); padding: 1px 4px; border-radius: 3px; }

/* ── Home ──────────────────────────────────────────────────── */
.home { justify-content: space-between; }
.hero { text-align: center; padding-top: 1vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero h1 { margin: 0; font: 900 clamp(70px, 21vw, 132px)/0.82 var(--display); letter-spacing: 0.01em; text-transform: uppercase; color: #fff; text-shadow: 4px 4px 0 var(--ink), 0 0 1px var(--ink); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.hero .tag { font: 700 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); padding: 4px 9px; border-radius: 3px; }
.dock { display: flex; flex-direction: column; gap: 12px; }
.dock .meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; height: 50px; padding: 0 14px; font: 700 18px var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink); background: #fffaf0; border: 2px solid var(--ink); border-radius: 5px; outline: none; }
.join input:focus { box-shadow: inset 0 0 0 2px var(--sun); }
.join input::placeholder { letter-spacing: 0.02em; text-transform: none; font: 500 16px var(--sans); color: var(--faint); }
.join .btn { min-height: 50px; }
.legend { display: grid; grid-template-columns: repeat(5, 1fr); border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.legend > div { padding: 8px 2px 7px; text-align: center; border-left: 2px solid var(--ink); }
.legend > div:first-child { border-left: 0; }
.legend b { display: block; font: 700 14px var(--mono); margin-top: 4px; }
.legend span { display: block; font: 700 8.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.challenge { display: flex; flex-direction: column; gap: 8px; background: var(--sun); }
.challenge .who { font: 900 28px/1 var(--display); text-transform: uppercase; }
.challenge p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.dots { display: inline-flex; gap: 5px; align-items: center; }

/* ── HUD ───────────────────────────────────────────────────── */
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; padding: 7px 14px 9px; border-radius: 5px; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35); }
.hud .cell .label { color: #b9ae94; font-size: 9.5px; }
.hud .val { font: 700 24px/1.05 var(--mono); color: var(--sun); font-variant-numeric: tabular-nums; margin-top: 2px; }
.hud .val small { font-size: 11px; color: #b9ae94; margin-left: 3px; }
.hud .mid { text-align: center; }
.hud .right { text-align: right; }
.hud .clock { color: var(--paper); }
.hud .clock.warn { color: var(--sun); } .hud .clock.danger { color: #ff6a4a; }
.pips { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.pip { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #8d856f; }
.pip.bbpip { border-radius: 1px; transform: rotate(45deg); }
.pip.current { border-color: var(--sun); box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.3); }
.pip.t0 { opacity: 0.5; }
.pip.t1 { background: var(--t1); border-color: var(--t1); } .pip.t2 { background: var(--t2); border-color: var(--t2); } .pip.t3 { background: var(--t3); border-color: var(--t3); }
.pip.t4 { background: var(--t4); border-color: #7fa6ff; } .pip.t5 { background: var(--t5); border-color: #c4a0ff; }
.pip.bbok { background: var(--signal); border-color: var(--signal); }

/* ── Play ──────────────────────────────────────────────────── */
.play { justify-content: space-between; gap: 10px; }
.play.revealed { justify-content: flex-start; }
.play.revealed .qcard { margin-top: auto; }
.qcard { display: flex; flex-direction: column; gap: 11px; animation: rise 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.qcard .cat { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 2px dashed var(--rule); }
.qcard .cat .label { color: var(--signal-2); }
.prompt p { margin: 0; font: 700 clamp(20px, 5.4vw, 25px)/1.25 var(--sans); letter-spacing: -0.005em; color: var(--ink); }
.prompt.long p { font-size: clamp(17px, 4.6vw, 21px); }
.bb-mode .qcard { background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: 4px 4px 0 var(--signal); }
.bb-mode .prompt p { color: var(--paper); font-weight: 600; }
.bb-mode .qcard .cat { border-color: rgba(244, 236, 218, 0.2); }
.bb-mode .qcard .cat .label { color: var(--sun); }
.bb-mode .your, .bb-mode .why p { color: var(--paper); }
.bb-mode .your b { color: var(--sun); }
.tries { display: flex; gap: 4px; }
.tries i { width: 16px; height: 6px; border-radius: 1px; background: var(--signal); border: 1.5px solid var(--ink); }
.bb-mode .tries i { border-color: var(--paper); }
.tries i.used { background: transparent; opacity: 0.5; }
.notes { display: flex; flex-direction: column; gap: 6px; }
.note { font-size: 14.5px; line-height: 1.4; padding: 8px 12px; border-radius: 4px; background: var(--paper-2); border: 2px solid var(--ink); color: var(--ink); animation: rise 0.25s both; }
.note b { display: block; font: 700 9.5px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal-2); margin-bottom: 2px; }
.bb-mode .note { background: #2b2924; color: var(--paper); border-color: var(--paper-3); }
.bb-mode .note b { color: var(--sun); }
.note.trap { background: #f8d9cf; }
.note.trap b { color: var(--danger); }
.answer-form { display: flex; border: 2px solid var(--ink); border-radius: 5px; background: #fffaf0; overflow: hidden; box-shadow: var(--shadow-sm); }
.answer-form:focus-within { box-shadow: 3px 3px 0 var(--signal); }
.answer-input { flex: 1; min-width: 0; height: 56px; padding: 0 14px; font: 600 19px var(--sans); color: var(--ink); background: transparent; border: 0; outline: none; -webkit-appearance: none; appearance: none; }
.answer-input::placeholder { color: var(--faint); font-weight: 500; }
.go-btn { padding: 0 18px; font: 900 19px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: #fff; background: var(--signal); border-left: 2px solid var(--ink); }
.go-btn:active { background: var(--signal-2); }
.feedback { min-height: 14px; text-align: center; font: 700 11px var(--mono); letter-spacing: 0.04em; color: var(--muted); }
.feedback.near { color: var(--signal-2); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option { min-height: 52px; padding: 8px 10px; border-radius: 5px; border: 2px solid var(--paper); background: transparent; color: var(--paper); font-weight: 700; font-size: 16px; }
.option:hover { background: rgba(244, 236, 218, 0.08); }
.option.is-correct { background: var(--sun); color: var(--ink); border-color: var(--sun); }
.option.is-wrong { border-color: #ff6a4a; color: #ff6a4a; }
.shake { animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake { 20%, 80% { transform: translateX(-2px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-6px); } }
.countdown { position: fixed; left: 0; right: 0; top: calc(15vh + env(safe-area-inset-top)); text-align: center; font: 900 clamp(96px, 26vw, 168px)/1 var(--display); color: var(--sun); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--ink); pointer-events: none; z-index: 5; }
.countdown.word { font-size: clamp(64px, 17vw, 120px); letter-spacing: 0.03em; text-transform: uppercase; }
.countdown.tick { animation: cd 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes cd { from { transform: scale(1.6); opacity: 0; } }

/* Reveal */
.stamp { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2px dashed var(--rule); }
.stamp .tier { font: 900 clamp(30px, 8.6vw, 40px)/1 var(--display); text-transform: uppercase; letter-spacing: 0.04em; border: 3.5px solid currentColor; border-radius: 6px; padding: 4px 10px 2px; transform: rotate(-3deg); }
.stamp .pts { font: 700 24px var(--mono); white-space: nowrap; }
.stamp-in { animation: stamp 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.stamp .tier.stamp-in { animation-name: thump; }
@keyframes stamp { from { opacity: 0; transform: scale(1.3); } }
@keyframes thump { from { opacity: 0; transform: rotate(-12deg) scale(1.8); } }
.your { font-size: 15.5px; color: var(--ink-2); }
.your b { color: var(--ink); }
.found { display: flex; flex-direction: column; gap: 8px; }
.found .row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.found .row .label { width: 100%; }
.ans { font-size: 14.5px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.ans.mine { color: var(--ink); font-weight: 800; background: var(--sun); padding: 0 5px; border-radius: 2px; }
.why p { margin: 4px 0 0; font: 400 16px/1.5 var(--sans); color: var(--ink); }
.why a { font: 700 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; display: inline-block; margin-top: 6px; }
.reveal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reveal-actions .btn { min-width: 170px; }
.reveal-scroll { max-height: min(48vh, 440px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.bonus { font: 700 12px var(--mono); letter-spacing: 0.04em; padding: 8px 11px; border-radius: 4px; border: 2px solid var(--ink); background: #d5ecdc; color: var(--ink); }
.bonus.gold { background: var(--sun); box-shadow: var(--shadow-sm); }
.bonus.od { background: var(--signal); color: #fff; box-shadow: var(--shadow-sm); }
.bonus.stall { background: var(--paper-3); color: var(--ink-2); border-style: dashed; }
.bonus.lone { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.bb-mode .bonus { border-color: var(--paper); }

/* Black Box intro */
.bb-intro { justify-content: center; }
.bb-intro .card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); box-shadow: 5px 5px 0 var(--signal); }
.bb-intro h2 { margin: 0; font: 900 56px/0.95 var(--display); text-transform: uppercase; color: var(--sun); }
.bb-intro p { margin: 0; max-width: 34ch; font: 500 17px/1.45 var(--sans); color: var(--paper); }
.bb-scale { display: flex; gap: 18px; font: 700 12px var(--mono); color: #b9ae94; }
.bb-scale b { color: var(--sun); }
.bb-intro .label { color: #b9ae94; }

/* Keyboard open: shrink the HUD so the input stays above the keyboard */
body.kb .topbar { display: none; }
body.kb .hud .pips { display: none; }
body.kb .hud { padding: 5px 12px; }
body.kb .hud .val { font-size: 18px; }
body.kb .prompt p { font-size: clamp(16px, 4.4vw, 19px); }
body.kb .play.asking .destbar .cargo, body.kb .play.asking .dest-open { display: none; }

/* ── Lobby ─────────────────────────────────────────────────── */
.lobby { justify-content: flex-end; gap: 12px; }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.lobby .code { font: 700 clamp(38px, 12vw, 54px)/1 var(--mono); letter-spacing: 0.18em; margin-top: 6px; color: var(--signal-2); }
.pilot { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 2px dashed var(--rule); font-weight: 700; }
.pilot.away { opacity: 0.45; }

/* ── Results ───────────────────────────────────────────────── */
.results { gap: 14px; padding-top: 30vh; }
.landing { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.landing .label { background: var(--paper); color: var(--ink) !important; border: 2px solid var(--ink); padding: 3px 8px; border-radius: 3px; }
.landing .alt { font: 900 clamp(84px, 26vw, 150px)/0.85 var(--display); color: var(--sun); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 5px 0 var(--ink); }
.landing .alt small { font: 900 28px var(--display); color: #fff; margin-left: 6px; letter-spacing: 0.06em; }
.landing .rating { font: 900 26px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-sm); padding: 2px 12px; border-radius: 4px; transform: rotate(-1.5deg); }
.flightlog { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding-top: 8px; }
.flightlog .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; background: none; border: 0; overflow: visible; }
.flightlog .bar i { display: block; width: 100%; max-width: 44px; border-radius: 2px; background: currentColor; border: 2px solid var(--ink); min-height: 4px; transform-origin: bottom; animation: grow 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.flightlog .bar b { font: 700 11px var(--mono); color: var(--ink); }
.flightlog .bar span { font: 700 9.5px var(--mono); color: var(--muted); letter-spacing: 0.06em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } }
.share-preview { font: 500 14px/1.6 var(--mono); white-space: pre-wrap; color: var(--ink-2); margin: 8px 0 0; padding: 10px 12px; background: var(--paper-2); border-radius: 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.board-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-top: 2px dashed var(--rule); align-items: center; }
.board-row.me .nm { color: var(--signal-2); }
.board-row .pos { font: 700 12px var(--mono); color: var(--muted); }
.board-row .nm { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .pts { font: 700 13px var(--mono); text-align: right; }
.rank { display: flex; flex-direction: column; gap: 9px; }
.rank-top { display: flex; justify-content: space-between; align-items: baseline; }
.rank-name { font: 900 28px/1 var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.bar { height: 10px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 2px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%); background: repeating-linear-gradient(-45deg, var(--signal) 0 6px, var(--signal-2) 6px 12px); transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.next-flight { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.next-flight .mix { font: 700 14px var(--sans); margin-top: 4px; color: var(--ink); }
.next-flight .cd { font: 700 24px var(--mono); font-variant-numeric: tabular-nums; text-align: right; margin-top: 4px; }
.duel { display: flex; flex-direction: column; gap: 10px; }
.duel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.duel-head .vs { font: 900 24px var(--display); text-transform: uppercase; }
.duel-row { display: grid; grid-template-columns: 26px 1fr 1fr; gap: 10px; padding: 8px 0; border-top: 2px dashed var(--rule); align-items: center; font-size: 14px; }
.duel-row .n { font: 700 10px var(--mono); color: var(--muted); }
.duel-row .cell { min-width: 0; display: flex; gap: 7px; align-items: center; }
.duel-row .cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-row .cell.win { color: var(--ink); font-weight: 800; }
.duel-row .cell.lose { color: var(--faint); }
.duel-row.head { border-top: 0; font: 700 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.verdict { font: 900 26px var(--display); text-transform: uppercase; text-align: center; padding-top: 6px; }
.verdict small { display: block; font: 700 11px var(--mono); text-transform: none; color: var(--muted); margin-top: 6px; }
details.review summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.review summary::-webkit-details-marker { display: none; }
details.review summary::after { content: '+'; font: 700 18px var(--mono); color: var(--ink); }
details.review[open] summary::after { content: '−'; }
.review ol { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.review li { display: flex; flex-direction: column; gap: 5px; }
.review .rq { font-weight: 700; font-size: 15px; line-height: 1.4; }
.review .ra { font-size: 14px; line-height: 1.5; color: var(--muted); }
.review .ra b { color: var(--ink); }

/* ── Modals ────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(13, 20, 36, 0.6); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s both; }
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal { width: 100%; max-width: 480px; max-height: calc(var(--app-h) - 24px); overflow-y: auto; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheet 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@media (min-width: 600px) { .modal { border-radius: 8px; border-bottom: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); } }
@keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.modal-head h2 { margin: 0; font: 900 32px/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.modal .close { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); font: 700 20px var(--mono); border: 2px solid var(--ink); border-radius: 50%; }
.modal p { line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.field input { height: 50px; padding: 0 14px; font: 600 17px var(--sans); color: var(--ink); background: #fffaf0; border: 2px solid var(--ink); border-radius: 5px; outline: none; }
.field input:focus { box-shadow: inset 0 0 0 2px var(--sun); }
.howto-step { display: flex; flex-direction: column; gap: 12px; min-height: 300px; animation: rise 0.3s both; }
.howto-step h3 { margin: 6px 0 0; font: 900 30px/1 var(--display); text-transform: uppercase; }
.howto-step p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.howto-art { min-height: 110px; display: grid; place-items: center; padding: 10px 0; }
.howto-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.steps { display: flex; gap: 6px; }
.steps i { width: 18px; height: 6px; border-radius: 1px; border: 1.5px solid var(--ink); }
.steps i.on { background: var(--signal); }
.bb-art { width: 74px; height: 74px; display: grid; place-items: center; font: 900 40px var(--display); color: var(--sun); background: var(--ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--signal); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--ink); border-radius: 4px; margin: 12px 0 16px; overflow: hidden; }
.stat { padding: 11px 4px; border-bottom: 2px solid var(--ink); border-left: 2px solid var(--ink); text-align: center; margin-bottom: -2px; }
.stat:nth-child(3n + 1) { border-left: 0; }
.stat b { display: block; font: 700 22px var(--mono); }
.stat span { display: block; font: 700 9px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.dist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.dist-row { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; font: 700 11px var(--mono); }
.dist-row .lbl { color: var(--muted); text-align: right; }
.dist-bar { height: 20px; min-width: 24px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 2px; display: flex; align-items: center; justify-content: flex-end; padding: 0 6px; }
.dist-bar.today { background: var(--signal); color: #fff; }
.history { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 4px; margin: 10px 0; }
.history .day { display: flex; flex-direction: column; align-items: center; gap: 3px; font: 700 9.5px var(--mono); color: var(--faint); }
.history .day.today { color: var(--signal-2); }
.history .col { width: 16px; height: 54px; border-radius: 2px; border: 2px solid var(--ink); background: var(--paper-2); display: flex; align-items: flex-end; overflow: hidden; }
.history .col i { display: block; width: 100%; background: var(--signal); }
.section { margin: 16px 0 4px; }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-root { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--sun); color: var(--ink); padding: 9px 16px; border-radius: 4px; border: 2px solid var(--ink); font: 700 14px var(--sans); box-shadow: var(--shadow-sm); animation: rise 0.25s both; max-width: calc(100vw - 32px); text-align: center; }
.toast.out { opacity: 0; transition: opacity 0.25s; }
.error-box { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 320px; }

/* ── Dev panel ─────────────────────────────────────────────── */
.dev-btn { width: auto; padding: 0 10px; border-radius: 4px; font: 700 10px var(--mono); letter-spacing: 0.14em; background: var(--sun); }
.dev-day { border-top: 2px dashed var(--rule); padding: 10px 0; }
.dev-day summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; list-style: none; font-size: 14px; }
.dev-day summary::-webkit-details-marker { display: none; }
.dev-q { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.dev-q b { color: var(--signal-2); }
.dev-q span { font-weight: 600; }

/* ── Missions, streak, skins ───────────────────────────────── */
.mission-pill { margin-top: 6px; padding: 7px 12px; border-radius: 4px; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-sm); font: 600 14px var(--sans); color: var(--ink); }
.mission { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 4px; border: 2px dashed var(--ink); background: transparent; }
.mission .tick { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ink); color: var(--ink); font: 700 14px var(--mono); }
.mission.done { border-style: solid; background: #d5ecdc; }
.mission.done .tick { background: var(--t3); color: #fff; }
.mission .txt { font-size: 15px; font-weight: 700; }
.mission .txt .label { display: block; margin-bottom: 2px; }
.streak-pill { display: inline-flex; align-items: center; gap: 6px; }
.streak-pill svg { width: 14px; height: 14px; }
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.skin { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 4px; border: 2px solid var(--ink); background: var(--paper); font: 700 12px var(--sans); text-align: center; }
.skin .sw { width: 22px; height: 36px; border-radius: 11px 11px 3px 3px; border: 2px solid var(--ink); }
.skin.on { background: var(--sun); box-shadow: var(--shadow-sm); }
.skin.locked { opacity: 0.5; cursor: default; border-style: dashed; }
.skin small { font: 600 9.5px var(--mono); color: var(--muted); letter-spacing: 0.02em; }

@media (max-height: 780px) { .home .hero .chips { display: none; } }
@media (max-height: 640px) {
  .hero h1 { font-size: clamp(56px, 15vw, 96px); }
  .results { padding-top: 24vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* ── Stages, fuel and the Destination ─────────────────────── */
.mono { font-family: var(--mono); letter-spacing: 0.05em; }
.c-l1 { color: var(--l1); } .c-l2 { color: var(--l2); } .c-l3 { color: var(--l3); } .c-flame { color: var(--danger); }
.pip.l1 { background: var(--l1); border-color: #c4a0ff; } .pip.l2 { background: var(--l2); border-color: #7fa6ff; } .pip.l3 { background: var(--l3); border-color: #6fd39b; }
.pip.near { background: var(--sun); border-color: var(--sun); } .pip.flame { background: #ff6a4a; border-color: #ff6a4a; border-radius: 2px; }
.fuelval { display: flex; justify-content: flex-end; padding-top: 6px; }
.gauge { display: inline-flex; gap: 3px; }
.gauge i { width: 7px; height: 14px; border-radius: 1px; border: 1.5px solid #8d856f; }
.gauge i.on { background: var(--signal); border-color: var(--signal); }

.play.pre { justify-content: space-between; }
.prelaunch { display: flex; justify-content: center; padding-top: 2vh; }
.prelaunch .tag, .mission-pill { align-self: center; width: auto; }
.prelaunch .tag { font: 700 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); padding: 5px 10px; border-radius: 3px; text-align: center; }

.blanks { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.blanks .bw { display: inline-flex; gap: 3px; }
.blanks i { display: grid; place-items: center; width: 24px; height: 30px; border: 2px solid var(--ink); border-radius: 3px; background: #fffaf0; font: 900 19px/1 var(--display); font-style: normal; color: var(--ink); }
.blanks b { display: grid; place-items: center; width: 10px; font: 900 18px var(--display); }
.destbar { background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 9px 12px 10px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; position: relative; }
.destbar .dest-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.destbar .dest-top .label:first-child { color: var(--signal-2); }
.destbar.cracked { background: var(--sun); }
.destbar.cracked .blanks i { background: var(--ink); color: var(--sun); }
.destbar.locked { opacity: 0.75; }
.cargo { display: flex; flex-wrap: wrap; gap: 5px; }
.cargo span { font: 700 12px var(--sans); padding: 3px 8px; border-radius: 3px; background: var(--ink); color: var(--paper); }
.cargo-hint { font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.dest-open { min-height: 38px; font-size: 16px; box-shadow: 2px 2px 0 var(--ink); align-self: flex-start; padding: 0 14px; }
.dest-form { display: flex; gap: 8px; }
.dest-form input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; font: 600 17px var(--sans); border: 2px solid var(--ink); border-radius: 5px; background: #fffaf0; color: var(--ink); outline: none; }
.dest-form .btn { min-height: 44px; font-size: 17px; padding: 0 14px; }
.play.asking .destbar .cargo-hint, .play.revealed .destbar .cargo-hint { display: none; }
@media (max-height: 760px) { .play.asking .destbar .blanks i { width: 20px; height: 24px; font-size: 16px; } .play.asking .destbar { gap: 5px; padding: 7px 10px; } }

.fuelcard { display: flex; flex-direction: column; gap: 12px; animation: rise 0.3s both; margin-top: auto; }
.fuelcard .cat { display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 2px dashed var(--rule); }
.fuel-title { margin: 0; font: 900 clamp(26px, 7vw, 34px)/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.tanks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tank { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 8px; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); box-shadow: var(--shadow-sm); transition: transform 0.07s, box-shadow 0.07s; }
.tank b { font: 900 30px/1 var(--display); }
.tank span { font: 700 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tank.on { background: var(--signal); color: #fff; transform: translate(3px, 3px); box-shadow: none; }
.tank.on span { color: #ffe3d6; }
.tank[data-n="3"].on { background: var(--danger); }
.tank[disabled] { opacity: 0.35; box-shadow: none; border-style: dashed; }
.tanks.demo { width: 100%; max-width: 300px; }
.payoff { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 10px; padding: 8px 10px; border-radius: 4px; background: var(--paper-2); font: 600 12px var(--mono); color: var(--ink-2); }
.payoff b { color: var(--ink); }
.payoff b.neg { color: var(--danger); }
.fuel-foot { text-align: center; }
.bets { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bet { display: inline-flex; align-items: center; gap: 4px; font: 600 13px var(--sans); padding: 4px 9px; border: 2px solid var(--ink); border-radius: 99px; background: #fffaf0; }
.bet .swatch { margin-right: 2px; }
.bet b { font-family: var(--display); font-size: 16px; }
.bet em { font-style: normal; color: var(--muted); font-size: 12px; }
.bet.allin { background: var(--danger); color: #fff; animation: hum 1.2s ease-in-out infinite; }
@keyframes hum { 50% { box-shadow: 0 0 0 4px rgba(198, 47, 47, 0.25); } }

.ask { font: 900 22px/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clues li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 4px; border: 2px solid var(--ink); background: #fffaf0; font: 600 16px/1.35 var(--sans); }
.clues li.old { background: transparent; border-style: dashed; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.clues li.old b { text-decoration: line-through; color: var(--faint); }
.clues li.pop { animation: rise 0.3s both; }
.clues .cn { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 700 12px var(--mono); }
.clues b { font: 700 13px var(--mono); color: var(--signal-2); padding-top: 3px; }
.clues.demo { width: 100%; max-width: 320px; }
.ask-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 22px; }
.ask-foot .feedback { text-align: left; }
.unit { display: grid; place-items: center; padding: 0 10px; font: 700 14px var(--mono); color: var(--muted); }
.tank-tag { padding: 2px 7px; border: 2px solid var(--ink); border-radius: 3px; color: var(--ink) !important; }
.tank-tag.allin { background: var(--danger); color: #fff !important; }
.stamp .pts small { display: block; font: 600 11px var(--mono); color: var(--muted); text-align: right; margin-top: 2px; }
.link-note { padding: 8px 10px; border-radius: 4px; background: var(--sun); border: 2px solid var(--ink); }
.link-note p { margin: 3px 0 0; font-weight: 600; }
.link-note.sealed { background: var(--paper-2); border-style: dashed; }
.link-note.sealed p { color: var(--muted); font-weight: 500; }

.finalcard { display: flex; flex-direction: column; gap: 12px; margin: auto 0; animation: rise 0.3s both; }
.finalcard h2 { margin: 0; font: 900 clamp(32px, 9vw, 44px)/0.95 var(--display); text-transform: uppercase; }
.finalcard p { margin: 0; line-height: 1.45; }
.celebrate { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 22px; background: var(--sun); border: 3px solid var(--ink); border-radius: 6px; box-shadow: 6px 6px 0 var(--ink); pointer-events: none; animation: slam 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both, fade 0.4s 2.2s reverse both; text-align: center; max-width: calc(100vw - 32px); }
.celebrate b { font: 900 clamp(28px, 8vw, 44px)/1 var(--display); text-transform: uppercase; }
.celebrate span { font: 700 18px var(--mono); }
@keyframes slam { from { opacity: 0; transform: translate(-50%, -50%) scale(1.8) rotate(-6deg); } }
.destreveal { display: flex; flex-direction: column; gap: 10px; }
.destreveal p { margin: 0; line-height: 1.45; }
.destreveal.cracked { background: var(--sun); }
.destreveal.cracked .blanks i { background: var(--ink); color: var(--sun); }
.destreveal .blanks i { color: var(--ink); }
.dest-teaser { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 2px dashed var(--rule); }
.dest-teaser .label { color: var(--signal-2); }
.dest-teaser .blanks i { width: 22px; height: 26px; }
.flightlog .bar.down i { background: repeating-linear-gradient(-45deg, var(--danger) 0 5px, #ff8a6a 5px 10px); }
.flightlog .bar.dest span { color: var(--signal-2); }
.review .rc { display: block; font-weight: 500; }
.dev-dest { margin: 8px 0 0; font-size: 14px; }
.duel-row .cell b { margin-left: auto; font: 700 12px var(--mono); }
