/* =========================================================================
   NGI GAME LAB — style.css
   Visual identity: deep-sea dark base, cyan telemetry accents, warm sunset
   counterpoints. Glass panels, crisp typography, no external fonts or
   assets — everything loads offline.
   ========================================================================= */

:root {
  --bg-0: #060e18;
  --bg-1: #0a1622;
  --bg-2: #0f2130;
  --panel: rgba(10, 26, 40, 0.78);
  --panel-2: rgba(14, 34, 50, 0.9);
  --line: rgba(88, 166, 194, 0.25);
  --cyan: #35f0ff;
  --cyan-dim: #1fa8b8;
  --amber: #ffb454;
  --green: #4dff88;
  --red: #ff4d5e;
  --ink: #dcecf5;
  --ink-dim: #7fa2b5;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SF Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  font-family: var(--font);
  color: var(--ink);
}

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

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(2, 8, 14, 0.55) 100%);
}

.hidden { display: none !important; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 22px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s;
  backdrop-filter: blur(6px);
}
.btn:hover { background: rgba(24, 52, 74, 0.95); border-color: var(--cyan-dim); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.btn:active { transform: translateY(0); }
.btn-primary {
  color: #04141c;
  background: linear-gradient(135deg, #3ee8f5, #19b8c9);
  border-color: transparent;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(135deg, #5cf2ff, #21c6d8); box-shadow: 0 8px 24px rgba(53, 240, 255, 0.25); }
.btn-big { font-size: 17px; padding: 15px 42px; }
.btn-back { align-self: flex-start; }
.btn-danger { background: rgba(90, 20, 30, 0.8); border-color: rgba(255, 77, 94, 0.5); color: #ffd6db; }
.btn-danger:hover { background: rgba(120, 26, 40, 0.9); border-color: var(--red); }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(53, 240, 255, 0.1);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--cyan);
}

/* =========================================================================
   MENU SCREENS
   ========================================================================= */
#screens { position: absolute; inset: 0; pointer-events: none; }
.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  pointer-events: auto;
  padding: 34px clamp(20px, 6vw, 90px);
  background: linear-gradient(180deg, rgba(4, 10, 18, 0.62) 0%, rgba(4, 10, 18, 0.28) 45%, rgba(4, 10, 18, 0.72) 100%);
}
.screen.visible { display: block; animation: fadeIn 0.28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.screen-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.screen-head h2 {
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0.14em;
  font-weight: 700;
  text-shadow: 0 2px 14px rgba(0,0,0,0.6);
}

/* ---- title ------------------------------------------------------------------ */
.title-card {
  max-width: 640px;
  margin: clamp(30px, 14vh, 140px) auto 0;
  text-align: center;
  pointer-events: auto;
}
.title-kicker {
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 14px;
}
.title-logo {
  font-size: clamp(44px, 7vw, 74px);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.02;
  color: #fff;
  text-shadow: 0 0 40px rgba(53, 240, 255, 0.35), 0 4px 18px rgba(0,0,0,0.7);
}
.title-logo span {
  background: linear-gradient(120deg, #35f0ff, #7cf 60%, #ffb454);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title-sub {
  margin-top: 10px;
  font-size: clamp(14px, 1.7vw, 18px);
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.title-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 34px auto 0;
}
.title-rank { margin-top: 26px; }
.title-footer {
  margin-top: 26px;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}
.warn-text { color: var(--amber); }

/* ---- rank bar ------------------------------------------------------------------ */
.rank-wrap { max-width: 460px; margin: 0 auto; }
.rank-name { font-size: 14px; letter-spacing: 0.18em; font-weight: 700; color: var(--cyan); }
.rank-xp { color: var(--ink-dim); font-weight: 500; margin-left: 8px; letter-spacing: 0.08em; }
.rank-bar {
  margin-top: 7px;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #19b8c9, #35f0ff);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.rank-next { margin-top: 6px; font-size: 11px; letter-spacing: 0.1em; color: var(--ink-dim); }

/* ---- stage selector ------------------------------------------------------------------ */
.stage-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 22px;
  max-width: 1200px;
}
.stage-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  font-weight: 800;
  color: var(--amber);
  margin-right: 4px;
}
.stage-chip {
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  text-align: left;
}
.stage-chip b { font-size: 14px; letter-spacing: 0.08em; }
.stage-chip i { font-style: normal; font-size: 10px; color: var(--ink-dim); letter-spacing: 0.06em; }
.stage-chip:hover { transform: translateY(-2px); border-color: var(--cyan-dim); }
.stage-chip.active { border-width: 2px; box-shadow: 0 0 18px rgba(53, 240, 255, 0.18); }
.stage-chip.active i { color: var(--ink); }
.stage-ks3 { border-color: rgba(77, 255, 136, 0.45); }
.stage-ks3.active { border-color: var(--green); color: #7dffab; }
.stage-gcse { border-color: rgba(255, 180, 84, 0.45); }
.stage-gcse.active { border-color: var(--amber); color: #ffcd8a; }
.stage-alevel { border-color: rgba(255, 77, 94, 0.45); }
.stage-alevel.active { border-color: var(--red); color: #ff9aa4; }
.stage-all.active { border-color: var(--cyan); color: var(--cyan); }

/* ---- mission select ------------------------------------------------------------------ */
.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  max-width: 1200px;
}
.mission-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mission-card:hover { transform: translateY(-3px); border-color: var(--cyan-dim); box-shadow: var(--shadow); }
.mission-card.locked { opacity: 0.55; cursor: default; filter: saturate(0.4); }
.mission-card.locked:hover { transform: none; }
.mission-card.recommended { border-color: rgba(53, 240, 255, 0.55); box-shadow: 0 0 24px rgba(53, 240, 255, 0.12); position: relative; overflow: hidden; }
.mc-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #04141c;
  background: linear-gradient(135deg, #3ee8f5, #19b8c9);
  padding: 4px 12px;
  border-radius: 0 12px 0 10px;
}
.mc-top { display: flex; justify-content: space-between; align-items: center; }
.mc-medal { font-size: 22px; }
.mission-card h3 { font-size: 19px; letter-spacing: 0.06em; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(53, 240, 255, 0.12);
  border: 1px solid rgba(53, 240, 255, 0.3);
  color: #9beef7;
}
.mc-brief {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-dim);
  flex: 1;
}
.mc-stats {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.06em;
}
.mc-play { margin-top: 2px; }
.mc-locked { font-size: 12px; color: var(--ink-dim); padding: 8px 0 2px; }

.tier-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 4px 10px;
  border-radius: 5px;
}
.tier-badge.big { font-size: 13px; padding: 6px 14px; }
.tier-ks3 { background: rgba(77, 255, 136, 0.14); color: #7dffab; border: 1px solid rgba(77, 255, 136, 0.4); }
.tier-gcse { background: rgba(255, 180, 84, 0.14); color: #ffcd8a; border: 1px solid rgba(255, 180, 84, 0.4); }
.tier-alevel { background: rgba(255, 77, 94, 0.14); color: #ff9aa4; border: 1px solid rgba(255, 77, 94, 0.45); }

/* ---- briefing ------------------------------------------------------------------ */
.brief-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 26px;
  max-width: 1100px;
}
.brief-p { font-size: 15.5px; line-height: 1.65; color: var(--ink); margin-bottom: 14px; max-width: 640px; }
.brief-objective, .brief-tip {
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  max-width: 640px;
}
.brief-objective { background: rgba(53, 240, 255, 0.08); border: 1px solid rgba(53, 240, 255, 0.3); color: #b8f6fc; }
.brief-tip { background: rgba(255, 180, 84, 0.07); border: 1px solid rgba(255, 180, 84, 0.25); color: #ffe0b8; }
.brief-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  backdrop-filter: blur(8px);
}
.brief-side h4 { font-size: 12px; letter-spacing: 0.2em; color: var(--ink-dim); margin-bottom: 12px; }
.concept-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(88, 166, 194, 0.2);
}
.concept-line:last-child { border-bottom: none; }
.concept-name { font-weight: 700; font-size: 14px; color: var(--cyan); }
.concept-formula { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); }
.brief-controls { margin-top: 18px; }
.ctrl-line { font-size: 13px; color: var(--ink-dim); padding: 4px 0; }
.brief-actions {
  margin-top: 30px;
  display: flex;
  gap: 14px;
}

/* ---- debrief ------------------------------------------------------------------ */
.debrief-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.2fr);
  gap: 26px;
  max-width: 1100px;
}
.debrief-medal {
  text-align: center;
  padding: 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.debrief-medal.gold { border-color: rgba(255, 210, 80, 0.6); box-shadow: 0 0 30px rgba(255, 200, 60, 0.18); }
.debrief-medal.silver { border-color: rgba(200, 220, 235, 0.5); }
.debrief-medal.bronze { border-color: rgba(230, 160, 90, 0.5); }
.dm-icon { font-size: 54px; }
.dm-name { margin-top: 6px; letter-spacing: 0.22em; font-weight: 700; color: var(--ink-dim); }
.debrief-score {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.score-row b { color: var(--ink); font-family: var(--mono); }
.score-total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--cyan);
  font-size: 16px;
}
.score-xp { margin-top: 4px; text-align: right; color: var(--amber); font-size: 13px; font-weight: 700; }
.debrief-stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.debrief-stats > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}
.debrief-stats span { color: var(--ink-dim); }
.debrief-stats b { font-family: var(--mono); color: var(--cyan); }
.debrief-right h4 { font-size: 12px; letter-spacing: 0.2em; color: var(--ink-dim); margin: 14px 0 8px; }
.debrief-right h4:first-child { margin-top: 0; }
#debrief-graph {
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.quiz-review { display: flex; flex-direction: column; gap: 6px; }
.qr-line {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.qr-line.ok { border-left: 3px solid var(--green); }
.qr-line.bad { border-left: 3px solid var(--red); }

.landing-report {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.landing-report b { color: var(--ink); font-family: var(--mono); }
.lr-grade { font-size: 17px; font-weight: 800; letter-spacing: 0.12em; margin-bottom: 4px; }
.grade-butter .lr-grade { color: #7dffab; }
.grade-smooth .lr-grade { color: var(--green); }
.grade-firm .lr-grade { color: var(--amber); }
.grade-hard .lr-grade { color: #ff9aa4; }
.grade-impact .lr-grade { color: var(--red); }

/* ---- achievements / codex ------------------------------------------------------------------ */
.ach-grid, .codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 1200px;
}
.ach-card, .codex-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(8px);
}
.ach-card.got { border-color: rgba(255, 200, 60, 0.45); box-shadow: 0 0 24px rgba(255, 200, 60, 0.1); }
.ach-card:not(.got), .codex-card.locked { opacity: 0.6; }
.ach-icon { font-size: 30px; }
.ach-name { margin-top: 8px; font-weight: 700; letter-spacing: 0.08em; }
.ach-desc { margin-top: 4px; font-size: 12.5px; color: var(--ink-dim); }
.cc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cc-head h3 { font-size: 16px; letter-spacing: 0.06em; }
.cc-formula { font-family: var(--mono); color: var(--cyan); font-size: 15px; margin-bottom: 4px; }
.cc-words { font-size: 12px; color: var(--amber); margin-bottom: 8px; }
.cc-blurb { font-size: 13px; line-height: 1.55; color: var(--ink); }
.cc-ingame { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--ink-dim); font-style: italic; }
.cc-locked { font-size: 12.5px; color: var(--ink-dim); }

/* ---- settings ------------------------------------------------------------------ */
.settings-grid {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}
.setting label { font-size: 14px; letter-spacing: 0.06em; color: var(--ink); }
.setting input[type="range"] { width: 200px; accent-color: var(--cyan); }
.setting-val { font-family: var(--mono); font-size: 12px; color: var(--cyan); width: 44px; text-align: right; }
.seg { display: flex; gap: 8px; }
.seg-btn { padding: 8px 16px; font-size: 12px; }
.seg-btn.active { background: rgba(53, 240, 255, 0.16); border-color: var(--cyan-dim); color: var(--cyan); }
.setting.danger { border-color: rgba(255, 77, 94, 0.35); }

/* ---- pause ------------------------------------------------------------------ */
.pause-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 14, 0.72);
  backdrop-filter: blur(5px);
  z-index: 60;
}
.pause-box {
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 44px;
  box-shadow: var(--shadow);
}
.pause-box h2 { letter-spacing: 0.3em; margin-bottom: 16px; }
.pause-controls { margin-bottom: 20px; text-align: center; }
.pause-actions { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }

