:root {
  /* Unified with the star map / system preview design language (starmap.css). */
  --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: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --ui-mono: Consolas, "Cascadia Mono", "Microsoft YaHei UI", monospace;
}

* { 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; }
#app canvas { touch-action: none; }

kbd {
  min-width: 24px; padding: 3px 7px; display: inline-grid; place-items: center;
  color: var(--ui-white); background: rgba(7, 17, 26, .62);
  border: 1px solid var(--ui-line); border-radius: 1px;
  font: 600 10px/1 var(--ui-mono); letter-spacing: .08em;
}

/* ---- ASTERION cockpit HUD --------------------------------------------------- */
#ship-hud-stage {
  --ship-cyan: #84c7d4;
  --ship-cyan-dim: #5d858e;
  --ship-cream: #ece8d4;
  --ship-red: #e2483d;
  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: "Bahnschrift", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none; font-kerning: normal;
  text-shadow: 0 0 7px rgba(127, 214, 232, .28);
}
#ship-hud-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ship-hud-label {
  position: absolute; display: flex; align-items: center; gap: 12px;
  color: var(--ship-cyan); font-size: 22px; font-weight: 600;
  letter-spacing: 1px; white-space: nowrap;
}
.ship-hud-readout { display: inline-flex; align-items: baseline; gap: 12px; 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; }
.ship-hud-key {
  display: inline-block; padding: 1px 11px 3px;
  color: #e4f0f2; background: rgba(10, 22, 27, .29);
  border: 1.5px solid #d8e7e9; border-radius: 7px;
  box-shadow: 0 0 6px rgba(190, 230, 240, .25), inset 0 0 6px rgba(190, 230, 240, .12);
  font-size: 19px; font-weight: 600; letter-spacing: 1px;
  text-shadow: none; transition: background .1s, box-shadow .1s;
}
.ship-hud-key.is-on { background: rgba(240, 236, 216, .35); box-shadow: 0 0 14px rgba(240, 236, 216, .6); }
#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: rgba(7, 15, 19, .43); border: 0;
  border-radius: 0; box-shadow: 0 0 24px rgba(0, 0, 0, .42), inset 0 0 30px rgba(60, 140, 160, .045);
}
#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: 8px; color: rgba(143, 216, 232, .58);
  font-size: 10px; font-weight: 600; letter-spacing: .6px; white-space: nowrap; text-shadow: none;
}
.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: 656px; width: 302px; height: 274px;
  transform: perspective(900px) rotateY(-9deg) rotateZ(-1.2deg);
}
#ship-hud-shield { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); }
.ship-hud-hull-number {
  position: absolute; left: 50%; top: 196px; transform: translateX(-50%);
  padding: 0 13px 2px; color: var(--ship-cream); background: rgba(7, 15, 19, .85);
  border: 2px solid var(--ship-cream); font-size: 22px; font-weight: 700; letter-spacing: 2px;
  text-shadow: 0 0 6px rgba(242, 236, 216, .4);
}
.ship-hud-hull-label {
  position: absolute; left: 18px; bottom: 38px; color: #8dced9;
  font-size: 22px; font-weight: 600; letter-spacing: 2px;
}
.ship-hud-hull-bar {
  position: absolute; left: 16px; right: 16px; bottom: 16px; height: 12px;
  background: var(--ship-cream); box-shadow: 0 0 10px rgba(242, 236, 216, .35);
  transform-origin: left center;
}
#ship-hud-altitude {
  position: absolute; left: 800px; top: 132px; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 8px;
  color: rgba(143, 216, 232, .48); font-size: 10px; letter-spacing: 1.4px; text-shadow: none;
  transition: opacity .16s ease;
}
#ship-hud-altitude strong { color: rgba(242, 236, 216, .76); font-size: 15px; font-variant-numeric: tabular-nums; }
#ship-hud-altitude small { font-size: 9px; }
#ship-hud-context {
  position: absolute; left: 800px; top: 151px; transform: translateX(-50%);
  display: flex; gap: 12px;
  color: rgba(143, 216, 232, .42); font: 9px/1 "Cascadia Mono", Consolas, monospace;
  letter-spacing: .1em; text-shadow: none; transition: opacity .16s ease;
}
#sys-seed { display: none; }

.ui-walk #ship-hud-stage, body.hero-active #ship-hud-stage, .hide-hud #ship-hud-stage { display: 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: var(--ui-white); font: 700 13px/1 var(--ui-mono);
  letter-spacing: .12em; pointer-events: none;
  background: transparent; border: 0; box-shadow: none; opacity: .58;
}
#brand i { color: var(--ui-cyan); font-style: normal; }
#brand b { font-weight: 500; }
#brand small {
  position: absolute; left: 10px; top: 27px;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ui-dim); font: 8px/1 var(--ui-mono); letter-spacing: .14em;
}

