/* ---- type: Barlow (OFL, self-hosted) for Latin + numerals; CJK falls through
   to the system face. Semi Condensed carries HUD readouts. ------------------- */
@font-face { font-family: "Barlow"; font-weight: 300; font-display: swap; src: url("assets/fonts/barlow-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("assets/fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("assets/fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("assets/fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  /* Two visual languages, kept apart on purpose:
     - MENU (title card, hero, pause, dialogs): neutral charcoal, solid plates,
       white inverse selection, colour only as a rare status accent.
     - HUD (cockpit, walk watch): line art over the world, cool white/cyan
       strokes, no plates, dark halo for legibility. */
  --menu-ink: #e8eaeb;
  --menu-dim: #8e9599;
  --menu-faint: #5d6468;
  --menu-plate: rgba(17, 19, 21, .94);
  --menu-plate-soft: rgba(17, 19, 21, .72);
  --menu-row: rgba(255, 255, 255, .035);
  --menu-line: rgba(255, 255, 255, .09);
  --menu-line-strong: rgba(255, 255, 255, .22);
  --menu-select: #eceeef;
  --menu-select-ink: #0f1113;
  --menu-accent: #7db7cc;
  --menu-warn: #e0a15a;
  --brand-1: #d8492f; --brand-2: #e8902f; --brand-3: #ecd9a4; --brand-4: #5f93ab;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --font-latin: "Barlow", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-hud: "Barlow Semi Condensed", "Barlow", "Microsoft YaHei UI", "PingFang SC", sans-serif;

  /* Legacy tokens: still used by star map / walk watch / route choice. */
  --ui-white: #eef3f3;
  --ui-dim: #aab3b4;
  --ui-line: rgba(203, 214, 214, .22);
  --ui-line-soft: rgba(222, 232, 232, .12);
  --ui-line-strong: rgba(222, 232, 232, .62);
  --ui-panel: rgba(7, 17, 26, .79);
  --ui-panel-soft: rgba(8, 20, 31, .62);
  --ui-panel-border: rgba(182, 198, 201, .19);
  --ui-cyan: #3ed4e8;
  --ui-cyan-deep: #2a7d8c;
  --ui-green: #17e31a;
  --ui-gold: #e9c885;
  --ui-warn: #e08f68;
  --ui-font: var(--font-latin);
  --ui-mono: var(--font-hud);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body {
  color: var(--ui-white);
  font-family: var(--ui-font);
  letter-spacing: .025em;
  overscroll-behavior: none;
}
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

#app, #app canvas { position: fixed; inset: 0; display: block; }
/* The canvas layout box is owned by CSS, never by renderer.setSize(). That call
   is made with updateStyle=false so the backing store can be reallocated lazily
   (one frame before a world draw), and a stale inline width/height would then
   pin the world to the pre-fullscreen size — black bands on F11/resize while
   the DOM HUD, which follows the viewport, keeps scaling. */
#app canvas { width: 100%; height: 100%; touch-action: none; }

kbd {
  min-width: 22px; padding: 3px 6px; display: inline-grid; place-items: center;
  color: var(--menu-ink); background: rgba(255, 255, 255, .06);
  border: 1px solid var(--menu-line-strong); border-radius: 2px;
  font: 600 10px/1 var(--font-hud); letter-spacing: .06em;
}

/* ---- ASTERION cockpit HUD --------------------------------------------------- */
#ship-hud-stage {
  --ship-cyan: #9fd4df;
  --ship-cyan-dim: #5d858e;
  --ship-cream: #ece8d4;
  --ship-red: #e2483d;
  /* HUD language: strokes over the world, no plates. A tight dark halo (not a
     coloured glow) keeps every glyph readable over bright cloud and ice. */
  --hud-halo: 0 0 2px rgba(0, 8, 12, .85), 0 1px 5px rgba(0, 8, 12, .55);
  position: fixed; z-index: 9; left: 0; top: 0;
  width: 1600px; height: 1000px;
  transform-origin: 0 0; will-change: transform;
  contain: layout style; overflow: visible; pointer-events: none;
  color: var(--ship-cyan);
  font-family: var(--font-hud);
  font-synthesis: none; font-kerning: normal;
  text-shadow: var(--hud-halo);
  transition: opacity .3s ease, visibility 0s;
}
#ship-hud-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: 50% 50%; transition: transform .3s var(--ease-out); }
.hud-halo { stroke: rgba(0, 8, 12, .5); fill: none; }
.ship-hud-label {
  position: absolute; display: flex; align-items: center; gap: 12px;
  color: var(--ship-cyan); font-size: 23px; font-weight: 600;
  letter-spacing: .06em; white-space: nowrap;
  transition: opacity .2s ease;
}
.ship-hud-readout { display: inline-flex; align-items: baseline; gap: 10px; line-height: 1; }
.ship-hud-readout > span { display: inline-block; line-height: 1; }
.ship-hud-readout > span:first-child { font-variant-numeric: tabular-nums; font-weight: 700; color: #e9f4f6; }
.ship-hud-key {
  display: inline-block; padding: 3px 8px 4px;
  color: #e4f0f2; background: rgba(0, 8, 12, .32);
  border: 1px solid rgba(216, 231, 233, .78); border-radius: 2px;
  font-size: 16px; font-weight: 600; letter-spacing: .08em;
  text-shadow: none; transition: background .1s, color .1s;
}
.ship-hud-key.is-on { color: #10181b; background: var(--ship-cream); }
#ship-hud-gun { right: 954px; top: 203px; }
#ship-hud-boost { left: 954px; top: 203px; }
#ship-hud-speed { right: 1014px; top: 680px; }
#ship-hud-pulse { left: 1014px; top: 680px; }
#ship-hud-pulse.is-low, #ship-hud-pulse-label.is-low { color: var(--ship-red); text-shadow: 0 0 8px rgba(226, 72, 61, .55); }

.ship-hud-panel {
  position: absolute; background: none; border: 0; border-radius: 0;
  transition: opacity .5s ease, clip-path .28s var(--ease-out);
  clip-path: inset(-20px -20px -20px -20px);
}
.ship-hud-panel-title {
  position: absolute; left: 18px; right: 18px; top: -20px;
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 4px; border-bottom: 1px solid rgba(159, 212, 223, .35);
  color: rgba(159, 212, 223, .75); font: 600 11px/1 var(--font-hud); letter-spacing: .24em;
}
.ship-hud-panel-title b { color: var(--ship-cream); font-weight: 600; letter-spacing: .12em; }
/* Contextual: the power panel recedes while nobody is routing power. */
#ship-hud-power.is-idle { opacity: .58; }
#ship-hud-integrity.is-hit .ship-hud-status-meter[data-kind="hull"] .ship-hud-status-cells { animation: hud-hit .45s ease-out; }
@keyframes hud-hit { 0%, 30% { border-color: var(--ship-red); box-shadow: 0 0 16px rgba(226, 72, 61, .8); } }
#ship-hud-pulse.is-low { animation: hud-low 1.1s ease-in-out infinite; }
@keyframes hud-low { 50% { opacity: .45; } }
#ship-hud-power {
  left: var(--ship-power-left, 58px); top: 678px; width: 330px; height: 258px;
  transform: perspective(900px) rotateY(9deg) rotateZ(1.2deg);
}
.ship-hud-power-cols { display: flex; gap: 9px; padding: 16px 18px 0; }
.ship-hud-power-col {
  position: relative; width: 40px; height: 104px;
  border: 1.5px solid rgba(150, 215, 230, .68); background: rgba(7, 18, 23, .12);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.ship-hud-pips {
  position: absolute; left: 5px; right: 5px; bottom: 5px;
  display: flex; flex-direction: column-reverse; gap: 3px;
}
.ship-hud-pip {
  height: 7px; border: 1px solid transparent; background: transparent; opacity: 0;
  transition: background .12s, opacity .12s, box-shadow .12s, border-color .12s;
}
.ship-hud-pip.is-on { opacity: 1; background: #8dced9; box-shadow: 0 0 4px rgba(127, 214, 232, .34); }
.ship-hud-power-col.is-selected {
  border-color: var(--ship-cream); background: rgba(242, 236, 216, .035);
  box-shadow: 0 0 8px rgba(242, 236, 216, .35);
}
.ship-hud-power-col.is-selected .ship-hud-pip.is-on { background: var(--ship-cream); box-shadow: 0 0 4px rgba(242, 236, 216, .5); }
.ship-hud-power-col.is-max { box-shadow: 0 0 9px rgba(127, 214, 232, .24); }
.ship-hud-power-col.is-routing {
  border-color: var(--ship-cream); box-shadow: 0 0 18px rgba(242, 236, 216, .48), inset 0 0 12px rgba(242, 236, 216, .08);
}
.ship-hud-power-labels { display: flex; gap: 9px; padding: 5px 18px 0; }
.ship-hud-power-labels span {
  width: 40px; color: #8dced9; text-align: center;
  font-size: 21px; font-weight: 700; line-height: 27px;
  text-shadow: 0 0 6px rgba(127, 214, 232, .4);
  transition: background .12s, color .12s;
}
.ship-hud-power-labels span.is-selected { color: #10181b; background: var(--ship-cream); border-radius: 2px; text-shadow: none; }
.ship-hud-power-labels span.is-routing { color: var(--ship-cream); }
.ship-hud-power-rail { display: block; margin: 0 18px; }
.ship-hud-power-subrow { position: relative; height: 32px; margin: 0 18px; }
.ship-hud-power-help {
  position: absolute; left: 0; top: 7px; color: rgba(159, 212, 223, .78);
  font-size: 11px; font-weight: 600; letter-spacing: .06em; white-space: nowrap;
}
.ship-hud-dpad {
  position: absolute; left: 126px; top: 1px; width: 46px; height: 28px;
  display: grid; grid-template-columns: 14px 16px 14px; align-items: center; justify-items: center;
  color: #8dced9; background: rgba(20, 40, 48, .22);
  border: 1px solid rgba(150, 215, 230, .48); border-radius: 3px;
  font-size: 11px; text-shadow: none; transition: box-shadow .12s, background .12s;
}
.ship-hud-dpad.is-flashing { background: rgba(127, 216, 232, .13); box-shadow: 0 0 8px rgba(127, 216, 232, .22); }
.ship-hud-dpad-vertical { display: flex; flex-direction: column; line-height: 10px; }
.ship-hud-power-counter {
  position: absolute; right: 0; top: 1px; display: flex; align-items: baseline; gap: 7px;
  color: var(--ship-cream); text-shadow: 0 0 6px rgba(242, 236, 216, .4);
}
.ship-hud-power-counter small { color: rgba(143, 216, 232, .72); font-size: 11px; letter-spacing: 1px; }
.ship-hud-power-counter strong { font-size: 21px; letter-spacing: 2px; }
.ship-hud-power-bar { position: relative; height: 25px; margin: 8px 18px 0; padding: 3px; border: 1px solid rgba(150, 215, 230, .46); }
.ship-hud-power-cells { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(var(--power-total, 23), minmax(0, 1fr)); gap: 3px; }
.ship-hud-power-cell { min-width: 0; background: rgba(150, 215, 230, .13); transition: background .12s, opacity .12s, box-shadow .12s; }
.ship-hud-power-cell.is-on { background: #e9f7fb; box-shadow: 0 0 5px rgba(180, 230, 245, .35); }

#ship-hud-integrity {
  left: var(--ship-integrity-left, 1226px); top: 678px; width: 302px; height: 258px;
  transform: perspective(900px) rotateY(-9deg) rotateZ(-1.2deg);
}
/* Mirror of the power panel: same column cell language, readouts on the
   outside edge, condition line where the power reserve bar sits. */
.ship-hud-status-grid { display: flex; gap: 9px; padding: 16px 18px 0; }
.ship-hud-status-meter { display: grid; justify-items: center; gap: 5px; }
.ship-hud-status-cells {
  width: 40px; height: 152px; padding: 5px;
  display: flex; flex-direction: column-reverse; gap: 4px;
  border: 1.5px solid rgba(150, 215, 230, .68); background: rgba(7, 18, 23, .12);
}
.ship-hud-status-cell { flex: 1; background: rgba(150, 215, 230, .1); transition: background .15s, box-shadow .15s; }
.ship-hud-status-meter[data-kind="shield"] .ship-hud-status-cell.is-on { background: #8dced9; box-shadow: 0 0 4px rgba(127, 214, 232, .34); }
.ship-hud-status-meter[data-kind="hull"] .ship-hud-status-cell.is-on { background: var(--ship-cream); box-shadow: 0 0 4px rgba(242, 236, 216, .4); }
.ship-hud-status-meter[data-kind="shield"] .ship-hud-status-cell.is-tip { animation: hud-shield-tip 2.4s ease-in-out infinite; }
@keyframes hud-shield-tip { 50% { opacity: .45; } }
.ship-hud-status-meter > span { color: #8dced9; font-size: 21px; font-weight: 700; line-height: 27px; }
.ship-hud-status-readouts { flex: 1; display: grid; align-content: space-between; padding: 2px 0 34px 10px; text-align: right; }
.ship-hud-status-readout small { display: block; color: rgba(159, 212, 223, .78); font: 600 11px/1 var(--font-hud); letter-spacing: .16em; }
.ship-hud-status-readout strong {
  display: block; margin-top: 6px; color: #e9f4f6; font: 700 52px/.9 var(--font-hud);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.ship-hud-status-readout[data-kind="hull"] strong { color: var(--ship-cream); }
.ship-hud-condition {
  display: flex; align-items: center; gap: 10px; height: 25px; margin: 8px 18px 0; padding: 0 10px;
  border: 1px solid rgba(150, 215, 230, .46); color: var(--ship-cyan); font-size: 13px; font-weight: 600; letter-spacing: .2em;
}
.ship-hud-condition i { width: 7px; height: 7px; border-radius: 50%; background: #8dced9; }
#ship-hud-integrity[data-condition="damaged"] .ship-hud-condition { color: #e8b26a; border-color: rgba(232, 178, 106, .6); }
#ship-hud-integrity[data-condition="damaged"] .ship-hud-condition i { background: #e8b26a; }
#ship-hud-integrity[data-condition="critical"] .ship-hud-condition { color: var(--ship-red); border-color: rgba(226, 72, 61, .7); animation: hud-low 1s ease-in-out infinite; }
#ship-hud-integrity[data-condition="critical"] .ship-hud-condition i,
#ship-hud-integrity[data-condition="critical"] .ship-hud-status-meter[data-kind="hull"] .ship-hud-status-cell.is-on { background: var(--ship-red); }
.hud-boot .ship-hud-status-cell.is-on { animation: hud-pop .16s ease-out backwards; animation-delay: var(--d, 560ms); }
#ship-hud-altitude {
  position: absolute; left: 800px; top: 128px; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 8px;
  color: rgba(218, 238, 242, .88); font-size: 12px; font-weight: 600; letter-spacing: .16em;
  text-shadow: 0 0 3px rgba(0, 8, 12, .96), 0 1px 7px rgba(0, 8, 12, .82);
  transition: opacity .2s ease;
}
#ship-hud-altitude strong { color: var(--ship-cream); font-size: 20px; font-variant-numeric: tabular-nums; }
#ship-hud-altitude small { font-size: 10px; color: rgba(218, 238, 242, .82); }
#ship-hud-context {
  position: absolute; left: 800px; top: 150px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  color: rgba(202, 230, 236, .82); font: 600 11px/1 var(--font-hud);
  text-shadow: 0 0 3px rgba(0, 8, 12, .96), 0 1px 7px rgba(0, 8, 12, .82);
  letter-spacing: .1em; transition: opacity .2s ease;
}
#ship-hud-context > span:not(:first-child):not(#sys-seed)::before {
  content: "·"; margin-right: 10px; opacity: .55;
}
body:has(#fold-nav:not([hidden])) #ship-hud-altitude,
body:has(#fold-nav:not([hidden])) #ship-hud-context { opacity: 0; visibility: hidden; }
#sys-seed { display: none; }
.hide-hud #ship-hud-stage { transition: none; }

/* Contextual flight reactions: boost, pulse fold, fuel recharge, gun heat, warp routing */
#ship-hud-stage.is-boosting #ship-hud-boost { color: var(--ship-cream); }
#ship-hud-stage.is-pulsing #ship-hud-svg { transform: scale(.988); }
#ship-hud-stage.is-recharging #pulse-fuel { color: #d8f5fa; animation: hud-recharge 1.4s ease-in-out infinite; }
@keyframes hud-recharge { 50% { opacity: .62; } }
#ship-hud-gun.is-gun-low #gun-value { color: #e8b26a; }
#ship-hud-stage.is-warp-routing #ship-hud-power { opacity: 1; }

/* Hidden states keep the stage in layout (visibility, not display) so the
   collapse can play before it disappears and the boot can play on return. */
.ui-walk #ship-hud-stage, .ui-shipwalk #ship-hud-stage, .ui-skydive #ship-hud-stage, .ui-cinematic-landing #ship-hud-stage,
body.hero-active #ship-hud-stage, .hide-hud #ship-hud-stage,
.travel-cinematic #ship-hud-stage, .starmap-open #ship-hud-stage, body.route-choice-active #ship-hud-stage {
  opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility 0s linear .3s;
}
#ship-hud-stage.hud-off #ship-hud-svg { transform: scale(.975); }
#ship-hud-stage.hud-off .ship-hud-panel { clip-path: inset(0 50% 0 50%); }
#ship-hud-stage.hud-off .ship-hud-label { opacity: 0; }

/* Boot: strokes draw on, meter rows and pips light in sequence, labels and
   panels wipe in. Every animation uses fill-mode backwards so the per-frame
   presentation attributes the HUD writes take over the moment it ends. */
#ship-hud-stage.hud-boot { animation: hud-flicker .22s linear backwards; }
@keyframes hud-flicker { 0% { opacity: 0; } 25% { opacity: .7; } 45% { opacity: .2; } 70% { opacity: .9; } 100% { opacity: 1; } }
.hud-boot .hud-draw { animation: hud-draw .7s var(--ease-out) backwards; animation-delay: var(--d, 0ms); }
@keyframes hud-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.hud-boot .hud-pop { animation: hud-pop .2s ease-out backwards; animation-delay: var(--d, 0ms); }
@keyframes hud-pop { from { opacity: 0; } }
.hud-boot .ship-hud-label { animation: hud-wipe .32s var(--ease-out) backwards; animation-delay: var(--d, 280ms); }
#ship-hud-gun { --d: 260ms; } #ship-hud-boost { --d: 300ms; } #ship-hud-speed { --d: 360ms; } #ship-hud-pulse { --d: 400ms; }
@keyframes hud-wipe { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.hud-boot #ship-hud-power { animation: hud-panel-l .42s var(--ease-out) 320ms backwards; }
.hud-boot #ship-hud-integrity { animation: hud-panel-r .42s var(--ease-out) 380ms backwards; }
@keyframes hud-panel-l { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(-20px -20px -20px -20px); } }
@keyframes hud-panel-r { from { opacity: 0; clip-path: inset(0 0 0 100%); } to { opacity: 1; clip-path: inset(-20px -20px -20px -20px); } }
.hud-boot .ship-hud-pip.is-on, .hud-boot .ship-hud-power-cell.is-on { animation: hud-pop .16s ease-out backwards; animation-delay: var(--d, 500ms); }
.hud-boot #ship-hud-altitude, .hud-boot #ship-hud-context { animation: hud-pop .4s ease-out 520ms backwards; }
@media (prefers-reduced-motion: reduce) {
  #ship-hud-stage.hud-boot, .hud-boot .hud-draw, .hud-boot .hud-pop, .hud-boot .ship-hud-label,
  .hud-boot #ship-hud-power, .hud-boot #ship-hud-integrity, .hud-boot .ship-hud-pip.is-on,
  .hud-boot .ship-hud-power-cell.is-on, .hud-boot #ship-hud-altitude, .hud-boot #ship-hud-context { animation: none; }
}
body.ui-space #crosshair { display: none !important; }
@media (max-height: 620px), (max-width: 900px) {
  #ship-hud-context { display: none; }
}

/* ---- brand plate ------------------------------------------------------------ */
#brand {
  position: fixed; z-index: 10; top: 22px; left: 24px;
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 10px;
  color: #e6eff1; font: 600 13px/1 var(--font-hud);
  letter-spacing: .14em; pointer-events: none;
  background: transparent; border: 0; box-shadow: none; opacity: .82;
  text-shadow: 0 0 3px rgba(0, 8, 12, .92), 0 1px 6px rgba(0, 8, 12, .68);
}
#brand i { color: #9fd4df; font-style: normal; opacity: .78; }
#brand b { font-weight: 600; color: #ece8d4; }
#brand small {
  position: absolute; left: 10px; top: 26px;
  max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: rgba(214, 228, 230, .72); font: 500 10px/1 var(--font-latin); letter-spacing: .1em;
}

body.weapon-firing #crosshair { box-shadow: 0 0 0 4px rgba(7, 17, 26, .2), 0 0 18px rgba(159, 212, 223, .66); }

#crosshair {
  position: fixed; z-index: 11; left: 50%; top: 50%; width: 34px; height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform .14s ease-out, opacity .14s ease-out;
}
#crosshair::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--ui-white);
  box-shadow: 0 0 3px rgba(0, 0, 0, .85);
}
#crosshair::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--ui-line-strong), var(--ui-line-strong)) left 50% top 0 / 1px 9px,
    linear-gradient(var(--ui-line-strong), var(--ui-line-strong)) left 50% bottom 0 / 1px 9px,
    linear-gradient(var(--ui-line-strong), var(--ui-line-strong)) left 0 top 50% / 9px 1px,
    linear-gradient(var(--ui-line-strong), var(--ui-line-strong)) right 0 top 50% / 9px 1px;
  background-repeat: no-repeat;
  opacity: .82;
}

.gas-danger #vignette { box-shadow: inset 0 0 160px rgba(174, 49, 22, .62); }

#star-map-btn {
  position: fixed; z-index: 13; left: 24px; top: 72px;
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  color: rgba(230, 239, 241, .84); background: transparent;
  border: 0; opacity: .88;
  text-shadow: 0 0 3px rgba(0, 8, 12, .92), 0 1px 6px rgba(0, 8, 12, .68);
  cursor: pointer; font: 600 12px/1 var(--font-latin); letter-spacing: .1em;
  transition: background .14s ease, color .14s ease, opacity .14s ease;
}
#star-map-btn kbd { background: rgba(0, 8, 12, .38); border-color: rgba(226, 236, 238, .48); }
#star-map-btn:hover, #star-map-btn:focus-visible {
  color: var(--menu-select-ink); background: var(--menu-select); opacity: 1;
  text-shadow: none; outline: 0;
}
#star-map-btn:hover kbd, #star-map-btn:focus-visible kbd {
  color: var(--menu-select-ink); background: transparent; border-color: rgba(15, 17, 19, .35);
}

