:root {
  --bg: #10161d;
  --plate: #232629;
  --plate-2: #2a2c2f;
  --plate-dark: #1b1e21;
  --ivory: #ded6c6;
  --ivory-dim: rgba(222, 214, 198, 0.58);
  --ivory-faint: rgba(222, 214, 198, 0.16);
  --line: rgba(222, 214, 198, 0.26);
  --line-dim: rgba(222, 214, 198, 0.12);
  --amber: #ff9a2e;
  --amber-dim: rgba(255, 154, 46, 0.35);
  --green: #6ef2a2;
  --red: #cf3b2f;
  --rosterH: clamp(152px, 21vh, 220px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app { position: fixed; inset: 0; }

#gl, #hud {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#gl { z-index: 0; touch-action: none; }
#hud { z-index: 4; pointer-events: none; transition: opacity 0.22s ease; }
body.mode-hangar #hud, body.view-chase #hud, body.view-orbit #hud { opacity: 0; }

#glass {
  position: fixed;
  inset: 0;
  z-index: 3;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 66%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 66%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background:
    radial-gradient(118% 96% at 50% 46%,
      rgba(110, 242, 162, 0.04) 0%,
      rgba(110, 242, 162, 0.014) 44%,
      rgba(5, 11, 13, 0.17) 80%,
      rgba(3, 7, 9, 0.42) 100%),
    linear-gradient(104deg,
      rgba(255, 198, 140, 0.12) 0%,
      rgba(255, 198, 140, 0.03) 14%,
      rgba(255, 255, 255, 0) 34%,
      rgba(150, 180, 200, 0.03) 74%,
      rgba(170, 200, 220, 0.06) 100%);
}
#glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(116deg,
    transparent 0%,
    rgba(255, 214, 170, 0.055) 18%,
    transparent 34%,
    transparent 66%,
    rgba(190, 215, 230, 0.035) 84%,
    transparent 100%);
}
body.mode-flight.view-cockpit #glass { opacity: 1; }

#glare {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.22s ease;
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 28%),
      rgba(255, 247, 228, 0.82) 0%,
      rgba(255, 228, 184, 0.34) 3.2%,
      rgba(255, 205, 142, 0.14) 9%,
      rgba(255, 186, 118, 0.05) 20%,
      rgba(255, 176, 110, 0.015) 34%,
      rgba(255, 176, 110, 0) 52%);
}
#glare::after {
  content: "";
  position: absolute;
  left: var(--fgx, 50%);
  top: var(--fgy, 40%);
  width: 15vmin;
  height: 15vmin;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255, 224, 178, 0.16) 0%,
    rgba(255, 198, 138, 0.06) 38%,
    rgba(255, 198, 138, 0) 70%);
}

#wipe {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: #090c0e;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.11s ease;
}
#wipe.on { opacity: 0.4; }

/* ---------- placard ---------- */
.placard {
  pointer-events: none;
  position: fixed;
  left: clamp(12px, 2vw, 30px);
  top: clamp(12px, 2vh, 24px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 15px 11px;
  background-color: var(--plate);
  background-image:
    radial-gradient(circle at 6px 6px, rgba(222, 214, 198, 0.32) 1px, transparent 1.6px),
    radial-gradient(circle at calc(100% - 6px) 6px, rgba(222, 214, 198, 0.32) 1px, transparent 1.6px),
    radial-gradient(circle at 6px calc(100% - 6px), rgba(222, 214, 198, 0.32) 1px, transparent 1.6px),
    radial-gradient(circle at calc(100% - 6px) calc(100% - 6px), rgba(222, 214, 198, 0.32) 1px, transparent 1.6px);
  border: 1px solid var(--line);
}
.pl-mark {
  font-family: "Big Shoulders", sans-serif;
  font-weight: 800;
  font-size: clamp(14px, 1.45vw, 20px);
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--ivory);
}
.pl-rule { height: 1px; width: 100%; background: var(--amber); opacity: 0.9; margin: 2px 0 1px; }
.pl-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--ivory-dim);
  text-transform: uppercase;
}

