/* Lodestar: The Long Burn — a dark glass-cockpit interface over the flight view. */
:root {
  --ink: #dce8ff; --muted: #8ea3c2; --faint: #5d6f8c; --line: rgba(140, 180, 255, .18); --panel: rgba(5, 10, 20, .62);
  --cyan: #7fe0ff; --green: #6ef0a8; --amber: #ffb547; --red: #ff5c5c; --violet: #c08cff;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
/* Hidden means hidden, whatever display a button's class gives it. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: #03060c; color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
kbd { display: inline-block; min-width: 22px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: rgba(255,255,255,.04); color: var(--ink); font: 600 10px/1.4 var(--mono); text-align: center; }
/* Instructions follow the pilot's input: keys, or a touch screen. */
body[data-input="touch"] .keys-only, body:not([data-input="touch"]) .touch-only { display: none !important; }
.space { position: fixed; inset: 0; overflow: hidden; }
#rocket-webgl, #rocket-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#rocket-canvas { z-index: 2; outline: none; touch-action: none; }
#rocket-webgl { z-index: 1; }
.vignette { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(0,0,0,.55) 100%); }
body[data-renderer="webgl"] .vignette { background: radial-gradient(ellipse at 50% 55%, transparent 62%, rgba(0,0,0,.35) 100%); }