/* ---- committed route: HUD line-art world marker + MENU route dialog --------- */
#destination-marker {
  position: fixed; z-index: 12; left: 0; top: 0; min-width: 112px; padding: 3px 8px 3px 26px;
  color: #edf5f7; background: transparent; border: 0; pointer-events: none;
  font: 600 11px/1.2 var(--font-hud); letter-spacing: .08em; transform: translate(-50%, -50%);
  text-shadow: 0 0 3px rgba(0, 8, 12, .96), 0 1px 6px rgba(0, 8, 12, .85);
  transition: opacity .22s ease;
}
#destination-marker i {
  position: absolute; left: 5px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%) rotate(45deg);
  border: 1.5px solid #ece8d4; background: rgba(6, 12, 16, .55);
  box-shadow: 0 0 0 1px rgba(0, 8, 12, .75);
}
#destination-marker i::after { content: ""; position: absolute; inset: 3px; background: #9fd4df; }
#destination-marker span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
#destination-marker small { color: #ece8d4; font: 600 10px/1.1 var(--font-hud); font-variant-numeric: tabular-nums; letter-spacing: .1em; }
#destination-marker.is-behind { opacity: .52; }

/* Route protocol dialog: MENU visual language (solid charcoal plate, top rule,
   white inverse active card, geometric trajectory schematics). */