/* ---------- flight bar ---------- */
#flightBar {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: clamp(12px, 2vh, 24px);
  z-index: 21;
  display: flex;
  gap: 8px;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
body.mode-flight #flightBar { opacity: 1; pointer-events: auto; transform: none; }

.seg { display: flex; border: 1px solid var(--line); background: var(--plate-dark); }
.seg button {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line-dim);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  padding: 9px 12px;
  cursor: pointer;
  line-height: 1;
  min-height: 36px;
}
.seg button:last-child { border-right: 0; }
.seg button.on {
  color: var(--amber);
  background: rgba(255, 154, 46, 0.07);
  box-shadow: inset 0 -2px 0 var(--amber);
}
.seg button:hover { color: var(--amber); }

.bar-btn {
  appearance: none;
  background: var(--plate);
  border: 1px solid var(--line);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  padding: 0 13px;
  cursor: pointer;
  min-height: 36px;
}
.bar-btn:hover { border-color: var(--amber); color: var(--amber); }

/* ---------- hangar ---------- */
#hangar {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
body.mode-flight #hangar {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none !important;
  visibility: hidden;
}

#hangarPanel {
  position: fixed;
  left: clamp(12px, 2vw, 30px);
  bottom: calc(var(--rosterH) + 18px);
  width: min(376px, 40vw);
  padding: 15px 18px 14px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-top: 2px solid var(--amber);
  pointer-events: auto;
}
.hp-cls {
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  color: var(--ivory-dim);
  margin-bottom: 5px;
}
.hp-name {
  margin: 0;
  font-family: "Big Shoulders", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 2.5vw, 32px);
  letter-spacing: 0.09em;
  line-height: 0.98;
  color: var(--ivory);
}
.hp-rule { height: 1px; background: var(--amber); width: 64px; margin: 9px 0 10px; opacity: 0.85; }
.hp-blurb {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(222, 214, 198, 0.74);
  max-width: 40ch;
}
.hp-specs { display: flex; flex-direction: column; }
.spec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-dim);
}
.spec .k {
  font-family: "Barlow", sans-serif;
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ivory-dim);
}
.spec .v {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ivory);
}
.spec .v em { font-style: normal; font-size: 8.5px; opacity: 0.7; margin-left: 3px; }
.spec .v.txt { font-family: "Barlow", sans-serif; font-size: 11px; letter-spacing: 0.04em; color: rgba(222, 214, 198, 0.85); }

.start-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.start-btn em {
  font-family: "IBM Plex Mono", monospace;
  font-style: normal;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  opacity: 0.62;
}
.start-btn:hover, .start-btn:focus-visible { background: var(--amber); color: #1a1c1e; outline: none; }

.hp-records { margin-top: 11px; border-top: 1px solid var(--line-dim); padding-top: 8px; }
.rec-title {
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--ivory-dim);
  margin-bottom: 4px;
}
#recList { list-style: none; margin: 0; padding: 0; }
#recList li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: rgba(222, 214, 198, 0.8);
  padding: 2px 0;
}
#recList li .rk { color: var(--amber); width: 12px; }
#recList li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#recList li a { color: inherit; text-decoration: none; }
#recList li a:hover { color: var(--amber); }
#recList li .vv { font-variant-numeric: tabular-nums; }
#recList li .vv em { font-style: normal; font-size: 8px; opacity: 0.65; margin-left: 2px; }
#recList li.rec-empty { color: var(--ivory-dim); font-family: "Barlow", sans-serif; font-size: 10.5px; letter-spacing: 0.04em; }

/* ---------- roster ---------- */
.roster {
  display: flex;
  background: var(--plate-dark);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(222, 214, 198, 0.2) transparent;
}
#roster {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--rosterH);
  z-index: 13;
  pointer-events: auto;
  padding-top: 4px;
  gap: 1px;
}
.roster::-webkit-scrollbar { height: 6px; }
.roster::-webkit-scrollbar-thumb { background: rgba(222, 214, 198, 0.2); }
.roster::-webkit-scrollbar-track { background: transparent; }