/* ---- compass ------------------------------------------------------------------ */
#compass {
  position: fixed; z-index: 10; top: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; width: min(280px, 36vw);
  padding: 5px 12px;
  color: var(--ui-dim); font: 10px/1 var(--ui-mono); letter-spacing: .16em;
  pointer-events: none;
  background: var(--ui-panel); border: 1px solid var(--ui-panel-border);
}
.compass-tick { flex: 1; height: 1px; background: var(--ui-line); }
#heading-cardinal { color: var(--ui-white); font-size: 13px; }
#heading-degrees { min-width: 40px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* ---- flight telemetry: compact readout tags hugging the screen edges --------- */
#flight-telemetry {
  position: fixed; z-index: 9; inset: 0;
  pointer-events: none; color: var(--ui-white);
}
.ft-side {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 12px; min-width: 92px;
  background: var(--ui-panel); border: 1px solid var(--ui-panel-border);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
.ft-left  { left: 0;  border-left: 0;  align-items: flex-start; }
.ft-right { right: 0; border-right: 0; align-items: flex-end; text-align: right; }
.ft-label { color: var(--ui-dim); font: 600 9px/1 var(--ui-font); letter-spacing: .18em; }
.ft-side strong {
  font: 650 26px/1 var(--ui-font); font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.ft-unit { color: var(--ui-dim); font: 9px/1 var(--ui-mono); letter-spacing: .1em; }
.ft-rule { display: none; }
.ft-action {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
  color: var(--ui-dim); font: 9px/1 var(--ui-font); letter-spacing: .06em;
}
.ft-action kbd { flex: 0 0 auto; }
body.weapon-firing .ft-fire { color: var(--ui-cyan); }
body.weapon-firing #crosshair { box-shadow: 0 0 0 4px rgba(7, 17, 26, .2), 0 0 18px rgba(62, 212, 232, .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, .8);
}
#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: .8;
}

/* ---- drive telemetry (bottom-left, flight) -------------------------------------- */
/* ---- drive telemetry (bottom-left, flight): star-map panel language --------- */
#hud {
  position: fixed; z-index: 10; left: 24px; bottom: 24px;
  width: 240px; padding: 10px 12px 9px;
  color: var(--ui-white); background: var(--ui-panel);
  border: 1px solid var(--ui-panel-border); box-shadow: inset 0 1px rgba(255, 255, 255, .018);
  pointer-events: none;
}
.drive-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 7px; border-bottom: 1px solid var(--ui-line-soft); }
.drive-header span { color: var(--ui-dim); font: 600 9px/1 var(--ui-font); letter-spacing: .18em; }
.drive-header strong { color: var(--ui-white); font: 700 11px/1 var(--ui-font); letter-spacing: .08em; }
.drive-telemetry { display: grid; gap: 6px; margin-top: 8px; }
.drive-telemetry > div { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; }
.drive-telemetry label { color: var(--ui-dim); font-size: 11px; }
.drive-telemetry b { color: var(--ui-white); font: 500 11px/1 var(--ui-mono); font-variant-numeric: tabular-nums; }
.drive-telemetry i { grid-column: 1 / -1; height: 3px; overflow: hidden; background: rgba(206, 220, 220, .28); }
.drive-telemetry i span { display: block; width: 0; height: 100%; background: #dfe6e6; transition: width .12s linear; }
#drive-boost-fill { background: var(--ui-gold); }
#drive-atmo-fill { background: rgba(170, 179, 180, .8); }
.hud-system { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--ui-line-soft); }
#sys-name { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
#sys-catalog, #cosmic-time { color: var(--ui-dim); font: 9px/1.4 var(--ui-mono); }
#cosmic-time { text-align: right; }
#sys-planets, #sys-seed { color: rgba(170, 179, 180, .62); font: 9px/1.4 var(--ui-mono); }

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

/* ---- ship integrity (bottom-right, flight) ------------------------------------ */
#ship-integrity {
  position: fixed; z-index: 10; right: 24px; bottom: 24px;
  width: 200px; min-height: 76px; padding: 10px 12px;
  background: var(--ui-panel);
  border: 1px solid var(--ui-panel-border); box-shadow: inset 0 1px rgba(255, 255, 255, .018);
  pointer-events: none;
}
.integrity-copy { display: flex; justify-content: space-between; align-items: baseline; }
.integrity-copy strong { color: var(--ui-dim); font-size: 11px; }
.integrity-copy strong b { color: var(--ui-white); font: 700 16px/1 var(--ui-mono); font-variant-numeric: tabular-nums; }
.integrity-copy span { color: rgba(170, 179, 180, .52); font: 8px/1 var(--ui-mono); letter-spacing: .08em; }
.integrity-line { position: absolute; left: 12px; right: 12px; top: 36px; height: 3px; background: rgba(206, 220, 220, .28); }
.integrity-line i { display: block; width: var(--level); height: 100%; background: var(--ui-gold); }
.ship-status { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; justify-content: space-between; color: var(--ui-dim); font-size: 10px; }
.ship-status b { color: var(--ui-white); font-weight: 500; }

#star-map-btn {
  position: fixed; z-index: 13; left: 24px; top: 76px;
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  color: var(--ui-dim); background: transparent;
  border: 0; opacity: .62;
  cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  transition: background .14s ease, color .14s ease;
}
#star-map-btn:hover { color: var(--ui-white); background: rgba(62, 212, 232, .06); opacity: 1; }

/* ---- committed route: quiet world marker + contextual travel choice -------- */
#destination-marker {
  position: fixed; z-index: 12; left: 0; top: 0; min-width: 108px; padding: 5px 8px 5px 28px;
  color: rgba(225, 241, 240, .76); background: linear-gradient(90deg, rgba(7, 17, 26, .7), transparent);
  border-top: 1px solid rgba(62, 212, 232, .23); pointer-events: none;
  font: 9px/1.25 var(--ui-mono); letter-spacing: .08em; transform: translate(-50%, -50%);
  transition: opacity .22s ease;
}
#destination-marker i {
  position: absolute; left: 5px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%) rotate(45deg);
  border: 1px solid rgba(62, 212, 232, .66); box-shadow: inset 0 0 8px rgba(62, 212, 232, .08), 0 0 9px rgba(62, 212, 232, .12);
}
#destination-marker i::after { content: ""; position: absolute; inset: 4px; background: var(--ui-cyan); opacity: .72; }
#destination-marker span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 165px; }
#destination-marker small { color: rgba(147, 168, 169, .62); font: 8px/1 var(--ui-mono); }
#destination-marker.is-behind { opacity: .48; }

