/* ---------------------------------------------------------------------------
   styles.css — vector/monospace HUD and overlay screens.
   --------------------------------------------------------------------------- */
:root {
  --cyan: #7ef0ff;
  --cyan-dim: rgba(126, 240, 255, 0.45);
  --green: #35e0c0;
  --amber: #ffc14d;
  --red: #ff5f6d;
  --pink: #ff4fd8;
  --ink: #cfe9ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-shadow: 0 0 6px rgba(80, 200, 255, 0.45);
  z-index: 10;
}

/* --- Top bar -------------------------------------------------------------- */
.hud-top, .hud-topright {
  position: absolute;
  top: 10px;
  display: flex;
  gap: 16px;
  align-items: baseline;
  background: rgba(0, 8, 16, 0.34);
  padding: 4px 8px;
  border-radius: 2px;
}
.hud-top { left: 12px; }
.hud-topright { right: 12px; flex-direction: column; align-items: flex-end; gap: 2px; }
.hud-score { font-size: 15px; font-weight: 700; color: #fff; }
.hud-lives { color: var(--green); letter-spacing: 0.2em; }
.hud-high { color: var(--cyan-dim); }
.hud-level { color: var(--cyan); letter-spacing: 0.14em; }
.hud-status { color: rgba(180, 220, 255, 0.55); font-size: 10px; }

/* --- Fuel / throttle ------------------------------------------------------ */
.hud-left {
  position: absolute;
  left: 12px;
  top: 46%;
  transform: translateY(-50%);
  width: 156px;
  background: rgba(0, 8, 16, 0.34);
  padding: 6px 8px;
  border-radius: 2px;
}
.hud-label { font-size: 10px; color: var(--cyan-dim); letter-spacing: 0.2em; margin-bottom: 3px; }
.hud-value { font-size: 13px; margin: 2px 0 10px; }
.bar {
  width: 100%;
  height: 9px;
  border: 1px solid var(--cyan-dim);
  background: rgba(0, 30, 60, 0.35);
  position: relative;
}
.bar.short { height: 6px; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #1d9fbf, var(--cyan)); transition: width 0.08s linear; }
.bar-fill.fuel.low { background: linear-gradient(90deg, #a02030, var(--red)); }
.bar-fill.thrust { background: linear-gradient(90deg, #b06a10, var(--amber)); }
.bar-tick {
  position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px;
  background: var(--green); opacity: 0.45; pointer-events: none;
}
.bar-tick.on { opacity: 1; box-shadow: 0 0 6px var(--green); }

/* --- Instruments ---------------------------------------------------------- */
.hud-bottomleft {
  position: absolute; left: 12px; bottom: 14px;
  background: rgba(0, 8, 16, 0.34);
  padding: 6px 8px;
  border-radius: 2px;
}
.readout { display: flex; justify-content: space-between; width: 178px; line-height: 1.5; }
.readout-label { color: var(--cyan-dim); font-size: 10px; letter-spacing: 0.18em; }
.readout-value { color: #dff3ff; }
.readout-value.ok { color: var(--green); }
.readout-value.warn { color: var(--amber); }
.readout-value.bad { color: var(--red); }

.safe-pill {
  margin-top: 7px;
  width: 178px;
  text-align: center;
  padding: 4px 6px;
  border: 1px solid var(--cyan-dim);
  color: var(--cyan-dim);
  letter-spacing: 0.16em;
  font-size: 11px;
}
.safe-pill.ok { border-color: var(--green); color: var(--green); background: rgba(6, 40, 32, 0.55); font-weight: 700; box-shadow: 0 0 12px rgba(53, 224, 192, 0.35); }
.safe-pill.warn { border-color: var(--amber); color: var(--amber); background: rgba(40, 30, 6, 0.5); }
.safe-pill.idle { opacity: 0.6; }
.safe-pill.state-landed { border-color: var(--green); color: var(--green); background: rgba(6, 40, 32, 0.55); }
.safe-pill.state-offpad { border-color: var(--amber); color: var(--amber); background: rgba(40, 30, 6, 0.5); }
.safe-pill.state-crashed { border-color: var(--red); color: var(--red); background: rgba(40, 6, 10, 0.5); }

/* --- Radar ---------------------------------------------------------------- */
.hud-radar { position: absolute; left: 214px; bottom: 14px; }
.radar-canvas {
  width: 150px; height: 96px;
  border: 1px solid var(--cyan-dim);
  background: rgba(0, 20, 40, 0.28);
  display: block;
}
.radar-label { font-size: 9px; color: var(--cyan-dim); letter-spacing: 0.18em; margin-bottom: 3px; }

/* --- Navball -------------------------------------------------------------- */
.hud-adi {
  position: absolute; right: 14px; bottom: 86px;
  width: 124px; height: 124px;
}
.adi-canvas { width: 124px; height: 124px; display: block; }

/* --- Landing-pad distance labels ------------------------------------------ */
.hud-padlabels { position: absolute; inset: 0; overflow: hidden; }
.hud-padlabel {
  position: absolute; left: 0; top: 0; display: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; white-space: nowrap;
  padding: 1px 5px; border-radius: 2px; background: rgba(2, 10, 18, 0.55);
}
.hud-padlabel.p1 { color: var(--green); border: 1px solid rgba(53, 224, 192, 0.5); }
.hud-padlabel.p2 { color: var(--amber); border: 1px solid rgba(255, 193, 77, 0.5); }
.hud-padlabel.p5 { color: var(--pink); border: 1px solid rgba(255, 79, 216, 0.5); }

/* --- Cockpit shell -------------------------------------------------------- */
.cockpit { position: absolute; inset: 0; pointer-events: none; }
.cockpit.hidden { display: none; }
.cockpit-top {
  position: absolute; left: 0; right: 0; top: 0; height: 5.5%;
  background: linear-gradient(180deg, #0a0f16 0%, #131a24 60%, #1c2530 100%);
  border-bottom: 2px solid rgba(126, 240, 255, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
}
.cockpit-dash {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(180deg, #16202b 0%, #0a0f16 100%);
  border-top: 2px solid rgba(126, 240, 255, 0.25);
  box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.7);
}
.cockpit-gauge { min-width: 84px; text-align: center; color: var(--cyan); }
.cockpit-gauge-label { display: block; font-size: 9px; letter-spacing: 0.2em; color: var(--cyan-dim); }
.cockpit-gauge b { font-size: 20px; }
.cockpit-screen-wrap {
  position: relative; padding: 6px 8px 8px; border: 1px solid rgba(126, 240, 255, 0.35);
  background: #02070c; box-shadow: inset 0 0 24px rgba(40, 180, 220, 0.18);
}
.cockpit-screen-title { font-size: 9px; letter-spacing: 0.22em; color: var(--cyan-dim); margin-bottom: 4px; }
.cockpit-screen { display: block; width: 420px; height: 180px; }
/* The dashboard carries its own instruments; hide the redundant HUD panels. */
#hud.cockpit-active .hud-bottomleft,
#hud.cockpit-active .hud-radar { display: none; }
#hud.cockpit-active .hud-guide { bottom: 27.5%; }
#hud.cockpit-active .hud-adi { bottom: calc(27.5% + 46px); right: 8.5%; }

/* --- Guidance ------------------------------------------------------------- */
.hud-guide {
  position: absolute; right: 14px; bottom: 14px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.guide-arrow { font-size: 22px; color: var(--cyan); line-height: 1; transform-origin: 50% 50%; }
.guide-dist { font-size: 16px; font-weight: 700; color: #fff; }
.guide-pad { font-size: 12px; letter-spacing: 0.16em; }

.pad-marker {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 2px solid var(--pink); border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.8), inset 0 0 6px rgba(255, 79, 216, 0.6);
  display: none;
}
.pad-marker::after {
  content: ''; position: absolute; inset: 9px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 50%;
}

/* --- Messages ------------------------------------------------------------- */
.hud-warn {
  position: absolute; top: 22%; left: 0; right: 0; text-align: center;
  color: var(--red); font-size: 18px; letter-spacing: 0.3em; font-weight: 700;
  animation: blink 0.9s steps(2, end) infinite;
}
.hud-warn.hidden { display: none; }
.hud-event {
  position: absolute; top: 32%; left: 0; right: 0; text-align: center;
  font-size: 30px; font-weight: 700; letter-spacing: 0.18em;
  opacity: 0; transition: opacity 0.18s linear;
}
.hud-event.show { opacity: 1; }
.hud-event.ok { color: var(--green); text-shadow: 0 0 18px rgba(53, 224, 192, 0.8); }
.hud-event.bad { color: var(--red); text-shadow: 0 0 18px rgba(255, 95, 109, 0.8); }
.hud-event.warn { color: var(--amber); }
.hud-event.info { color: var(--cyan); }

@keyframes blink { 50% { opacity: 0.25; } }

/* --- Overlay screens ------------------------------------------------------ */
.overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 20, 40, 0.72), rgba(0, 0, 0, 0.92));
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.overlay.hidden, .screen.hidden, .tutorial.hidden, .touch.hidden { display: none; }
.screen { text-align: center; max-width: 760px; padding: 24px; }
h1.title {
  font-size: 54px; letter-spacing: 0.16em; margin: 0 0 6px;
  color: #fff; text-shadow: 0 0 24px rgba(126, 240, 255, 0.6);
}
h1.title span { color: var(--pink); text-shadow: 0 0 24px rgba(255, 79, 216, 0.7); }
h2.title { font-size: 34px; letter-spacing: 0.16em; margin: 0 0 6px; color: #fff; }
h2.title.ok { color: var(--green); }
h2.title.bad { color: var(--red); }
h2.title.small { font-size: 26px; }
.subtitle { color: rgba(180, 220, 255, 0.7); font-size: 12px; letter-spacing: 0.14em; margin-bottom: 14px; }
.title-score { font-size: 14px; color: var(--cyan); margin-bottom: 18px; letter-spacing: 0.18em; }
.title-score b { color: #fff; }
.title-version { margin-top: 14px; font-size: 10px; color: var(--cyan-dim); letter-spacing: 0.24em; }
.blink { animation: blink 1.3s steps(2, end) infinite; letter-spacing: 0.2em; margin-top: 16px; font-size: 13px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 11px; color: rgba(180, 220, 255, 0.75); margin-top: 10px; }
.keys b { color: var(--cyan); }
.options { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.opt {
  pointer-events: auto; background: rgba(0, 30, 60, 0.4); border: 1px solid var(--cyan-dim);
  color: var(--ink); font: inherit; font-size: 11px; letter-spacing: 0.12em; padding: 6px 12px; cursor: pointer;
}
.opt:hover { border-color: var(--cyan); color: #fff; }
.opt b { color: var(--cyan); }

.scorebox {
  border: 1px solid var(--cyan-dim); padding: 14px 18px; min-width: 340px; margin: 16px auto;
  background: rgba(0, 20, 40, 0.35); text-align: left;
}
.scorebox .row { display: flex; justify-content: space-between; gap: 30px; line-height: 1.7; font-size: 13px; }
.scorebox .row span { color: var(--cyan-dim); letter-spacing: 0.12em; }
.scorebox .row.total { border-top: 1px solid var(--cyan-dim); margin-top: 8px; padding-top: 8px; font-size: 18px; }
.scorebox .row.total b { color: #fff; }

/* --- Tutorial ------------------------------------------------------------- */
.tutorial {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.86); pointer-events: auto;
}
.tutorial-inner { max-width: 620px; padding: 26px 30px; border: 1px solid var(--cyan-dim); background: rgba(0, 18, 34, 0.85); }
.tutorial h3 { margin: 0 0 12px; letter-spacing: 0.22em; color: var(--cyan); font-size: 15px; }
.tutorial p { font-size: 13px; line-height: 1.7; margin: 0 0 12px; }
.tutorial ul { font-size: 12.5px; line-height: 1.9; padding-left: 18px; margin: 0 0 12px; color: rgba(207, 233, 255, 0.9); }
.tutorial b { color: var(--cyan); }
.tutorial .dim { color: rgba(180, 220, 255, 0.6); font-size: 12px; }

/* --- Touch controls ------------------------------------------------------- */
.touch { position: absolute; inset: 0; pointer-events: none; }
.touch-left {
  position: absolute; left: 16px; bottom: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.roll-pad { display: flex; gap: 10px; }
.tbtn.dir { width: 58px; padding: 10px 0; font-size: 16px; line-height: 1; }
.tbtn.active { background: rgba(126, 240, 255, 0.28); }
.stick {
  position: relative; width: 132px; height: 132px;
  border: 2px solid var(--cyan-dim); border-radius: 50%;
  background: rgba(0, 30, 60, 0.22);
  pointer-events: auto; touch-action: none;
}
.knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border: 2px solid var(--cyan); border-radius: 50%; background: rgba(0, 60, 90, 0.5);
  transition: transform 0.03s linear;
}
.thrust-zone {
  position: absolute; right: 14px; bottom: 18px; display: flex; flex-direction: column;
  align-items: center; gap: 10px; pointer-events: auto;
}
.thrust-slider {
  width: 44px; height: clamp(76px, 15vh, 132px); border: 1px solid var(--cyan-dim); position: relative;
  background: rgba(0, 30, 60, 0.22); touch-action: none;
}
.thrust-knob { position: absolute; left: 3px; right: 3px; bottom: 0; height: 12px; background: var(--amber); }
.throttle-quick { display: flex; gap: 6px; }
.tbtn {
  pointer-events: auto; font: inherit; font-size: 11px; letter-spacing: 0.12em;
  color: var(--ink); background: rgba(0, 30, 60, 0.5); border: 1px solid var(--cyan-dim);
  padding: 10px 12px; touch-action: none;
}
.tbtn.small { padding: 6px 8px; font-size: 10px; }
.tbtn.big { width: clamp(76px, 15vh, 104px); height: clamp(76px, 15vh, 104px); border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--amber); border-color: var(--amber); }
.tbtn.big.active { background: rgba(255, 193, 77, 0.35); }
.tbtns { display: flex; gap: 6px; }

/* --- Pause screen buttons ------------------------------------------------- */
.pause-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.pause-buttons .tbtn { font-size: 12px; padding: 8px 14px; }

/* --- Small screens -------------------------------------------------------- */
@media (max-width: 760px), (max-height: 560px) {
  #hud { font-size: 11px; }
  .hud-top { gap: 10px; top: 8px; left: 10px; }
  .hud-score { font-size: 13px; }
  .hud-topright { top: 8px; right: 10px; }
  .hud-status { display: none; }
  .hud-high { display: none; }
  .hud-left { top: auto; bottom: 168px; transform: none; width: 132px; }
  .hud-bottomleft { bottom: auto; top: 46px; left: 10px; }
  .readout { width: 142px; font-size: 11px; }
  .safe-pill { width: 142px; font-size: 10px; }
  .hud-radar { display: none; }
  .hud-adi { right: 10px; bottom: clamp(180px, 52vh, 420px); width: 92px; height: 92px; }
  .adi-canvas { width: 92px; height: 92px; }
  .cockpit-dash { height: 24%; gap: 8px; }
  .cockpit-screen { width: 220px; height: 120px; }
  .cockpit-gauge { min-width: 54px; }
  .cockpit-gauge b { font-size: 14px; }
  .hud-guide { right: 10px; bottom: auto; top: 46px; }
  .hud-event { font-size: 20px; top: 26%; }
  .hud-warn { font-size: 14px; top: 18%; }
  h1.title { font-size: 32px; letter-spacing: 0.1em; }
  h2.title { font-size: 22px; }
  .scorebox { min-width: 0; width: 88vw; padding: 10px 12px; }
  .scorebox .row { font-size: 11.5px; }
  .tutorial-inner { max-width: 92vw; padding: 16px; }
  .tutorial ul { font-size: 11.5px; line-height: 1.7; }
}

/* --- Vignette (under the HUD, over the 3D view) --------------------------- */
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.34) 100%);
}