/* =========================================================================
   HUD
   ========================================================================= */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--font);
  z-index: 20;
}

.hud-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: min(560px, 72vw);
}
.hud-mission-title {
  font-size: 11.5px;
  letter-spacing: 0.3em;
  color: var(--amber);
  font-weight: 700;
}
.hud-objective {
  margin-top: 5px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.hud-progress {
  margin: 8px auto 0;
  width: 78%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}
.hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #19b8c9, #35f0ff);
  transition: width 0.3s ease;
}
.hud-progress-text {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
}
.hud-phase {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  font-weight: 700;
}

/* left cluster: speed dial + throttle */
.hud-left {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.hud-speed-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px 12px;
  text-align: center;
  backdrop-filter: blur(6px);
  min-width: 150px;
}
.hud-dial { width: 132px; height: 70px; display: block; margin: 0 auto; }
.dial-bg { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 7; stroke-linecap: round; }
.dial-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(53, 240, 255, 0.6));
}
.hud-speed-num {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-top: 2px;
}
.hud-speed-unit { font-size: 11px; letter-spacing: 0.2em; color: var(--ink-dim); }

.hud-throttle-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(6px);
}
.hud-block-label { font-size: 9.5px; letter-spacing: 0.22em; color: var(--ink-dim); font-weight: 700; }
.hud-throttle-bar {
  width: 12px;
  height: 88px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.hud-throttle-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #ffb454, #ff7a3d);
  transition: height 0.15s linear;
}
.hud-throttle-pct { font-family: var(--mono); font-size: 12px; color: var(--amber); }