#route-choice {
  --route-cyan: #82c7d2;
  --route-cream: #ece8d4;
  position: fixed; z-index: 20; left: 50%; top: 48%;
  width: min(900px, calc(100vw - 64px)); transform: translate(-50%, -50%);
  color: rgba(225, 235, 235, .82); background: transparent; border: 0;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, .34));
  animation: route-choice-enter .3s cubic-bezier(.18, .78, .2, 1) both;
}
#route-choice::before {
  content: ''; position: fixed; z-index: -2; inset: -60vh -60vw; pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(3, 12, 17, .08) 0 22%, rgba(2, 8, 12, .48) 64%, rgba(1, 5, 8, .78) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, .24), transparent 24%, transparent 76%, rgba(0, 0, 0, .24));
  backdrop-filter: blur(.7px) saturate(.72);
}
#route-choice::after {
  content: '1 / 2  选择航行协议    ·    ESC  取消';
  position: absolute; left: 50%; bottom: -40px; transform: translateX(-50%);
  color: rgba(130, 199, 210, .46); font: 8px/1 var(--ui-mono); letter-spacing: .2em;
  white-space: nowrap; text-shadow: 0 1px 5px #000;
}
#route-choice > header {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 78px; padding: 0 72px 22px; border: 0; text-align: center;
}
#route-choice > header::after {
  content: ''; position: absolute; left: 15%; right: 15%; bottom: 7px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(130, 199, 210, .38) 22%, rgba(236, 232, 212, .62) 50%, rgba(130, 199, 210, .38) 78%, transparent);
}
#route-choice > header div { min-width: 0; display: grid; justify-items: center; gap: 9px; }
#route-choice > header span { color: rgba(130, 199, 210, .55); font: 600 9px/1 var(--ui-mono); letter-spacing: .38em; }
#route-choice > header strong {
  min-width: 0; max-width: 690px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--route-cream); font: 600 clamp(21px, 2.4vw, 30px)/1.12 var(--ui-font);
  letter-spacing: .12em; text-shadow: 0 0 18px rgba(130, 199, 210, .14);
}
#route-cancel-btn {
  position: absolute; right: 23px; top: 4px; width: 34px; height: 34px;
  color: rgba(130, 199, 210, .42); background: transparent; border: 0; cursor: pointer;
  font: 300 22px/1 var(--ui-mono); transition: color .15s ease, transform .15s ease;
}
#route-cancel-btn:hover, #route-cancel-btn:focus-visible { color: var(--route-cream); outline: 0; transform: rotate(90deg); }
.route-choice-actions {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  padding: 10px 0; background: transparent;
}
.route-choice-actions::before {
  content: ''; position: absolute; z-index: 2; left: 50%; top: 50%; width: 18px; height: 18px;
  transform: translate(-50%, -50%) rotate(45deg); border: 1px solid rgba(236, 232, 212, .64);
  background: rgba(4, 13, 17, .86); box-shadow: 0 0 16px rgba(130, 199, 210, .2);
}
.route-choice-actions::after {
  content: ''; position: absolute; left: 50%; top: 18%; bottom: 18%; width: 1px;
  background: linear-gradient(transparent, rgba(130, 199, 210, .26), transparent);
}
.route-choice-actions > button {
  position: relative; min-height: 188px; padding: 28px 48px 25px 34px;
  display: grid; grid-template-columns: 72px 1fr; gap: 24px; align-items: center;
  color: rgba(202, 222, 224, .72); text-align: left;
  background:
    linear-gradient(90deg, rgba(130, 199, 210, .5), rgba(130, 199, 210, .5)) left top / 52% 1px no-repeat,
    linear-gradient(90deg, rgba(130, 199, 210, .36), transparent 76%) left bottom / 82% 1px no-repeat,
    linear-gradient(120deg, rgba(15, 38, 45, .76), rgba(5, 15, 20, .46) 62%, rgba(5, 15, 20, .08));
  border: 0; border-left: 2px solid rgba(130, 199, 210, .62); cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 50%, calc(100% - 30px) 100%, 0 100%, 12px 50%);
  transition: color .18s ease, filter .18s ease, transform .18s cubic-bezier(.18, .78, .2, 1);
}
.route-choice-actions > button:nth-child(2) {
  padding: 28px 34px 25px 48px; text-align: right; grid-template-columns: 1fr 72px;
  background:
    linear-gradient(270deg, rgba(130, 199, 210, .5), rgba(130, 199, 210, .5)) right top / 52% 1px no-repeat,
    linear-gradient(270deg, rgba(130, 199, 210, .36), transparent 76%) right bottom / 82% 1px no-repeat,
    linear-gradient(240deg, rgba(15, 38, 45, .76), rgba(5, 15, 20, .46) 62%, rgba(5, 15, 20, .08));
  border-left: 0; border-right: 2px solid rgba(130, 199, 210, .62);
  clip-path: polygon(30px 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 30px 100%, 0 50%);
}
.route-choice-actions > button:nth-child(2) .route-method-glyph { grid-column: 2; grid-row: 1; }
.route-choice-actions > button:nth-child(2) span { grid-column: 1; grid-row: 1; }
.route-choice-actions > button:hover, .route-choice-actions > button:focus-visible {
  color: var(--route-cream); filter: brightness(1.32) drop-shadow(0 0 18px rgba(130, 199, 210, .16));
  transform: translateX(-6px); outline: 0;
}
.route-choice-actions > button:nth-child(2):hover,
.route-choice-actions > button:nth-child(2):focus-visible { transform: translateX(6px); }
.route-choice-actions > button span { min-width: 0; }
.route-choice-actions small { display: block; margin-bottom: 10px; color: rgba(130, 199, 210, .52); font: 8px/1 var(--ui-mono); letter-spacing: .2em; }
.route-choice-actions b { display: block; color: rgba(236, 232, 212, .92); font-size: 21px; font-weight: 650; letter-spacing: .12em; }
.route-choice-actions em { display: block; margin-top: 11px; color: rgba(160, 186, 189, .58); font: normal 10px/1.5 var(--ui-font); letter-spacing: .04em; }
.route-choice-actions kbd {
  position: absolute; top: 17px; right: 27px; min-width: 25px; padding: 5px 7px;
  color: rgba(236, 232, 212, .68); background: rgba(0, 0, 0, .18);
  border-color: rgba(130, 199, 210, .3); font-size: 9px; text-align: center;
}
.route-choice-actions > button:nth-child(2) kbd { right: auto; left: 27px; }
.route-method-glyph { position: relative; width: 64px; height: 64px; display: block; }
.warp-glyph::before, .warp-glyph::after { content: ""; position: absolute; left: 4px; right: 4px; border-top: 2px solid var(--route-cyan); transform: skewX(-28deg); }
.warp-glyph::before { top: 21px; box-shadow: 9px 11px rgba(130, 199, 210, .42), 18px 22px rgba(130, 199, 210, .18); }
.warp-glyph::after { top: 12px; left: 35px; width: 19px; height: 19px; border-right: 2px solid var(--route-cream); transform: rotate(45deg); }
.rift-glyph { border: 1px solid rgba(130, 199, 210, .66); border-radius: 48% 55% 44% 58%; box-shadow: inset 0 0 18px rgba(130, 199, 210, .16), 0 0 18px rgba(130, 199, 210, .12); transform: rotate(-8deg); }
.rift-glyph::before { content: ""; position: absolute; inset: 11px 5px 13px 9px; border: 2px solid rgba(130, 199, 210, .72); border-radius: 56% 43% 59% 40%; }
.rift-glyph::after { content: ""; position: absolute; left: 29px; top: -8px; width: 1px; height: 80px; background: linear-gradient(transparent, rgba(236, 232, 212, .88), transparent); transform: rotate(17deg); }