#route-choice {
  position: fixed; z-index: 24; left: 50%; top: 50%;
  width: min(640px, calc(100vw - 40px)); transform: translate(-50%, -50%);
  padding: 24px 26px 18px;
  color: var(--menu-ink); background: var(--menu-plate);
  border: 0; border-top: 3px solid var(--menu-ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
  animation: route-choice-enter .24s var(--ease-out) both;
}
#route-choice::before {
  content: ""; position: fixed; z-index: -1; inset: -60vh -60vw; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(6, 7, 8, .38) 0%, rgba(6, 7, 8, .74) 100%);
  backdrop-filter: blur(4px) saturate(.72);
}
.route-choice-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--menu-line);
}
.route-choice-titleblock { min-width: 0; display: grid; gap: 10px; }
.route-choice-eyebrow {
  display: flex; align-items: center; gap: 10px;
  color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .24em;
}
#route-choice-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--menu-ink); font: 500 clamp(20px, 2.2vw, 27px)/1.12 var(--font-latin);
  letter-spacing: .06em;
}
#route-cancel-btn {
  flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  color: var(--menu-dim); background: transparent; border: 1px solid var(--menu-line-strong);
  font: 300 20px/1 var(--font-latin); transition: background .12s ease, color .12s ease, border-color .12s ease;
}
#route-cancel-btn:hover, #route-cancel-btn:focus-visible {
  color: var(--menu-select-ink); background: var(--menu-select); border-color: var(--menu-select); outline: 0;
}
.route-choice-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin-top: 16px;
}
.route-card {
  position: relative; min-width: 0; padding: 15px 16px 16px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  text-align: left; cursor: pointer;
  color: var(--menu-ink); background: var(--menu-row);
  border: 1px solid var(--menu-line); border-top: 2px solid var(--menu-line-strong);
  transition: background .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out),
    transform .16s var(--ease-out), filter .16s var(--ease-out);
}
.route-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.route-card-index {
  color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .16em;
}
.route-card kbd {
  min-width: 22px; padding: 3px 6px; color: var(--menu-dim);
  background: transparent; border-color: var(--menu-line-strong);
}
.route-card-schematic {
  display: block; width: 100%; height: 52px; color: var(--menu-ink); opacity: .82;
  transition: opacity .15s ease, color .15s ease;
}
.route-card-body { display: grid; gap: 6px; }
.route-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.route-card-heading b { font: 600 19px/1.1 var(--font-latin); letter-spacing: .08em; }
.route-card-heading small { color: var(--menu-dim); font: 500 11px/1 var(--font-latin); letter-spacing: .1em; }
.route-card em {
  color: var(--menu-dim); font: normal 12px/1.45 var(--font-latin); letter-spacing: .03em;
}
/* White inverse selection bar/card — Starfield signature */
.route-card.is-selected {
  color: var(--menu-select-ink); background: var(--menu-select);
  border-color: var(--menu-select);
}
.route-card.is-selected .route-card-index,
.route-card.is-selected .route-card-heading small,
.route-card.is-selected em { color: rgba(15, 17, 19, .66); }
.route-card.is-selected kbd { color: var(--menu-select-ink); border-color: rgba(15, 17, 19, .35); }
.route-card.is-selected .route-card-schematic { color: var(--menu-select-ink); opacity: .94; }
.route-card:hover, .route-card:focus-visible {
  color: var(--menu-select-ink); background: var(--menu-select);
  border-color: var(--menu-select); outline: 0;
  transform: translateY(-2px);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .48));
}
.route-card:hover .route-card-index, .route-card:focus-visible .route-card-index,
.route-card:hover .route-card-heading small, .route-card:focus-visible .route-card-heading small,
.route-card:hover em, .route-card:focus-visible em { color: rgba(15, 17, 19, .66); }
.route-card:hover kbd, .route-card:focus-visible kbd { color: var(--menu-select-ink); border-color: rgba(15, 17, 19, .35); }
.route-card:hover .route-card-schematic, .route-card:focus-visible .route-card-schematic { color: var(--menu-select-ink); opacity: .94; }
.route-choice-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--menu-line);
  color: var(--menu-faint); font: 400 11px/1.4 var(--font-latin); letter-spacing: .04em;
}
.route-choice-footer kbd { min-width: 18px; padding: 2px 4px; margin: 0 1px; font-size: 9px; color: var(--menu-dim); }

body.route-choice-active #brand,
body.route-choice-active #star-map-btn,
body.route-choice-active #destination-marker,
body.route-choice-active #resource-strip,
body.route-choice-active #bottom,
body.route-choice-active #compass,
body.route-choice-active #flight-telemetry,
body.route-choice-active #hud,
body.route-choice-active #ship-integrity,
body.route-choice-active #crosshair,
body.route-choice-active #version,
body.route-choice-active #dev-fps {
  opacity: 0 !important; visibility: hidden; pointer-events: none !important;
}

@keyframes route-choice-enter {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}
@media (prefers-reduced-motion: reduce) {
  #route-choice { animation: none; }
  .route-card { transition: none; }
}

/* ---- walk mode: the survey watch + line-art weapon HUD ---------------------- */
#walk-hud { display: none; }
.ui-walk #walk-hud { display: block; }
.ui-walk #surface-weapon { display: block; }
.ui-walk #flight-telemetry, .ui-walk #hud, .ui-walk #ship-integrity, .ui-walk #resource-strip,
.ui-walk #destination-marker, .ui-walk #route-choice,
.ui-walk #compass { display: none; }
.ui-walk #brand { opacity: .62; }
#walk-hud {
  position: fixed; z-index: 10;
  left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom));
  width: min(220px, 20vw, 25vh); aspect-ratio: 1; pointer-events: none;
}
#walk-dial { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 20px rgba(0, 4, 8, .55)); }
#surface-weapon {
  --weapon-ink: #e9f4f6;
  --weapon-cyan: #9fd4df;
  --weapon-signal: #ece8d4;
  display: none; position: fixed; z-index: 10;
  right: max(24px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
  width: clamp(216px, 15vw, 268px); min-width: 0; padding: 10px 4px 6px 14px;
  border: 0; border-top: 1px solid rgba(159, 212, 223, .42);
  color: var(--weapon-ink); text-align: right; pointer-events: none;
  background: transparent;
  font-family: var(--font-hud);
  text-shadow: 0 0 3px rgba(0, 8, 12, .92), 0 1px 6px rgba(0, 8, 12, .72);
}
#surface-weapon::before {
  content: 'SRF // ' attr(data-active-slot); position: absolute; left: 4px; top: 11px;
  color: rgba(159, 212, 223, .82); font: 600 10px/1 var(--font-hud); letter-spacing: .16em;
}
.surface-weapon-label {
  min-height: 12px; padding-left: 66px; overflow: hidden; color: var(--weapon-cyan);
  font: 600 11px/1 var(--font-hud); letter-spacing: .16em; text-overflow: ellipsis; white-space: nowrap;
}
.surface-weapon-ammo {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 12px; margin-top: 8px;
  color: var(--weapon-ink); font: 700 32px/.92 var(--font-hud); font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}
