/* Orion — precision optical-instrument console */

:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --ink: #e5e2dc;
  --ink-dim: #a5a39e;
  --line: rgba(163,163,163, 0.20);
  --line-hi: rgba(189,189,189, 0.52);
  --accent: #e5e2dc;

  --attention: #f0eee8;
  --attention-dim: rgba(164,164,164, 0.45);
  --warning: #f0eee8;
  --orbital: #b5b3ae;
  --panel: rgba(13,13,13, 0.94);
  --ui-surface: #0d0d0d;
  --ui-text: var(--ink);
  --ui-muted: var(--ink-dim);
  --gut: 12px;      /* every panel's inset from the viewport edge */
  --miniPx: 240px;                      /* #minimap, CSS px */
  --barH: calc(var(--miniPx) + 12px);   /* + 5px padding and 1px border each side */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --disp: "Chakra Petch", "IBM Plex Mono", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: var(--disp); font-size: 13px; color: var(--ink); cursor: crosshair;
  /* dragging to look must never smear a text selection across the HUD */
  user-select: none; -webkit-user-select: none;
}
input, select, .modalcard { user-select: text; -webkit-user-select: text; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }

/* An opacity on the HUD ancestor isolates the frost from the scene until the
   transition ends. Reveal chrome separately and leave its backdrop at full opacity. */
#hud > :not(#flightInstruments) { transition: opacity .8s ease; }
#splash:not(.gone) ~ #hud > :not(#flightInstruments) { opacity: 0; }
#splash:not(.gone) ~ #hud > #flightInstruments { visibility: hidden; }
#flightInstruments > * { transition: opacity .8s ease; }
#splash:not(.gone) ~ #hud #flightInstruments > * { opacity: 0; }
body.flight-entering #hud > :not(#flightInstruments),
body.flight-entering #flightInstruments > * { opacity: 0; transition: none; }
body.flight-entering #flightInstruments { visibility: hidden; }

#splash {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: clamp(30px, 5.5vmin, 64px);

  background:
    radial-gradient(ellipse 62% 38% at 50% 47%,
      rgba(5,5,5,0.58) 0%, rgba(5,5,5,0.40) 46%, rgba(5,5,5,0.12) 78%, rgba(5,5,5,0.00) 100%),
    linear-gradient(178deg,
      rgba(5,5,5,0.58) 0%, rgba(5,5,5,0.52) 30%, rgba(5,5,5,0.42) 52%,
      rgba(5,5,5,0.28) 72%, rgba(5,5,5,0.16) 88%, rgba(5,5,5,0.10) 100%);
  transition: opacity 0.7s ease, visibility 0.7s;
}

@property --frost {
  syntax: "<length>";
  inherits: true;          /* #splash::before reads it by inheritance */
  initial-value: 4px;      /* the resting blur radius — see the frost block */
}

#splash::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  backdrop-filter: blur(var(--frost, 4px));
  -webkit-backdrop-filter: blur(var(--frost, 4px));
}

#splash.gone {
  opacity: 0; visibility: hidden; pointer-events: none;
  --frost: 0px;

  transition: opacity 2.6s ease-in-out 0.3s, visibility 4.4s,
              --frost 4.0s cubic-bezier(0.33, 0, 0.15, 1) 0.2s;
}
#splash.gone .splashInner,
#splash.gone #titleOrrery,
#splash.gone .reticleMarks {

  opacity: 0; transition: opacity 1.2s cubic-bezier(0.33, 0, 0.15, 1);
}

#titleOrrery {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;

  opacity: 1;
}

.reticleMarks { position: absolute; inset: clamp(14px, 3.2vmin, 34px); pointer-events: none; }
.reticleMarks i {
  position: absolute; width: 18px; height: 18px;
  border: 0 solid rgba(206,206,206, 0.35);
}
.reticleMarks i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.reticleMarks i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.reticleMarks i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.reticleMarks i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

.splashInner {
  /* Anchor the second O to the Sun before any startup JavaScript runs.
     Its opening is at (181.2, 47.5) in the 346 × 96 title artwork. */
  --title-width: min(480px, 76vw);
  position: absolute; width: var(--title-width);
  left: calc(50% - var(--title-width) * 181.2 / 346);
  top: calc(50% - var(--title-width) * 47.5 / 346);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.wordmark {
  display: flex; flex-direction: column; align-items: stretch;
  width: 100%;
  margin: 0;
  font-family: "Michroma", var(--disp); font-weight: 400;

  font-size: clamp(22px, 5.4vmin, 76px); line-height: 1;

  letter-spacing: 0.10em; text-indent: 0.10em;
  word-spacing: 0.35em;
  white-space: nowrap;
}
.wmSeen {
  color: #f9f9f9;

  text-shadow: 0 3px 30px rgba(0,0,0, 0.9), 0 1px 3px rgba(0,0,0, 0.65);
}
.titleCard {
  display: block;
  width: 100%;
  height: auto;
}

.wmRule {
  height: 1px; margin-top: clamp(6px, 1vmin, 10px);
  background: linear-gradient(90deg,
    rgba(181,181,181, 0) 0%,
    rgba(175,175,175, 0.55) 50%,
    rgba(181,181,181, 0) 100%);
  filter: none;
}

.sEnter {
  margin-top: clamp(18px, 2.5vmin, 28px);
  font: 500 15px/1.4 var(--disp); letter-spacing: 0; text-indent: 0;

  color: #f9f9f9;
  text-shadow: 0 1px 10px rgba(0,0,0, 0.75), 0 1px 2px rgba(0,0,0, 0.6);

  position: relative;
}
.sEnter b { color: #ffffff; font-weight: 700; }
@keyframes promptPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.sTxt {
  display: inline-block; text-indent: 0;

  transition: opacity 1.5s ease 0.45s;
}

.sSpin {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%;

  opacity: 0; transition: opacity 1.8s ease;
}

.sSpin::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg,
    var(--accent) 0deg,
    rgba(206,206,206, 0) 8deg,
    rgba(206,206,206, 0) 230deg,
    rgba(206,206,206, 0.45) 330deg,
    var(--accent) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000000 0);
  animation: sSpin 1.9s linear infinite;
}

.sSpin::after {
  content: ""; position: absolute; top: -1px; left: 50%;
  width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 3px 1px var(--accent), 0 0 7px 2px rgba(206,206,206, 0.6);
  transform-origin: 2px 12px;
  animation: sSpin 1.9s linear infinite;
}
@keyframes sSpin { to { transform: rotate(360deg); } }
#splash.waiting .sTxt  { opacity: 0; }
#splash.waiting .sSpin { opacity: 1; }

.sNote {
  margin-top: clamp(10px, 1.5vmin, 14px);
  font-size: 9px; letter-spacing: 0.2em; text-indent: 0.2em;

  color: #a3a3a3;
  text-shadow: 0 1px 8px rgba(0,0,0, 0.7);
}
html.touch .sNote { color: var(--attention); }