body.route-choice-active #ship-hud-stage,
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%, -46%) scale(.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #route-choice { animation: none; }
  .route-choice-actions > button { transition: none; }
}

#resource-strip {
  position: fixed; z-index: 10; right: 24px; bottom: 112px; display: flex; gap: 6px;
  color: var(--ui-dim); font: 9px/1 var(--ui-mono); pointer-events: none;
}
#resource-strip span, #resource-strip strong {
  padding: 5px 8px; background: var(--ui-panel); border: 1px solid var(--ui-panel-border);
}
#resource-strip b { color: var(--ui-white); font-weight: 500; }
#resource-strip strong { color: var(--ui-gold); font-weight: 500; }
#resource-strip strong small { margin-left: 4px; color: rgba(170, 179, 180, .4); font: 8px/1 var(--ui-mono); letter-spacing: .08em; }
#resource-strip .pulse-recharging { color: var(--ui-cyan); }

/* ---- walk mode: the survey watch replaces the flight instruments ------------------ */
#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: .55; }
#walk-hud {
  position: fixed; z-index: 10;
  left: max(14px, env(safe-area-inset-left)); bottom: max(14px, 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 7px 25px rgba(0, 4, 10, .62)); }
#surface-weapon { display: none; position: fixed; z-index: 10; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); min-width: 232px; padding: 10px 12px 9px; border: 1px solid var(--ui-panel-border); background: var(--ui-panel); color: var(--ui-white); font-family: var(--ui-font, monospace); text-align: right; pointer-events: none; box-shadow: inset 0 1px rgba(255, 255, 255, .018); }
.surface-weapon-label { color: var(--ui-dim); font-size: 9px; letter-spacing: .18em; }
.surface-weapon-ammo { margin-top: 2px; font: 650 22px/1 var(--ui-font); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.surface-weapon-slots { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; color: var(--ui-dim); font: 9px/1 var(--ui-mono); letter-spacing: .08em; }
.surface-weapon-slots .active { color: var(--ui-green); }
#surface-weapon.mining-laser .surface-weapon-label, #surface-weapon.mining-laser .surface-weapon-ammo, #surface-weapon.mining-laser .surface-weapon-slots .active { color: var(--ui-cyan); }
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: 25px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 9px; pointer-events: none;
}
#hint {
  padding: 0; color: rgba(150, 210, 225, .45); background: transparent; border: 0;
  font: 600 max(8px, calc(15px * var(--ship-hud-scale, .66)))/1.5 var(--ui-font);
  letter-spacing: max(1px, calc(2px * var(--ship-hud-scale, .66)));
  text-shadow: 0 1px 3px #000; transition: opacity .6s; white-space: nowrap;
}
#hint b { color: inherit; font-weight: 600; }
#hint.hint-faded { opacity: 0; }
#land-btn {
  pointer-events: auto; min-width: 240px; padding: 11px 18px; color: var(--ui-white); background: var(--ui-panel);
  border: 1px solid var(--ui-panel-border); cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  transition: background .14s ease, border-color .14s ease;
}
#land-btn:hover { background: rgba(62, 212, 232, .12); border-color: rgba(62, 212, 232, .4); }