.surface-weapon-ammo::before {
  content: attr(data-state); margin-right: auto; padding-left: 4px; color: rgba(159, 212, 223, .82);
  font: 600 10px/1 var(--font-hud); letter-spacing: .18em;
}
.surface-weapon-slots {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: end; gap: 10px;
  margin-top: 9px; padding-top: 7px; border-top: 1px solid rgba(159, 212, 223, .28);
  color: rgba(159, 212, 223, .62); font: 600 10px/1 var(--font-hud); letter-spacing: .08em;
}
.surface-weapon-slots span { position: relative; opacity: .65; }
.surface-weapon-slots .active { color: var(--weapon-signal); opacity: 1; }
.surface-weapon-slots .active::before {
  content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 2px;
  background: var(--weapon-signal);
}
#surface-weapon.reloading { --weapon-signal: #e0a15a; }
#surface-weapon.reloading .surface-weapon-ammo::before { color: #e0a15a; }
#surface-weapon.holstered { opacity: .65; --weapon-signal: #8e9599; }
#surface-weapon.mining-laser { --weapon-ink: #e9f4f6; --weapon-signal: #9fd4df; }
body.surface-ads #crosshair { transform: translate(-50%, -50%) scale(.62); }
body.surface-ads #crosshair::after { opacity: 1; }

/* ---- centre-bottom prompts --------------------------------------------------------- */
#bottom {
  position: fixed; z-index: 14; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 9px; pointer-events: none;
}
#hint {
  padding: 0; color: rgba(232, 240, 242, .86); background: transparent; border: 0;
  font: 500 max(11px, calc(15px * var(--ship-hud-scale, .72)))/1.45 var(--font-latin);
  letter-spacing: .1em;
  text-shadow: 0 0 3px rgba(0, 8, 12, .95), 0 1px 7px rgba(0, 8, 12, .75);
  transition: opacity .6s; white-space: nowrap;
}
#hint b { color: #ece8d4; font-weight: 600; }
#hint.hint-faded { opacity: 0; }
#land-btn {
  pointer-events: auto; padding: 9px 12px;
  color: rgba(231, 239, 239, .78); background: transparent; border: 0;
  text-shadow: var(--hud-halo); cursor: pointer;
  font: 500 11px/1.2 var(--font-hud); letter-spacing: .08em;
}
#land-btn:hover, #land-btn:focus-visible {
  color: var(--ship-cream); text-decoration: underline; text-underline-offset: 4px;
}

/* Contextual F/E prompt inside the HALCYON or beside exterior ramp */
#interact-prompt {
  pointer-events: none; padding: 8px 16px;
  color: var(--menu-ink); background: var(--menu-plate);
  border: 1px solid var(--menu-line); border-left: 2px solid #ece8d4;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .44);
  font: 600 12px/1.2 var(--font-latin); letter-spacing: .1em; white-space: nowrap;
}
#interact-prompt.hidden { display: none; }
#touch-flight-menu { display: none; }
@media (pointer: coarse) {
  body.ui-space:not(.hero-active, .travel-cinematic, .hide-hud, .route-choice-active, .starmap-open) #touch-flight-menu:not([hidden]) {
    display: block; position: fixed; z-index: 14; right: 15px; top: 54px;
    width: 44px; height: 44px; color: var(--ship-cream); background: transparent;
    border: 0; font: 600 18px/1 var(--font-hud); text-shadow: var(--hud-halo);
  }
}
.ui-skydive #interact-prompt {
  border: 0; background: none; box-shadow: none; color: var(--ship-cream);
  text-shadow: var(--hud-halo); font: 500 13px/1.4 var(--font-hud); letter-spacing: .08em;
}
.ui-skydive #star-map-btn, .ui-skydive #brand, .ui-skydive #crosshair { display: none; }

#stats { position: fixed; z-index: 12; left: 10px; bottom: 20px; display: none; color: rgba(200, 220, 220, .42); font: 9px/1.4 var(--ui-mono); white-space: pre; }
.debug-hud #stats { display: block; }
#dev-fps { position: fixed; z-index: 60; left: 8px; top: 7px; display: none; color: rgba(190, 220, 224, .38); font: 10px/1 var(--ui-mono); letter-spacing: .04em; pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .65); }
.dev-runtime #dev-fps { display: block; }
#version { position: fixed; z-index: 12; left: 9px; bottom: 7px; color: rgba(200, 220, 220, .34); font: 9px/1 var(--ui-mono); }
#performance-notice {
  position: fixed; z-index: 18; right: 20px; top: 20px; max-width: min(340px, 72vw); padding: 9px 14px;
  color: var(--menu-ink); background: var(--menu-plate-soft);
  border: 1px solid var(--menu-line); border-left: 2px solid var(--menu-warn);
  font: 500 11px/1.5 var(--font-latin); letter-spacing: .04em;
  pointer-events: none; transition: opacity .7s ease;
}
#performance-notice.notice-fade { opacity: 0; }

/* Travel commits are cinematic: controls stay live, but cockpit chrome gets
   out of the way until the destination identity has landed. */
.travel-cinematic, .travel-cinematic #app canvas { cursor: none !important; }
.travel-cinematic #brand, .travel-cinematic #compass, .travel-cinematic #flight-telemetry,
.travel-cinematic #hud, .travel-cinematic #ship-integrity, .travel-cinematic #star-map-btn,
.travel-cinematic #destination-marker, .travel-cinematic #route-choice,
.travel-cinematic #resource-strip, .travel-cinematic #walk-hud,
.travel-cinematic #surface-weapon, .travel-cinematic #bottom,
.travel-cinematic #crosshair, .travel-cinematic #stats, .travel-cinematic #dev-fps,
.travel-cinematic #version, .travel-cinematic #performance-notice,
.travel-cinematic #touch-ui { display: none !important; }

/* Flight cockpit chrome fades in after the hero pull-back / warp arrival
   instead of snapping on. hud-cloaked holds opacity 0 for one frame while a
   hiding class (hero-active / travel-cinematic) is lifted, then a rAF removes
   the cloak so the opacity transition fires. Elements that carry their own
   .hidden stay display:none and are unaffected. */
#brand, #star-map-btn, #destination-marker, #route-choice,
#walk-hud, #surface-weapon, #bottom, #crosshair, #stats, #dev-fps,
#version, #time-warp-indicator, #touch-ui, #performance-notice {
  transition: opacity .8s cubic-bezier(.22, .61, .36, 1);
}
body.hud-cloaked #brand, body.hud-cloaked #star-map-btn,
body.hud-cloaked #destination-marker, body.hud-cloaked #route-choice, body.hud-cloaked #walk-hud,
body.hud-cloaked #surface-weapon, body.hud-cloaked #bottom, body.hud-cloaked #crosshair,
body.hud-cloaked #stats, body.hud-cloaked #dev-fps, body.hud-cloaked #version,
body.hud-cloaked #time-warp-indicator, body.hud-cloaked #touch-ui, body.hud-cloaked #performance-notice {
  opacity: 0 !important;
}

#arrival-title {
  position: fixed; z-index: 40; left: 50%; top: clamp(42px, 8vh, 92px);
  width: min(620px, calc(100vw - 48px)); transform: translate(-50%, -10px);
  display: grid; justify-items: center; gap: 7px; pointer-events: none;
  opacity: 0; filter: blur(4px); transition: opacity .65s ease, transform .8s cubic-bezier(.2,.72,.18,1), filter .65s ease;
  color: #f3f8f7; text-align: center; text-shadow: 0 2px 18px rgba(0, 0, 0, .9);
}
#arrival-title::before {
  content: ''; width: 40px; height: 4px; margin-bottom: 5px;
  background: linear-gradient(90deg, var(--brand-1) 0 25%, var(--brand-2) 25% 50%, var(--brand-3) 50% 75%, var(--brand-4) 75%);
}
#arrival-title.arrival-visible { opacity: 1; filter: blur(0); transform: translate(-50%, 0); }
#arrival-kicker { color: rgba(232, 234, 235, .7); font: 600 12px/1 var(--font-hud); letter-spacing: .48em; }
#arrival-name { font: 500 clamp(28px, 4vw, 50px)/1.12 var(--font-latin); letter-spacing: .1em; }
#arrival-system { color: rgba(224, 237, 235, .62); font: 500 12px/1.2 var(--font-hud); letter-spacing: .2em; }

/* ---- loading / hero / pause --------------------------------------------------------- */
#brand-loading {
  position: fixed; inset: 0; z-index: 600;
  cursor: default;
  display: grid; grid-template-rows: minmax(0, 1fr) minmax(32px, auto);
  justify-items: center; gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(clamp(20px, 5vh, 48px), env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #000; color: #fff; transition: opacity .28s ease;
}
#brand-loading.is-leaving { opacity: 0; }
.brand-loading-art {
  position: relative; width: min(100%, 1200px); height: 100%; display: grid; place-items: center;
}
.brand-loading-art span {
  font: 500 clamp(24px, 6vw, 64px)/1.2 var(--font-latin); letter-spacing: .045em;
}
.brand-loading-art img {
  position: absolute; inset: 11%; width: 78%; height: 78%; object-fit: contain; visibility: hidden;
}
.brand-loading-art.is-ready span { visibility: hidden; }
.brand-loading-art.is-ready img { visibility: visible; }
.brand-loading-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  pointer-events: none; background: transparent; visibility: hidden;
}
.brand-loading-art.is-playing .brand-loading-frame { visibility: visible; }
.brand-loading-art.is-playing img, .brand-loading-art.is-playing span { visibility: hidden; }
.brand-loading-copy { width: min(100%, 280px); min-height: 30px; }
.brand-loading-copy .title-card-bar { margin-top: 0; }
.brand-loading-copy .title-card-status, .brand-loading-copy .title-card-status b { color: #c3cad0; }
#brand-map-status {
  text-align: center; color: #c3cad0; font: 500 13px/1.6 var(--font-latin); letter-spacing: .12em;
}
@media (prefers-reduced-motion: reduce) {
  #brand-loading { transition: none; }
  .brand-loading-art.is-playing .brand-loading-frame { visibility: hidden; }
  .brand-loading-art.is-playing.is-ready img { visibility: visible; }
  .brand-loading-art.is-playing:not(.is-ready) span { visibility: visible; }
}