#flightIntro {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center; padding: 24px;
  background: rgba(0,0,0,.12);
}
.fiBox {
  width: min(620px, 100%); max-height: calc(100dvh - 48px); overflow-x: hidden; overflow-y: auto;
  padding: 24px; background: rgba(0,0,0,.75);
  border: 1px solid rgba(229,226,220,.14); border-radius: 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 24px 100px rgba(0,0,0,.6); text-align: left;
}
.fiBox h2 { padding: 0; border: 0; color: var(--ink); font: 500 22px/1.2 var(--disp); letter-spacing: -.025em; }
.fiSub { margin-top: 8px; color: var(--ink-dim); font: 13px/1.5 var(--disp); }
.fiOpts { margin-top: 20px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.fiOpt { position: relative; min-width: 0; padding: 16px; text-align: left; font-family: var(--disp); color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; }
.fiOpt:hover { border-color: transparent; background: rgba(229,226,220,.035); }
.fiOpt.on { border-color: transparent; background: rgba(229,226,220,.055); outline: 2px solid var(--ink); outline-offset: 2px; }
.fiOpt:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fiKey { position: absolute; top: 17px; right: 16px; color: var(--ink-dim); font: 12px/1.4 var(--disp); }
.fiName { display: block; padding-right: 24px; color: var(--ink); font: 500 15px/1.4 var(--disp); }
.fiDesc { display: block; margin-top: 8px; color: var(--ink-dim); font: 13px/1.5 var(--disp); }
.fiEnter { display: flex; align-items: center; justify-content: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(229,226,220,.08); }
#fiConfirm { padding: 10px 16px; background: var(--ink); border-color: var(--ink); color: var(--bg); }
#fiConfirm:hover { background: #fff; border-color: #fff; }
@media (max-width: 620px) {
  #flightIntro { padding: 12px; }
  .fiBox { padding: 20px; max-height: calc(100dvh - 24px); }
  .fiOpts { grid-template-columns: minmax(0,1fr); gap: 4px; }
}

.sNote, .reticleMarks i {
  animation: fadeRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.reticleMarks i { animation-duration: 1.2s; }
.sNote { animation-delay: 1.05s; }

#splash:not(.waiting) .sTxt {
  animation: promptPulse 2.4s ease-in-out 2s infinite;
}
@keyframes fadeRise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.wmSeen  { animation: seenArrive 1.0s ease-out 0.42s both; }
/* The rule draws itself out from the centre, a beat after the word lands. */
.wmRule  { transform-origin: 50% 50%; animation: ruleGrow 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.9s both; }
@keyframes seenArrive {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ruleGrow {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  #splash *, #splash *::before, #splash *::after {
    animation-duration: 0.01ms !important; animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
  .wmRule { transform: scaleX(1) !important; }

  #splash, #splash::before,
  #splash .splashInner, #splash .reticleMarks {
    transition-duration: 0.01ms !important;
  }
}

/* Shared instrument surfaces and controls. */
.panel { background: var(--panel); border: 1px solid var(--line); position: relative; }
h2 { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); color: var(--ink); font: 600 20px/1.2 var(--disp); letter-spacing: 0; }
h3 { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 8px; color: var(--ink); font: 600 15px/1.3 var(--disp); letter-spacing: 0; }
h3.fold { cursor: pointer; border-top: 1px solid var(--line); padding-top: 10px; }
h3.fold:hover { color: var(--accent); }
.panelBody { padding: 18px; }
.spacer { flex: 1; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { font: 500 13px/1.3 var(--disp); letter-spacing: 0; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 8px 12px; cursor: pointer; transition: color .12s, background .12s, border-color .12s; }
button:hover { color: var(--ink); background: rgba(189,189,189,.08); border-color: var(--line-hi); }
button:disabled { opacity: .45; cursor: default; }
button.on { color: var(--accent); background: rgba(189,189,189,.10); border-color: var(--accent); }
button.mini { padding: 3px 7px; border-color: transparent; color: var(--ink-dim); }
button.mini:hover { color: var(--ink); background: rgba(189,189,189,.08); }
button:focus-visible, input:focus-visible, summary:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tgroup { display: inline-flex; }
.tgroup button { border-radius: 0; border-right-width: 0; }
.tgroup button:first-child { border-radius: 3px 0 0 3px; }
.tgroup button:last-child { border-right-width: 1px; border-radius: 0 3px 3px 0; }
.tgroup.small button { padding: 5px 8px; font-size: 12px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.lbl { color: var(--ink-dim); font: 12px/1.5 var(--disp); letter-spacing: 0; white-space: nowrap; flex: none; }
.val { font: 12px/1.5 var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.val.dim, .dim { color: var(--ink-dim); }
.nowrap { white-space: nowrap; }
.foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-dim); text-align: right; }
.foot.split { display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.flare { color: var(--attention) !important; }
.warn { margin-top: 8px; padding: 8px 10px; line-height: 1.5; color: var(--attention); background: rgba(164,164,164,.06); border-left: 2px solid var(--attention); }
.sep { border-top: 1px solid var(--line); margin: 10px 0; }
select, input { font: 13px/1.4 var(--mono); color: var(--ink); background: #161616; border: 1px solid var(--line); border-radius: 3px; padding: 8px; }
select { flex: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.modalJump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.hint { margin-top: 8px; font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
.hint b { color: var(--accent); }
.checks label { display: block; font-size: 13px; padding: 6px 0; cursor: help; }
.checks label:hover { color: #ffffff; }
.checks input { margin-right: 7px; cursor: pointer; }
.small { font-size: 11px; }

/* Flight measurements share a centred baseline beneath the chase view. */
#flightInstruments { position: absolute; z-index: 1; left: 50%; bottom: 40px; transform: translateX(-50%); width: min(720px, calc(100vw - 64px)); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; color: var(--ink); text-align: center; text-shadow: 0 1px 5px #000000, 0 1px 2px #000000; }
/* Feather the frost itself, so neither the blur nor the tint has a panel edge. */
#flightInstruments::before {
  content: ""; position: absolute; inset: -40px -64px -36px; z-index: -1;
  pointer-events: none; background: rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-mask-image: radial-gradient(ellipse closest-side at center, #000 24%, rgba(0,0,0,.7) 48%, transparent 96%);
  mask-image: radial-gradient(ellipse closest-side at center, #000 24%, rgba(0,0,0,.7) 48%, transparent 96%);
}
.instrument { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 8px 0; }
.instrument > span { color: #c4c2bd; font: 12px var(--disp); letter-spacing: 0; }
.instrument > strong { font: 400 22px/1.2 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.instrument > strong:has(.readoutUnit) { font-size: clamp(22px, 2vw, 28px); white-space: nowrap; }
.readoutUnit { color: var(--ink-dim); font: 400 14px var(--disp); }
.instrument > small { color: var(--ink-dim); font: 11px/1.4 var(--disp); max-width: 100%; }
.instrument > small:empty { display: none; }
#compactContext { display: flex; justify-content: center; gap: 10px; align-items: baseline; margin: 0; font: 12px/1.4 var(--disp); max-width: 100%; }
#compactMode { color: var(--ink-dim); font-weight: 400; }
#compactMode:empty { display: none; }
#compactReference:empty { display: none; }
#compactReference, #compactHint { color: #cbcbcb; font-size: 12px; }
#surfaceChartCanvas { display: block; cursor: crosshair; }
#surfaceChartVehicles { display: grid; gap: 8px; }
#surfaceChartVehicles button { text-align: left; display: flex; justify-content: space-between; padding: 12px; }
#surfaceChartVehicles button[aria-pressed="true"] { border-color: var(--ink); background: rgba(255,255,255,.08); }
#surfaceChartGuidance { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.surfaceChartTools { display: flex; gap: 8px; margin-top: 16px; }
/* Bare side icons stay separate from the lower-right navigation inset. */
#bottomBar { position: absolute; inset: 0; pointer-events: none; }
#bottomBar > * { pointer-events: auto; }
#dock { position: absolute; top: 50%; right: 24px; transform: translateY(-50%); z-index: 2; display: flex; flex-direction: column; gap: 12px; }
#dock > button { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; color: var(--ink-dim); background: transparent; border: 0; border-radius: 0; cursor: pointer; filter: drop-shadow(0 1px 3px #000); }
#dock > button:hover { color: #fff; background: transparent; }
#dock > button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.dockIcon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
/* Compensate for the ship silhouette's narrower outline beside the gear. */
#btnShip .dockIcon { width: 26px; height: 26px; stroke-width: 1.6; }
#minimapWrap { position: absolute; bottom: 40px; right: 56px; width: calc(var(--miniPx) + 16px); padding: 8px; flex: none; background: transparent; border: 0; border-radius: 0; isolation: isolate; }
#minimapWrap::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: rgba(0,0,0,.28); -webkit-mask-image: radial-gradient(ellipse closest-side, #000 12%, rgba(0,0,0,.55) 52%, transparent 96%); mask-image: radial-gradient(ellipse closest-side, #000 12%, rgba(0,0,0,.55) 52%, transparent 96%); }
#minimapWrap.surface-map::before { -webkit-mask-image: radial-gradient(ellipse closest-side, #000 36%, transparent 96%); mask-image: radial-gradient(ellipse closest-side, #000 36%, transparent 96%); }
/* The radar centre is at y=111; its frame stays symmetric with or without a target. */
#minimapWrap:not(.surface-map) { height: calc(var(--miniPx) * 222 / 240 + 16px); overflow: clip; overflow-clip-margin: 18px; }
#minimap { display: block; width: var(--miniPx); height: calc(var(--miniPx) * 250 / 240); cursor: pointer; filter: drop-shadow(0 1px 2px #000000); }
#minimap:hover { filter: drop-shadow(0 1px 2px #000); }
#minimap:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* Flight marks and feedback. */
#reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none !important; }
#reticle .cross { width: 60px; height: 60px; position: relative; }
#reticle .cross::before, #reticle .cross::after { content: ''; position: absolute; background: rgba(189,189,189,.45); }
#reticle .cross::before { left: 50%; top: -12px; width: 1px; height: 84px; }
#reticle .cross::after { top: 50%; left: -12px; height: 1px; width: 84px; }
#retInfo { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 12px var(--mono); color: var(--accent); }
#toast { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); max-width: calc(100vw - 48px); text-align: center; background: var(--panel); color: var(--ink); border-left: 2px solid var(--accent); padding: 10px 16px; font: 13px/1.5 var(--disp); transition: opacity .3s; pointer-events: none; }
#bodyMenu { position: absolute; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; z-index: 20; }
#bmName { font: 600 16px var(--disp); padding: 12px 14px 4px; }
#bmDist { color: var(--ink-dim); font: 12px var(--mono); padding: 0 14px 10px; }
#bodyMenu button { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 10px 14px; }
#bodyMenu button em { display: block; font-style: normal; font-size: 12px; color: var(--ink-dim); margin-top: 4px; }

/* Full-screen workspaces and reference dialogs. */
.overlay { position: fixed; inset: 0; background: rgba(5,5,5,.52); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 30; }
.modalcard { width: min(720px, 100%); max-height: min(84dvh, 800px); display: flex; flex-direction: column; border-radius: 4px; box-shadow: 0 18px 70px #00000077; }
.modalcard .panelBody { overflow: auto; line-height: 1.6; font-size: 14px; }
.modalcard ul { margin: 8px 0 16px 20px; }
.modalcard li { margin-bottom: 6px; }
.modalcard table, .sRef table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modalcard td, .modalcard th, .sRef td, .sRef th { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.modalcard th, .sRef th { color: var(--ink-dim); font-weight: 500; font-size: 12px; }
.pass { color: var(--accent); }
.fail { color: var(--warning); }
.scen, .fleet-option { display: block; width: 100%; text-align: left; margin-bottom: 0; padding: 14px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.scen b, .fleet-option b { color: var(--ink); display: block; font: 600 17px var(--disp); margin-bottom: 4px; }
.scen span, .fleet-option span { font-size: 12px; color: var(--ink-dim); font-weight: 400; }
.scen.cur, .fleet-option.cur { background: rgba(189,189,189,.08); box-shadow: inset 3px 0 0 var(--accent); }
.fleet-list { display: grid; gap: 0; margin-top: 14px; }
#mapOverlay {
  --ink: #e8e8e8;
  --ink-dim: #a0a0a0;
  --line: rgba(160,160,160,.20);
  align-items: stretch; justify-content: stretch; padding: 0; background: #000000;
}
#mapOverlay input, #mapOverlay select { background: #000000; }
#mapOverlay button:hover, #mapOverlay button.on,
#mapOverlay #palList li.sel button, #mapOverlay #palList li button:hover,
#mapOverlay #navLandmarkResults button:hover,
#mapOverlay #navLandmarkResults button[aria-pressed="true"] { background: rgba(255,255,255,.055); }
#mapClose { position: absolute; top: 12px; right: 12px; z-index: 8; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; background: rgba(0,0,0,.65); border: 1px solid var(--line); }
#mapCard { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#mapBody { display: grid; grid-template-columns: minmax(0,1fr) 340px; flex: 1; min-height: 0; }
#mapWrap { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#mapLabels { position: absolute; inset: 0; pointer-events: none; }
#mapCanvas { display: block; cursor: grab; touch-action: none; }
#mapCanvas:active { cursor: grabbing; }
#mapRail { border-left: 1px solid var(--line); min-height: 0; overflow: hidden; }
@media (max-width: 700px) {
  #mapBody { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(80px,1fr) 240px; }
  #mapRail { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: auto auto minmax(0,1fr); gap: 6px 12px; padding: 10px; }
}
#plotOverlay { position: static; padding: 0; display: block; background: transparent; }
#plotCard { display: flex; flex-direction: column; min-width: 0; }
#plotWrap { display: flex; justify-content: center; align-items: center; min-width: 0; }
#plotStack { position: relative; }
#plotStack canvas { display: block; }
#plotGl { position: absolute; inset: 0; }
#plotHud { position: relative; cursor: crosshair; touch-action: none; }
#plotTarget { color: var(--ink-dim); font: 12px/1.5 var(--mono); }
#plotTarget.dim { color: var(--ink-dim); }

/* Settings shares the ship selector's quiet glass surface and flat choices. */
#modal { z-index: 40; }
#settings { --line: rgba(229,226,220,.08); background: rgba(0,0,0,.12); cursor: default; }
#settingsCard { width: min(1240px, calc(100vw - 48px)); height: min(84dvh, 740px); max-height: 84dvh; display: flex; flex-direction: column; border-radius: 14px; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-color: rgba(229,226,220,.14); overflow: hidden; box-shadow: 0 24px 100px rgba(0,0,0,.6); }
#settingsHead { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; position: relative; flex: none; }
#settingsHead h2 { border: 0; padding: 0; font: 500 20px/1.2 var(--disp); letter-spacing: -.025em; }
#settingsClose { width: 32px; height: 32px; border-radius: 8px; }
#settingsBody { display: flex; min-height: 0; flex: 1; }
#settingsSidebar { display: flex; flex-direction: column; padding: 12px; position: relative; flex: none; width: 140px; min-height: 0; }
#settingsTabs { display: flex; flex-direction: column; gap: 4px; flex: none; min-width: 0; }
#settingsSidebar::after { content: ''; position: absolute; right: 0; top: 12px; bottom: 12px; width: 1px; background: linear-gradient(to bottom, transparent, rgba(229,226,220,.18) 25%, rgba(229,226,220,.18) 75%, transparent); pointer-events: none; }
#settingsTabs button { text-align: left; border-color: transparent; border-radius: 8px; padding: 10px 12px; font: 500 14px/1.4 var(--disp); color: var(--ink-dim); }
#settingsTabs button:hover { color: var(--ink); background: rgba(229,226,220,.035); }
#settingsTabs button.on { color: var(--ink); background: rgba(229,226,220,.055); box-shadow: none; border-color: transparent; }
#settingsPanes { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 8px 24px 12px; scrollbar-color: var(--line-hi) transparent; scrollbar-width: thin; }
.spane { min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
#settingsPanes:has(.spane[data-pane="controls"]:not(.hidden)) { overflow: hidden; }
.spane[data-pane="controls"] { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.sControlsList { flex: 1; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 2px 4px 20px 0; scrollbar-color: var(--line-hi) transparent; scrollbar-width: thin; }
#settingsFoot { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: auto; padding-top: 16px; flex: none; }
#settingsReset { text-align: left; padding: 10px 12px; }
#settingsFoot button, #settings .sActions button { border-radius: 8px; border-color: transparent; background: rgba(229,226,220,.035); }
#settingsFoot button:hover, #settings .sActions button:hover { background: rgba(229,226,220,.055); }
#settingsStatus { color: var(--ink-dim); font: 11px/1.5 var(--disp); padding: 0 12px; }
#settingsStatus:empty { display: none; }
#settings :is(button,input,select,summary):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sHint { font-size: 13px; color: var(--ink-dim); margin: 12px 0; }
.sHint b { color: var(--ink); }
.sFilters { display: flex; flex: none; gap: 8px; position: relative; z-index: 1; padding: 10px 0; }
.sFilters input { min-width: 0; flex: 1; }
.sFilters input, .sCategoryTrigger { min-width: 0; height: 36px; padding: 8px 12px; font: 13px var(--disp); color: var(--ink); border: 1px solid transparent; border-radius: 8px; background: rgba(229,226,220,.035); }
.sCategory { position: relative; flex: 1; min-width: 0; }
.sCategoryTrigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.sCategoryTrigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sCategoryArrow { flex: none; width: 8px; height: 8px; margin: -4px 4px 0 0; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); color: var(--ink-dim); }
.sCategoryTrigger:hover, .sCategoryTrigger[aria-expanded="true"] { background: rgba(229,226,220,.055); border-color: transparent; }
.sCategoryList { position: absolute; top: calc(100% + 6px); left: 0; right: 0; padding: 4px; max-height: min(240px, 40dvh); overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent; border: 1px solid rgba(229,226,220,.14); border-radius: 10px; background: rgba(0,0,0,.92); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.sCategoryOption { padding: 9px 12px; border-radius: 6px; color: var(--ink-dim); font: 13px/1.4 var(--disp); cursor: pointer; }
.sCategoryOption[aria-selected="true"] { color: var(--ink); background: rgba(229,226,220,.055); }
.sCategoryOption.is-active { color: var(--ink); background: rgba(229,226,220,.08); }
.sFilters input::placeholder { color: var(--ink-dim); }
.sGroup { font: 500 14px/1.4 var(--disp); color: var(--ink-dim); margin: 16px 0 6px; border-top: 1px solid var(--line); padding-top: 14px; }
.sGroup:first-of-type { border-top: 0; margin-top: 4px; padding-top: 0; }
.spane:is([data-pane="graphics"], [data-pane="sound"]) .sRow:has(+ .sGroup) { border-bottom: 0; }
.spane[data-pane="sound"] .sRowHead { grid-template-columns: minmax(0,1fr) 280px; }
.spane[data-pane="sound"] .sSeg { width: 280px; }
.spane[data-pane="sound"] .sSeg button { white-space: nowrap; }
.sSlider { width: 100%; font-size: 14px; display: grid; grid-template-columns: minmax(0,1fr) 224px; align-items: center; gap: 20px; }
.sSliderCtl { display: grid; grid-template-columns: minmax(0,1fr) 40px; align-items: center; gap: 10px; }
.sSliderCtl output { font: 500 12px/1 var(--mono); color: var(--ink-dim); text-align: right; }
.sSlider input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: var(--ink); cursor: pointer; }
.kbRow { display: grid; grid-template-columns: minmax(0,1fr) 110px 32px; align-items: center; gap: 10px; padding: 4px 0; min-height: 40px; }
.kbLabel { min-width: 0; font-size: 14px; }
.kbChip { min-width: 0; font: 13px var(--mono); text-align: center; padding: 7px 9px; border-color: transparent; border-radius: 8px; background: rgba(229,226,220,.035); }
.kbChip.capturing { color: var(--ink); border-color: var(--ink); background: rgba(229,226,220,.055); }
.kbChip.locked, .kbChip.locked:hover { color: var(--ink-dim); cursor: default; background: transparent; border-color: transparent; }
.kbReset { font-size: 16px; color: var(--ink-dim); border: 0; padding: 6px; text-align: center; }
.kbReset:not(button) { min-width: 0; padding: 0; font-size: 11px; overflow-wrap: anywhere; }
.sRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sRow:last-child { border-bottom: 0; }
.sRowHead { display: grid; grid-template-columns: minmax(0,1fr) 224px; align-items: center; gap: 20px; width: 100%; }
.sRowLabel { flex: 1; font-size: 14px; }
.sSeg { width: 224px; max-width: 100%; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
#settings .sSeg button { padding: 7px 8px; min-width: 0; min-height: 34px; font: 500 13px/1.4 var(--disp); border: 1px solid transparent; border-radius: 8px; color: var(--ink-dim); }
#settings .sSeg button:hover { color: var(--ink); background: rgba(229,226,220,.035); }
#settings .sSeg button.on { color: var(--ink); background: rgba(229,226,220,.055); border-color: transparent; }
.sToggle { width: 100%; font-size: 14px; cursor: pointer; display: grid; grid-template-columns: minmax(0,1fr) 224px; align-items: center; gap: 20px; }
.sToggle input {
  appearance: none; -webkit-appearance: none;
  justify-self: end; display: grid; place-content: center;
  width: 16px; height: 16px; margin: 0; cursor: pointer;
  border: 1px solid var(--ink-dim); border-radius: 3px;
  background: transparent; color: var(--ink);
}
.sToggle input::after {
  content: ''; width: 4px; height: 8px; margin-top: -2px;
  border: solid currentColor; border-width: 0 1.25px 1.25px 0;
  transform: rotate(45deg); opacity: 0;
  transition: border-color 240ms ease, opacity 120ms ease;
}
.sToggle input:checked { border-color: var(--ink); }
.sToggle input:checked::after { opacity: 1; }
.sToggle input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (forced-colors: active) {
  .sToggle input { appearance: auto; -webkit-appearance: auto; }
  .sToggle input::after { display: none; }
}
.sActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sRef { margin-top: 16px; }
.sGroup, .sRow, .sActions, .fiEnter { border-image: linear-gradient(to right, transparent, rgba(229,226,220,.18), transparent) 1; }
.sRef table { table-layout: fixed; overflow-wrap: anywhere; }
#settings summary { cursor: pointer; padding: 8px 0; font-size: 13px; color: var(--ink-dim); }
.kdim { color: var(--ink-dim); font: 11px var(--mono); margin-left: 6px; }

/* ── body labels ── */
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
/* Selection stays compact even when a planet fills the view. */
#selectionMarker {
  position: absolute; width: 22px; height: 22px;
  transform: translate(-50%, -50%); z-index: 4; pointer-events: none;
  color: var(--accent); opacity: 0.8;
}
#selectionMarker[hidden] { display: none; }
.targetBracket {
  position: absolute; inset: 0;
  background:
    linear-gradient(currentColor, currentColor) left top / 6px 1px,
    linear-gradient(currentColor, currentColor) left top / 1px 6px,
    linear-gradient(currentColor, currentColor) right top / 6px 1px,
    linear-gradient(currentColor, currentColor) right top / 1px 6px,
    linear-gradient(currentColor, currentColor) left bottom / 6px 1px,
    linear-gradient(currentColor, currentColor) left bottom / 1px 6px,
    linear-gradient(currentColor, currentColor) right bottom / 6px 1px,
    linear-gradient(currentColor, currentColor) right bottom / 1px 6px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 1px 1px #000000);
}
.targetName {
  position: absolute; top: 29px; left: 50%; transform: translateX(-50%);
  font-family: var(--disp); font-size: 14px; font-weight: 500;
  border: 0; border-radius: 0; padding: 0; background: none; color: inherit;
  pointer-events: auto; cursor: pointer;
  white-space: nowrap; text-shadow: 0 1px 3px #000000, 0 0 4px #000000;
}
.targetBodyName, .targetDistance { display: block; }
.targetDistance { margin-top: 4px; color: var(--ink-dim); font: 12px/1.3 var(--mono); }
.targetName:hover { color: #ffffff; }
.targetName:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.targetArrow { display: none; position: absolute; inset: 0; }
.targetArrow::after {
  content: ""; position: absolute; width: 8px; height: 8px; top: 6px; left: 4px;
  border-top: 1px solid currentColor; border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
#selectionMarker.offscreen .targetBracket { display: none; }
#selectionMarker.offscreen .targetArrow { display: block; }
.blabel {
  position: absolute; top: 0; left: 0; will-change: transform, opacity;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--disp); font-weight: 600; letter-spacing: 0.2em;
  color: #e4e4e4; white-space: nowrap; pointer-events: none; cursor: pointer;
  text-shadow: 0 0 6px #050505, 0 0 3px #050505, 0 1px 2px #050505;
}
/* Stacked finder stems cross other names; only text should receive clicks. */
.blabel .nm { line-height: 1.1; pointer-events: auto; }
.blabel .sub {
  pointer-events: auto;
  font-family: var(--mono); font-weight: 400; letter-spacing: 0.02em;
  font-size: 0.82em; color: var(--accent); margin-top: 1px;
}
/* tick pointing down at the body — also the finder mark for sub-pixel targets */
.blabel .tick {
  width: 1px; height: 9px; margin-top: 3px;
  background: linear-gradient(180deg, rgba(228,228,228,0.7), rgba(228,228,228,0.05));
}
.blabel.tiny .tick { height: 16px; }
.blabel.tiny .tick::after {
  content: ""; position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%);
  width: 7px; height: 7px; border: 1px solid rgba(206,206,206,0.75); border-radius: 50%;
}

#places { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.plabel {
  position: absolute; top: 0; left: 0; will-change: transform, opacity;
  font-family: var(--disp); font-weight: 500; letter-spacing: 0.1em;
  font-size: 10px; line-height: 13px; color: #c3c3c3; white-space: nowrap;
  text-shadow: 0 0 6px #050505, 0 0 3px #050505, 0 1px 2px #050505;

  pointer-events: auto; cursor: pointer;
}
.plabel::before {
  content: ""; position: absolute; left: -11px; top: -11px; width: 22px; height: 22px;
}
.plabel:hover { color: #ffffff; }
.plabel:hover .pdot { box-shadow: 0 0 7px currentColor; }
.plabel .pnm { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); }
.plabel .pdot {
  position: absolute; left: -3px; top: -3px; width: 6px; height: 6px;
  box-sizing: border-box; border-radius: 50%; background: currentColor;
}
.plabel.natural .pdot { background: none; border: 1px solid currentColor; }
.plabel.space .pdot {
  background: none; border: 1px solid currentColor; border-radius: 0;
  transform: rotate(45deg);
}
.plabel.geo { color: var(--accent); }
.plabel.geo .pdot { background: none; border: 1px solid currentColor; }
.plabel.geo .pdot::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); width: 12px; height: 1px;
  background: currentColor; opacity: 0.5;
}

.blabel.moon { color: var(--ink); letter-spacing: 0.14em; }
/* A constant-size finder is visible even when the moon's surface is black. */
.blabel.moon.finder .tick { height: var(--finder-stem, 16px); background: rgba(236,236,236,.55); }
/* Keep the finder at the body, but leave stacked names free of crossing lines. */
.blabel.moon.finder.stacked .tick { background: none; }
.blabel.moon.finder .tick::after {
  content: ""; position: absolute; bottom: -4px; left: 50%;
  transform: translate(-50%, 50%); width: 9px; height: 9px;
  box-sizing: border-box; border: 1px solid currentColor; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(5,5,5,.85); pointer-events: none;
}
.blabel:hover { color: #ffffff; }
.blabel.sel { color: var(--accent); }

#hud.lean > .panel, #hud.lean > #bottomBar { display: none; }

.hidden { display: none !important; }
kbd {
  font-family: var(--mono); font-size: 10px; border: 1px solid var(--line-hi);
  border-bottom-width: 2px; padding: 1px 5px; color: var(--accent); background: rgba(0,0,0,0.4);
}

#gVeil {
  position: absolute; inset: 0; z-index: 3; opacity: 0;
  pointer-events: none !important;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 0%, rgba(0,0,0,0) var(--gvR, 62%), #000000 100%);
}

#headingMark {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  pointer-events: none !important; z-index: 6; display: none;
}

#headingMark::before, #headingMark::after {
  content: ""; position: absolute;
  border: 2px solid rgba(223,223,223, 0.9);
  filter: drop-shadow(0 0 2px rgba(0,0,0, 0.9));
}
/* ring */
#headingMark::before { inset: 8px; border-radius: 50%; }
/* wings — the gap across the middle is what keeps the target itself readable */
#headingMark::after {
  inset: 14px 0; border-width: 2px 0 0 0;
  clip-path: polygon(0 0, 26% 0, 26% 100%, 0 100%, 100% 0, 74% 0, 74% 100%, 100% 100%);
}

#proMark, #retroMark {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  pointer-events: none !important; z-index: 5; display: none;
}
#proMark::before, #retroMark::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  border: 2px solid rgba(157,157,157, 0.9);
  filter: drop-shadow(0 0 2px rgba(0,0,0, 0.9));
}
/* the dot — prograde */
#proMark::after {
  content: ""; position: absolute; inset: 11px; border-radius: 50%;
  background: rgba(157,157,157, 0.9);
  filter: drop-shadow(0 0 2px rgba(0,0,0, 0.9));
}

#retroMark::after {
  content: ""; position: absolute; inset: 5px;
  background:
    linear-gradient(45deg, transparent 44%, rgba(157,157,157, 0.9) 44%, rgba(157,157,157, 0.9) 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, rgba(157,157,157, 0.9) 44%, rgba(157,157,157, 0.9) 56%, transparent 56%);
  filter: drop-shadow(0 0 2px rgba(0,0,0, 0.9));
}

#aimMark {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  pointer-events: none !important; z-index: 6; display: none;
}
#aimMark::before, #aimMark::after {
  content: ""; position: absolute; background: rgba(246,246,246, 0.85);
  filter: drop-shadow(0 0 2px rgba(0,0,0, 0.9));
}
/* horizontal pair, with a gap across the middle so the target stays readable */
#aimMark::before {
  left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
  clip-path: polygon(0 0, 29% 0, 29% 100%, 0 100%, 100% 0, 71% 0, 71% 100%, 100% 100%);
}
/* vertical pair */
#aimMark::after {
  top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  clip-path: polygon(0 0, 100% 0, 100% 29%, 0 29%, 0 100%, 100% 100%, 100% 71%, 0 71%);
}