#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: 18px; top: 18px; max-width: min(340px, 72vw); padding: 9px 12px;
  color: rgba(238, 243, 243, .8); background: var(--ui-panel); border: 1px solid var(--ui-panel-border);
  font: 10px/1.5 var(--ui-font); 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, .travel-cinematic #ship-hud-stage { display: none !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: min(320px, 54vw); height: 1px; margin-bottom: 5px;
  background: linear-gradient(90deg, transparent, rgba(62, 212, 232, .82), transparent);
}
#arrival-title.arrival-visible { opacity: 1; filter: blur(0); transform: translate(-50%, 0); }
#arrival-kicker { color: rgba(62, 212, 232, .82); font: 9px/1 var(--ui-mono); letter-spacing: .48em; }
#arrival-name { font: 500 clamp(27px, 4vw, 48px)/1.12 var(--ui-font); letter-spacing: .18em; }
#arrival-system { color: rgba(224, 237, 235, .58); font: 10px/1.2 var(--ui-mono); letter-spacing: .2em; }

/* ---- loading / hero / pause --------------------------------------------------------- */
#loading { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; background: #03090c; transition: opacity .6s; }
.loading-inner { width: 230px; color: var(--ui-dim); text-align: center; }
.loading-ring { height: 2px; background: #263436; overflow: hidden; position: relative; }
.loading-ring::after {
  content: ""; position: absolute; inset: 0; background: #dfe7e7;
  transform-origin: left; transform: scaleX(var(--loading-progress, 0));
}
#loading-text { margin-top: 14px; font: 700 13px/1 var(--ui-font); letter-spacing: 5px; color: var(--ui-white); }

/* ---- full-page hero / start screen ------------------------------------------- */
#hero-overlay {
  position: fixed; z-index: 48; inset: 0; overflow: hidden;
  background: linear-gradient(90deg, rgba(5, 10, 15, .92) 0%, rgba(5, 10, 15, .55) 34%, rgba(5, 10, 15, 0) 58%);
  transition: opacity .55s ease;
}
#hero-overlay.hero-leaving { opacity: 0; pointer-events: none; }
/* 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 #compass, body.hero-active #flight-telemetry,
body.hero-active #hud, body.hero-active #ship-integrity, body.hero-active #star-map-btn,
body.hero-active #destination-marker, body.hero-active #route-choice,
body.hero-active #resource-strip, 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-frame { position: absolute; inset: 22px; pointer-events: none; border-top: 1px solid var(--ui-line-soft); border-bottom: 1px solid var(--ui-line-soft); }
.hero-corner { position: absolute; width: 22px; height: 22px; border-color: rgba(62, 212, 232, .4); }
.hero-corner-nw { left: 0; top: 0; border-left: 1px solid; border-top: 1px solid; }
.hero-corner-ne { right: 0; top: 0; border-right: 1px solid; border-top: 1px solid; }
.hero-corner-sw { left: 0; bottom: 0; border-left: 1px solid; border-bottom: 1px solid; }
.hero-corner-se { right: 0; bottom: 0; border-right: 1px solid; border-bottom: 1px solid; }

.hero-topline, .hero-bottomline {
  position: absolute; z-index: 2; left: 50px; right: 50px;
  display: flex; justify-content: space-between; gap: 18px;
  color: rgba(222, 239, 237, .48); font: 9px/1.4 var(--ui-mono); letter-spacing: .16em; text-transform: uppercase;
}
.hero-topline { top: 40px; justify-content: flex-start; gap: 26px; }
.hero-bottomline { bottom: 40px; }
.hero-topline b, .hero-bottomline b { color: var(--ui-white); font-weight: 500; }

/* wordmark: layered DEEP SPACE identity, top-left */
.hero-wordmark { position: absolute; z-index: 2; left: 50px; top: 96px; display: flex; flex-direction: column; align-items: flex-start; }
.hero-wordmark-eyebrow { color: var(--ui-cyan); font: 600 10px/1 var(--ui-mono); letter-spacing: .3em; }
.hero-wordmark-main {
  margin: 14px 0 0 -4px; font: 200 clamp(56px, 7.4vw, 108px)/.94 var(--ui-font);
  letter-spacing: .18em; color: var(--ui-white);
  text-shadow: 0 0 38px rgba(62, 212, 232, .12);
}
.hero-wordmark-cn { margin-top: 12px; color: var(--ui-dim); font: 400 15px/1 var(--ui-font); letter-spacing: .9em; }
.hero-wordmark-rule { width: 72px; height: 2px; margin-top: 20px; background: var(--ui-cyan); box-shadow: 0 0 10px rgba(62, 212, 232, .4); }