#hero-splash { position: fixed; inset: 0; display: grid; place-items: center; background: #090a0b; }
.title-card { width: max-content; max-width: calc(100vw - 48px); display: grid; color: var(--menu-ink); }
.title-card-eyebrow {
  display: flex; align-items: center; gap: 12px;
  color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .34em;
}
.brand-stripe {
  flex: 0 0 auto; width: 28px; height: 6px;
  background: linear-gradient(90deg, var(--brand-1) 0 25%, var(--brand-2) 25% 50%, var(--brand-3) 50% 75%, var(--brand-4) 75%);
}
.title-card-mark {
  margin: 14px 0 0 -3px; color: var(--menu-ink);
  font: 500 clamp(46px, 6.4vw, 78px)/.9 var(--font-latin); letter-spacing: .045em;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .title-card-mark { font-size: clamp(32px, 9vw, 46px); }
}
.title-card-bar { position: relative; height: 3px; margin-top: 26px; overflow: hidden; background: rgba(255, 255, 255, .1); }
.title-card-bar i {
  position: absolute; inset: 0; display: block; background: var(--menu-ink);
  transform-origin: left; transform: scaleX(var(--loading-progress, 0));
}
.title-card-bar.is-full i { transform: none; }
.title-card-status {
  display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px;
  color: var(--menu-dim); font: 500 12px/1 var(--font-latin); letter-spacing: .16em;
}
.title-card-status b { color: var(--menu-faint); font: 600 11px/1 var(--font-hud); letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.title-card-cta { color: var(--menu-ink); }
#hero-splash:focus-visible .title-card-cta, #hero-splash:hover .title-card-cta { text-decoration: underline; text-underline-offset: 6px; }

#hero-splash { z-index: 49; cursor: pointer; outline: 0; transition: opacity .45s ease; }
#hero-splash.hidden { display: none; }
#hero-splash.splash-leaving { opacity: 0; pointer-events: none; }

/* ---- MENU language: shared list rows + sliding inverse selection bar ------- */
.menu-list { position: relative; display: grid; gap: 2px; }
.menu-list section { display: grid; gap: 2px; }
.menu-cursor {
  position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0;
  background: var(--menu-select); pointer-events: none; opacity: 0;
  transition: transform .16s var(--ease-out), height .16s var(--ease-out), width .16s var(--ease-out), opacity .12s;
}
.menu-cursor.is-snapping { transition: none; }
.menu-item {
  position: relative; z-index: 1; width: 100%; min-height: 46px; padding: 0 14px 0 16px;
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  color: var(--menu-ink); background: transparent; border: 0; outline: 0;
  font: 500 16px/1 var(--font-latin); letter-spacing: .06em;
}
.menu-item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item small { color: var(--menu-dim); font: 500 11px/1 var(--font-latin); letter-spacing: .1em; }
.menu-item kbd { color: var(--menu-dim); background: transparent; border-color: var(--menu-line-strong); }
.menu-item.is-current { color: var(--menu-select-ink); }
.menu-item.is-current small { color: rgba(15, 17, 19, .55); }
.menu-item.is-current kbd { color: var(--menu-select-ink); border-color: rgba(15, 17, 19, .35); }
.menu-item:disabled { cursor: default; color: var(--menu-faint); }
.menu-item:disabled small { color: var(--menu-faint); }

/* ---- full-page hero / start screen ------------------------------------------- */
#hero-overlay {
  position: fixed; z-index: 480; inset: 0; overflow: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  grid-template-rows: auto 1fr auto; gap: clamp(16px, 4vh, 40px) 32px;
  padding: clamp(18px, 5vh, 40px) clamp(16px, 5vw, 56px) clamp(16px, 4vh, 36px);
  background:
    linear-gradient(0deg, rgba(8, 9, 10, .55) 0%, rgba(8, 9, 10, 0) 38%),
    linear-gradient(90deg, rgba(8, 9, 10, .88) 0%, rgba(8, 9, 10, .55) 32%, rgba(8, 9, 10, 0) 58%);
  transition: opacity .55s ease;
}
#hero-overlay.hero-leaving { opacity: 0; pointer-events: none; }
#hero-overlay.hero-over-splash { z-index: 500; }
#hero-overlay.hero-faded { opacity: 0; }
#hero-overlay[inert] { visibility: hidden; }
/* While the start page is up, every piece of flight chrome stays out of the
   frame — the menu owns the screen, the live planet owns the backdrop. */
body.hero-active #brand, body.hero-active #star-map-btn,
body.hero-active #destination-marker, body.hero-active #route-choice,
body.hero-active #walk-hud, body.hero-active #surface-weapon, body.hero-active #bottom,
body.hero-active #crosshair, body.hero-active #stats,
body.hero-active #performance-notice, body.hero-active #touch-ui,
body.hero-active #version, body.hero-active #dev-fps { display: none !important; }

.hero-topline, .hero-bottomline {
  position: relative; z-index: 2; grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  color: var(--menu-dim); font: 600 11px/1.4 var(--font-hud); letter-spacing: .14em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .6);
}
.hero-bottomline { padding-top: 14px; border-top: 1px solid var(--menu-line); }
.hero-topline b, .hero-bottomline b { color: var(--menu-ink); font-weight: 600; }

/* The hero card IS the boot title card (same eyebrow / mark / bar), parked
   low-left; the menu unfolds under the bar where the status line was. */