/* ---- Masthead and home screen. */
.masthead { position: absolute; z-index: 20; top: calc(14px + var(--safe-top)); left: calc(18px + var(--safe-left)); right: calc(18px + var(--safe-right)); display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.masthead > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 15px var(--sans); letter-spacing: .2px; }
.brand img { border-radius: 9px; }
.brand span span { color: var(--cyan); font-weight: 400; }
.brand small { margin-left: 8px; color: var(--muted); font: 700 8px var(--sans); letter-spacing: 2px; }
.header-actions { display: flex; gap: 8px; }
.quiet { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(5,10,20,.45); color: var(--ink); font: 600 11px var(--sans); text-decoration: none; backdrop-filter: blur(8px); }
.quiet:hover { border-color: rgba(127,224,255,.5); }
body:not([data-screen="home"]) .masthead { display: none; }
.home { position: absolute; z-index: 10; left: calc(clamp(22px, 6vw, 96px) + var(--safe-left)); top: 50%; transform: translateY(-50%); width: min(560px, calc(100vw - 44px)); }
body:not([data-screen="home"]) .home, body:not([data-screen="home"]) .home-footer { display: none; }
.eyebrow { margin: 0 0 18px; color: var(--muted); font: 700 10px var(--sans); letter-spacing: 2.4px; display: flex; align-items: center; gap: 10px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(110,240,168,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(110,240,168,.55); } 70% { box-shadow: 0 0 0 10px rgba(110,240,168,0); } 100% { box-shadow: 0 0 0 0 rgba(110,240,168,0); } }
.home h1 { margin: 0; font: 400 clamp(56px, 9vw, 112px)/.92 var(--serif); letter-spacing: -3px; color: #f2f6ff; text-shadow: 0 6px 40px rgba(0,0,0,.6); }
.home h1 span { display: block; margin-top: 14px; font: italic 400 clamp(20px, 2.6vw, 30px)/1.1 var(--serif); letter-spacing: 0; color: #c6d4ee; }
.home h1 em { color: var(--amber); }
.home-copy { margin: 22px 0 0; max-width: 470px; color: #c3d0e6; font-size: 15px; line-height: 1.65; text-shadow: 0 2px 18px rgba(0,0,0,.8); }
.home-copy b { color: #fff; font-weight: 600; }
.home-facts { display: flex; gap: 26px; margin: 26px 0 0; }
.home-facts div { display: flex; flex-direction: column; }
.home-facts b { font: 400 26px var(--serif); color: #fff; }
.home-facts span { color: var(--muted); font: 700 8.5px var(--sans); letter-spacing: 1.6px; max-width: 120px; }
.home-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin-top: 30px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 0 24px; border: 1px solid rgba(255,214,150,.65); border-radius: 999px; background: linear-gradient(180deg, #ffcf7a, #f2a33d); color: #1a1006; font: 700 13px var(--sans); letter-spacing: .3px; box-shadow: 0 10px 34px rgba(242,163,61,.28); }
.primary:hover { filter: brightness(1.06); }
.secondary { display: block; width: 100%; min-height: 44px; margin-top: 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--ink); font: 600 12px var(--sans); }
.secondary:hover { border-color: rgba(127,224,255,.45); }
.text-button { border: 0; background: none; color: #c6d4ee; font: 600 12px var(--sans); padding: 10px 2px; }
.text-button:hover { color: #fff; }
.home-note { margin: 22px 0 0; color: var(--faint); font-size: 12px; line-height: 1.6; }
.home-note span { color: var(--muted); }
.home-footer { position: absolute; z-index: 10; left: calc(clamp(22px, 6vw, 96px) + var(--safe-left)); right: calc(22px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); display: flex; align-items: center; gap: 22px; color: var(--faint); font: 700 9px var(--sans); letter-spacing: 1.8px; }
.home-footer .text-button, .home-footer .analytics-privacy-button { letter-spacing: 0; color: var(--muted); }

/* ---- Flight instruments. */
.hud { position: absolute; inset: 0; z-index: 12; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud[hidden], .touch-controls[hidden] { display: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.kicker { color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1.8px; }
.hud-top { position: absolute; top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right)); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 10px; }
.lane-panel { justify-self: start; display: flex; flex-direction: column; gap: 5px; width: min(320px, 100%); padding: 11px 14px 12px; }
.lane-panel > b { font: 400 21px/1.15 var(--serif); color: #fff; }
.lane-objective { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 600 11px var(--sans); }
.lane-objective span { color: var(--amber); }
.lane-objective span[data-ready="true"] { color: var(--green); }
.lane-objective strong { color: var(--ink); font: 600 11px var(--mono); white-space: nowrap; }
.lane-progress { display: flex; align-items: center; gap: 8px; }
.lane-progress progress { flex: 1; height: 4px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.lane-progress progress::-webkit-progress-bar { background: rgba(255,255,255,.1); }
.lane-progress progress::-webkit-progress-value { background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: 4px; }
.lane-progress progress::-moz-progress-bar { background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: 4px; }
.target-icon { color: var(--green); font-size: 13px; line-height: 1; }
.next-challenge { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.next-challenge[hidden] { display: none; }
.challenge-mark { color: var(--amber); font-size: 16px; }
.next-challenge small { display: block; color: var(--muted); font: 700 8px var(--sans); letter-spacing: 1.4px; }
.next-challenge b { display: block; color: #fff; font: 600 12px var(--sans); }
.next-challenge strong { color: var(--amber); font: 600 12px var(--mono); }
.next-challenge[data-kind="capture"] .challenge-mark, .next-challenge[data-kind="capture"] strong, .next-challenge[data-kind="assist"] .challenge-mark, .next-challenge[data-kind="assist"] strong { color: var(--green); }
.next-challenge[data-kind="radiation"] .challenge-mark, .next-challenge[data-kind="radiation"] strong { color: var(--violet); }
.next-challenge[data-kind="shelter"] .challenge-mark, .next-challenge[data-kind="shelter"] strong { color: #5ab8ff; }
.next-challenge[data-urgent="true"] strong { animation: blink 1s steps(2) infinite; }
.clock-panel { display: flex; flex-direction: column; align-items: center; padding: 8px 20px 9px; min-width: 170px; }
.clock-panel b { font: 600 24px/1.1 var(--mono); color: #fff; letter-spacing: -.5px; }
.clock-panel[data-state="warn"] b { color: var(--amber); }
.clock-panel[data-state="danger"] b { color: var(--red); animation: blink 1s steps(2) infinite; }
.dilation { margin-top: 3px; padding: 2px 8px; border-radius: 999px; background: rgba(183,166,255,.14); color: #cbbcff; font: 700 9.5px var(--mono); letter-spacing: .6px; }
.dilation[hidden] { display: none; }
@keyframes blink { 50% { opacity: .55; } }
.flight-status { justify-self: end; display: flex; align-items: center; gap: 7px; pointer-events: auto; }
.status-chip { display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 14px; }
.chip-item { display: flex; flex-direction: column; justify-content: center; gap: 3px; margin: -4px -6px; padding: 4px 6px; border-radius: 8px; }
.chip-item > small { color: var(--muted); font: 700 8px/1 var(--sans); letter-spacing: 1.5px; }
.assist-tag { padding: 3px 7px; border: 1px solid rgba(110,240,168,.5); border-radius: 999px; color: var(--green); font: 700 8.5px/1 var(--sans); letter-spacing: 1.2px; }
.assist-tag[hidden] { display: none; }
.echo-count { display: flex; align-items: baseline; gap: 4px; }
.echo-count b { font: 400 22px/1 var(--serif); color: #fff; }
.echo-count small { color: var(--muted); font: 600 11px var(--mono); }
.plates { color: var(--green); font: 700 15px/1 var(--mono); letter-spacing: 2px; }
.plates[data-state="warn"] { color: var(--amber); }
.plates[data-state="danger"] { color: var(--red); animation: blink 1s steps(2) infinite; }
.circle { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); font: 600 14px var(--mono); backdrop-filter: blur(8px); }
.circle:hover { border-color: rgba(127,224,255,.5); }
.hud-bottom { position: absolute; left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right)); bottom: calc(12px + var(--safe-bottom)); display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.speed-panel { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px 11px; min-width: 150px; pointer-events: auto; }
.speed-reading { display: flex; align-items: baseline; gap: 6px; }
.speed-reading b { font: 400 40px/1 var(--serif); color: #fff; letter-spacing: -1px; }
.speed-reading span { color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1.4px; }
.speed-target { align-self: flex-start; margin: 2px 0 1px; padding: 2px 8px; border-radius: 999px; background: rgba(255,181,71,.14); color: var(--amber); font: 700 10px var(--mono); letter-spacing: .6px; }
.speed-target[data-ok="true"] { background: rgba(110,240,168,.16); color: var(--green); }
.speed-target[hidden] { display: none; }
.speed-detail { color: var(--muted); font: 600 11px var(--mono); }
.look-back { margin-top: 6px; align-self: flex-start; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--ink); font: 600 11px var(--sans); }
.look-back[hidden] { display: none; }
.look-back[aria-pressed="true"], .look-back[data-active="true"] { border-color: var(--amber); color: var(--amber); }
.look-back kbd { margin-left: 4px; }
.systems { width: 300px; padding: 10px 14px 12px; display: grid; gap: 8px; }
.gauge { display: grid; grid-template-columns: auto 1fr; align-items: baseline; row-gap: 4px; }
.gauge[hidden] { display: none; }
.gauge-label { color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1.5px; }
.gauge-value { justify-self: end; display: flex; align-items: baseline; gap: 8px; }
.gauge-value b { font: 600 13px var(--mono); color: #fff; }
.gauge-value small { color: var(--muted); font: 500 10.5px var(--mono); }
#fuel-pct { font-size: 15px; }
.gauge-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; color: var(--faint); font: 500 9.5px var(--sans); }
.gauge-note[hidden] { display: none; }
.hatch { display: inline-block; width: 14px; height: 7px; border-radius: 2px; background: repeating-linear-gradient(135deg, rgba(255,255,255,.75) 0 2px, transparent 2px 4px); }
.bar { position: relative; grid-column: 1 / -1; height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); }
.bar i { display: block; height: 100%; width: 100%; border-radius: 4px; background: var(--cyan); transition: width .2s linear; }
/* The brake reserve: the hatched start of the tank that braking into orbit will need. */
.bar em { position: absolute; left: 0; top: -2px; bottom: -2px; width: 0; border-right: 2px solid #fff; border-radius: 4px 0 0 4px; background: repeating-linear-gradient(135deg, rgba(255,255,255,.62) 0 2px, rgba(255,255,255,0) 2px 5px); box-shadow: 2px 0 6px rgba(255,255,255,.45); }
.bar em[hidden] { display: none; }
.gauge[data-state="danger"] .bar em { border-right-color: var(--red); background: repeating-linear-gradient(135deg, rgba(255,92,92,.8) 0 2px, rgba(255,92,92,0) 2px 5px); }
.gauge[data-locked="true"] .bar em { border-right-color: var(--amber); box-shadow: 0 0 10px rgba(255,181,71,.8); }
#fuel-bar { background: linear-gradient(90deg, #ff9d3c, #ffcf6a); }
/* A lesson can point at the instrument it is about. */
[data-focus="true"] { border-radius: 10px; animation: focus-pulse 1.1s ease-in-out infinite; }
@keyframes focus-pulse { 0%, 100% { box-shadow: 0 0 0 1px rgba(127,224,255,.55); } 50% { box-shadow: 0 0 0 2px rgba(127,224,255,.95), 0 0 22px 4px rgba(127,224,255,.35); } }
#dose-bar { background: var(--violet); }
#heat-bar { background: linear-gradient(90deg, #ffb547, #ff5c5c); }
#front-bar { background: linear-gradient(90deg, #ffb547, #ff5c2c); }
.gauge[data-state="warn"] .gauge-value b { color: var(--amber); }
.gauge[data-state="danger"] .gauge-value b { color: var(--red); }
.gauge[data-state="danger"] .bar i { background: var(--red); }
.alert { position: absolute; left: 50%; top: calc(96px + var(--safe-top)); transform: translateX(-50%); padding: 8px 16px; border: 1px solid rgba(255,92,92,.55); border-radius: 8px; background: rgba(40,6,10,.72); color: #ffd2d2; font: 700 11px var(--mono); letter-spacing: 1.2px; text-align: center; white-space: nowrap; backdrop-filter: blur(6px); }
.alert[data-tone="warn"] { border-color: rgba(255,181,71,.6); background: rgba(40,26,4,.72); color: #ffe2b0; }
.alert[data-tone="info"] { border-color: rgba(127,224,255,.5); background: rgba(4,22,34,.72); color: #cdf3ff; }
/* Messages keep their own places on wide screens and stack on compact ones. */
.messages { display: contents; }
.alert[hidden], .comms[hidden], .coach[hidden], .toast[hidden], .gate[hidden] { display: none; }
.toast { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(4,14,26,.62); color: #e6f6ff; font: 700 13px var(--sans); letter-spacing: .4px; white-space: nowrap; text-shadow: 0 0 12px rgba(127,224,255,.6); }
.comms { position: absolute; left: 50%; bottom: calc(118px + var(--safe-bottom)); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-left: 2px solid var(--cyan); border-radius: 6px; background: rgba(4,10,20,.72); backdrop-filter: blur(8px); display: flex; flex-direction: column; gap: 2px; }
.comms-head { display: flex; align-items: baseline; gap: 8px; }
.comms b { color: var(--cyan); font: 700 9.5px var(--sans); letter-spacing: 1.6px; text-transform: uppercase; }
.comms-head small { color: var(--muted); font: 600 9.5px var(--sans); letter-spacing: .4px; }
.comms-head small[hidden] { display: none; }
#comms-text { color: #e6eeff; font-size: 13px; line-height: 1.45; }
.coach { position: absolute; left: 50%; top: calc(140px + var(--safe-top)); transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(5,10,20,.66); color: #e3ecff; font: 600 12px var(--sans); text-align: center; max-width: min(620px, calc(100vw - 32px)); }
.coach[data-tone="warn"] { border: 1px solid rgba(255,181,71,.55); background: rgba(40,26,4,.8); color: #ffe2b0; }
.coach[data-tone="danger"] { border: 1px solid rgba(255,92,92,.55); background: rgba(40,6,10,.8); color: #ffd2d2; }
/* A first-flight lesson: time slows until the pilot tries the move. */
.gate { position: absolute; left: 50%; top: calc(140px + var(--safe-top)); transform: translateX(-50%); width: min(400px, calc(100vw - 32px)); padding: 11px 16px 12px; border: 1px solid rgba(127,224,255,.6); border-radius: 14px; background: rgba(3,12,26,.86); box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 34px rgba(127,224,255,.2); backdrop-filter: blur(10px); text-align: center; animation: gate-glow 1.6s ease-in-out infinite; }
.gate-kicker { display: block; color: var(--cyan); font: 700 9px var(--sans); letter-spacing: 1.8px; }
.gate-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.gate-row > b { font: 400 28px/1 var(--serif); color: #fff; }
.gate-keys { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 5px; color: var(--muted); font: 600 11px var(--sans); }
.gate-keys kbd { min-width: 28px; padding: 4px 8px; border-color: rgba(127,224,255,.55); color: #fff; font-size: 12px; }
.gate-keys .glyph { padding: 4px 10px; border: 1px solid rgba(127,224,255,.55); border-radius: 999px; color: var(--cyan); font: 700 11px var(--mono); }
.gate-keys .glyph.brake { border-color: rgba(255,181,71,.6); color: var(--amber); }
.gate-text { margin: 7px 0 0; color: #dce8ff; font: 600 12.5px/1.45 var(--sans); }
.gate-meter { display: block; height: 3px; margin-top: 9px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.gate-meter i { display: block; height: 100%; width: 0; background: var(--green); }
.gate[data-action="brake"] { border-color: rgba(255,181,71,.65); box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 34px rgba(255,181,71,.2); }
.gate[data-action="brake"] .gate-kicker { color: var(--amber); }
@keyframes gate-glow { 50% { box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 46px rgba(127,224,255,.38); } }
/* With a lesson up, later messages queue beneath it. */
.gate:not([hidden]) ~ .coach { top: calc(276px + var(--safe-top)); }
.gate:not([hidden]) ~ .toast { top: max(38%, calc(318px + var(--safe-top))); }
.desktop-keys { position: absolute; left: 50%; bottom: calc(14px + var(--safe-bottom)); transform: translateX(-50%); margin: 0; color: var(--faint); font-size: 11px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.desktop-keys kbd { margin-left: 8px; }
@media (pointer: coarse) { .desktop-keys { display: none; } }
.radiation-noise { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; mix-blend-mode: screen; background-image: radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 2px), radial-gradient(circle at 40% 80%, #fff 0 1px, transparent 2px), radial-gradient(circle at 85% 15%, #fff 0 1px, transparent 2px); background-size: 137px 113px, 191px 157px, 229px 173px, 283px 211px; }
.flash { position: absolute; inset: 0; z-index: 15; pointer-events: none; background: #fff; opacity: 0; }

/* ---- Touch controls. */
.touch-controls { position: absolute; inset: 0; z-index: 13; pointer-events: none; }
.touch-left { position: absolute; left: calc(14px + var(--safe-left)); bottom: calc(150px + var(--safe-bottom)); pointer-events: auto; }
.touch-right { position: absolute; right: calc(14px + var(--safe-right)); bottom: calc(150px + var(--safe-bottom)); pointer-events: auto; }
.touch-big { width: 76px; height: 76px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font: 600 22px var(--mono); touch-action: none; }
.touch-big small { margin-top: 5px; font: 700 9px var(--sans); letter-spacing: 1px; }
.touch-big.burn { border: 1px solid rgba(127,224,255,.5); background: rgba(4,22,34,.6); color: var(--cyan); }
.touch-big.brake { border: 1px solid rgba(255,181,71,.45); background: rgba(30,18,4,.6); color: var(--amber); }
.touch-big[data-active="true"].burn { background: rgba(127,224,255,.25); }
.touch-big[data-active="true"].brake { background: rgba(255,181,71,.25); }
/* The button a lesson asks for. */
.touch-big[data-cue="true"] { animation: cue-pulse 1s ease-in-out infinite; }
@keyframes cue-pulse { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,.18), 0 0 26px currentColor; } }
.touch-hint { position: absolute; left: 50%; bottom: calc(150px + var(--safe-bottom)); transform: translateX(-50%); margin: 0; color: var(--muted); font: 600 11px var(--sans); white-space: nowrap; transition: opacity .6s; }

/* ---- Overlays and cards. */
.overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(18px + var(--safe-top)) calc(18px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(18px + var(--safe-left)); background: rgba(2,4,10,.5); backdrop-filter: blur(4px); }
.overlay[hidden] { display: none; }
.card { width: min(480px, 100%); max-height: 100%; overflow: auto; padding: 28px 30px; border: 1px solid var(--line); border-radius: 18px; background: rgba(6,11,22,.9); box-shadow: 0 30px 90px rgba(0,0,0,.55); text-align: left; overscroll-behavior: contain; touch-action: pan-y; }
.card h2 { margin: 8px 0 10px; font: 400 32px/1.1 var(--serif); letter-spacing: -.6px; color: #fff; }
.card .story { color: #c3d0e6; font-size: 14px; line-height: 1.65; margin: 0 0 16px; }
.card.compact { width: min(400px, 100%); }
.card .primary { width: 100%; margin-top: 6px; }
/* Cards whose actions must never scroll away: the content scrolls, the footer stays. */
.card.split { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.card-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 26px 30px 12px; }
.card-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 30px 18px; border-top: 1px solid var(--line); background: rgba(4,8,16,.55); }
.card-scroll[data-more="true"], .brief-scroll[data-more="true"] { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
.card .card-actions .primary { flex: 1 1 100%; width: auto; margin: 0; }
.card-actions .secondary { flex: 1 1 150px; width: auto; min-height: 42px; margin: 0; padding: 0 14px; }
.card-actions .text-button { flex: 1 1 auto; min-height: 40px; }
.intro-card, .ending-card { width: min(560px, 100%); }
.intro-card h2 { font-size: 34px; }
.cast { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cast[hidden] { display: none; }
.cast li { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.cast b { display: block; color: #fff; font: 400 16px/1.2 var(--serif); }
.cast span { color: var(--muted); font: 600 10.5px var(--sans); }
.log-card { margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(127,224,255,.3); border-radius: 12px; background: linear-gradient(180deg, rgba(127,224,255,.09), rgba(127,224,255,.02)); }
.log-card[hidden] { display: none; }
.log-card .kicker { color: var(--cyan); }
.log-card b { display: block; margin-top: 4px; color: #fff; font: 400 18px/1.25 var(--serif); }
.log-card p { margin: 6px 0 0; color: #d6e2f7; font: italic 14px/1.6 var(--serif); }
.brief-card { width: min(1020px, 100%); padding: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); overflow: hidden; }
.brief-chart { position: relative; background: #040810; border-right: 1px solid var(--line); min-height: 280px; }
.brief-chart canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.chart-key { position: absolute; left: 14px; top: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); font: 600 10px var(--sans); }
.chart-key i { display: inline-block; width: 18px; height: 0; border-top: 3px solid rgba(127,224,255,.5); margin-left: 6px; }
.chart-key .key-hazard { border-top-color: var(--amber); }
.brief-body { display: flex; flex-direction: column; min-height: 0; max-height: min(640px, calc(100dvh - 36px)); padding: 24px 26px 20px; }
.brief-scroll h3 { margin: 0 0 8px; color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1.6px; text-transform: uppercase; }
.win { margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(110,240,168,.3); border-radius: 12px; background: rgba(110,240,168,.05); }
.win h3 { color: var(--green); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 7px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; color: #e6eeff; font-size: 13.5px; line-height: 1.45; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(110,240,168,.16); color: var(--green); font: 700 11px/1 var(--mono); }
.scene { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.scene[hidden] { display: none; }
.scene li { padding-left: 12px; border-left: 2px solid rgba(127,224,255,.4); }
.scene li > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.scene b { color: var(--cyan); font: 700 9.5px var(--sans); letter-spacing: 1.3px; text-transform: uppercase; }
.scene small { color: var(--faint); font: 600 10px var(--sans); }
.scene p { margin: 3px 0 0; color: #dfe8fb; font: italic 14px/1.55 var(--serif); }
.brief-block { margin: 0 0 14px; }
.controls p { margin: 0; color: #c9d6ee; font-size: 12.5px; line-height: 2; }
.controls b { padding: 2px 7px; border-radius: 999px; font: 700 10px var(--mono); white-space: nowrap; }
.pill-burn { border: 1px solid rgba(127,224,255,.5); color: var(--cyan); }
.pill-brake { border: 1px solid rgba(255,181,71,.5); color: var(--amber); }
.brief-extras { margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; background: rgba(110,240,168,.08); color: #c8f7dc; font: 600 12px/1.5 var(--sans); }
.brief-extras[hidden] { display: none; }
.facts small { display: block; color: var(--faint); font: 500 9.5px var(--mono); }
.assist-toggle { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--muted); font: 700 11px var(--sans); white-space: nowrap; }
.assist-toggle[aria-pressed="true"] { border-color: rgba(110,240,168,.55); background: rgba(110,240,168,.1); color: var(--green); }
.assist-toggle[hidden] { display: none; }
.brief-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.difficulty { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1.4px; text-transform: uppercase; }
.difficulty[data-level="hard"], .difficulty[data-level="expert"] { border-color: rgba(255,181,71,.45); color: var(--amber); }
.brief-route { margin: -4px 0 0; color: var(--cyan); font: 600 12px var(--mono); }
.brief-scroll { flex: 1; min-height: 0; overflow: auto; margin: 14px -6px 0; padding: 0 6px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.facts div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.facts span { display: block; color: var(--muted); font: 700 8px var(--sans); letter-spacing: 1.3px; }
.facts b { font: 600 13px var(--mono); color: #fff; }
.hazards { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; }
.hazards li { padding: 4px 10px; border-radius: 999px; background: rgba(255,92,92,.1); color: #ffc4c4; font: 600 11px var(--sans); }
.hazards li[data-kind="assist"] { background: rgba(127,224,255,.1); color: #c9f2ff; }
.lesson { display: flex; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(127,224,255,.07); color: #d4f1ff; font-size: 13px; }
.lesson p { margin: 0; }
.goals { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.goals li { display: flex; gap: 10px; align-items: center; color: #c9d6ee; font-size: 13px; }
.goals li::before { content: '✦'; color: var(--faint); }
.goals li[data-met="true"]::before { color: var(--amber); }
.brief-body footer { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
.brief-body footer .primary { flex: 1 1 150px; }
.result-card { width: min(540px, 100%); }
.result-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; }
.result-stars { margin: 0; color: var(--faint); font-size: 26px; line-height: 1; letter-spacing: 7px; }
.result-stars b { color: var(--amber); font-weight: 400; text-shadow: 0 0 18px rgba(255,181,71,.6); }
.result-tip { display: flex; gap: 10px; align-items: baseline; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,181,71,.09); color: #ffe6bf; font-size: 13px; line-height: 1.5; }
.result-tip[hidden], .result-quote[hidden], .offer[hidden], .reward[hidden] { display: none; }
.result-tip b { color: var(--amber); font: 700 9px var(--sans); letter-spacing: 1.5px; }
.result-quote { margin: 0 0 14px; padding-left: 12px; border-left: 2px solid rgba(127,224,255,.4); }
.result-quote p { margin: 0; color: #dfe8fb; font: italic 14px/1.55 var(--serif); }
.result-quote cite { display: block; margin-top: 3px; color: var(--cyan); font: 700 9.5px var(--sans); font-style: normal; letter-spacing: 1.2px; text-transform: uppercase; }
.offer { margin: 0 0 14px; padding: 10px 12px; border: 1px dashed rgba(110,240,168,.45); border-radius: 10px; color: #c8f7dc; font-size: 12.5px; line-height: 1.5; }
.reward { margin: 0 0 14px; padding: 9px 12px; border-radius: 10px; background: rgba(255,207,106,.09); color: #ffe2a8; font: 600 12.5px/1.45 var(--sans); }
.reward[data-kind="unlocked"] { border: 1px solid rgba(255,207,106,.5); background: rgba(255,207,106,.14); }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.result-stats div { padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.result-stats b { display: block; font: 600 14px var(--mono); color: #fff; }
.result-stats span { color: var(--muted); font: 700 7.5px var(--sans); letter-spacing: 1.2px; }
.result-goals { margin-bottom: 12px; }
.result-score { margin: 0 0 4px; color: var(--muted); font: 600 11px var(--mono); }
.result-score:empty { display: none; }
.result-card[data-outcome="failed"] #result-kicker { color: var(--red); }
.result-card[data-outcome="delivered"] #result-kicker { color: var(--green); }
.offer-button { border-color: rgba(110,240,168,.45); color: #c8f7dc; }

/* ---- Dialogs. */
dialog { width: min(640px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 24px 26px; border: 1px solid var(--line); border-radius: 18px; background: #070d1a; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(1,3,8,.7); backdrop-filter: blur(4px); }
dialog h2 { margin: 6px 0 8px; font: 400 30px/1.1 var(--serif); color: #fff; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-copy { color: var(--muted); margin: 0 0 16px; }
.mission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mission-list button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); text-align: left; }
.mission-list button:hover:not(:disabled) { border-color: rgba(127,224,255,.45); background: rgba(127,224,255,.05); }
.mission-list button:disabled { opacity: .45; cursor: default; }
.mission-list .number { font: 600 13px var(--mono); color: var(--muted); }
.mission-list .name { display: flex; flex-direction: column; }
.mission-list .name b { font: 400 17px var(--serif); color: #fff; }
.mission-list .name small { color: var(--muted); font: 500 11px var(--mono); }
.mission-list .stars { color: var(--faint); letter-spacing: 3px; }
.mission-list .stars b { color: var(--amber); font-weight: 400; }
.mission-list li[data-skipped="true"] .name small { color: #c8f7dc; }
.tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 4px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.03); }
.tabs button { padding: 7px 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 700 11px var(--sans); letter-spacing: .4px; }
.tabs button[aria-selected="true"] { background: rgba(127,224,255,.15); color: #fff; }
.tabs button[hidden], .tab-panel[hidden] { display: none; }
.log-list, .upgrade-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log-list li, .upgrade-list li { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.log-list .entry-head, .upgrade-list .entry-head { display: flex; align-items: baseline; gap: 10px; }
.log-list .number { color: var(--muted); font: 600 12px var(--mono); }
.log-list b, .upgrade-list b { flex: 1; color: #fff; font: 400 16px/1.3 var(--serif); }
.log-list p { margin: 5px 0 0; color: #c9d6ee; font: italic 13.5px/1.6 var(--serif); }
.log-list li[data-state="locked"] { opacity: .5; }
.log-list li[data-state="locked"] p, .log-list li[data-state="skipped"] p { font: 500 12px/1.5 var(--sans); color: var(--muted); }
.log-list li[data-state="skipped"] { border-style: dashed; border-color: rgba(110,240,168,.4); }
.upgrade-list p { margin: 4px 0 0; color: #c3d0e6; font-size: 12.5px; line-height: 1.5; }
.upgrade-list .threshold { color: var(--amber); font: 700 11px var(--mono); white-space: nowrap; }
.upgrade-list .status { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); font: 700 9px var(--sans); letter-spacing: 1px; white-space: nowrap; }
.upgrade-list li[data-owned="true"] { border-color: rgba(110,240,168,.45); background: rgba(110,240,168,.05); }
.upgrade-list li[data-owned="true"] .status { background: rgba(110,240,168,.16); color: var(--green); }
.manual { display: grid; gap: 12px; margin: 14px 0 18px; }
.manual div { display: grid; grid-template-columns: 74px 1fr; gap: 12px; align-items: start; }
.manual kbd { justify-self: start; }
.manual p { margin: 0; color: #c3d0e6; font-size: 13px; line-height: 1.6; }
.manual b { color: #fff; }
.advanced { margin: -4px 0 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.advanced summary { color: var(--cyan); font: 700 12px var(--sans); cursor: pointer; }
.advanced .manual { margin: 12px 0 2px; }
dialog .primary { width: 100%; }
.storage-note { position: fixed; z-index: 40; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 999px; background: rgba(40,26,4,.85); color: #ffe2b0; font-size: 12px; }
.storage-note[hidden] { display: none; }
.no-script { position: fixed; inset: auto 0 0; z-index: 50; padding: 14px; background: #1a0c0c; color: #ffd9d9; text-align: center; }
.no-script a { color: #fff; }

/* ---- Compact layouts. Every card keeps its actions on screen down to 320×280. */
@media (max-width: 860px) {
  .brief-card { display: flex; flex-direction: column; }
  .brief-chart { flex: 0 0 auto; height: clamp(110px, 24vh, 220px); min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brief-body { flex: 1 1 auto; max-height: none; padding: 18px 20px 14px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .hud-top { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .clock-panel { grid-column: 1; grid-row: 1; justify-self: start; align-items: flex-start; min-width: 0; padding: 6px 11px; }
  .clock-panel b { font-size: 17px; }
  .clock-panel .kicker { font-size: 8px; }
  .flight-status { grid-column: 2; grid-row: 1; gap: 5px; }
  .status-chip { height: 40px; gap: 10px; padding: 0 10px; }
  .chip-item > small { font-size: 7px; }
  .echo-count b { font-size: 18px; }
  .plates { font-size: 13px; }
  .circle { width: 36px; height: 36px; font-size: 12px; }
  .lane-panel { grid-column: 1 / -1; grid-row: 2; width: auto; max-width: none; padding: 7px 11px 8px; gap: 4px; }
  .lane-panel > .kicker, .lane-panel > b { display: none; }
  .next-challenge { margin-top: 1px; padding-top: 5px; gap: 8px; }
  .next-challenge small { display: none; }
  .hud-bottom { gap: 8px; }
  .speed-panel { min-width: 0; padding: 7px 12px 8px; }
  .speed-reading b { font-size: 30px; }
  .speed-detail { display: none; }
  .systems { width: auto; flex: 1; max-width: 230px; gap: 6px; padding: 8px 11px; }
  .gauge-value small, .gauge-note, .facts small { display: none; }
  .messages { position: absolute; top: calc(146px + var(--safe-top)); left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
  .messages > * { position: static; transform: none; max-width: 100%; }
  .gate { width: min(400px, 100%); padding: 9px 12px 10px; }
  .gate-row > b { font-size: 24px; }
  .comms { width: 100%; padding: 8px 12px; }
  #comms-text { font-size: 12px; line-height: 1.4; }
  .coach { font-size: 11.5px; }
  .alert { white-space: normal; }
  .toast { order: -1; }
  .touch-left, .touch-right { bottom: calc(132px + var(--safe-bottom)); }
  .touch-hint { bottom: calc(150px + var(--safe-bottom)); max-width: calc(100vw - 210px); white-space: normal; text-align: center; }
  .home { top: auto; bottom: calc(68px + var(--safe-bottom)); transform: none; }
  .home h1 { letter-spacing: -2px; }
  .home-copy { font-size: 14px; }
  .home-facts { gap: 16px; }
  .home-facts b { font-size: 21px; }
  .home-footer { gap: 12px; font-size: 8px; }
  .home-footer > span { display: none; }
  .card { padding: 22px 20px; }
  .card-scroll { padding: 20px 18px 10px; }
  .card-actions { padding: 12px 18px 14px; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand small { display: none; }
  dialog { padding: 20px 18px; }
  .manual div { grid-template-columns: 62px 1fr; gap: 10px; }
}
/* Phones held sideways: briefing and report sit side by side, actions in one row. */
@media (max-height: 520px) and (min-width: 600px) {
  .lane-panel { width: min(250px, calc(50vw - 150px)); padding: 7px 11px 8px; gap: 3px; }
  .lane-panel > .kicker { display: none; }
  .lane-panel > b { font-size: 16px; }
  .next-challenge { margin-top: 1px; padding-top: 5px; }
  .clock-panel { padding: 6px 14px; }
  .clock-panel b { font-size: 18px; }
  .status-chip { height: 42px; }
  .speed-panel { padding: 7px 12px; }
  .speed-reading b { font-size: 28px; }
  .speed-detail { display: none; }
  .systems { width: 240px; gap: 4px; padding: 7px 10px; }
  .gauge-note, .gauge-value small, .facts small { display: none; }
  .messages { position: absolute; top: calc(70px + var(--safe-top)); left: 50%; right: auto; width: clamp(220px, calc(100vw - 560px), 440px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
  .messages > * { position: static; transform: none; max-width: 100%; }
  .gate { width: 100%; padding: 7px 12px 8px; }
  .gate-row { margin-top: 3px; }
  .gate-row > b { font-size: 21px; }
  .gate-text { margin-top: 4px; font-size: 11.5px; }
  .gate-meter { margin-top: 6px; }
  .comms { width: 100%; padding: 7px 11px; }
  #comms-text { font-size: 12px; line-height: 1.4; }
  .alert { white-space: normal; }
  .toast { order: -1; }
  .desktop-keys { display: none; }
  .touch-left, .touch-right { bottom: calc(108px + var(--safe-bottom)); }
  .touch-hint { display: none; }
  .home { top: 54%; }
  .home h1 { font-size: 54px; }
  .home-copy { font-size: 13px; margin-top: 12px; }
  .home-facts { display: none; }
  .home-actions { margin-top: 16px; }
  .overlay { padding: calc(12px + var(--safe-top)) calc(14px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(14px + var(--safe-left)); }
  .brief-card { display: flex; flex-direction: row; }
  .brief-chart { flex: 0 0 38%; height: auto; border-right: 1px solid var(--line); border-bottom: 0; }
  .brief-body { flex: 1 1 auto; min-width: 0; padding: 14px 18px 12px; }
  .brief-body h2, .card h2 { margin: 4px 0 6px; font-size: 24px; }
  .brief-scroll { margin-top: 10px; }
  .brief-body footer { margin-top: 10px; }
  .card .primary, .brief-body footer .primary { min-height: 44px; }
  .result-card { width: min(860px, 100%); }
  .result-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 0 22px; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 2px; }
  .card-scroll { padding: 16px 22px 8px; }
  .card-actions { padding: 10px 22px 12px; }
  .card .card-actions .primary { flex: 1.4 1 190px; }
  .card-actions .secondary { flex: 1 1 140px; min-height: 40px; }
  .card-actions .text-button { flex: 0 1 auto; }
  .intro-card, .ending-card { width: min(720px, 100%); }
}
/* Short portrait screens drop the chart and tighten every card. */
@media (max-height: 460px) and (max-width: 599px) { .brief-chart { display: none; } }
@media (max-height: 420px) {
  .overlay { padding: calc(8px + var(--safe-top)) calc(10px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(10px + var(--safe-left)); }
  .card h2, .brief-body h2 { margin: 2px 0 6px; font-size: 21px; }
  .card .story { font-size: 13px; margin-bottom: 10px; }
  .brief-body { padding: 12px 14px 10px; }
  .card-scroll { padding: 12px 16px 6px; }
  .card-actions { gap: 6px 8px; padding: 8px 14px 10px; }
  .card .card-actions .primary, .brief-body footer .primary { min-height: 40px; }
  .card-actions .secondary, .assist-toggle { min-height: 36px; }
  .card-actions .text-button { min-height: 34px; padding: 6px 2px; }
  .result-stars { font-size: 20px; }
  .result-stats b { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .clock-panel[data-state="danger"] b, .plates[data-state="danger"], .next-challenge[data-urgent="true"] strong, .gate, .touch-big[data-cue="true"] { animation: none; }
  /* Lessons still point at their instrument, without pulsing. */
  [data-focus="true"] { animation: none; box-shadow: 0 0 0 2px rgba(127,224,255,.9); }
  .touch-big[data-cue="true"] { box-shadow: 0 0 0 3px rgba(255,255,255,.5); }
  .bar i { transition: none; }
}

/* Journey: a quiet flight deck, with the sky doing most of the talking. */
:root { --faint: #8b9ab1; --panel: rgba(7, 16, 32, .72); }
body[data-mode="journey"] .manual-only, body:not([data-mode="journey"]) .journey-only { display: none !important; }
.home { width: min(480px, calc(100vw - 48px)); }
.home::before { content: ""; position: absolute; z-index: -1; inset: -70px -90px; background: radial-gradient(ellipse, rgba(3,9,23,.87), rgba(3,9,23,.52) 50%, transparent 72%); pointer-events: none; }
.home h1 { font-size: clamp(64px, 7.8vw, 108px); line-height: .92; letter-spacing: -5px; font-weight: 400; text-shadow: 0 4px 50px #091931; }
.home h1 > span { display: block; font-size: clamp(29px, 3.2vw, 43px); line-height: 1.3; letter-spacing: -1.4px; margin-top: 12px; color: #cfdfef; }
.home h1 em { color: #a5edeb; }
.home-copy { max-width: 420px; font-size: 16px; line-height: 1.7; color: #b7c9df; margin-top: 22px; }
.home-copy b { color: #f4e6c8; font-weight: 600; }
.eyebrow { color: #a4becd; letter-spacing: 2px; font-size: 9px; }
.beacon-route { display: flex; align-items: center; gap: 14px; margin: 26px 0; width: min(390px,100%); }
.route-caption, .route-end { font: 700 8px var(--sans); letter-spacing: 1.4px; color: #91aaba; white-space: nowrap; }
.beacon-lights { position: relative; display: flex; align-items: center; justify-content: space-between; flex: 1; }
.beacon-lights::before { content: ""; height: 1px; background: #385064; left: 0; right: 0; position: absolute; }
.beacon-lights i { z-index: 1; width: 6px; height: 6px; border: 1px solid #617a90; border-radius: 50%; background: #0b192b; }
.beacon-lights i[data-next="true"] { width: 10px; height: 10px; border-color: #aff5eb; box-shadow: 0 0 14px #65dace; }
.beacon-lights i[data-lit="true"] { background: #a1f1cd; border-color: #b7ffe0; box-shadow: 0 0 10px #73f1c0; }
.mode-picker { display: flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid rgba(153,195,226,.18); border-radius: 13px; background: rgba(6,17,34,.65); }
.mode-option { border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; min-height: 52px; text-align: left; color: #91a7c0; background: transparent; }
.mode-option b { display: block; font-size: 12px; font-weight: 600; }
.mode-option small { display: block; margin-top: 2px; font-size: 10px; }
.mode-option[aria-pressed="true"] { color: #dffcf6; background: rgba(100,210,194,.12); border-color: rgba(136,231,218,.3); }
.home-actions { margin-top: 22px; gap: 12px 20px; }
.primary { min-height: 52px; background: linear-gradient(135deg,#d0f7e8,#84dacc); border-color: #b6f3db; color: #102723; box-shadow: 0 8px 32px #64d1b524; letter-spacing: .1px; }
.primary:hover { box-shadow: 0 9px 38px #64d1b53d; }
.home-note { font-size: 11px; line-height: 1.9; margin-top: 17px; color: #8ca3ba; }
.circle { min-width: 44px; min-height: 44px; }
.quiet { min-height: 44px; display: inline-flex; align-items: center; }
.brief-purpose { color: #b7cede; font-size: 15px; line-height: 1.7; margin: 0 0 20px; }
.brief-details { margin-top: 18px; border-top: 1px solid var(--line); }
.brief-details summary { display: flex; justify-content: space-between; align-items: center; min-height: 48px; cursor: pointer; color: #a6bed0; font-size: 12px; list-style: none; }
.brief-details summary::-webkit-details-marker { display: none; }
.brief-details[open] > summary { margin-bottom: 10px; }
body[data-mode="manual"] .brief-details { border: 0; }
body[data-mode="journey"] .brief-card { max-width: 850px; }
body[data-mode="journey"] .brief-body h2 { font-size: 38px; letter-spacing: -1.2px; }
body[data-mode="journey"] .steps { gap: 12px; }
body[data-mode="journey"] .steps li { font-size: 13px; line-height: 1.6; }
body[data-mode="journey"] .brief-chart { background: radial-gradient(ellipse at 50% 40%, #173e4e, #071423 70%); }
body[data-mode="journey"] .hud-top { display: flex; justify-content: space-between; gap: 12px; top: calc(18px + var(--safe-top)); left: calc(20px + var(--safe-left)); right: calc(20px + var(--safe-right)); }
body[data-mode="journey"] .lane-panel { width: 260px; max-width: 55%; padding: 10px 14px; gap: 6px; background: rgba(5,16,30,.58); border-color: rgba(136,206,221,.2); }
body[data-mode="journey"] .lane-panel > .kicker { display: block; font-size: 8px; }
body[data-mode="journey"] .lane-panel > b { display: none; }
body[data-mode="journey"] .lane-objective { font-size: 13px; }
body[data-mode="journey"] .lane-objective span { color: #d2f4ee; }
body[data-mode="journey"] .lane-objective strong { color: #8fb6bf; font-size: 10px; }
body[data-mode="journey"] #clock-panel, body[data-mode="journey"] #next-challenge, body[data-mode="journey"] #ride-sound, body[data-mode="journey"] .assist-tag { display: none; }
body[data-mode="journey"] .flight-status { gap: 8px; }
body[data-mode="journey"] .status-chip { height: 58px; background: rgba(5,16,30,.58); padding: 0 14px; gap: 16px; }
body[data-mode="journey"] .plates { color: #a8f4d4; letter-spacing: 2px; font-size: 14px; }
body[data-mode="journey"] .hud-bottom { bottom: calc(24px + var(--safe-bottom)); left: calc(24px + var(--safe-left)); right: auto; gap: 18px; flex-direction: row-reverse; align-items: center; }
body[data-mode="journey"] .speed-panel { min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; }
body[data-mode="journey"] .speed-panel > .gauge-label, body[data-mode="journey"] .speed-reading, body[data-mode="journey"] #speed-target, body[data-mode="journey"] #fuel-reserve, body[data-mode="journey"] .gauge-value small, body[data-mode="journey"] #fuel-note { display: none; }
body[data-mode="journey"] .speed-detail { display: block; color: #a3bbce; font: 11px var(--sans); }
body[data-mode="journey"] #score { display: block; font: 24px var(--mono); color: #effffa; }
.chain { color: #f1d5a5; font-size: 10px; padding-top: 4px; }
body[data-mode="journey"] .systems { background: none; border: 0; box-shadow: none; backdrop-filter: none; width: 125px; max-width: 125px; padding: 0; gap: 5px; }
body[data-mode="journey"] #fuel-bar { background: linear-gradient(90deg, #4eabb6, #b3f7dd); }
body[data-mode="journey"] #fuel-gauge .gauge-value b { font-size: 11px; color: #b6ddd6; }
body[data-mode="journey"] .touch-left { display: none; }
body[data-mode="journey"] .touch-right { bottom: calc(22px + var(--safe-bottom)); right: calc(24px + var(--safe-right)); }
body[data-mode="journey"] .touch-big { width: 72px; height: 72px; color: #b5f6e8; border-color: #a2e5dc70; background: #092535c9; box-shadow: inset 0 0 20px #7ee0d31a; }
body[data-mode="journey"] .touch-big[data-active="true"] { background: #28675e; box-shadow: 0 0 28px #8ae5ce50; }
body[data-mode="journey"] .touch-hint { display: none; }
.journey-keys { position: absolute; bottom: calc(22px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); margin: 0; color: #9cb5c9; font-size: 11px; white-space: nowrap; }
body[data-mode="journey"] .messages { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 7px; left: 50%; top: calc(110px + var(--safe-top)); bottom: auto; width: min(420px, calc(100% - 40px)); transform: translateX(-50%); pointer-events: none; }
body[data-mode="journey"] .messages > * { position: static; transform: none; max-width: 100%; }
body[data-mode="journey"] .comms { width: 100%; padding: 9px 13px; border-color: #9bded0; background: #071725bf; }
body[data-mode="journey"] .comms-head small { display: none; }
body[data-mode="journey"] #comms-text { font-size: 12px; line-height: 1.5; }
body[data-mode="journey"] .gate { width: 100%; padding: 10px 14px; border-color: #a1e8d661; animation: none; }
body[data-mode="journey"] .gate-row > b { font-size: 24px; }
body[data-mode="journey"] .gate-kicker { font-size: 8px; }
body[data-mode="journey"] .alert { white-space: normal; font-size: 10px; }
body[data-mode="journey"] .toast { order: -1; padding: 4px 12px; background: #143e46b0; color: #d9fff3; }
body[data-mode="journey"] .result-stats > div:nth-child(2), body[data-mode="journey"] .result-stats > div:nth-child(3) { display: none; }
body[data-mode="journey"] .result-stats { grid-template-columns: 1fr 1fr; }
body[data-mode="journey"] .result-card { border-color: #90dfc54a; }
body[data-mode="journey"] .result-stars b { color: #bdf8d6; }
@media (max-width: 600px) {
  .home { left: calc(24px + var(--safe-left)); bottom: calc(62px + var(--safe-bottom)); width: calc(100vw - 48px - var(--safe-left) - var(--safe-right)); }
  .home::before { inset: -45px -45px -70px; background: linear-gradient(0deg, #030b18 4%, #030b18eb 55%, #030b1899 80%, transparent); }
  .home h1 { font-size: clamp(54px, 16vw, 78px); letter-spacing: -3px; }
  .home h1 > span { font-size: 29px; margin-top: 6px; }
  .eyebrow { margin-bottom: 12px; font-size: 8px; letter-spacing: 1.3px; }
  .home-copy { font-size: 13px; line-height: 1.65; margin: 15px 0; max-width: 350px; }
  .beacon-route { margin: 18px 0; gap: 12px; }
  .mode-picker { width: 100%; }
  .mode-option { flex: 1; padding: 9px 10px; }
  .mode-option small { font-size: 9px; }
  .mode-option:first-child { flex: 1.4; }
  .home-actions { margin-top: 16px; gap: 5px; }
  .home-actions .primary { width: 100%; font-size: 14px; }
  .home-actions .text-button { width: 100%; min-height: 40px; }
  .home-note { margin: 5px 0 0; font-size: 10px; }
  .home-footer { bottom: calc(8px + var(--safe-bottom)); left: calc(24px + var(--safe-left)); }
  .masthead { top: calc(10px + var(--safe-top)); }
  .brand { gap: 7px; font-size: 13px; }
  .brand img { width: 28px; height: 28px; }
  .quiet { padding: 8px 10px; font-size: 10px; }
  .all-games { display: none; }
  body[data-mode="journey"] .hud-top { top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right)); gap: 8px; align-items: center; }
  body[data-mode="journey"] .lane-panel { flex: 1; width: auto; max-width: none; padding: 8px 10px; gap: 5px; }
  body[data-mode="journey"] .lane-objective { font-size: 12px; gap: 4px; }
  body[data-mode="journey"] .status-chip { padding: 0 8px; gap: 10px; height: 56px; }
  body[data-mode="journey"] .chip-item > small { font-size: 7px; }
  body[data-mode="journey"] .plates { font-size: 10px; letter-spacing: 1px; }
  body[data-mode="journey"] .flight-status { gap: 5px; }
  body[data-mode="journey"] .messages { top: calc(88px + var(--safe-top)); width: calc(100% - 32px); gap: 5px; }
  body[data-mode="journey"] .hud-bottom { bottom: calc(24px + var(--safe-bottom)); left: calc(20px + var(--safe-left)); gap: 16px; }
  body[data-mode="journey"] .systems { width: 96px; max-width: 96px; }
  body[data-mode="journey"] .journey-keys { bottom: calc(114px + var(--safe-bottom)); font-size: 10px; }
  body[data-mode="journey"] .brief-body h2 { font-size: 30px; }
  body[data-mode="journey"] .brief-chart { height: 130px; flex-basis: 130px; }
  body[data-mode="journey"] .brief-purpose { font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
  body[data-mode="journey"] .brief-scroll { margin-top: 12px; }
}
@media (max-height: 730px) and (max-width: 600px) {
  .home { bottom: calc(53px + var(--safe-bottom)); }
  .home h1 { font-size: 55px; }
  .home h1 > span { font-size: 26px; }
  .home-copy { margin: 12px 0; }
  .beacon-route { margin: 14px 0; }
  .home-note { display: none; }
  .home-actions { margin-top: 12px; }
}
@media (max-height: 520px) and (min-width: 600px) {
  .home { top: 70px; bottom: 42px; transform: none; left: calc(36px + var(--safe-left)); width: 440px; overflow: auto; touch-action: pan-y; padding-bottom: 10px; }
  .home h1 { font-size: 48px; letter-spacing: -2px; }
  .home h1 > span { font-size: 23px; margin-top: 4px; }
  .home-copy { font-size: 12px; line-height: 1.5; margin: 10px 0; }
  .eyebrow, .beacon-route, .home-note { display: none; }
  .mode-option { min-height: 44px; padding: 5px 12px; }
  .mode-option small { font-size: 9px; }
  .home-actions { margin-top: 10px; }
  .home-actions .primary { min-height: 44px; }
  body[data-mode="journey"] .hud-top { top: calc(10px + var(--safe-top)); }
  body[data-mode="journey"] .lane-panel { width: 220px; }
  body[data-mode="journey"] .messages { top: calc(83px + var(--safe-top)); width: 310px; gap: 4px; }
  body[data-mode="journey"] .comms { padding: 6px 10px; }
  body[data-mode="journey"] #comms-text { font-size: 11px; }
  body[data-mode="journey"] .gate { padding: 6px 10px; }
  body[data-mode="journey"] .gate-kicker { display: none; }
  body[data-mode="journey"] .gate-text { font-size: 11px; }
  body[data-mode="journey"] .hud-bottom { bottom: calc(14px + var(--safe-bottom)); }
  body[data-mode="journey"] .touch-right { bottom: calc(14px + var(--safe-bottom)); }
  body[data-mode="journey"] .touch-big { width: 64px; height: 64px; }
  body[data-mode="journey"] .journey-keys { display: none; }
  body[data-mode="journey"] .brief-body h2 { font-size: 26px; }
  body[data-mode="journey"] .brief-purpose { font-size: 12px; margin-bottom: 10px; }
  body[data-mode="journey"] .brief-body footer { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .primary, .touch-big { transition: none; } }
.ring-star { color: #95acba; font: 10px/1.4 var(--sans); }
#ring-star-brief { color: #a9d6c7; font-size: 11px; margin: -6px 0 14px; }
body[data-mode="journey"] .messages { top: calc(124px + var(--safe-top)); }
@media (max-width:600px) {
  body[data-mode="journey"] .messages { top: calc(102px + var(--safe-top)); }
  #ring-star { font-size: 8px; }
  body[data-mode="journey"] .lane-panel { gap: 4px; }
}
@media (max-height:700px) and (max-width:600px) {
  body[data-mode="journey"] .brief-chart { display: none; }
  body[data-mode="journey"] .brief-body { padding: 20px 18px 16px; }
  body[data-mode="journey"] .brief-purpose { margin-bottom: 12px; }
  body[data-mode="journey"] .brief-card { max-height: 100%; }
}
@media (max-height:520px) and (min-width:600px) {
  body[data-mode="journey"] .messages { top: calc(96px + var(--safe-top)); }
  #ring-star { font-size: 9px; }
}
.route-tip { margin: 16px 0 0; padding: 10px 12px; border-left: 2px solid #8bd6c2; background: #8bd6c20b; color: #b9dbd2; font-size: 12px; line-height: 1.6; }
@media (max-height:700px) and (max-width:600px) {
  body[data-mode="journey"] .brief-body { padding: 16px 16px 12px; }
  body[data-mode="journey"] .brief-body h2 { font-size: 28px; }
  body[data-mode="journey"] .steps { gap: 8px; }
  body[data-mode="journey"] .steps li { font-size: 12px; line-height: 1.5; }
  body[data-mode="journey"] .brief-purpose { font-size: 12px; margin-bottom: 12px; }
  body[data-mode="journey"] #ring-star-brief { display: none; }
}

/* Courier edition: warm signal light, quiet instruments, and room for the stars. */
:root {
  --ink: #f1f0e9; --muted: #aabcc9; --faint: #7f98aa;
  --line: rgba(166,208,220,.2); --panel: rgba(8,22,34,.72);
  --cyan: #9de7e6; --green: #a9edc8; --amber: #f5c577;
  --sans: "Avenir Next", Avenir, "Trebuchet MS", -apple-system, BlinkMacSystemFont, sans-serif;
}
.home { width: min(530px, calc(100vw - 48px)); top: 49%; }
.home::before { inset: -100px -110px; background: radial-gradient(ellipse, #03111eee 6%, #03111eb8 42%, #03111e55 62%, transparent 75%); }
.home h1 { font-size: clamp(74px, 8.5vw, 122px); letter-spacing: -6px; color: #faf2df; text-shadow: 0 8px 60px #010b1f; }
.home h1 > span { margin-top: 23px; font: 400 clamp(28px, 2.9vw, 40px)/1.15 var(--serif); letter-spacing: -.8px; color: #d8e7e9; }
.home h1 > span br { display: none; }
.home h1 em { color: #f5c577; font-style: italic; }
.eyebrow { margin-bottom: 25px; color: #b3d2d4; font-size: 8px; letter-spacing: 2.7px; }
.pulse-dot { background: #f5c577; width: 5px; height: 5px; animation: none; box-shadow: 0 0 12px #eec37a88; }
.home-copy { margin-top: 25px; font-size: 15px; line-height: 1.8; max-width: 450px; color: #a7bdcc; }
.home-copy b { color: #e3efea; font-weight: 500; }
.beacon-route { margin: 27px 0 25px; width: 330px; max-width: 100%; gap: 16px; }
.route-caption, .route-end { color: #89a4b5; font-size: 7px; letter-spacing: 1.7px; }
.beacon-lights::before { background: linear-gradient(90deg, #98bcb454, #536a7a55); }
.beacon-lights i { width: 5px; height: 5px; background: #0a1b2b; border-color: #536d7e; }
.beacon-lights i[data-next="true"] { width: 9px; height: 9px; border-color: #f4cd8a; background: #f4cd8a; box-shadow: 0 0 17px #eeb46088; }
.beacon-lights i[data-lit="true"] { background: #b0f1d0; border-color: #b0f1d0; }
.primary { min-height: 54px; padding: 0 28px; border-radius: 12px; border: 1px solid #ffe1a5; background: linear-gradient(135deg, #ffe0a2, #efbd6c); color: #342818; font-size: 13px; font-weight: 700; box-shadow: 0 8px 32px #f0bb6820, inset 0 1px #fff5d5aa; transition: transform .15s, box-shadow .15s; }
.primary:hover { transform: translateY(-1px); filter: none; box-shadow: 0 11px 38px #f0bb6835, inset 0 1px #fff5d5aa; }
.primary:active { transform: translateY(1px); }
.primary > span:last-child:not(:first-child) { margin-left: 18px; font-size: 19px; font-weight: 400; }
.home-actions { margin-top: 0; gap: 17px; }
.home-actions .primary { min-width: 210px; justify-content: space-between; }
.home-actions .text-button { color: #bad2d6; font-size: 11px; font-weight: 500; }
.home-controls { margin-top: 24px; display: flex; align-items: center; gap: 12px; color: #aac5cc; }
.steer-symbol { display: grid; place-items: center; height: 34px; width: 34px; border: 1px solid #8eb8c341; border-radius: 50%; font: 20px var(--serif); color: #b4dada; }
.home-controls p { margin: 0; font-size: 11px; line-height: 1.7; }
.home-controls b { display: block; font-weight: 500; color: #d1e2e3; }
.home-controls p > span { color: #7e9aaa; font-size: 10px; }
.home-note { margin-top: 16px; font-size: 9px; line-height: 1.6; color: #7d96a6; }
.home-note span { color: #7d96a6; }
.save-mark { margin-left: 7px; white-space: nowrap; }
.flight-settings { position: relative; width: fit-content; margin-top: 17px; color: #91a9b6; font-size: 10px; }
.flight-settings > summary { min-height: 32px; list-style: none; display: flex; gap: 20px; align-items: center; cursor: pointer; }
.flight-settings > summary::-webkit-details-marker { display: none; }
.flight-settings > summary span { color: #b3d1d4; transition: transform .15s; }
.flight-settings[open] > summary span { transform: rotate(180deg); }
.flight-settings .mode-picker { position: absolute; bottom: 100%; left: 0; padding: 6px; margin-bottom: 6px; z-index: 3; width: 320px; box-shadow: 0 20px 60px #0009; background: #071824f5; border-color: #5f889873; backdrop-filter: blur(20px); }
.flight-settings .mode-option { min-height: 56px; padding: 9px 13px; flex: 1; }
.flight-settings .mode-option b { font-size: 11px; }
.flight-settings .mode-option small { font-size: 9px; }
.flight-settings .mode-option[aria-pressed="true"] { color: #f4ddb4; background: #f2bf6d13; border-color: #e5bb7c66; }
.masthead { left: calc(30px + var(--safe-left)); right: calc(30px + var(--safe-right)); top: calc(22px + var(--safe-top)); }
.brand { color: #e5eeeb; font-size: 13px; gap: 9px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand span span { color: #a0c6ca; }
.brand small { color: #78909f; font-size: 6px; letter-spacing: 2.7px; margin-left: 13px; }
.quiet { border-color: #9dbbc026; background: #0b1a2950; font-size: 10px; padding: 7px 14px; }
.home-footer { bottom: calc(20px + var(--safe-bottom)); font-size: 7px; letter-spacing: 2px; color: #6b8798; }
.home-footer .text-button, .home-footer .analytics-privacy-button { color: #91abb7; font-size: 10px; }

/* One objective strip; a small shield and pause cluster. No chrome on the horizon. */
body[data-mode="journey"] .hud-top { top: calc(20px + var(--safe-top)); left: calc(24px + var(--safe-left)); right: calc(24px + var(--safe-right)); align-items: flex-start; }
body[data-mode="journey"] .lane-panel { position: relative; width: 300px; max-width: 50%; padding: 12px 16px 11px; gap: 6px; border-radius: 12px; background: linear-gradient(115deg, #071522e6, #0b2732b3); border-color: #a3ccd028; box-shadow: 0 8px 32px #0002, inset 0 1px #dcf5f709; }
body[data-mode="journey"] .lane-panel > .kicker { color: #7fa3b4; font-size: 7px; letter-spacing: 1.7px; }
body[data-mode="journey"] .lane-panel > b { display: block; font: 500 15px/1.25 var(--sans); color: #e8f3ee; }
body[data-mode="journey"] .lane-objective { font: 500 11px var(--sans); gap: 9px; }
body[data-mode="journey"] .lane-objective span { color: #f1d5a2; }
body[data-mode="journey"] .lane-objective span[data-ready="true"] { color: #b0f2cd; }
body[data-mode="journey"] .lane-objective strong { color: #6e9bab; font: 9px var(--mono); }
body[data-mode="journey"] .lane-progress { gap: 6px; }
body[data-mode="journey"] .lane-progress progress { height: 2px; }
body[data-mode="journey"] .lane-progress progress::-webkit-progress-value { background: linear-gradient(90deg, #91bdcd, #c2e5e0); }
body[data-mode="journey"] .target-icon { color: #d6c795; font-size: 10px; }
body[data-mode="journey"] #ring-star { display: none; }
body[data-mode="journey"] .status-chip { height: 58px; gap: 17px; padding: 0 15px; border-radius: 11px; background: #071723c4; border-color: #a3ccd022; box-shadow: 0 8px 30px #0002; }
body[data-mode="journey"] .chip-item > small { color: #7da2af; font-size: 7px; letter-spacing: 1.4px; }
body[data-mode="journey"] .echo-count b { font: 500 21px/1 var(--sans); color: #f7d7a0; }
body[data-mode="journey"] .echo-count small { color: #b49d7c; font-size: 9px; }
body[data-mode="journey"] .plates { font-size: 11px; color: #b9eed8; letter-spacing: 2px; }
body[data-mode="journey"] .flight-status { gap: 9px; align-items: flex-start; }
body[data-mode="journey"] #pause { width: 44px; height: 44px; background: #0a1c28b8; border-color: #b9d7d82b; font-size: 15px; margin-top: 6px; }
body[data-mode="journey"] .hud-bottom { left: calc(26px + var(--safe-left)); bottom: calc(30px + var(--safe-bottom)); gap: 24px; }
body[data-mode="journey"] .systems { width: 144px; max-width: 144px; }
body[data-mode="journey"] .gauge-label { color: #8bb5c2; font-size: 8px; letter-spacing: 2px; }
body[data-mode="journey"] #fuel-gauge .gauge-value b { font: 10px var(--mono); color: #c4e5df; }
body[data-mode="journey"] .bar { height: 4px; border-radius: 4px; background: #d1f1e61a; margin-top: 2px; }
body[data-mode="journey"] #fuel-bar { background: linear-gradient(90deg, #70b6b8, #d1f0d8); box-shadow: 0 0 10px #9ddbc52b; }
body[data-mode="journey"] .speed-detail { color: #759cae; font-size: 9px; }
body[data-mode="journey"] #score { font: 500 21px var(--sans); color: #ddeee7; letter-spacing: -.5px; }
body[data-mode="journey"] .chain { color: #f5ce8e; font-size: 9px; }
body[data-mode="journey"] .touch-right { right: calc(28px + var(--safe-right)); bottom: calc(25px + var(--safe-bottom)); }
body[data-mode="journey"] .touch-big { position: relative; width: 78px; height: 78px; font-size: 21px; border-radius: 50%; background: linear-gradient(150deg,#192f3cdd,#081a28ed); border: 1px solid #cce8dd4a; box-shadow: 0 4px 24px #0004, inset 0 0 0 5px #c3ece808, inset 0 1px #e9fff024; color: #f6d89e; transition: background .1s, transform .1s, box-shadow .1s; }
body[data-mode="journey"] .touch-big small { font: 700 8px var(--sans); letter-spacing: 1.7px; margin-top: 3px; color: #d6e5dc; }
body[data-mode="journey"] .touch-big[data-active="true"] { transform: scale(.96); background: linear-gradient(150deg,#6a5c3ce6,#2b3e3be6); border-color: #f6d191; box-shadow: 0 0 30px #f1c56e35, inset 0 0 0 4px #ffd98a12; }
body[data-mode="journey"] .journey-keys { bottom: calc(27px + var(--safe-bottom)); color: #8db0bc; font-size: 10px; letter-spacing: .1px; }
body[data-mode="journey"] .journey-keys kbd { color: #bcd8db; border-color: #89b0bf30; font-size: 8px; min-width: 18px; }
body[data-mode="journey"] .messages { top: calc(135px + var(--safe-top)); width: min(400px, calc(100% - 40px)); gap: 6px; }
body[data-mode="journey"] .comms { padding: 10px 14px; background: #071a25d9; border-left: 1px solid #a0d8d0; border-radius: 0 10px 10px 0; box-shadow: 0 10px 30px #0002; }
body[data-mode="journey"] .comms-head b { font-size: 7px; letter-spacing: 1.8px; color: #8bb7c0; }
body[data-mode="journey"] #comms-text { font-size: 12px; color: #d5e5e4; }
body[data-mode="journey"] .gate { background: #071824e6; border-color: #abd8d93b; border-radius: 12px; box-shadow: 0 10px 40px #0004; }
body[data-mode="journey"] .gate-kicker { color: #e9c990; letter-spacing: 1.6px; }
body[data-mode="journey"] .gate-row > b { color: #f7ebd5; }
body[data-mode="journey"] .gate-text { color: #b7d0d5; font-weight: 400; }
body[data-mode="journey"] .toast { padding: 5px 12px; background: #133b3cd9; color: #e2f9db; font-size: 12px; }
body[data-mode="journey"] .coach { font-size: 11px; color: #d8e4dd; background: #112b38df; }

/* Reports and menus share the same tactile, finely edged flight-deck material. */
.card, dialog { background: linear-gradient(145deg, #0d2433f8, #06131ffb 70%); border-color: #a9d1d036; border-radius: 18px; box-shadow: 0 30px 100px #0009, inset 0 1px #dbfff00d; }
.card h2, dialog h2 { color: #f5ebd5; letter-spacing: -.8px; }
.card-actions { background: #071521d9; border-top-color: #b5d1cf1c; }
.secondary { border-radius: 10px; border-color: #91b8c330; color: #c5ddda; min-height: 46px; font-weight: 500; }
.secondary:hover { background: #a1d4cf0b; }
.text-button { min-height: 40px; font-weight: 500; }
.card .story { color: #a8c1ce; }
.result-stats div { border: 0; border-radius: 0; border-top: 1px solid #a4cac72b; text-align: left; padding: 13px 0 9px; }
.result-stats b { font: 500 24px var(--sans); color: #e0eee6; }
.result-stats span { color: #80a3b3; font-size: 7px; letter-spacing: 1.5px; }
body[data-mode="journey"] .result-stars b { color: #f5cf8e; }
body[data-mode="journey"] .result-card { border-color: #b2d4cf38; }
.result-tip { border-radius: 8px; background: #f2bd6610; color: #e4d5b8; }
.result-quote { border-color: #7fb6b668; }
.result-quote p { color: #b6cfce; }
.result-quote cite { color: #79a8b5; }
.tabs { border-radius: 10px; background: #03121e77; border-color: #85b5bd26; }
.tabs button { border-radius: 6px; min-height: 38px; font-weight: 500; }
.tabs button[aria-selected="true"] { color: #f4d6a1; background: #e5be7416; }
.mission-list button { border-radius: 11px; border-color: #80acb627; background: #c5e6dc03; min-height: 62px; }
.mission-list .name b { font-family: var(--sans); font-size: 14px; font-weight: 500; color: #dfefea; }
.mission-list .name small { font-size: 9px; margin-top: 4px; color: #7f9fad; }
.mission-list .number { color: #89b2bd; }
.mission-list .stars b { color: #e9ca8d; }
.dialog-head .circle { background: transparent; }
.dialog-copy { font-size: 12px; line-height: 1.7; color: #91afbd; }
.manual div { border-top: 1px solid #96bec119; padding-top: 13px; }
.manual p { color: #9eb9c7; font-size: 12px; }
.manual b { color: #e0eee9; }
.manual kbd { background: #a0d9cf0a; border-color: #83b1bb39; color: #e6c78f; border-bottom-width: 1px; font-size: 11px; padding: 6px 10px; }

@media (max-width: 600px) {
  .masthead { top: calc(15px + var(--safe-top)); left: calc(20px + var(--safe-left)); right: calc(20px + var(--safe-right)); }
  .brand img { width: 26px; height: 26px; }
  .brand { font-size: 12px; }
  .quiet { min-height: 38px; font-size: 9px; padding: 6px 12px; }
  .home { left: calc(24px + var(--safe-left)); top: auto; bottom: calc(60px + var(--safe-bottom)); width: calc(100vw - 48px - var(--safe-left) - var(--safe-right)); }
  .home::before { inset: -80px -50px -75px; background: linear-gradient(0deg,#03101ff5 20%,#03101fdf 58%,#03101f70 80%,transparent); }
  .home h1 { font-size: clamp(68px, 18vw, 84px); letter-spacing: -4px; }
  .home h1 > span { font-size: 29px; line-height: 1.2; margin-top: 17px; }
  .home h1 > span br { display: inline; }
  .eyebrow { font-size: 6.5px; letter-spacing: 1.8px; margin-bottom: 19px; gap: 8px; }
  .home-copy { font-size: 12px; line-height: 1.75; margin-top: 17px; max-width: 340px; }
  .home-copy br { display: none; }
  .beacon-route { margin: 21px 0; width: 100%; gap: 15px; }
  .route-caption, .route-end { font-size: 6px; letter-spacing: 1.4px; }
  .home-actions { gap: 4px; }
  .home-actions .primary { min-height: 54px; width: 100%; padding: 0 22px; font-size: 13px; }
  .home-actions .text-button { font-size: 10px; min-height: 37px; }
  .home-controls { margin-top: 10px; gap: 10px; }
  .home-controls p { font-size: 10px; }
  .home-controls p > span { font-size: 8px; }
  .steer-symbol { width: 30px; height: 30px; font-size: 17px; }
  .home-note { margin-top: 12px; font-size: 8px; }
  .save-mark { display: none; }
  .flight-settings { margin-top: 5px; font-size: 9px; }
  .flight-settings > summary { min-height: 30px; }
  .flight-settings .mode-picker { max-width: calc(100vw - 48px); }
  .home-footer { left: calc(24px + var(--safe-left)); bottom: calc(13px + var(--safe-bottom)); gap: 24px; }
  .home-footer .text-button, .home-footer .analytics-privacy-button { font-size: 9px; }
  body[data-mode="journey"] .hud-top { top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right)); gap: 8px; align-items: flex-start; }
  body[data-mode="journey"] .lane-panel { padding: 10px 12px; gap: 5px; width: auto; max-width: none; flex: 1; }
  body[data-mode="journey"] .lane-panel > .kicker { font-size: 6px; letter-spacing: 1.3px; }
  body[data-mode="journey"] .lane-panel > b { font-size: 12px; }
  body[data-mode="journey"] .lane-objective { font-size: 9px; }
  body[data-mode="journey"] .lane-objective strong { display: none; }
  body[data-mode="journey"] .status-chip { gap: 12px; padding: 0 10px; height: 59px; }
  body[data-mode="journey"] .chip-item > small { font-size: 6px; letter-spacing: 1px; }
  body[data-mode="journey"] .echo-count b { font-size: 18px; }
  body[data-mode="journey"] .echo-count small { font-size: 8px; }
  body[data-mode="journey"] .plates { font-size: 9px; letter-spacing: 1px; }
  body[data-mode="journey"] .flight-status { gap: 5px; }
  body[data-mode="journey"] #pause { width: 40px; height: 40px; min-width: 40px; min-height: 40px; margin-top: 9px; font-size: 13px; }
  body[data-mode="journey"] .hud-bottom { left: calc(20px + var(--safe-left)); bottom: calc(24px + var(--safe-bottom)); gap: 20px; }
  body[data-mode="journey"] .systems { width: 105px; max-width: 105px; }
  body[data-mode="journey"] .gauge-label { font-size: 7px; letter-spacing: 1.3px; }
  body[data-mode="journey"] #fuel-gauge .gauge-value b { font-size: 9px; }
  body[data-mode="journey"] #score { font-size: 19px; }
  body[data-mode="journey"] .speed-detail { font-size: 8px; }
  body[data-mode="journey"] .touch-right { right: calc(20px + var(--safe-right)); bottom: calc(20px + var(--safe-bottom)); }
  body[data-mode="journey"] .touch-big { width: 72px; height: 72px; font-size: 20px; }
  body[data-mode="journey"] .touch-big small { font-size: 7px; letter-spacing: 1.4px; }
  body[data-mode="journey"] .journey-keys { bottom: calc(112px + var(--safe-bottom)); font-size: 9px; color: #87a6b2; }
  body[data-mode="journey"] .messages { top: calc(110px + var(--safe-top)); width: calc(100% - 40px); gap: 5px; }
  body[data-mode="journey"] #comms-text { font-size: 11px; line-height: 1.5; }
  body[data-mode="journey"] .comms { padding: 8px 12px; }
}
@media (max-height: 730px) and (max-width: 600px) {
  .home { bottom: calc(52px + var(--safe-bottom)); }
  .home h1 { font-size: 65px; }
  .home h1 > span { font-size: 25px; margin-top: 12px; }
  .home h1 > span br { display: none; }
  .home .eyebrow { margin-bottom: 16px; }
  .home-copy { margin-top: 14px; font-size: 11px; }
  .beacon-route { margin: 17px 0; }
  .home-controls { margin-top: 6px; }
  .home-note { display: none; }
}
@media (max-height: 610px) and (max-width: 600px) {
  .home { bottom: calc(48px + var(--safe-bottom)); }
  .home h1 { font-size: 58px; }
  .home h1 > span { font-size: 22px; margin-top: 10px; }
  .home .eyebrow { margin-bottom: 12px; }
  .home-copy { font-size: 11px; line-height: 1.6; margin-top: 12px; }
  .beacon-route { margin: 14px 0; }
  .home-actions .primary { min-height: 49px; }
  .home-controls { display: none; }
  .flight-settings { margin-top: 0; }
  body[data-mode="journey"] .messages { top: calc(108px + var(--safe-top)); }
}
@media (max-height: 520px) and (min-width: 600px) {
  .home { top: 76px; bottom: 42px; left: calc(36px + var(--safe-left)); width: 430px; overflow: auto; padding-bottom: 0; }
  .home h1 { font-size: 57px; letter-spacing: -2.5px; }
  .home h1 > span { font-size: 24px; margin-top: 10px; }
  .home h1 > span br { display: none; }
  .home-copy { font-size: 11px; line-height: 1.7; margin-top: 12px; }
  .home-actions { margin-top: 17px; gap: 16px; }
  .home-actions .primary { min-height: 45px; width: 190px; min-width: 190px; }
  .home-controls, .home-note, .home .eyebrow, .beacon-route { display: none; }
  .home-actions .text-button { width: auto; }
  .flight-settings { margin-top: 5px; }
  .flight-settings .mode-picker { bottom: 0; left: 125px; margin-bottom: 0; }
  .masthead { top: calc(12px + var(--safe-top)); left: calc(22px + var(--safe-left)); right: calc(22px + var(--safe-right)); }
  .home-footer { bottom: calc(8px + var(--safe-bottom)); }
  body[data-mode="journey"] .hud-top { top: calc(12px + var(--safe-top)); left: calc(18px + var(--safe-left)); right: calc(18px + var(--safe-right)); }
  body[data-mode="journey"] .lane-panel { width: 270px; padding: 9px 12px; gap: 4px; }
  body[data-mode="journey"] .lane-panel > b { font-size: 13px; }
  body[data-mode="journey"] .status-chip { height: 52px; }
  body[data-mode="journey"] #pause { margin-top: 4px; }
  body[data-mode="journey"] .messages { top: calc(100px + var(--safe-top)); width: 300px; }
  body[data-mode="journey"] .comms { padding: 7px 11px; }
  body[data-mode="journey"] #comms-text { font-size: 10px; }
  body[data-mode="journey"] .hud-bottom { bottom: calc(18px + var(--safe-bottom)); }
  body[data-mode="journey"] .touch-right { bottom: calc(14px + var(--safe-bottom)); right: calc(20px + var(--safe-right)); }
  body[data-mode="journey"] .touch-big { width: 65px; height: 65px; }
  body[data-mode="journey"] .journey-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .primary, .touch-big, .flight-settings > summary span { transition: none; }
  .primary:hover, .primary:active { transform: none; }
}
.steer-control { position: absolute; z-index: 14; width: 64px; height: 64px; margin: -32px; pointer-events: none; border: 1px solid #c0ece739; border-radius: 50%; background: #9be2d508; box-shadow: 0 0 24px #072a4220; }
.steer-anchor { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #b5e8df66; left: 29px; top: 29px; }
.steer-knob { position: absolute; width: 22px; height: 22px; border-radius: 50%; left: 20px; top: 20px; background: #c9eee21a; border: 1px solid #d3f7edaa; box-shadow: 0 0 12px #b3f4dd22; transform: translate(var(--dx, 0px), var(--dy, 0px)); }
body[data-mode="journey"][data-screen="flight"] #rocket-canvas { cursor: crosshair; }
body[data-mode="journey"] .lane-panel, body[data-mode="journey"] .lane-progress, body[data-mode="journey"] .lane-progress progress { min-width: 0; }
body[data-mode="journey"] .lane-progress progress { width: 100%; }
body[data-mode="journey"] .flight-status { flex-shrink: 0; }
@media(max-width:350px) {
  body[data-mode="journey"] .lane-panel { padding: 9px 10px; }
  body[data-mode="journey"] .lane-panel > .kicker { font-size: 5.5px; letter-spacing: .8px; }
  body[data-mode="journey"] .lane-panel > b { font-size: 11px; }
  body[data-mode="journey"] .lane-objective { font-size: 8px; }
  body[data-mode="journey"] .status-chip { padding: 0 9px; gap: 10px; }
  body[data-mode="journey"] .plates { font-size: 8px; }
}
body[data-mode="journey"][data-screen="flying"] #rocket-canvas { cursor: crosshair; }

/* Neutral instrument finishes over a visible-light space palette. */
:root{--ink:#e6e8e8;--muted:#a3a9ae;--faint:#777f87;--line:rgba(218,224,229,.17);--panel:rgba(8,10,13,.78);--cyan:#c8dbe4;--green:#b6cdbd;--amber:#d9c29a;--violet:#a9b4c5}
body{background:#020304}
.home::before{background:radial-gradient(ellipse,rgba(0,2,4,.9) 6%,rgba(0,2,4,.66) 42%,rgba(0,2,4,.2) 62%,transparent 75%)}
.home h1{color:#eeefeb;text-shadow:0 5px 35px #0008}.home h1>span{color:#d4d9dc}.home h1 em{color:#c9c0aa}
.home-copy,.home-copy b,.home-controls b{color:#b9c0c4}.home-note,.home-note span,.home-controls p>span,.route-caption,.route-end,.eyebrow,.brand small{color:#8d979f}
.primary{background:linear-gradient(145deg,#e2e5e4,#bdc7cc);border-color:#e4e9e9;color:#151b20;box-shadow:0 5px 25px #0004,inset 0 1px #fff8}
.primary:hover{box-shadow:0 7px 28px #0006,inset 0 1px #fff8}
.beacon-lights i[data-next="true"]{background:#d4d7d1;border-color:#e0e3df;box-shadow:0 0 10px #dce6e52a}.beacon-lights i[data-lit="true"]{background:#adc6b5;border-color:#b6c8bd;box-shadow:none}
.pulse-dot{background:#c6cfd1;box-shadow:none}.steer-symbol{color:#c4ced4;border-color:#c8d2d433}
.quiet,.flight-settings .mode-picker{background:#080c10e8;border-color:#d8e0e126}.flight-settings .mode-option[aria-pressed="true"]{color:#e0e4e4;background:#d2d9dd0c;border-color:#ccd6dd55}
.card,dialog{background:linear-gradient(145deg,#13181cf8,#070b0ffb 70%);border-color:#bcc8ce30;box-shadow:0 30px 100px #000a}
.card h2,dialog h2{color:#e7e9e6}.card-actions{background:#090d11ed}.secondary{color:#c7d0d4;border-color:#c1cbd32d}
body[data-mode="journey"] .lane-panel,body[data-mode="journey"] .status-chip,body[data-mode="journey"] #pause{background:#080d12d6;border-color:#c6d1d529;box-shadow:0 8px 28px #0004}
body[data-mode="journey"] .lane-panel>b,body[data-mode="journey"] .lane-objective span{color:#d9dfe1}
body[data-mode="journey"] .lane-panel>.kicker,body[data-mode="journey"] .chip-item>small,body[data-mode="journey"] .gauge-label{color:#9ca9b2}
body[data-mode="journey"] .echo-count b{color:#e0d9c6}body[data-mode="journey"] .echo-count small{color:#a9a79e}body[data-mode="journey"] .plates{color:#b7cabc}
body[data-mode="journey"] .lane-progress progress::-webkit-progress-value{background:linear-gradient(90deg,#9eacb7,#d0d7d8)}
body[data-mode="journey"] #fuel-bar{background:linear-gradient(90deg,#8c9fac,#cbd6d9);box-shadow:none}
body[data-mode="journey"] #fuel-gauge .gauge-value b,body[data-mode="journey"] #score{color:#d4dde0}
body[data-mode="journey"] .touch-big{background:linear-gradient(145deg,#1d252ce8,#080e14f2);border-color:#c2cfd23d;color:#d4d9d6;box-shadow:0 4px 24px #0005,inset 0 0 0 4px #d7e1e306}
body[data-mode="journey"] .touch-big small{color:#b6c0c5}body[data-mode="journey"] .touch-big[data-active="true"]{background:#34424bf2;border-color:#e2e7e7;box-shadow:0 0 17px #c8d7dc20}
body[data-mode="journey"] .comms,body[data-mode="journey"] .gate,body[data-mode="journey"] .coach{background:#0a1118ed;border-color:#a7bbc535;color:#cbd5da}
body[data-mode="journey"] .comms-head b,body[data-mode="journey"] .gate-kicker{color:#9eafb9}body[data-mode="journey"] #comms-text,body[data-mode="journey"] .gate-text{color:#c6cfd4}
body[data-mode="journey"] .toast{background:#1b2529ed;color:#d1ded4}body[data-mode="journey"] .journey-keys{color:#8b9ba6}
#blackhole-preview{color:#c9d0d3;min-height:36px}.home-footer{flex-wrap:wrap}
.gravity-effect{position:absolute;left:50%;bottom:calc(113px + var(--safe-bottom));transform:translateX(-50%);display:flex;flex-direction:column;gap:4px;min-width:215px;padding:9px 13px;border:1px solid #bfc8cd33;border-radius:9px;background:#06090de8;text-align:center;pointer-events:none;box-shadow:0 5px 24px #0005}
.gravity-effect b{font:500 10px var(--sans);letter-spacing:.4px;color:#e3d7ba}.gravity-effect span{font:9px var(--mono);color:#adb9c1}
@media(max-width:600px){.home-footer{gap:7px 14px}#blackhole-preview{font-size:9px}.gravity-effect{bottom:calc(110px + var(--safe-bottom));min-width:205px;padding:8px 11px}.gravity-effect b{font-size:9px}.gravity-effect span{font-size:8px}}
@media(max-height:500px) and (min-width:601px){.gravity-effect{bottom:calc(20px + var(--safe-bottom));padding:8px 12px}}