/* menu: clean vertical command list with a single left accent line */
.hero-menu { position: absolute; z-index: 2; left: 50px; top: 54%; transform: translateY(-50%); display: grid; gap: 10px; width: min(320px, 40vw); }
.hero-menu-item {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 15px 13px 20px; text-align: left; cursor: pointer;
  color: var(--ui-white); background: var(--ui-panel);
  border: 1px solid var(--ui-panel-border);
  box-shadow: inset 0 1px rgba(255, 255, 255, .018);
  transition: background .16s ease, border-color .16s ease, transform .16s ease, opacity .16s ease;
}
.hero-menu-item::before {
  content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px;
  background: rgba(62, 212, 232, .35); box-shadow: 0 0 10px rgba(62, 212, 232, .15);
  transition: background .16s ease, box-shadow .16s ease, top .16s ease, bottom .16s ease;
}
.hero-menu-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hero-menu-eyebrow { color: rgba(170, 179, 180, .72); font: 600 8px/1 var(--ui-font); letter-spacing: .22em; text-transform: uppercase; }
.hero-menu-label { font-size: 15px; font-weight: 650; letter-spacing: .08em; color: var(--ui-white); }
.hero-menu-item kbd { flex: 0 0 auto; color: rgba(238, 243, 243, .55); background: rgba(7, 17, 26, .45); border-color: rgba(203, 214, 214, .14); }
.hero-menu-item:hover:not(:disabled), .hero-menu-item:focus-visible {
  background: rgba(62, 212, 232, .1); border-color: rgba(62, 212, 232, .38);
  outline: 0; transform: translateX(4px);
}
.hero-menu-item:hover:not(:disabled)::before, .hero-menu-item:focus-visible::before {
  top: 6px; bottom: 6px; background: var(--ui-cyan); box-shadow: 0 0 14px rgba(62, 212, 232, .55);
}
.hero-menu-item:disabled {
  opacity: .72; cursor: not-allowed;
  background: rgba(7, 17, 26, .55); border-color: rgba(182, 198, 201, .1);
}
.hero-menu-item:disabled::before { background: rgba(170, 179, 180, .22); box-shadow: none; }
.hero-menu-item:disabled .hero-menu-eyebrow { color: rgba(170, 179, 180, .55); }
.hero-menu-item:disabled .hero-menu-label { color: rgba(238, 243, 243, .62); }
.hero-menu-item:disabled kbd { color: rgba(238, 243, 243, .38); border-color: rgba(203, 214, 214, .1); }
#hero-start-btn { background: rgba(62, 212, 232, .1); border-color: rgba(62, 212, 232, .32); }
#hero-start-btn::before { background: var(--ui-cyan); box-shadow: 0 0 14px rgba(62, 212, 232, .45); }
#hero-start-btn .hero-menu-label { font-size: 16px; font-weight: 700; letter-spacing: .1em; }
#hero-start-btn kbd { color: var(--ui-cyan); border-color: rgba(62, 212, 232, .35); background: rgba(62, 212, 232, .08); }
.hero-note { position: absolute; z-index: 2; left: 50px; top: calc(54% + 152px); color: rgba(238, 243, 243, .38); font: 9px/1 var(--ui-mono); letter-spacing: .1em; }


#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: the world stays live behind a blurred plate ---------- */
#pause-overlay {
  position: fixed; z-index: 45; inset: 0;
  background: linear-gradient(90deg, rgba(5, 10, 15, .72), rgba(5, 10, 15, .38) 46%, rgba(5, 10, 15, .18));
  backdrop-filter: blur(14px) saturate(.72) brightness(.72);
}
.pause-panel {
  position: absolute; left: clamp(22px, 6vw, 96px); top: 50%; transform: translateY(-50%);
  width: min(560px, 88vw); padding: 0; color: var(--ui-white);
  background: none; border: 0; box-shadow: none;
}
.pause-header { display: flex; justify-content: space-between; align-items: end; }
.pause-titleblock { display: flex; flex-direction: column; align-items: flex-start; }
.pause-eyebrow { color: var(--ui-cyan); font: 600 9px/1 var(--ui-mono); letter-spacing: .26em; }
.pause-panel h2 { margin-top: 14px; font-size: clamp(40px, 5vw, 64px); font-weight: 250; letter-spacing: .14em; line-height: 1.04; }
.pause-titlerule { width: 64px; height: 2px; margin-top: 18px; background: var(--ui-cyan); box-shadow: 0 0 10px rgba(62, 212, 232, .4); }
.pause-state { display: grid; grid-template-columns: auto auto; gap: 5px 10px; align-items: center; color: var(--ui-dim); font-size: 10px; }
.pause-state i { grid-row: 1 / 3; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-gold); box-shadow: 0 0 10px rgba(233, 200, 133, .65); }
.pause-state b { font: 500 10px/1 var(--ui-mono); color: var(--ui-white); }
.pause-actions { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 34px; }
.pause-actions section { display: grid; gap: 6px; align-content: start; }
.pause-time { margin-top: 16px; }
.pause-time header { display: flex; justify-content: space-between; padding: 0 2px 7px; color: var(--ui-dim); font-size: 10px; letter-spacing: .12em; }
.pause-time header small { color: rgba(170, 179, 180, .52); font: 8px/1 var(--ui-mono); }
.pause-actions button {
  width: 100%; min-height: 50px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; color: var(--ui-white); text-align: left;
  background: var(--ui-panel); border: 1px solid var(--ui-panel-border);
  box-shadow: inset 0 1px rgba(255, 255, 255, .018);
  cursor: pointer; font-size: 12px; letter-spacing: .06em; transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.pause-actions button > span { flex: 1; }
.pause-actions button small { display: block; margin-bottom: 4px; color: var(--ui-dim); font: 8px/1 var(--ui-font); letter-spacing: .14em; text-transform: uppercase; }
.pause-actions button > b { color: rgba(237, 245, 244, .45); font: 400 15px/1 var(--ui-mono); }
.pause-actions .pause-resume { min-height: 64px; background: rgba(62, 212, 232, .12); border-color: rgba(62, 212, 232, .3); font-size: 15px; }
.pause-actions button:hover, .pause-actions button:focus-visible {
  background: rgba(62, 212, 232, .11); border-color: rgba(62, 212, 232, .34); outline: 0; transform: translateX(2px);
}
.event-glyph { position: relative; flex: 0 0 22px; width: 22px; height: 22px; border: 1px solid rgba(218, 235, 233, .36); border-radius: 50%; overflow: hidden; }
.event-glyph::before { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1px; background: rgba(218, 235, 233, .5); }
.event-glyph.sunrise::after, .event-glyph.sunset::after { content: ""; position: absolute; left: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-gold); box-shadow: 0 0 8px rgba(233, 200, 133, .55); }
.event-glyph.sunset::after { top: 12px; }
.event-glyph.eclipse::after { content: ""; position: absolute; left: 5px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #071116; box-shadow: 3px -2px 0 var(--ui-warn); }
.pause-panel footer { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; padding-top: 13px; border-top: 1px solid var(--ui-line-soft); color: rgba(170, 179, 180, .58); font: 9px/1.4 var(--ui-mono); letter-spacing: .06em; }
.pause-panel footer b { color: var(--ui-dim); font-weight: 500; }
.pause-panel.is-acquiring .pause-state i { background: var(--ui-cyan); animation: control-pulse .75s ease-in-out infinite alternate; }
@keyframes control-pulse { to { opacity: .3; box-shadow: 0 0 18px rgba(62, 212, 232, .8); } }

#time-warp-indicator {
  position: fixed; z-index: 22; left: 50%; top: 72px; width: min(340px, 72vw); padding: 9px 13px 10px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
  color: var(--ui-white); background: var(--ui-panel);
  border: 1px solid var(--ui-panel-border); transform: translateX(-50%); pointer-events: none;
}
#time-warp-indicator > span { color: var(--ui-gold); font: 8px/1 var(--ui-mono); letter-spacing: .16em; }
#time-warp-indicator strong { font-size: 11px; font-weight: 600; letter-spacing: .1em; }
#time-warp-indicator > i { grid-column: 1 / 3; height: 2px; overflow: hidden; background: var(--ui-line-soft); }
#time-warp-progress { display: block; width: 0; height: 100%; background: var(--ui-gold); box-shadow: 0 0 8px rgba(233, 200, 133, .5); }
#time-warp-rate { grid-column: 3; grid-row: 1 / 3; color: var(--ui-white); font: 10px/1 var(--ui-mono); }