.hero-content { position: relative; z-index: 2; align-self: end; min-width: 0; }
.hero-card { width: min(100%, 400px); text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.hero-card .title-card-bar { margin-top: 24px; }
.hero-menu { margin-top: 10px; }
.hero-menu .menu-item { min-height: 50px; font-size: 18px; text-shadow: none; }
#hero-start-btn { background: var(--menu-accent); color: var(--menu-select-ink); font-weight: 600; }
#hero-start-btn.is-current { background: var(--menu-select); }
#hero-start-btn kbd { color: var(--menu-select-ink); border-color: var(--menu-faint); }
#hero-overlay.is-selecting-battlefield :is(.hero-menu, .hero-combat-config, .hero-perf-hint) { display: none; }
.hero-map-panel {
  margin-top: 10px; padding: 12px 14px; color: var(--menu-ink);
  background: var(--ui-panel); border-top: 1px solid var(--menu-accent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.hero-map-panel header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.hero-map-panel h2 { font: 600 15px/1.4 var(--font-latin); letter-spacing: .04em; }
.hero-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.hero-map-panel button {
  padding: 7px 10px; border: 1px solid var(--menu-line-strong);
  color: var(--menu-ink); background: var(--menu-row); cursor: pointer;
  font: 500 13px/1.4 var(--font-latin);
}
.hero-map-panel button:hover, .hero-map-panel button:focus-visible {
  background: var(--menu-select); color: var(--menu-select-ink); outline: 0; text-shadow: none;
}
.hero-map-panel button:hover kbd, .hero-map-panel button:focus-visible kbd {
  color: var(--menu-select-ink); border-color: var(--menu-faint);
}
.hero-map-grid button { display: grid; align-content: start; gap: 3px; text-align: left; }
.hero-map-grid strong { font-size: 15px; }
.hero-map-grid span { color: var(--menu-accent); font: 600 11px/1.4 var(--font-hud); letter-spacing: .12em; }
.hero-map-grid button:hover span, .hero-map-grid button:focus-visible span { color: inherit; }
.hero-map-grid small { font-size: 12px; }
.hero-combat-config {
  display: grid; gap: 8px; margin-top: 16px; padding: 12px 14px;
  background: var(--ui-panel); border-top: 1px solid var(--menu-accent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.hero-combat-config h2 { color: var(--menu-ink); font: 600 13px/1.4 var(--font-latin); letter-spacing: .08em; }
.combat-config-row { display: flex; flex-wrap: wrap; gap: 6px; }
.combat-config-row button {
  padding: 5px 10px; border: 1px solid var(--menu-line-strong); border-radius: 999px;
  color: var(--menu-ink); background: var(--menu-row); cursor: pointer;
  font: 500 13px/1.3 var(--font-latin);
}
.combat-config-row button[aria-pressed="true"] {
  color: var(--menu-select-ink); background: var(--menu-accent); border-color: var(--menu-accent); font-weight: 600;
}
.combat-config-row button:hover, .combat-config-row button:focus-visible { outline: 1px solid var(--menu-ink); outline-offset: 1px; }
#hero-entry-error {
  margin-top: 12px; padding: 8px 12px; border-left: 2px solid var(--menu-warn);
  color: var(--menu-warn); background: var(--menu-plate); overflow-wrap: anywhere;
  font: 500 14px/1.5 var(--font-latin);
}
.hero-card .hero-perf-hint { width: 100%; margin-top: 16px; }

.hero-dossier {
  position: relative; z-index: 2; align-self: end;
  padding: 16px 18px; color: var(--menu-ink);
  background: var(--ui-panel); border-top: 2px solid var(--menu-accent);
  backdrop-filter: blur(10px);
}
.hero-dossier h2 { font: 600 18px/1.3 var(--font-latin); letter-spacing: .06em; }
.hero-dossier dl { display: grid; gap: 4px; margin-top: 12px; }
.hero-dossier dl div { display: grid; grid-template-columns: 4em 1fr; gap: 8px; padding: 8px; background: var(--menu-row); }
.hero-dossier dt { color: var(--ui-dim); font: 500 12px/1.5 var(--font-latin); }
.hero-dossier dd { margin: 0; font: 500 14px/1.5 var(--font-latin); }

/* Entrance from the splash: the card glides from screen centre (FLIP in
   ui.js), then menu rows, foot and dossier follow in sequence. */
.hero-card { transition: transform .8s cubic-bezier(.65, 0, .25, 1); }
.hero-menu .menu-item, .hero-combat-config, .hero-dossier, .hero-topline, .hero-bottomline {
  transition: opacity .35s ease, transform .45s var(--ease-out);
}
.hero-menu .menu-item:nth-child(2) { transition-delay: .62s; }
.hero-menu .menu-item:nth-child(3) { transition-delay: .7s; }
.hero-menu .menu-item:nth-child(4) { transition-delay: .78s; }
.hero-combat-config { transition-delay: .86s; }
.hero-dossier { transition-delay: .9s; }
.hero-topline, .hero-bottomline { transition-delay: 1s; }
#hero-overlay.hero-entering .hero-menu .menu-item,
#hero-overlay.hero-entering .hero-combat-config,
#hero-overlay.hero-entering .hero-perf-hint { opacity: 0; transform: translateY(-8px); transition: none; }
#hero-overlay.hero-entering .hero-dossier { opacity: 0; transform: translateX(16px); transition: none; }
#hero-overlay.hero-entering .hero-topline, #hero-overlay.hero-entering .hero-bottomline { opacity: 0; transition: none; }
#hero-overlay.hero-entering .menu-cursor { opacity: 0 !important; }
#hero-overlay.hero-settling .menu-cursor { transition: opacity .3s ease .6s; }
#hero-overlay.hero-settling .hero-perf-hint {
  transition: opacity .35s ease .92s, transform .45s var(--ease-out) .92s, background .12s;
}
@media (prefers-reduced-motion: reduce) {
  .hero-card, .hero-menu .menu-item, .hero-combat-config, .hero-perf-hint, .hero-dossier, .hero-topline, .hero-bottomline { transition: none; }
}

/* ---- generic dialog plate (graphics settings, perf tutorial) ---------------- */
.graphics-settings-panel, .perf-tutorial-panel {
  color: var(--menu-ink); background: var(--menu-plate);
  border: 0; border-top: 3px solid var(--menu-ink); box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}

.graphics-settings-panel {
  position: fixed; z-index: 530; top: 50%; right: clamp(22px, 6vw, 92px); transform: translateY(-50%);
  width: min(560px, calc(100vw - 44px)); max-height: calc(100vh - 72px); overflow: auto; padding: 26px 28px;
  animation: dialog-plate-in .2s var(--ease-out) both;
}
.graphics-settings-panel.hidden { display: none; }
body:has(#graphics-settings-panel:not(.hidden)) .hero-dossier { opacity: 0 !important; transition-delay: 0s; pointer-events: none; }
@keyframes dialog-plate-in { from { opacity: 0; transform: translate(12px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.graphics-settings-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--menu-line); }
.graphics-settings-panel > header span, .graphics-device span, .graphics-settings-panel legend { color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .2em; text-transform: uppercase; }
.graphics-settings-panel h2 { margin: 10px 0 0; font: 500 28px/1 var(--font-latin); letter-spacing: .08em; }
.graphics-settings-panel > header button, #perf-tutorial-close {
  flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  color: var(--menu-dim); background: transparent; border: 1px solid var(--menu-line-strong); font: 300 20px/1 var(--font-latin);
  transition: background .12s, color .12s;
}
.graphics-settings-panel > header button:hover, #perf-tutorial-close:hover, #perf-tutorial-close:focus-visible { color: var(--menu-select-ink); background: var(--menu-select); outline: 0; }
.graphics-device { display: grid; gap: 7px; margin: 20px 0 4px; }
.graphics-device strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px/1.35 var(--font-latin); }
.graphics-device small { color: var(--menu-dim); font: 500 11px/1.4 var(--font-hud); letter-spacing: .06em; }
.graphics-gpu-alert {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 8px; padding: 10px 12px;
  background: rgba(224, 161, 90, .1); border-left: 3px solid var(--menu-warn);
}
.graphics-gpu-alert-copy { display: grid; gap: 4px; min-width: 0; }
.graphics-gpu-alert-copy b { color: var(--menu-warn); font: 600 12px/1.2 var(--font-latin); letter-spacing: .06em; }
.graphics-gpu-alert-copy small { white-space: normal; color: rgba(232, 234, 235, .74); font: 400 11px/1.4 var(--font-latin); letter-spacing: .02em; }
#graphics-perf-tutorial-btn {
  flex: 0 0 auto; padding: 8px 12px; cursor: pointer;
  color: var(--menu-warn); background: transparent; border: 1px solid rgba(224, 161, 90, .48);
  font: 600 11px/1 var(--font-latin); letter-spacing: .08em; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
#graphics-perf-tutorial-btn:hover, #graphics-perf-tutorial-btn:focus-visible {
  color: var(--menu-select-ink); background: var(--menu-warn); border-color: var(--menu-warn); outline: 0;
}
.graphics-settings-panel fieldset { margin: 22px 0 0; padding: 0; border: 0; }
.graphics-settings-panel legend { margin-bottom: 10px; }
.graphics-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.graphics-choice-grid label { cursor: pointer; min-width: 0; }
.graphics-choice-grid label.is-recommended { position: relative; }
.graphics-choice-grid label.is-recommended::after {
  content: "推荐"; position: absolute; right: 10px; top: 10px; z-index: 1;
  color: var(--menu-accent); font: 600 10px/1 var(--font-latin); letter-spacing: .12em;
}
.graphics-choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.graphics-choice-grid span { display: flex; min-height: 58px; flex-direction: column; justify-content: center; gap: 6px; padding: 10px 14px; background: var(--menu-row); transition: background .12s, color .12s; }
.graphics-choice-grid b { font: 500 14px/1 var(--font-latin); letter-spacing: .08em; }
.graphics-choice-grid small { color: var(--menu-dim); font: 400 11px/1.25 var(--font-latin); }
.graphics-choice-grid label:hover span { background: rgba(255, 255, 255, .08); }
.graphics-choice-grid input:checked + span { color: var(--menu-select-ink); background: var(--menu-select); }
.graphics-choice-grid input:checked + span small { color: rgba(15, 17, 19, .6); }
.graphics-choice-grid label.is-recommended:has(input:checked)::after { color: #2c6a80; }
.graphics-choice-grid input:focus-visible + span { outline: 1px solid var(--menu-ink); outline-offset: 2px; }
.graphics-texture-status { margin: 6px 0 0; color: var(--menu-dim); font: 400 12px/1.5 var(--font-latin); }
.graphics-texture-status[data-state="error"] { color: var(--menu-warn); }
#graphics-settings-apply:disabled { opacity: .55; cursor: wait; }
.graphics-settings-note { min-height: 28px; margin: 18px 0; color: var(--menu-dim); font: 400 12px/1.5 var(--font-latin); }
.graphics-settings-panel > footer { display: flex; justify-content: flex-end; gap: 8px; }
.graphics-settings-panel > footer button {
  min-width: 110px; padding: 12px 18px; cursor: pointer; color: var(--menu-ink);
  background: transparent; border: 1px solid var(--menu-line-strong); font: 500 13px/1 var(--font-latin); letter-spacing: .08em;
  transition: background .12s, color .12s;
}
.graphics-settings-panel > footer button:hover, .graphics-settings-panel > footer button:focus-visible,
#graphics-settings-apply { color: var(--menu-select-ink); background: var(--menu-select); border-color: var(--menu-select); outline: 0; }
.graphics-restart-mask { position: fixed; inset: 0; z-index: 2200; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--menu-ink); background: #090a0b; }
.graphics-restart-mask.hidden { display: none; }
.graphics-restart-mask i { width: 160px; height: 2px; background: linear-gradient(90deg, transparent, var(--menu-ink), transparent) 0 0 / 50% 100% no-repeat, rgba(255, 255, 255, .1); animation: restart-scan 1.1s linear infinite; }
@keyframes restart-scan { from { background-position: -80px 0, 0 0; } to { background-position: 160px 0, 0 0; } }
.graphics-restart-mask strong { font: 500 15px/1 var(--font-latin); letter-spacing: .14em; }
.graphics-restart-mask span { color: var(--menu-dim); font: 500 11px/1 var(--font-latin); letter-spacing: .12em; }

/* low-power GPU hint: amber is the one warm status colour in the menu language */
.hero-perf-hint {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; text-align: left; cursor: pointer; color: var(--menu-ink);
  background: linear-gradient(90deg, rgba(224, 161, 90, .14), rgba(17, 19, 21, .76));
  border: 0; border-left: 3px solid var(--menu-warn);
  transition: background .12s;
}
.hero-perf-hint-glyph { flex: 0 0 auto; width: 16px; height: 16px; border: 1px solid var(--menu-warn); border-radius: 50%; position: relative; }
.hero-perf-hint-glyph::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 10px/1 var(--font-latin); color: var(--menu-warn); }
.hero-perf-hint-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.hero-perf-hint-title { color: var(--menu-warn); font: 600 12px/1 var(--font-latin); letter-spacing: .08em; }
.hero-perf-hint-sub { font: 400 11px/1.3 var(--font-latin); letter-spacing: .04em; color: rgba(232, 234, 235, .78); }
.hero-perf-hint kbd { flex: 0 0 auto; color: var(--menu-warn); border-color: rgba(224, 161, 90, .4); background: transparent; }
.hero-perf-hint:hover, .hero-perf-hint:focus-visible { background: linear-gradient(90deg, rgba(224, 161, 90, .24), rgba(17, 19, 21, .86)); outline: 0; }

#perf-tutorial {
  position: fixed; inset: 0; z-index: 1100; padding: 24px;
  display: grid; place-items: center; background: rgba(6, 7, 8, .74);
}
#perf-tutorial.hidden { display: none; }
.perf-tutorial-panel { width: min(640px, 92vw); max-height: calc(100vh - 48px); overflow: auto; padding: 28px 30px; border-top-color: var(--menu-warn); }
.perf-tutorial-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.perf-tutorial-titleblock { display: flex; flex-direction: column; align-items: flex-start; }
.perf-tutorial-eyebrow { color: var(--menu-warn); font: 600 11px/1 var(--font-hud); letter-spacing: .22em; }
.perf-tutorial-panel h2 { margin-top: 12px; font: 500 clamp(26px, 3.4vw, 36px)/1.06 var(--font-latin); letter-spacing: .08em; }
.perf-tutorial-rule { display: none; }
.perf-tutorial-steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 4px; }
.perf-tutorial-steps > li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 14px 14px 14px 0; background: var(--menu-row); }
.perf-step-num { color: var(--menu-warn); font: 600 18px/1 var(--font-hud); text-align: right; letter-spacing: .04em; }
.perf-step-body b { display: block; font: 500 14px/1.2 var(--font-latin); letter-spacing: .06em; }
.perf-step-body p { margin: 7px 0 0; color: var(--menu-dim); font: 400 12px/1.65 var(--font-latin); }
.perf-step-body em { color: var(--menu-ink); font-style: normal; }
.perf-step-body kbd { font-size: 10px; }
.perf-step-paths { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.perf-step-paths li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; }
.perf-step-paths span { color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .1em; text-transform: uppercase; }
.perf-step-paths code { color: var(--menu-ink); font: 11px/1.4 Consolas, "Cascadia Mono", monospace; word-break: break-all; }
.perf-tutorial-panel footer { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--menu-line); color: var(--menu-dim); font: 400 11px/1.6 var(--font-latin); }