/* Navigation is a destination instrument, with the globe taking the main stage. */
#navigationCard { width: 100%; height: 100%; display: flex; flex-direction: column; min-height: 0; color: var(--ink); font: 14px/1.5 var(--disp); }
.navigationHead { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; gap: 12px; flex: none; border-bottom: 1px solid var(--line); }
.navigationHead h2 { margin: 0; padding: 0; border: 0; font: 600 21px/1.3 var(--disp); }
.navigationHead button { flex: none; border-color: transparent; color: var(--ink-dim); }
.navigationBody { overflow: auto; overscroll-behavior: contain; padding: 16px 18px 18px; min-height: 0; }
.navStage, .navStack { display: flex; flex-direction: column; gap: 14px; }
.navStack { padding-top: 12px; }
.navStage label, .navStack label { display: grid; gap: 6px; color: var(--ink-dim); font-size: 13px; }
.navStage p { margin: 0; }
.navStage small { display: block; color: var(--ink-dim); font-size: 12px; line-height: 1.45; }
.navStage summary { cursor: pointer; color: var(--ink-dim); padding: 6px 0; font-size: 13px; }
.navStage summary:hover { color: var(--ink); }
#navigationCard input { width: 100%; min-width: 0; padding: 10px 12px; }
#palInput { font-family: var(--disp); font-size: 15px; }
#palInput::placeholder { color: var(--ink-dim); opacity: 1; }
#navContext { color: var(--ink-dim); font-size: 12px; }
#palList { list-style: none; width: 100%; max-height: min(42dvh, 350px); background: transparent; border: 0; overflow: auto; padding: 0; margin: 0; }
#palList li { display: block; padding: 0; margin: 0; border-bottom: 1px solid var(--line); }
#palList li:last-child { border-bottom: 0; }
#palList li button { width: 100%; text-align: left; border: 0; border-radius: 0; padding: 12px 10px; background: transparent; }
#palList li.sel button { background: rgba(189,189,189,.09); box-shadow: inset 2px 0 0 var(--accent); }
#palList li button:hover { background: rgba(189,189,189,.07); }
.navResult { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 3px 14px; }
.navResultName { color: var(--ink); font: 600 16px/1.3 var(--disp); }
.navResultMeta { grid-column: 1; color: var(--ink-dim); font-size: 12px; }
.navResultDistance { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--ink-dim); font: 11px var(--mono); font-variant-numeric: tabular-nums; }
#navBodyName, #navDestination { font: 500 27px/1.2 var(--disp); color: var(--ink); }
#navBodyDistance { font: 14px var(--mono); }
#navBodyCapability, #navBodyNote, #navTripType, #navReason { color: var(--ink-dim); }
#navLandmarkResults { display: grid; gap: 0; }
#navLandmarkResults button { text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px; }
.navTools { display: flex; gap: 8px; flex-wrap: wrap; }
#navLocation { display: flex; flex-direction: column; }
.navMap { min-width: 0; }
#navSelectionBody { font: 600 20px var(--disp); }
.navLocationTools { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.navLocationTools .navStack { padding-top: 8px; gap: 10px; }
.navStageFooter { padding: 14px 18px; border-top: 1px solid var(--line); flex: none; }
#plotGo, #navLaunch, #navBodyReview { width: 100%; min-width: 0; }
#navigationCard #plotGo, #navigationCard #navLaunch, #navigationCard #navBodyReview { color: #161616; background: var(--accent); border-color: var(--accent); padding: 11px 14px; font-weight: 600; }
#navigationCard #plotGo:hover, #navigationCard #navLaunch:hover, #navigationCard #navBodyReview:hover { background: #d1d1d1; }
.navFact { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; font-variant-numeric: tabular-nums; padding: 12px 0; border-top: 1px solid var(--line); }
.navFact > span:first-child { color: var(--ink-dim); }
.navFact > div { text-align: right; }
#navArrival, #navSurfaceDistance { font: 14px var(--mono); }
#navMapFailure { color: var(--warning); font-size: 12px; }
body.ui-reading #flightInstruments { visibility: hidden; }
body.ui-reading #minimapWrap { visibility: hidden; pointer-events: none; }
#hud.lean #flightInstruments { display: none; }
#hud.lean #bottomBar { display: flex; }
/* Equal columns keep changing numbers from moving the instrument strip. */
.flight-readouts { display: flex; width: 100%; gap: 32px; align-items: flex-start; justify-content: center; }
.flight-readouts:has(#compactInstrumentC.hidden) { width: min(100%, 520px); }
/* Cruise centres total speed; landing gives height and vertical speed equal weight. */
:is(.cruise-readouts, .landing-readouts) .flight-readouts { gap: 24px; align-items: baseline; }
:is(.cruise-readouts, .landing-readouts) .instrument { gap: 6px; }
:is(.cruise-readouts, .landing-readouts) .instrument > strong:has(.readoutUnit) { font-size: clamp(20px, 1.6vw, 24px); }
.cruise-readouts .flight-readouts:not(:has(#compactInstrumentC.hidden)) > #compactInstrumentB { order: -1; }
/* A shallow cockpit arc: speed at the crown, altitude and vertical rate below. */
.cruise-readouts .flight-readouts:not(:has(#compactInstrumentC.hidden)) { align-items: flex-start; }
.cruise-readouts .flight-readouts:not(:has(#compactInstrumentC.hidden)) > :is(#compactInstrumentB, #compactInstrumentC) { margin-top: clamp(24px, 3.2vw, 46px); }
.cruise-readouts .instrument:first-child,
.landing-readouts .instrument:not(#compactInstrumentC) { flex-grow: 1.25; }
.cruise-readouts #compactValueA:has(.readoutUnit),
.landing-readouts :is(#compactValueA, #compactValueB):has(.readoutUnit) { font-size: clamp(28px, 2.4vw, 34px); }
.cruise-readouts #compactLabelA,
.landing-readouts :is(#compactLabelA, #compactLabelB) { color: var(--ink); }
/* Rover speed stays on the centreline, with secondary readings beside it. */
body[data-vehicle-mode="rover"] .flight-readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: baseline; }
body[data-vehicle-mode="rover"] #compactInstrumentB { grid-column: 1; grid-row: 1; }
body[data-vehicle-mode="rover"] .instrument:first-child { grid-column: 2; grid-row: 1; }
body[data-vehicle-mode="rover"] #compactInstrumentC { grid-column: 3; grid-row: 1; }
body[data-vehicle-mode="rover"] #compactValueA:has(.readoutUnit) { font-size: clamp(28px, 2.4vw, 34px); }
body[data-vehicle-mode="rover"] #compactLabelA { color: var(--ink); }
.instrumentActions { display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 24px; max-width: 100%; }
#compactHint { font: 12px/1.4 var(--disp); }
#navRouteDistance, #navBodyDistance { font: 13px var(--mono); }
.navStageFooter:has(> .hidden):not(:has(> button:not(.hidden))) { display: none; }
.sNote { font: 12px var(--disp); letter-spacing: 0; }

@media (max-width: 850px) {
  .flight-readouts { gap: 18px; }
  #flightInstruments { bottom: 28px; width: min(620px, calc(100vw - 48px)); }
  #navLocation { grid-template-columns: minmax(0,1fr) minmax(220px,1fr); gap: 14px; }
}
@media (max-width: 1100px) {
  #minimapWrap { bottom: 180px; }
}
@media (max-width: 640px) {
  .overlay { padding: 12px; }
  #flightInstruments { bottom: 18px; width: calc(100vw - 32px); gap: 4px; }
  .flight-readouts { gap: 12px; }
  .instrument { padding: 5px 0; }
  .instrument > strong, .instrument > strong:has(.readoutUnit) { font-size: clamp(15px, 3.6vw, 22px); }
  :is(.cruise-readouts, .landing-readouts) .flight-readouts { gap: 10px; }
  :is(.cruise-readouts, .landing-readouts) .instrument > strong:has(.readoutUnit) { font-size: clamp(14px, 3.2vw, 20px); }
  .cruise-readouts #compactValueA:has(.readoutUnit),
  .landing-readouts :is(#compactValueA, #compactValueB):has(.readoutUnit) { font-size: clamp(20px, 4.4vw, 28px); }
  body[data-vehicle-mode="rover"] #compactValueA:has(.readoutUnit) { font-size: clamp(20px, 4.4vw, 28px); }
  .readoutUnit { font-size: 11px; }
  .instrument > small { font-size: 10px; }
  #compactContext { max-width: none; margin: 0; gap: 8px; flex-wrap: wrap; }
  #compactHint { max-width: 40ch; }
  .instrumentActions { gap: 8px; flex-wrap: wrap; }
  #bottomBar { --miniPx: 160px; }
  #dock { right: 12px; gap: 8px; }
  #minimapWrap { right: 12px; bottom: 170px; }
  .navigationHead { padding: 12px 14px; }
  .navigationBody { padding: 14px; }
  .navStageFooter { padding: 12px 14px; }
  #navLocation { display: flex; flex-direction: column; gap: 14px; }
  .navMap > *, .navLocationTools { width: 100%; }
  .navResultName { font-size: 15px; }
  #navBodyName, #navDestination { font-size: 24px; }
  #settingsBody { flex-direction: column; }
  #settingsSidebar { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 8px; }
  #settingsTabs { flex: 1; flex-direction: row; flex-wrap: wrap; gap: 2px; }
  #settingsFoot { flex-direction: row; align-items: center; margin-top: 0; padding: 0; flex-wrap: wrap; }
  #settingsReset { padding: 8px; }
  #settingsStatus { max-width: 160px; padding: 0; }
  #settingsSidebar::after { top: auto; bottom: 0; left: 20px; right: 20px; width: auto; height: 1px; background: linear-gradient(to right, transparent, rgba(229,226,220,.18), transparent); }
  #settingsTabs button { padding: 8px; }
  #settingsPanes { padding: 14px 14px 12px; }
  .sRowHead { align-items: start; gap: 8px; }
  .kbChip { min-width: 84px; }
  .kbReset { min-width: 42px; }
  .modalcard h2, #settingsHead h2 { font-size: 18px; }
  .modalcard .panelBody { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}

@media (min-width: 641px) and (max-width: 720px) {
  #navLocation { display: flex; flex-direction: column; gap: 14px; }
  .navMap, .navLocationTools { width: 100%; }
}

.srOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* One chart at system, nearby-space and surface scales. */
#mapSurfaceWrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#mapSurfaceWrap .navMap { width: 100%; height: 100%; }
#mapSurfaceWrap #plotOverlay, #mapSurfaceWrap #plotWrap { height: 100%; }
#mapRail .navigationHead { padding: 16px; }
#mapRail .navigationHead h2 { font-size: 21px; }
#mapRail .navigationBody { flex: 1; padding: 16px; }
#mapRail #navLocation { display: flex; flex-direction: column; }
#mapRail #navSelectionBody { display: none; }
#mapRail #palList { max-height: none; overflow: visible; }
#mapRail #navLandmarkResults button { background: transparent; }
#mapRail #navLandmarkResults button:hover { background: rgba(189,189,189,.07); }
#mapRail #navLandmarkResults button[aria-pressed="true"] { color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); background: rgba(189,189,189,.09); }
#mapRail #navDestination { font-size: 24px; }
#mapRail .navStageFooter { padding: 14px 16px; }
@media (max-width: 700px) {
  #mapBody { grid-template-rows: minmax(100px, 1fr) minmax(160px, 46%); }
  #mapRail { display: block; padding: 0; border-left: 0; border-top: 1px solid var(--line); }
  #mapRail .navigationHead { padding: 10px 14px; }
  #mapRail .navigationBody { padding: 10px 14px; }
  #mapRail .navStageFooter { padding: 10px 14px; }
}

/* Travel has its own chart row, so it never covers navigation controls. */
#mapCard { height: 100dvh; overflow: hidden; }
#mapRail { background: #000000; }
#mapRail .navigationHead { justify-content: flex-start; }
#mapRail .navigationHead h2 { margin-left: auto; }
#navigationCard.home-step .navigationHead { display: none; }
#mapRail #plotTarget { padding: 14px; border: 1px solid var(--line); background: #000000; font: 14px/1.5 var(--disp); color: var(--ink); }
#mapRail #navLandmarkResults button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; }
#mapRail #navLandmarkResults small { font: 10px var(--mono); white-space: nowrap; }
#navLandmarkEmpty { color: var(--ink-dim); font-size: 13px; line-height: 1.6; }
#navigationCard button:focus-visible, #mapClose:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 900px) {
}
@media (max-width: 700px) {
}

@media (max-height: 540px) {
  #flightInstruments { bottom: 12px; }
  #bottomBar { --miniPx: 150px; }
  #dock { gap: 6px; }
  #minimapWrap { bottom: 158px; right: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  #minimapWrap { transition: none; }
}

@media (max-width: 640px) {
  #settingsFoot { gap: 8px; }
  #settingsStatus { font-size: 12px; }
  .sFilters { flex-wrap: wrap; }
  .sFilters input { flex-basis: 100%; }
  .sCategory { flex-basis: 100%; }
  .kbRow { grid-template-columns: minmax(0,1fr) 96px 28px; gap: 6px; }
  .kbReset { min-width: 0; }
  .sRowHead, .sSlider, .spane[data-pane="sound"] .sRowHead { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .sToggle { grid-template-columns: minmax(0,1fr) 24px; gap: 12px; }
  .sSeg { width: 224px; justify-self: end; }
  #settings .sSeg button { padding: 8px 10px; }
}

/* Surface chart: the same neutral instrument palette as the flight HUD. */
#mapOverlay.surface-chart {
  background: var(--bg);
}
.surface-chart #mapBody { grid-template-columns: minmax(0,1fr) 360px; }
.surface-chart #mapWrap { background: radial-gradient(ellipse at center, #181818 0%, var(--bg) 72%); }
.surface-chart #mapRail { background: var(--bg); box-shadow: -16px 0 60px rgba(0,0,0,.18); }
.surface-chart #mapClose { top: 24px; right: 24px; width: 40px; height: 40px; color: var(--accent); background: var(--bg); }
.surface-chart #mapRail .navigationHead { padding: 30px 26px 24px; justify-content: flex-start; }
.surface-chart #mapRail .navigationHead h2 { font: 500 25px/1.25 var(--disp); margin-left: 0; }
.surface-chart #mapRail .navigationBody { padding: 24px 26px; }
.surface-chart #navSurface { gap: 20px; }
.surface-chart #surfaceChartContext { color: var(--accent); display: flex; align-items: center; gap: 9px; font-size: 13px; }
.surface-chart #surfaceChartContext::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--attention-dim); flex: none; }
.surface-chart .surfaceChartHint { color: var(--ink-dim); font-size: 13px; line-height: 1.6; }
.surface-chart #surfaceChartVehicles { gap: 10px; }
.surface-chart #surfaceChartVehicles button { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 16px 14px; min-height: 64px; color: var(--ink); background: #181818; border: 1px solid var(--line); border-radius: 4px; font-size: 16px; }
.surface-chart #surfaceChartVehicles button:hover { background: #242424; border-color: var(--line-hi); }
.surface-chart #surfaceChartVehicles button[aria-pressed="true"] { background: #252525; border-color: var(--line-hi); box-shadow: inset 3px 0 var(--attention); }
.surface-chart #surfaceChartVehicles button[aria-pressed="true"] .surfaceVehicleIcon,
.surface-chart #surfaceChartVehicles button[aria-pressed="true"] small { color: var(--attention); }
.surface-chart .surfaceVehicleIcon { color: var(--accent); font: 26px/1 var(--disp); text-align: center; }
.surface-chart #surfaceChartVehicles small { font: 12px var(--mono); }
.surface-chart #surfaceChartGuidance { grid-template-columns: 1fr 1fr; gap: 22px 16px; margin-top: 8px; padding-top: 26px; }
.surface-chart #surfaceChartDestination { grid-column: 1 / -1; color: var(--attention); font-size: 17px; }
.surface-chart #surfaceChartGuidance .navFact { flex-direction: column; border: 0; padding: 0; gap: 8px; }
.surface-chart #surfaceChartGuidance .navFact > span { font-size: 12px; }
.surface-chart #surfaceChartGuidance strong { font: 400 28px/1.25 var(--mono); letter-spacing: -1px; color: var(--ink); }
.surface-chart #surfaceChartTurn { grid-column: 1 / -1; padding: 16px 14px; background: rgba(229,226,220,.06); border-left: 2px solid var(--attention); color: var(--attention); font-size: 15px; }
.surface-chart #surfaceChartClear { grid-column: 1 / -1; justify-self: start; padding: 0; border: 0; color: var(--ink-dim); font-size: 12px; background: transparent; min-height: 24px; }
.surface-chart .surfaceChartTools { padding-top: 24px; border-top: 1px solid var(--line); margin-top: 8px; gap: 8px; }
.surface-chart .surfaceChartTools button { min-height: 40px; background: #181818; border-color: var(--line); color: var(--accent); }
.surface-chart .surfaceChartTools button:first-child,
.surface-chart .surfaceChartTools button:nth-child(2) { width: 40px; font-size: 20px; }
#surfaceChartSystem { color: var(--ink-dim); background: transparent; border-color: var(--line); min-height: 40px; font-size: 12px; }
@media (max-width: 900px) and (min-width: 701px) {
  .surface-chart #mapBody { grid-template-columns: minmax(0,1fr) 300px; }
  .surface-chart #mapRail .navigationBody { padding: 20px; }
}
@media (max-width: 700px) {
  .surface-chart #mapBody { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(220px,1fr) minmax(180px,42dvh); }
  .surface-chart #mapRail { display: block; padding: 0; }
  .surface-chart #mapRail .navigationHead { padding: 14px 20px; }
  .surface-chart #mapRail .navigationHead h2 { font-size: 20px; }
  .surface-chart #mapRail .navigationBody { padding: 16px 20px; }
  .surface-chart #surfaceChartVehicles { grid-template-columns: 1fr 1fr; }
  .surface-chart #surfaceChartVehicles button { grid-template-columns: 22px 1fr; padding: 12px; font-size: 14px; }
  .surface-chart #surfaceChartVehicles small { grid-column: 2; }
  .surface-chart #surfaceChartGuidance { gap: 16px; }
}

/* The surface terrain fills the chart; the rail is reserved for vehicle fixes. */
.surface-chart #surfaceChartCanvas { position: absolute; inset: 0; }
.surface-chart #navigationCard > .navigationHead,
.surface-chart #surfaceChartContext,
.surface-chart .surfaceChartHint,
.surface-chart #surfaceChartGuidance { display: none; }
.surface-chart #mapRail .navigationBody { padding: 24px; }
#surfaceChartMapTools { position: absolute; z-index: 8; top: 20px; left: 24px; display: flex; gap: 10px; align-items: center; }
.surface-chart #surfaceChartMapTools .surfaceChartTools { margin: 0; padding: 0; border: 0; }
#surfaceChartMapTools button { background: var(--panel); min-height: 40px; }
#surfaceChartMapTools #surfaceChartSystem { padding: 10px 16px; }
@media (max-width: 700px) {
  .surface-chart #mapBody { grid-template-rows: minmax(220px,1fr) 130px; }
  .surface-chart #mapRail .navigationBody { padding: 16px; }
  #surfaceChartMapTools { top: 12px; left: 12px; gap: 6px; }
  .surface-chart #mapClose { top: 12px; right: 12px; }
}

.surface-chart #surfaceChartCanvas { cursor: grab; touch-action: none; }
.surface-chart #surfaceChartCanvas.panning { cursor: grabbing; }

.surfaceVehicleIcon svg { display: block; width: 26px; height: 26px; margin: 0 auto; }

/* A quiet viewing bay lets the hull carry the ship selector. */
.overlay:has(.fleet-workspace) { background: rgba(0,0,0,.12); }
.modalcard:has(.fleet-workspace) { width: min(1240px, calc(100vw - 48px)); height: min(84dvh, 740px); max-height: 84dvh; background: rgba(0,0,0,.50); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); border-color: rgba(229,226,220,.14); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 100px rgba(0,0,0,.6); }
.modalcard:has(.fleet-workspace) > h2 { position: absolute; top: 14px; right: 16px; z-index: 1; padding: 0; border: 0; background: transparent; }
.modalcard:has(.fleet-workspace) .panelBody { flex: 1; min-height: 0; overflow: hidden; padding: 0; }
.fleet-workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); height: 100%; min-height: 0; }
.fleet-preview { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: transparent; }
.fleet-preview::after { content: ''; position: absolute; right: 0; top: 12px; bottom: 12px; width: 1px; background: linear-gradient(to bottom, transparent, rgba(229,226,220,.18) 25%, rgba(229,226,220,.18) 75%, transparent); pointer-events: none; }
.fleet-heading { padding: 30px 32px 0; }
.fleet-name { margin: 0; color: #f0eee8; font: 500 clamp(22px, 2.4vw, 32px)/1.15 var(--disp); letter-spacing: -.025em; }
.fleet-credit { margin-top: 10px; color: var(--ink-dim); font: 12px/1.5 var(--disp); }
.fleet-model-host { width: 100%; flex: 1; min-height: 0; overflow: hidden; }
.fleet-model-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.fleet-model-canvas.dragging { cursor: grabbing; }
.fleet-model-canvas:focus-visible { outline: 1px solid var(--line-hi); outline-offset: -4px; }
.fleet-preview-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 32px 24px; color: var(--ink-dim); font: 12px/1.4 var(--disp); }
.fleet-reset { padding: 7px 0; background: transparent; border: 0; border-radius: 0; font: 12px var(--disp); color: var(--ink-dim); }
.fleet-reset:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.fleet-preview-status { position: absolute; left: 24px; right: 24px; top: 50%; transform: translateY(-50%); text-align: center; color: var(--ink-dim); font: 12px var(--disp); pointer-events: none; }
.fleet-preview-status:empty { display: none; }
.fleet-options { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 52px 24px 24px; gap: 18px; }
.fleet-list { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; margin: 0; gap: 4px; scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent; }
.fleet-options .fleet-option { position: relative; display: flex; align-items: center; gap: 10px; flex: 1 0 auto; min-height: 68px; padding: 16px 12px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; text-align: left; }
.fleet-options .fleet-option b { flex: 1; margin: 0; color: var(--ink); font: 500 15px/1.4 var(--disp); }
.fleet-options .fleet-option:hover { background: rgba(229,226,220,.035); }
.fleet-options .fleet-option[aria-pressed="true"] { background: rgba(229,226,220,.055); box-shadow: none; }
.fleet-options .fleet-option .fleet-active { flex: none; padding: 0; border: 0; font: 11px var(--disp); color: var(--ink-dim); }
.fleet-option:focus-visible, .fleet-reset:focus-visible, .fleet-select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fleet-select { flex: none; min-height: 46px; background: var(--accent); color: var(--bg); border-color: var(--accent); border-radius: 8px; font: 600 15px var(--disp); }
.fleet-select:not(:disabled):hover { background: #fff; color: var(--bg); }
.fleet-select:disabled { background: rgba(229,226,220,.035); color: #bab8b3; border-color: transparent; opacity: 1; cursor: default; }
@media (max-width: 720px) {
  #settingsCard, .modalcard:has(.fleet-workspace) { width: calc(100vw - 24px); height: 90dvh; }
  .fleet-workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) minmax(0,1fr); }
  .fleet-preview::after { top: auto; bottom: 0; left: 20px; right: 20px; width: auto; height: 1px; background: linear-gradient(to right, transparent, rgba(229,226,220,.18), transparent); }
  .fleet-heading { padding: 18px 20px 0; }
  .fleet-name { font-size: 23px; }
  .fleet-credit { margin-top: 6px; font-size: 11px; }
  .fleet-preview-tools { padding: 0 20px 12px; font-size: 11px; }
  .fleet-options { padding: 12px; gap: 10px; }
  .fleet-options .fleet-option { min-height: 48px; padding: 10px 12px; }
  .fleet-options .fleet-option b { font-size: 14px; }
  .fleet-select { min-height: 42px; }
}


/* The numeric speed shares the label's centre; its unit sits beside it. */
#compactValueA:has(.readoutUnit) { position: relative; overflow: visible; }
#compactValueA .readoutUnit {
  position: absolute; left: calc(100% + 10px); bottom: .15em; white-space: nowrap;
}
@media (max-width: 640px) {
  #compactValueA .readoutUnit { left: calc(100% + 6px); font-size: 11px; }
}


/* Elevation-only flight views have no vehicle list to put in a sidebar. */
.surface-chart:has(#surfaceChartVehicles:empty) #mapBody {
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
}
.surface-chart:has(#surfaceChartVehicles:empty) #mapRail { display: none; }

#pauseIndicator {position:fixed;top:16px;left:16px;z-index:25;padding:8px 12px;background:#151719;color:#f0eee8;border:1px solid #595d62;border-radius:4px;}