/* right cluster: formula card */
.hud-right {
  position: absolute;
  right: 22px;
  top: 96px;
  width: min(330px, 30vw);
}
.hud-formula {
  background: var(--panel);
  border: 1px solid rgba(53, 240, 255, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 30px rgba(53, 240, 255, 0.08);
}
.hud-card-tag { font-size: 9.5px; letter-spacing: 0.26em; color: var(--amber); font-weight: 700; }
.hud-card-title {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.02em;
}
.hud-card-body {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.hud-card-body .fv { color: #ffd28a; }
.hud-card-body .fr {
  color: var(--cyan);
  font-weight: 700;
  font-size: 15.5px;
}
.hud-card-note { margin-top: 8px; font-size: 11.5px; line-height: 1.45; color: var(--ink-dim); }

/* bottom-left readouts */
.hud-bottom-left {
  position: absolute;
  left: 22px;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hud-readout {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: rgba(8, 20, 32, 0.6);
  border-left: 2px solid var(--line);
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 205px;
  backdrop-filter: blur(4px);
}
.hud-readout-label { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-dim); font-weight: 600; }
.hud-readout-value { font-family: var(--mono); font-size: 12px; color: #bfe9f5; }

/* graph */
.hud-bottom-right {
  position: absolute;
  right: 22px;
  bottom: 22px;
}
.hud-graph-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  backdrop-filter: blur(6px);
}
.hud-graph { display: block; border-radius: 6px; }

/* warnings */
.hud-warn {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.hud-warn-item {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.28em;
  padding: 8px 22px;
  border-radius: 8px;
  margin-bottom: 8px;
  animation: warnPulse 0.8s ease-in-out infinite alternate;
}
.hud-warn-item.red { color: #fff; background: rgba(255, 40, 60, 0.55); }
.hud-warn-item.amber { color: #1c1204; background: rgba(255, 190, 70, 0.75); }
@keyframes warnPulse { from { opacity: 0.65; } to { opacity: 1; } }

.hud-combo {
  position: absolute;
  top: 19%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(53, 240, 255, 0.5);
}

/* =========================================================================
   QUESTION MODAL
   ========================================================================= */
.q-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 9, 15, 0.66);
  backdrop-filter: blur(4px);
  z-index: 80;
  animation: fadeIn 0.2s ease;
}
.q-box {
  width: min(600px, 92vw);
  background: var(--panel-2);
  border: 1px solid rgba(53, 240, 255, 0.35);
  border-radius: 18px;
  padding: 26px 30px;
  box-shadow: 0 0 60px rgba(53, 240, 255, 0.12), var(--shadow);
}
.q-tag {
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--amber);
  font-weight: 800;
}
.q-text {
  margin-top: 12px;
  font-size: 17.5px;
  line-height: 1.55;
  color: #fff;
}
.q-options {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.q-option {
  text-align: left;
  font-size: 15px;
  padding: 13px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(16, 38, 56, 0.85);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
  font-family: var(--font);
}
.q-option:hover:not(:disabled) { border-color: var(--cyan-dim); background: rgba(24, 56, 78, 0.9); transform: translateX(3px); }
.q-option.correct {
  border-color: var(--green);
  background: rgba(30, 90, 50, 0.5);
  color: #d2ffe2;
  font-weight: 700;
}
.q-option.wrong {
  border-color: var(--red);
  background: rgba(100, 30, 40, 0.5);
  color: #ffd4d9;
}
.q-explain {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(53, 240, 255, 0.06);
  border: 1px dashed rgba(53, 240, 255, 0.3);
  color: #c8ecf5;
}
.q-continue {
  margin-top: 14px;
  width: 100%;
}

/* =========================================================================
   TOASTS
   ========================================================================= */
.toast {
  position: fixed;
  top: 84px;
  right: 26px;
  z-index: 90;
  min-width: 240px;
  max-width: 340px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan-dim);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: none; }
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.gold { border-left-color: #ffd054; box-shadow: 0 0 30px rgba(255, 200, 60, 0.15); }
.toast-title { font-size: 13.5px; font-weight: 800; letter-spacing: 0.08em; }
.toast-sub { margin-top: 3px; font-size: 12px; color: var(--ink-dim); }

/* =========================================================================
   RESPONSIVE / ACCESSIBILITY
   ========================================================================= */
@media (max-width: 980px) {
  .hud-right { width: 250px; top: 84px; }
  .hud-card-body { font-size: 12.5px; }
  .brief-grid, .debrief-grid { grid-template-columns: 1fr; }
  .hud-bottom-left { top: auto; bottom: 130px; }
}
@media (max-width: 700px) {
  .hud-bottom-left { display: none; }
  .hud-right { right: 12px; width: 220px; }
  .hud-left { left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* =========================================================================
   PLATFORM SHELL — hub & game pages
   ========================================================================= */
#shell-ui { position: absolute; inset: 0; pointer-events: none; }
#shell-ui .screen { pointer-events: auto; }
#game-page { position: absolute; inset: 0; pointer-events: none; }
#game-page .screen { pointer-events: auto; }
#shell-toasts { position: absolute; inset: 0; pointer-events: none; z-index: 90; }

.hub-screen {
  display: none;
  overflow-y: auto;
  padding: 40px clamp(20px, 6vw, 90px);
  background: linear-gradient(180deg, rgba(4, 10, 18, 0.66) 0%, rgba(4, 10, 18, 0.30) 45%, rgba(4, 10, 18, 0.78) 100%);
}
.hub-screen.visible { display: block; animation: fadeIn 0.28s ease; }

.hub-card {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
  pointer-events: auto;
}
.hub-card .title-kicker { font-size: 12px; letter-spacing: 0.42em; color: var(--amber); font-weight: 600; margin-bottom: 12px; }
.hub-card .title-logo {
  font-size: clamp(40px, 6vw, 66px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 40px rgba(53, 240, 255, 0.35), 0 4px 18px rgba(0, 0, 0, 0.7);
}
.hub-card .title-logo span {
  background: linear-gradient(120deg, #35f0ff, #7cf 60%, #ffb454);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hub-card .title-sub { margin-top: 8px; font-size: 13px; letter-spacing: 0.24em; color: var(--ink-dim); text-transform: uppercase; }
.hub-rank { max-width: 460px; margin: 22px auto 0; }

.hub-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin: 34px 0 8px;
}
.hub-game-card {
  --accent: var(--cyan);
  position: relative;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
  backdrop-filter: blur(8px);
}
.hub-game-card:hover { transform: translateY(-4px); box-shadow: 0 0 34px rgba(53, 240, 255, 0.14); }
.hub-game-card.soon { opacity: 0.5; cursor: default; border-top-color: rgba(255, 255, 255, 0.15); }
.hub-game-card.soon:hover { transform: none; box-shadow: none; }
.hgc-icon { font-size: 34px; margin-bottom: 10px; }
.hgc-title { font-size: 20px; font-weight: 800; letter-spacing: 0.05em; color: #fff; }
.hgc-tagline { margin-top: 4px; font-size: 12.5px; color: var(--ink-dim); }
.hgc-progress { margin-top: 12px; font-size: 11px; letter-spacing: 0.1em; color: var(--amber); }
.hgc-progress span { color: var(--cyan); font-family: var(--mono); }
.hgc-play { margin-top: 14px; width: 100%; }
.hgc-status { margin-top: 12px; font-size: 10px; font-weight: 800; letter-spacing: 0.22em; color: var(--ink-dim); }

.hub-menu { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }
.hub-menu .btn { padding: 10px 18px; font-size: 12px; }

.game-section-title { margin: 26px 0 12px; font-size: 18px; letter-spacing: 0.1em; color: var(--cyan); }
.global-note { color: var(--ink-dim); font-size: 13px; margin-bottom: 6px; }

/* =========================================================================
   QUICK SETTINGS — bottom corner gear, always available
   ========================================================================= */
.quick-settings {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 95;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--cyan);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}
.quick-settings:hover {
  transform: rotate(45deg) scale(1.08);
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(53, 240, 255, 0.25);
}
#shell-ui { z-index: 70; }

/* =========================================================================
   ECONOMY — coins, hangar, dealership, progress, onboarding
   ========================================================================= */
.coin-pill {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 20px;
  padding: 7px 16px;
}
.hub-stats { display: flex; justify-content: center; gap: 22px; margin: 18px 0 4px; flex-wrap: wrap; }
.hub-stat { font-size: 13px; letter-spacing: 0.08em; color: var(--ink-dim); }
.hub-stat b { color: var(--cyan); font-family: var(--mono); }

.fleet-nav { display: flex; gap: 10px; align-items: center; margin: 12px 0 18px; }

.hangar-grid, .dealer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.hangar-ship, .dealer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.dealer-card.current { border-color: var(--green); }
.dealer-card.owned { border-color: rgba(53, 240, 255, 0.3); }
.hangar-icon { font-size: 40px; }
.hangar-name, .hgc-title { margin: 8px 0 4px; }
.hangar-desc { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 12px; }
.spec-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 10px 0; }
.spec-row { display: flex; justify-content: space-between; padding: 7px 12px; font-size: 12.5px; border-bottom: 1px solid rgba(88,166,194,0.12); }
.spec-row:last-child { border-bottom: none; }
.spec-row span { color: var(--ink-dim); }
.spec-row b { color: var(--cyan); font-family: var(--mono); font-weight: 600; }

.hangar-owned { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.hangar-owned h4 { font-size: 12px; letter-spacing: 0.16em; color: var(--ink-dim); }
.hangar-upgrades h4 { font-size: 12px; letter-spacing: 0.16em; color: var(--ink-dim); margin-bottom: 10px; }
.upgrade-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.upgrade-card.maxed { opacity: 0.75; border-color: rgba(77, 255, 136, 0.3); }
.up-name { font-weight: 800; letter-spacing: 0.06em; }
.up-effect { font-size: 12px; color: var(--ink-dim); margin: 2px 0 8px; }
.up-pips { display: flex; gap: 6px; margin-bottom: 10px; }
.pip { width: 26px; height: 7px; border-radius: 4px; background: rgba(255,255,255,0.12); }
.pip.filled { background: var(--cyan); box-shadow: 0 0 8px rgba(53,240,255,0.4); }
.up-state { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--green); }
.dealer-flag { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--green); }
.dealer-need { font-size: 11.5px; color: var(--amber); margin-top: 6px; }

.progress-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.pt-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.pt-card span { font-size: 11px; letter-spacing: 0.12em; color: var(--ink-dim); text-transform: uppercase; }
.pt-card b { font-size: 22px; font-family: var(--mono); color: var(--cyan); }

.topic-table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.topic-row { display: grid; grid-template-columns: 1fr 130px 130px; gap: 10px; padding: 10px 16px; border-bottom: 1px solid rgba(88,166,194,0.12); font-size: 13px; align-items: center; }
.topic-row:last-child { border-bottom: none; }
.topic-name { color: var(--ink); }
.topic-name i { color: var(--ink-dim); font-style: normal; font-size: 11px; margin-left: 6px; }
.topic-acc { font-family: var(--mono); color: var(--cyan); }
.topic-status { font-weight: 800; font-size: 10.5px; letter-spacing: 0.14em; }
.topic-status.strong { color: var(--green); }
.topic-status.dev { color: var(--amber); }
.topic-status.weak { color: var(--red); }
.topic-row.none { color: var(--ink-dim); }

.onboard-screen {
  display: none;
  overflow-y: auto;
  padding: 40px clamp(20px, 6vw, 90px);
  background: linear-gradient(180deg, rgba(4,10,18,0.94), rgba(4,10,18,0.92));
}
.onboard-screen.visible { display: block; }
.onboard-card { max-width: 860px; margin: 0 auto; }
.onboard-section { margin-top: 30px; text-align: left; }
.onboard-section h3 { letter-spacing: 0.14em; font-size: 14px; color: var(--amber); margin-bottom: 8px; }
.onboard-note { font-size: 13px; color: var(--ink-dim); margin-bottom: 14px; }
.onboard-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.onboard-chip {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.onboard-chip b { font-size: 17px; letter-spacing: 0.08em; }
.onboard-chip i { font-style: normal; font-size: 11px; color: var(--amber); }
.onboard-chip em { font-style: normal; font-size: 12px; color: var(--ink-dim); }
.onboard-chip.selected { border-color: var(--cyan); box-shadow: 0 0 20px rgba(53,240,255,0.2); }
.onboard-card .btn-big { margin-top: 30px; width: 100%; }

/* =========================================================================
   CRASH — sea contact restart
   ========================================================================= */
.crash-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(120, 10, 10, 0.45);
  animation: fadeIn 0.15s ease;
  pointer-events: auto;
}
.crash-box {
  text-align: center;
  background: rgba(10, 6, 6, 0.92);
  border: 1px solid rgba(255, 77, 94, 0.6);
  border-radius: 16px;
  padding: 34px 54px;
  box-shadow: 0 0 60px rgba(255, 40, 40, 0.3);
}
.crash-box h2 {
  font-size: 30px;
  letter-spacing: 0.14em;
  color: #ff4d5e;
  margin-bottom: 10px;
}
.crash-box p { color: var(--ink); font-size: 15px; }
.crash-box .crash-sub, .crash-box p:last-child { color: var(--ink-dim); font-size: 13px; margin-top: 8px; }

/* km/h under the big speed readout */
.hud-kmh {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  font-family: var(--mono);
  margin-top: 2px;
}