#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; }

#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: 28px; bottom: calc(min(250px, 24vw, 30vh) + 24px); width: 116px; height: 116px; border: 1px solid rgba(235, 240, 236, .38); border-radius: 50%; background: rgba(3, 12, 17, .25); pointer-events: auto; touch-action: none; }
#joystick-knob { position: absolute; left: 34px; top: 34px; width: 48px; height: 48px; border: 1px solid var(--ui-cyan); border-radius: 50%; background: rgba(62, 160, 176, .22); }
@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 #compass, .hide-hud #flight-telemetry, .hide-hud #hud, .hide-hud #ship-integrity,
.hide-hud #resource-strip, .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) {
  .ft-side strong { font-size: 32px; }
  #hud { width: 250px; left: 14px; bottom: 14px; }
  #ship-integrity { right: 14px; bottom: 14px; width: 210px; }
  #resource-strip { right: 14px; bottom: 110px; }
  #walk-hud { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); width: min(190px, 32vw, 25vh); }
  #joystick { bottom: calc(min(210px, 38vw, 30vh) + 20px); }
}

@media (max-width: 640px) {
  #brand { top: 12px; left: 12px; transform: scale(.86); transform-origin: top left; }
  #compass { top: 18px; width: 190px; }
  #star-map-btn { left: auto; right: 12px; top: 13px; }
  #star-map-btn span { display: none; }
  .ft-side { padding: 10px 12px; min-width: 96px; }
  .ft-side strong { font-size: 24px; }
  .ft-action { display: none; }
  .ft-rule { width: 38px; }
  #hud { left: 8px; bottom: 7px; width: 54vw; padding: 8px 10px; }
  .drive-header { padding-bottom: 5px; }
  .drive-telemetry { gap: 5px; margin-top: 6px; }
  .drive-telemetry > div:nth-child(3), .hud-system { display: none; }
  #ship-integrity { right: 8px; bottom: 7px; width: 38vw; min-height: 72px; padding: 8px 9px; }
  .integrity-copy span { display: none; }
  .integrity-line { left: 9px; right: 9px; top: 32px; }
  .ship-status { left: 9px; right: 9px; bottom: 9px; }
  #resource-strip { display: none; }
  #route-choice { left: 50%; right: auto; top: 48%; width: min(620px, calc(100vw - 20px)); transform: translate(-50%, -50%); }
  #route-choice::after { bottom: -31px; font-size: 7px; letter-spacing: .15em; }
  #route-choice > header { min-height: 66px; padding: 0 48px 16px; }
  #route-choice > header div { gap: 7px; }
  #route-choice > header span { font-size: 7px; letter-spacing: .28em; }
  #route-choice > header strong { max-width: 500px; font-size: clamp(18px, 4vw, 23px); }
  #route-cancel-btn { right: 8px; top: 0; }
  .route-choice-actions { gap: 10px; padding: 7px 0; }
  .route-choice-actions > button {
    min-height: 142px; padding: 20px 34px 18px 21px;
    grid-template-columns: 48px 1fr; gap: 13px;
  }
  .route-choice-actions > button:nth-child(2) { padding: 20px 21px 18px 34px; grid-template-columns: 1fr 48px; }
  .route-method-glyph { width: 44px; height: 44px; }
  .warp-glyph::before { top: 15px; box-shadow: 6px 8px rgba(130, 199, 210, .42), 12px 16px rgba(130, 199, 210, .18); }
  .warp-glyph::after { top: 8px; left: 24px; width: 13px; height: 13px; }
  .rift-glyph::before { inset: 8px 4px 9px 6px; }
  .rift-glyph::after { left: 20px; top: -5px; height: 54px; }
  .route-choice-actions small { margin-bottom: 7px; font-size: 7px; letter-spacing: .14em; }
  .route-choice-actions b { font-size: 16px; }
  .route-choice-actions em { margin-top: 8px; font-size: 8px; }
  .route-choice-actions kbd { top: 12px; right: 20px; min-width: 20px; padding: 3px 5px; }
  .route-choice-actions > button:nth-child(2) kbd { left: 20px; }
  #destination-marker span { max-width: 116px; }
  #bottom { bottom: 88px; }
  #hint { max-width: 84vw; 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); }
  #joystick { bottom: calc(min(174px, 42vw, 27vh) + 16px); }
  .hero-frame { inset: 10px; }
  .hero-topline { left: 22px; top: 22px; }
  .hero-bottomline { left: 22px; right: 22px; bottom: 22px; }
  .hero-bottomline span:nth-child(2) { display: none; }
  .hero-wordmark { left: 22px; top: 74px; }
  .hero-wordmark-main { font-size: clamp(44px, 13vw, 72px); }
  .hero-menu { left: 22px; width: calc(100vw - 44px); }
  .hero-note { left: 22px; }
  .pause-panel { left: 16px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; }
  .pause-panel h2 { font-size: 34px; }
  .pause-state { display: none; }
  .pause-actions { margin-top: 22px; }
  .pause-actions .pause-resume { min-height: 60px; }
}