#vignette { position: fixed; z-index: 7; inset: 0; pointer-events: none; background: radial-gradient(ellipse, transparent 62%, rgba(0, 4, 7, .32) 100%); }
#fade { position: fixed; z-index: 30; inset: 0; opacity: 0; background: #000; pointer-events: none; transition: opacity .6s; }

/* ---- full-page pause: solid charcoal plate over the dimmed, softened world -- */
#pause-overlay {
  position: fixed; z-index: 500; inset: 0;
  background: linear-gradient(90deg, rgba(6, 7, 8, .8), rgba(6, 7, 8, .5) 46%, rgba(6, 7, 8, .3));
  backdrop-filter: blur(6px) saturate(.6);
}
.pause-panel {
  position: absolute; left: clamp(22px, 6vw, 96px); top: 50%; transform: translateY(-50%);
  width: min(460px, 88vw); padding: 26px 24px 18px; color: var(--menu-ink);
  background: var(--menu-plate); border-top: 3px solid var(--menu-ink); box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
  animation: menu-plate-in .22s var(--ease-out) both;
}
@keyframes menu-plate-in { from { opacity: 0; transform: translate(-14px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.pause-header { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 2px 20px; border-bottom: 1px solid var(--menu-line); }
.pause-titleblock { display: flex; flex-direction: column; align-items: flex-start; }
.pause-eyebrow { display: flex; align-items: center; gap: 10px; color: var(--menu-dim); font: 600 11px/1 var(--font-hud); letter-spacing: .26em; }
.pause-panel h2 { margin-top: 12px; font: 500 34px/1 var(--font-latin); letter-spacing: .1em; }
.pause-state { display: grid; grid-template-columns: auto auto; gap: 5px 9px; align-items: center; color: var(--menu-dim); font: 400 11px/1 var(--font-latin); }
.pause-state i { grid-row: 1 / 3; width: 6px; height: 6px; border-radius: 50%; background: var(--menu-warn); }
.pause-state b { font: 600 11px/1 var(--font-hud); letter-spacing: .14em; color: var(--menu-ink); }
.pause-actions { margin-top: 14px; }
#pause-overlay.is-selecting-battlefield :is(.pause-actions, .pause-panel footer) { display: none; }
.pause-panel .pause-map-panel h2 { margin: 0; font: 600 15px/1.4 var(--font-latin); letter-spacing: .04em; }
.pause-map-panel button[aria-current="true"] { border-color: var(--menu-accent); }
.pause-map-panel button[aria-current="true"]::after { content: '当前战场'; font-weight: 600; }
.pause-time { margin-top: 14px; }
.pause-time header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 10px; padding: 0 2px 8px; color: var(--menu-dim); font: 500 12px/1 var(--font-latin); letter-spacing: .14em; }
.pause-time header small { color: var(--menu-faint); font: 400 11px/1 var(--font-latin); letter-spacing: .04em; }
.pause-time-lock {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px;
  color: var(--menu-ink, #e2ecf8); letter-spacing: .04em; white-space: nowrap;
  margin-left: auto; margin-right: 12px;
}
.pause-time-lock[hidden] { display: none; }
.pause-time-lock input { margin: 0; accent-color: #38bdf8; cursor: pointer; }
.pause-actions .menu-item { min-height: 46px; }
.pause-actions .pause-resume { min-height: 54px; font-size: 18px; }
#pause-overlay [hidden], #controls-help-overlay[hidden] { display: none; }
.is-naval .pause-panel {
  width: min(760px, calc(100vw - clamp(22px, 6vw, 96px) - 16px));
  max-height: calc(100dvh - 32px); overflow: auto;
  border-top-color: var(--menu-accent);
}
.is-naval .pause-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.is-naval .pause-primary .menu-item-label { white-space: normal; }
.is-naval .pause-time {
  grid-column: 1 / -1; margin-top: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; align-items: stretch;
}
.is-naval .pause-time header { grid-column: 1 / -1; }
.is-naval .pause-time .menu-item { min-height: 46px; padding: 0 12px; justify-content: center; gap: 8px; }
.is-naval .pause-time .menu-item-label { flex: 0 1 auto; white-space: nowrap; }
.is-naval .pause-time .menu-item small { font-size: 10px; letter-spacing: .06em; }
#pause-restart-btn.is-confirming { box-shadow: inset 3px 0 var(--menu-warn); font-weight: 600; }
.pause-quick-settings {
  padding: 14px 16px; border-top: 1px solid var(--menu-accent);
  color: var(--menu-ink); background: var(--ui-panel);
}
.pause-quick-settings h3, .controls-help-groups h3 { font: 600 15px/1.4 var(--font-latin); }
.pause-setting {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; margin-top: 12px;
  align-items: baseline; font: 500 14px/1.4 var(--font-latin);
}
.pause-setting output { color: var(--menu-accent); font-variant-numeric: tabular-nums; }
.pause-setting input { grid-column: 1 / -1; width: 100%; min-height: 24px; accent-color: var(--menu-accent); cursor: pointer; }
.pause-setting-select select {
  grid-column: 1 / -1; width: 100%; min-height: 36px; padding: 6px 10px;
  color: var(--menu-ink); background: rgba(8, 18, 30, .85);
  border: 1px solid rgba(125, 211, 252, .35); border-radius: 4px;
  font: 500 14px/1.4 var(--font-latin); cursor: pointer;
}
.pause-setting-select select:hover { border-color: rgba(125, 211, 252, .6); }
.pause-setting-select select:focus-visible { outline: 2px solid var(--menu-accent); outline-offset: 1px; }
.pause-setting-select select option { color: var(--menu-ink); background: #08121e; }
.pause-quick-settings p { margin-top: 12px; color: var(--ui-dim); font: 400 12px/1.6 var(--font-latin); }
#controls-help-overlay {
  position: fixed; z-index: 520; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(6, 7, 8, .65); backdrop-filter: blur(8px);
}
.controls-help-panel {
  width: min(880px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  padding: clamp(16px, 3vw, 28px); color: var(--menu-ink);
  background: var(--ui-panel); border-top: 2px solid var(--menu-accent);
}
.controls-help-panel > header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid var(--menu-line-strong);
}
.controls-help-panel h2 { font: 600 clamp(20px, 4vw, 28px)/1.2 var(--font-latin); }
#controls-help-close {
  padding: 6px 10px; color: var(--menu-ink); border: 1px solid var(--menu-line-strong);
  background: var(--menu-row); font: 500 14px/1.4 var(--font-latin); cursor: pointer;
}
#controls-help-close:focus-visible, #controls-help-close:hover { outline: 1px solid var(--menu-accent); }
.controls-help-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.controls-help-groups h3 { color: var(--menu-accent); }
.controls-help-groups dl { display: grid; gap: 4px; margin-top: 8px; }
.controls-help-groups dl div {
  display: grid; grid-template-columns: minmax(72px, auto) 1fr; gap: 8px; align-items: start;
  padding: 7px 8px; background: var(--menu-row); font: 500 13px/1.45 var(--font-latin);
}
.controls-help-groups dd { margin: 0; }
.event-glyph { position: relative; flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; overflow: hidden; opacity: .7; }
.event-glyph::before { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1px; background: currentColor; }
.event-glyph.sunrise::after, .event-glyph.sunset::after { content: ""; position: absolute; left: 6px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.event-glyph.sunset::after { top: 11px; }
.event-glyph.eclipse::after { content: ""; position: absolute; left: 4px; top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 1px solid currentColor; box-shadow: inset 4px -2px 0 currentColor; }
.pause-panel footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 2px 0; border-top: 1px solid var(--menu-line); color: var(--menu-faint); font: 400 11px/1.4 var(--font-latin); letter-spacing: .04em; }
.pause-panel footer kbd { min-width: 18px; padding: 2px 4px; margin: 0 1px; font-size: 9px; color: var(--menu-dim); }
.pause-panel.is-acquiring .pause-state i { background: var(--menu-accent); animation: control-pulse .75s ease-in-out infinite alternate; }
@keyframes control-pulse { to { opacity: .3; } }

#time-warp-indicator {
  position: fixed; z-index: 22; left: 50%; top: 16px; width: min(340px, 72vw); padding: 10px 14px 11px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center;
  color: var(--menu-ink); background: var(--menu-plate-soft); border-top: 2px solid var(--menu-ink);
  transform: translateX(-50%); pointer-events: none;
}
#time-warp-indicator > span { color: var(--menu-dim); font: 600 10px/1 var(--font-hud); letter-spacing: .18em; }
#time-warp-indicator strong { font: 500 13px/1 var(--font-latin); letter-spacing: .08em; }
#time-warp-indicator > i { grid-column: 1 / 3; height: 2px; overflow: hidden; background: rgba(255, 255, 255, .12); }
#time-warp-progress { display: block; width: 0; height: 100%; background: var(--menu-ink); }
#time-warp-rate { grid-column: 3; grid-row: 1 / 3; color: var(--menu-ink); font: 600 14px/1 var(--font-hud); }

#err { position: fixed; z-index: 100; inset: 18px; padding: 18px; overflow: auto; color: #ffd8d8; background: rgba(40, 0, 0, .94); font: 12px/1.5 var(--ui-mono); white-space: pre-wrap; }

#webgl-error {
  position: fixed; z-index: 95; inset: 0; display: grid; place-items: center; padding: 24px;
  background: rgba(9, 10, 11, .92);
}
#webgl-error.hidden { display: none; }
.webgl-error-panel {
  width: min(600px, 92vw); max-height: calc(100vh - 48px); overflow: auto; padding: 28px 30px;
  color: var(--menu-ink); background: var(--menu-plate);
  border-top: 2px solid var(--menu-warn); box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.webgl-error-eyebrow { color: var(--menu-warn); font: 600 11px/1 var(--font-hud); letter-spacing: .22em; }
.webgl-error-panel h2 { margin-top: 12px; font: 500 clamp(22px, 3vw, 30px)/1.12 var(--font-latin); letter-spacing: .06em; }
.webgl-error-summary { margin-top: 16px; color: var(--menu-muted); font: 400 13px/1.65 var(--font-latin); }
.webgl-error-steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 4px; }
.webgl-error-steps > li {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start;
  padding: 12px 14px 12px 0; background: var(--menu-row);
}
.webgl-error-steps .step-num {
  text-align: center; color: var(--menu-warn); font: 600 12px/1.4 var(--font-hud); letter-spacing: .12em;
}
.webgl-error-steps .step-body b { display: block; font: 600 13px/1.4 var(--font-latin); color: var(--menu-ink); }
.webgl-error-steps .step-body p { margin-top: 4px; font: 400 12px/1.55 var(--font-latin); color: var(--menu-muted); }
.webgl-error-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.webgl-error-btn {
  min-height: 40px; padding: 0 18px; border: 1px solid var(--menu-line);
  background: transparent; color: var(--menu-ink); cursor: pointer;
  font: 600 13px/1 var(--font-latin); letter-spacing: .08em;
}
.webgl-error-btn.is-primary { background: var(--menu-select); color: var(--menu-select-ink); border-color: var(--menu-select); }
.webgl-error-btn:hover, .webgl-error-btn:focus-visible { background: var(--menu-select); color: var(--menu-select-ink); outline: 0; }
.webgl-error-footer {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--menu-line);
  color: var(--menu-dim); font: 400 11px/1.5 var(--ui-mono); word-break: break-word;
}