.acard {
  appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 0 132px;
  max-width: 215px;
  height: calc(100% - 4px);
  margin-top: 0;
  padding: 8px 10px 7px;
  background: var(--plate);
  border: 0;
  border-right: 1px solid var(--line-dim);
  border-bottom: 2px solid transparent;
  color: var(--ivory);
  text-align: left;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.acard:hover { opacity: 0.9; transform: translateY(-3px); background: #272a2d; }
.acard.selected { opacity: 1; border-bottom-color: var(--amber); background: #2a2d30; }
.ac-emblem {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  opacity: 0.92;
}
.ac-emblem svg { width: 100%; height: 100%; display: block; }
.ac-cls {
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--ivory-dim);
  padding-right: 28px;
  min-height: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-sil {
  flex: 1 1 auto;
  min-height: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 3px 0 1px;
}
.ac-sil svg { height: 100%; max-height: 100%; width: auto; max-width: 94%; display: block; }
.ac-cls, .ac-name, .ac-specs { flex: 0 0 auto; }
.ac-name {
  font-family: "Big Shoulders", sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.ac-specs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.spec-mini { display: flex; flex-direction: column; min-width: 0; align-items: flex-end; text-align: right; }
.spec-mini .k {
  font-family: "Barlow", sans-serif;
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: rgba(222, 214, 198, 0.42);
  white-space: nowrap;
  overflow: hidden;
}
.spec-mini .v {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: rgba(222, 214, 198, 0.9);
  white-space: nowrap;
}
.spec-mini .v em { font-style: normal; font-size: 6.5px; opacity: 0.65; margin-left: 1px; }

/* ---------- hint ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 22;
  transform: translateX(-50%) translateY(6px);
  padding: 7px 12px;
  background: var(--plate);
  border: 1px solid var(--line);
  color: var(--ivory-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hint.show { opacity: 0.95; transform: translateX(-50%) translateY(0); }
body.mode-hangar .hint { display: none; }

/* ---------- touch ---------- */
#touch { display: none; }
body.mode-flight.touch #touch { display: block; }
body.mode-flight.touch .hint { display: none; }
#stickBase {
  position: fixed;
  left: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 44%),
    radial-gradient(circle at 50% 50%, #30353a 0%, #23272b 46%, #171a1d 72%, #0f1113 100%);
  border: 1px solid rgba(222, 214, 198, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -10px 20px rgba(0, 0, 0, 0.62),
    0 6px 16px rgba(0, 0, 0, 0.5);
  z-index: 24;
  touch-action: none;
}
.sb-rim {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background-image: repeating-conic-gradient(from 0deg, rgba(222, 214, 198, 0.34) 0 1deg, transparent 1deg 15deg);
  -webkit-mask-image: radial-gradient(circle, transparent 0 62%, #000 63% 71%, transparent 72%);
  mask-image: radial-gradient(circle, transparent 0 62%, #000 63% 71%, transparent 72%);
  opacity: 0.7;
  pointer-events: none;
}
.sb-boot {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 24px;
  bottom: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 40%, #14171a 0%, #101214 48%, #1c2024 74%, #090b0c 100%);
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.sb-boot::before, .sb-boot::after {
  content: "";
  position: absolute;
  background: rgba(222, 214, 198, 0.10);
}
.sb-boot::before { left: 50%; top: 8px; bottom: 8px; width: 1px; }
.sb-boot::after { top: 50%; left: 8px; right: 8px; height: 1px; }
.sb-label {
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 6.5px;
  letter-spacing: 0.16em;
  color: rgba(222, 214, 198, 0.52);
  white-space: nowrap;
  pointer-events: none;
}
#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 62px;
  margin: -31px 0 0 -23px;
  border-radius: 46% 46% 34% 34% / 34% 34% 62% 62%;
  background:
    linear-gradient(155deg, #62686f 0%, #3c4248 22%, #24282c 56%, #121518 100%);
  border: 1px solid rgba(222, 214, 198, 0.34);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.20),
    inset -4px 0 8px rgba(0, 0, 0, 0.35),
    0 7px 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.grip-palm {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 8px;
  height: 28px;
  border-radius: 40% 40% 30% 30% / 30% 30% 50% 50%;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px);
  opacity: 0.7;
}
.grip-cap {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 26px;
  height: 11px;
  margin-left: -13px;
  border-radius: 50%;
  background: linear-gradient(#4b5157, #22262a);
  border: 1px solid rgba(222, 214, 198, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.grip-hat {
  position: absolute;
  left: 50%;
  top: 15px;
  width: 15px;
  height: 11px;
  margin-left: -7.5px;
  border-radius: 3px;
  background: linear-gradient(#202428, #0d0f11);
  border: 1px solid rgba(222, 214, 198, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.grip-trigger {
  position: absolute;
  left: 50%;
  top: 32px;
  width: 20px;
  height: 7px;
  margin-left: -10px;
  border-radius: 3px 3px 5px 5px;
  background: linear-gradient(#c8632a, #7c2f12);
  box-shadow: 0 0 5px rgba(255, 154, 46, 0.25);
}
#thrWrap {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 24;
  display: grid;
  grid-template-columns: auto 30px;
  grid-template-rows: auto auto;
  gap: 4px 6px;
  align-items: end;
}
.thr-marks {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 132px;
  padding-bottom: 1px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 6.5px;
  letter-spacing: 0.08em;
  color: rgba(222, 214, 198, 0.52);
  text-align: right;
}
.thr-marks span:nth-child(1) { color: var(--amber); opacity: 0.8; }
#thrTrack {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  width: 30px;
  height: 132px;
  background:
    linear-gradient(90deg, #0b0d0f 0%, #1e2226 26%, #2a2f34 50%, #191c1f 74%, #0b0d0f 100%);
  border: 1px solid rgba(222, 214, 198, 0.3);
  border-radius: 3px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
  touch-action: none;
}
.thr-rail {
  position: absolute;
  left: 50%;
  top: 7px;
  bottom: 7px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: linear-gradient(#08090a, #2b3035);
  box-shadow: inset 0 0 4px #000;
  pointer-events: none;
}
#thrFill {
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 6px;
  margin-left: -3px;
  height: 62%;
  border-radius: 3px;
  background: linear-gradient(#ffc26e, #d57a1c 65%, #8a4a10);
  box-shadow: 0 0 9px rgba(255, 154, 46, 0.55);
  pointer-events: none;
}
#thrKnob {
  position: absolute;
  left: -9px;
  right: -9px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(#666c72 0%, #373c41 38%, #1a1d20 100%);
  border: 1px solid rgba(222, 214, 198, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 3px 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
#thrKnob i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #ffd28c, #ff9a2e 55%, #a95a12);
  box-shadow: 0 0 7px rgba(255, 154, 46, 0.7);
}
.thr-label {
  grid-column: 1 / span 2;
  grid-row: 1;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--ivory-dim);
  white-space: nowrap;
}
.thr-label em { font-style: normal; color: var(--amber); }
#touchBtns {
  position: fixed;
  left: 160px;
  right: calc(16px + 82px);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 24;
  display: flex;
  gap: 6px;
  justify-content: center;
}
#touchBtns button {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  max-width: 76px;
  height: 36px;
  background: var(--plate);
  border: 1px solid var(--line);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-size: 9.5px;
  letter-spacing: 0.14em;
}
#touchBtns button:active { border-color: var(--amber); color: var(--amber); }

/* ---------- side help ---------- */
.side-panel {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: clamp(60px, 9vh, 92px);
  z-index: 44;
  width: min(308px, calc(100vw - 24px));
  background: var(--plate);
  border: 1px solid var(--line);
  border-top: 2px solid var(--amber);
  transform: translateX(calc(100% + 30px));
  transition: transform 0.24s ease;
}
.side-panel.open { transform: none; }
.sp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.22em;
}
.sp-body { padding: 10px 12px 12px; }
.x {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ivory);
  width: 26px;
  height: 26px;
  line-height: 1;
  font-size: 16px;
  cursor: pointer;
}
.x:hover { border-color: var(--amber); color: var(--amber); }

.ctrl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: baseline;
  font-family: "Barlow", sans-serif;
  font-size: 11.5px;
  color: rgba(222, 214, 198, 0.82);
}
.ctrl-grid .key {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--amber);
  white-space: nowrap;
  text-align: right;
}
.ctrl-note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-dim);
  font-family: "Barlow", sans-serif;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--ivory-dim);
}

/* ---------- menu ---------- */
.menu {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  max-height: min(76vh, 580px);
  background: #202326;
  border-top: 2px solid var(--amber);
  transform: translateY(calc(100% + 6px));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.menu.open { transform: translateY(0); }
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.menu-title {
  font-family: "Big Shoulders", sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.26em;
  color: var(--ivory);
}
.menu-inner {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(420px, 1.45fr);
  gap: 22px;
  padding: 14px 16px 16px;
  overflow: auto;
  min-height: 0;
}
.menu-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lbl {
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--ivory-dim);
}
.menu-btns { gap: 7px; }
.act-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.16em;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 36px;
}
.act-btn:hover { border-color: var(--amber); color: var(--amber); }
.menu-controls {
  border-top: 1px solid var(--line-dim);
  padding-top: 9px;
}
.menu-roster-wrap { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.menu-roster-wrap .lbl { margin-bottom: 1px; }

.roster-compact {
  height: 164px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  overflow-y: hidden;
}
.roster-compact .acard { min-width: 116px; padding: 7px 8px 6px; }
.roster-compact .ac-name { font-size: 12px; }
.roster-compact .ac-sil { min-height: 28px; }
.roster-compact .ac-specs { display: none; }
.roster-compact .ac-cls { font-size: 7px; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 20%;
  z-index: 50;
  transform: translate(-50%, -8px);
  padding: 10px 18px;
  background: var(--plate);
  border: 1px solid var(--amber);
  color: var(--ivory);
  font-family: "Barlow", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { border-color: var(--red); color: var(--red); }

/* ---------- boot ---------- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e1318;
  transition: opacity 0.5s ease;
}
#boot.hide { opacity: 0; pointer-events: none; }
.boot-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 34px;
  background: var(--plate);
  border: 1px solid var(--line);
}
.boot-mark {
  font-family: "Big Shoulders", sans-serif;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: 0.22em;
  color: var(--ivory);
}
.boot-rule { width: 120px; height: 1px; background: var(--amber); }
.boot-msg {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ivory-dim);
}

/* ---------- responsive ---------- */
@media (max-height: 720px) {
  .hp-blurb { display: none; }
  .spec { padding: 4px 0; }
  .hp-records { display: none; }
}
@media (max-height: 620px) {
  #hangarPanel { padding: 11px 14px 10px; }
  .hp-name { font-size: 23px; }
  .start-btn { min-height: 40px; }
}

@media (max-width: 980px) {
  .menu-inner { grid-template-columns: 1fr; gap: 14px; }
  .roster-compact { height: 148px; }
}

@media (max-aspect-ratio: 1/1) {
  #hangarPanel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: calc(var(--rosterH) + 12px);
    padding: 12px 14px 12px;
  }
  .hp-blurb { display: none; }
  .hp-name { font-size: 26px; }
  .hp-records { display: none; }
  .hp-specs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .spec { padding: 4px 0; }
  .acard { flex-basis: 128px; min-width: 128px; }
  #roster { height: clamp(150px, 19vh, 200px); }
  :root { --rosterH: clamp(150px, 21vh, 200px); }
  #flightBar { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 160px); }
  .seg button { padding: 8px 9px; font-size: 9.5px; letter-spacing: 0.1em; }
  .bar-btn { padding: 0 10px; font-size: 9.5px; }
  #hint { display: none; }
}

@media (max-width: 600px) {
  #flightBar { top: 82px; right: 12px; }
}

@media (max-width: 560px) {
  .placard { padding: 7px 11px 9px; }
  .pl-mark { font-size: 12px; }
  .pl-sub { font-size: 7px; }
  .bar-btn { font-size: 9px; }
  .seg button { font-size: 9px; padding: 7px 8px; }
  .menu-inner { padding: 12px; }
  .menu-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  #hangar, #flightBar, .menu, .side-panel, .hint, #toast, #glass, #hud, #boot { transition-duration: 0.01ms; }
}