@media (max-width: 480px) {
  #route-choice { top: 50%; width: calc(100vw - 24px); }
  #route-choice > header { min-height: 58px; padding-bottom: 13px; }
  #route-choice > header strong { max-width: 310px; font-size: 17px; }
  .route-choice-actions { grid-template-columns: 1fr; gap: 12px; }
  .route-choice-actions::before, .route-choice-actions::after { display: none; }
  .route-choice-actions > button,
  .route-choice-actions > button:nth-child(2) {
    min-height: 112px; padding: 17px 40px 15px 24px; grid-template-columns: 46px 1fr;
    text-align: left; border-left: 2px solid rgba(130, 199, 210, .62); border-right: 0;
    clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 50%, calc(100% - 22px) 100%, 0 100%, 9px 50%);
  }
  .route-choice-actions > button:nth-child(2) .route-method-glyph { grid-column: 1; }
  .route-choice-actions > button:nth-child(2) span { grid-column: 2; text-align: left; }
  .route-choice-actions > button:nth-child(2) kbd { left: auto; right: 17px; }
  .route-choice-actions em { display: none; }
  .route-choice-actions > button:hover,
  .route-choice-actions > button:nth-child(2):hover,
  .route-choice-actions > button:focus-visible,
  .route-choice-actions > button:nth-child(2):focus-visible { transform: translateX(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .pause-panel.is-acquiring .pause-state i { animation: none; }
  .pause-actions button { transition: none; }
}

#black-hole-observatory {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: #010204;
  color: #f4eee7;
}
#black-hole-observatory.hidden { display: none; }
#black-hole-frame { width: 100%; height: 100%; border: 0; background: #010204; }
.black-hole-chrome { position: absolute; inset: 0; pointer-events: none; padding: 28px 34px; display: flex; flex-direction: column; justify-content: space-between; }
.black-hole-chrome header { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; align-items: start; }
.black-hole-chrome header > span { color: #e6a562; font: 600 11px/1.2 ui-monospace, monospace; letter-spacing: .18em; }
.black-hole-chrome h2 { grid-column: 1; margin: 0; font: 500 clamp(22px, 3vw, 42px)/1.1 system-ui, sans-serif; letter-spacing: .04em; }
.black-hole-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; pointer-events: auto; }
.black-hole-chrome button { pointer-events: auto; border: 1px solid #cf9b68aa; background: #08090bb8; color: #fff4e6; padding: 11px 14px; cursor: pointer; }
#black-hole-slingshot { background: #9b5622d9; border-color: #efb16f; }
.black-hole-chrome kbd { margin-left: 8px; color: #e6a562; }
.black-hole-readouts { align-self: flex-end; display: grid; grid-template-columns: repeat(2, minmax(130px, 190px)); gap: 1px; background: #b27d4c55; }
.black-hole-readouts span { display: flex; flex-direction: column; padding: 12px 14px; background: #050608c9; backdrop-filter: blur(10px); }
.black-hole-readouts small { color: #bb9b7c; font: 10px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.black-hole-readouts b { margin-top: 4px; font: 500 17px/1.2 ui-monospace, monospace; }
.black-hole-chrome footer { display: flex; justify-content: space-between; gap: 18px; color: #b7aaa0; font: 10px/1.3 ui-monospace, monospace; letter-spacing: .08em; }
.black-hole-chrome footer b { color: #e6a562; }
body.black-hole-mode > :not(#black-hole-observatory):not(script) { visibility: hidden; }

@media (max-width: 680px) {
  .black-hole-chrome { padding: 16px; }
  .black-hole-chrome header { grid-template-columns: 1fr; }
  .black-hole-actions { grid-column: 1; grid-row: auto; justify-self: start; }
  .black-hole-readouts { grid-template-columns: repeat(2, minmax(110px, 1fr)); width: 100%; }
  .black-hole-chrome footer span { display: none; }
}