#touch-ui { position: fixed; z-index: 20; inset: 0; pointer-events: none; }
/* Touch devices keep the stick; mouse/desktop play should leave this corner clean. */
#joystick {
  position: absolute; left: 26px; bottom: calc(min(250px, 24vw, 30vh) + 24px);
  width: 116px; height: 116px; border-radius: 50%;
  border: 1.5px solid rgba(226, 236, 238, .42); background: rgba(9, 14, 17, .34);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; left: 34px; top: 34px; width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid #ece8d4; background: rgba(236, 232, 212, .16);
}
.touch-action-btn {
  position: absolute; right: max(22px, env(safe-area-inset-right));
  width: 64px; height: 64px; display: grid; place-items: center;
  color: #edf5f7; background: rgba(9, 14, 17, .52);
  border: 1.5px solid rgba(220, 238, 242, .56); border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  font: 600 12px/1 var(--font-hud); letter-spacing: .12em;
  pointer-events: auto; touch-action: manipulation; user-select: none;
  transition: transform .1s ease, background .1s ease, color .1s ease, border-color .1s ease;
}
.touch-action-btn::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(220, 238, 242, .18); border-radius: 50%; }
.touch-action-btn:active { color: #0f1113; border-color: #eceeef; background: #eceeef; transform: scale(.95); }
#btn-jump { bottom: calc(min(250px, 24vw, 30vh) + 26px); }
#btn-takeoff { bottom: calc(min(250px, 24vw, 30vh) + 104px); }
@media (pointer: fine) {
  #touch-ui { display: none !important; }
}

/* walking owns the mouse as a look input even before pointer lock is granted */
body.walking #app, body.walking #app * { cursor: none !important; }

.hide-hud #brand, .hide-hud #bottom,
.hide-hud #stats, .hide-hud #crosshair, .hide-hud #walk-hud, .hide-hud #surface-weapon, .hide-hud #star-map-btn { display: none !important; }

@media (max-width: 900px) {
  #walk-hud { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); width: min(190px, 32vw, 25vh); }
  #surface-weapon { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: min(224px, 34vw); }
  .ui-walk #bottom { bottom: calc(min(190px, 32vw, 25vh) + 22px); }
  #joystick { bottom: calc(min(210px, 38vw, 30vh) + 20px); }
  #btn-jump { bottom: calc(min(210px, 38vw, 30vh) + 22px); }
  #btn-takeoff { bottom: calc(min(210px, 38vw, 30vh) + 100px); }
}

@media (max-width: 640px) {
  #brand { top: 12px; left: 12px; transform: scale(.86); transform-origin: top left; }
  #star-map-btn { left: auto; right: 12px; top: 13px; }
  #star-map-btn span { display: none; }
  #route-choice {
    width: calc(100vw - 24px); padding: 18px 18px 14px;
  }
  .route-choice-header { padding-bottom: 12px; gap: 12px; }
  .route-choice-titleblock { gap: 7px; }
  .route-choice-eyebrow { font-size: 10px; letter-spacing: .18em; }
  #route-choice-name { font-size: clamp(18px, 4.2vw, 22px); }
  .route-choice-actions { gap: 8px; margin-top: 12px; }
  .route-card { padding: 12px 12px 13px; gap: 9px; }
  .route-card-schematic { height: 42px; }
  .route-card-heading b { font-size: 16px; }
  .route-card-heading small { font-size: 10px; }
  .route-card em { font-size: 11px; line-height: 1.35; }
  .route-choice-footer { margin-top: 12px; padding-top: 10px; font-size: 10px; }
  .route-choice-footer > span:last-child { display: none; }
  #destination-marker span { max-width: 116px; }
  #bottom { bottom: 88px; }
  .ui-walk #bottom { bottom: calc(min(160px, 38vw, 24vh) + 18px); }
  #interact-prompt { padding: 6px 12px; font-size: 11px; }
  #hint { max-width: 88vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #walk-hud { left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); width: min(160px, 38vw, 24vh); }
  #surface-weapon { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); width: min(198px, 46vw); padding: 8px 4px 4px 10px; }
  .surface-weapon-label { padding-left: 52px; font-size: 9px; }
  .surface-weapon-ammo { font-size: 24px; }
  .surface-weapon-slots { gap: 6px; font-size: 9px; }
  #joystick { left: 16px; width: 100px; height: 100px; bottom: calc(min(174px, 42vw, 27vh) + 22px); }
  #joystick-knob { left: 28px; top: 28px; width: 44px; height: 44px; }
  #btn-jump { bottom: calc(min(174px, 42vw, 27vh) + 18px); }
  #btn-takeoff { bottom: calc(min(174px, 42vw, 27vh) + 96px); }
  #hero-overlay { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto auto; }
  .hero-bottomline span:nth-child(2), .hero-bottomline span:nth-child(3) { display: none; }
  .hero-dossier { width: min(100%, 400px); }
  .title-card-mark { font-size: clamp(38px, 12vw, 64px); }
  .hero-perf-hint-sub { font-size: 10px; }
  .graphics-settings-panel { inset: 12px; width: auto; max-height: none; transform: none; padding: 19px; animation: none; }
  .graphics-gpu-alert { flex-direction: column; align-items: stretch; gap: 10px; }
  .pause-panel { left: 16px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; padding: 20px 16px 14px; }
  .is-naval .pause-panel { width: calc(100vw - 32px); }
  .pause-panel h2 { font-size: 28px; }
  .pause-state { display: none; }
  .pause-panel footer > span:last-child { display: none; }
  .is-naval .pause-actions, .controls-help-groups { grid-template-columns: minmax(0, 1fr); }
  .is-naval .pause-time { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .is-naval .pause-time .menu-item { justify-content: flex-start; }
  .pause-time-lock { margin-right: 0; }
}

@media (max-height: 620px) {
  .hero-bottomline { padding-top: 10px; }
  .hero-card .title-card-mark { font-size: clamp(36px, 5.5vw, 56px); }
  .hero-card .title-card-bar { margin-top: 16px; }
  .hero-menu .menu-item { min-height: 42px; font-size: 16px; }
  .hero-card .hero-perf-hint { margin-top: 10px; padding: 10px 12px; }
}

@media (max-width: 480px) {
  #route-choice { width: calc(100vw - 20px); padding: 16px 14px 12px; }
  .route-choice-actions { grid-template-columns: 1fr; gap: 8px; }
  .route-card { padding: 11px 12px; gap: 6px; }
  .route-card-schematic { height: 34px; }
  .route-card em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pause-panel.is-acquiring .pause-state i { animation: none; }
  .pause-panel, .graphics-settings-panel { animation: none; }
  .menu-cursor { transition: none; }
}

/* Fold navigation unfolds above the line of flight while the far view warms. */
#fold-nav {
  position: absolute; z-index: 20; top: clamp(7px, 2vh, 32px); left: 50%;
  transform: translateX(-50%); width: min(410px, 82vw); text-align: center;
  color: #bdebf4; font: 11px/1.35 ui-monospace, monospace; pointer-events: none;
  filter: drop-shadow(0 1px 3px #08141b);
}
.hide-hud #fold-nav, #fold-nav[hidden] { display: none; }
.fold-instrument { position: relative; display: grid; min-height: 60px; place-items: center; }
.fold-readout { display: grid; justify-items: center; gap: 3px; width: 64%; box-sizing: border-box;
  padding: 5px 12px; background: linear-gradient(90deg, transparent, #071923bc 25% 75%, transparent);
  animation: fold-ignition .28s ease-out both; }
#fold-state { font-size: 10px; letter-spacing: .22em; color: #8bdaeb; }
#fold-target { font-size: clamp(12px, 1.2vw, 15px); font-weight: 500; color: #effcff;
  letter-spacing: .04em; text-wrap: balance; overflow-wrap: anywhere; }
#fold-system { color: #c5dce2; font-size: 10px; }
#fold-system:empty { display: none; }
.fold-traces { position: absolute; inset: 0; width: 100%; height: 100%;
  animation: fold-unfurl .52s cubic-bezier(.17,.82,.19,1) both; }
.fold-datum { opacity: .55; stroke-width: .85; }
.fold-wave { stroke-width: 1.2; stroke-dasharray: 18 3 75;
  animation: fold-scan 1.6s linear infinite; }
#fold-abort { pointer-events: auto; border: 0; padding: 6px 10px; background: #09151c85;
  font: inherit; color: #d3e5e8; cursor: pointer; }
#fold-abort kbd { color: #93dbe9; }
#fold-nav[data-phase="open"] .fold-traces { opacity: 0; transition: opacity .32s; }
#fold-nav[data-phase="open"] #fold-state { color: #d3f9ed; }
@media (max-height: 620px) {
  #fold-nav { top: 5px; }
  .fold-instrument { min-height: 44px; }
  #fold-abort { padding-block: 3px; }
}
@keyframes fold-ignition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fold-unfurl { from { clip-path: inset(0 49%); } to { clip-path: inset(0); } }
@keyframes fold-scan { to { stroke-dashoffset: -96; } }
@media (prefers-reduced-motion: reduce) {
  .fold-readout, .fold-traces, .fold-wave { animation: none; }
}
