/* Lunar Rover: a quiet instrument HUD over a black sky. Dark glass panels, warm amber for charge,
   green for samples, numerals in a mono face. */
:root {
  --ink: #f2efe8;
  --dim: #a9a49a;
  --line: rgba(255, 255, 255, 0.13);
  --glass: rgba(10, 11, 14, 0.5);
  --amber: #ffb347;
  --green: #63e49c;
  --red: #ff5a4e;
  --ui: var(--kit-grotesk);
  --num: var(--kit-mono);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ink);
  font: 500 15px/1.35 var(--ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }
#game { position: absolute; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#game canvas:active { cursor: grabbing; }

.num { font-family: var(--num); font-variant-ligatures: none; font-variant-numeric: tabular-nums; font-weight: 500; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: clamp(11px, 0.95vw, 16px); }
.panel {
  position: absolute;
  padding: 0.75em 1em 0.8em;
  border-radius: 0.8em;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: inset 0 0 0 1px var(--line), 0 0.6em 1.8em rgba(0, 0, 0, 0.35);
}
.panel header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.4em;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.panel header .num { font-size: 1.45em; letter-spacing: 0; color: var(--ink); text-transform: none; }

.battery { top: 2.2vh; left: 2vw; width: 17em; }
.cells { display: grid; grid-template-columns: repeat(20, 1fr); gap: 0.22em; margin-top: 0.6em; height: 0.9em; }
.cells i { display: block; border-radius: 0.12em; background: rgba(255, 255, 255, 0.1); }
.cells i.on { background: var(--amber); box-shadow: 0 0 0.6em rgba(255, 179, 71, 0.45); }
.battery.low .cells i.on { background: var(--red); box-shadow: 0 0 0.6em rgba(255, 90, 78, 0.55); }
.battery.low header .num { color: var(--red); }

.samples { top: 2.2vh; right: 2vw; width: 15em; }
.pips { display: flex; gap: 0.45em; margin-top: 0.65em; }
.pips i { width: 1em; height: 1em; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.pips i.on { background: var(--green); box-shadow: 0 0 0.7em rgba(99, 228, 156, 0.6); }

.nav { top: 2.2vh; left: 50%; transform: translateX(-50%); text-align: center; min-width: 10em; }
.nav header { justify-content: center; }
.bearing { display: flex; align-items: center; justify-content: center; gap: 0.55em; margin-top: 0.35em; font-size: 1.45em; }
.arrow { width: 1em; height: 1em; fill: var(--amber); transition: none; }

.speed { left: 2vw; bottom: 2.4vh; display: flex; align-items: baseline; gap: 0.4em; padding: 0.55em 1em; }
.speed .big { font-size: 2.3em; line-height: 1; min-width: 1.9em; text-align: right; }
.speed .unit { color: var(--dim); font-size: 0.85em; letter-spacing: 0.08em; }

.clock { right: 2vw; bottom: 2.4vh; display: flex; align-items: baseline; gap: 0.8em; padding: 0.7em 1em; font-size: 0.95em; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.clock .num { font-size: 1.4em; letter-spacing: 0.02em; color: var(--ink); }

/* The marker over the next beacon. */
.marker { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 0.3em; pointer-events: none; font-size: clamp(11px, 0.85vw, 14px); transform: translate(-50%, -100%); will-change: transform; }
.diamond { width: 0.9em; height: 0.9em; transform: rotate(45deg); border: 2px solid var(--amber); box-shadow: 0 0 0.8em rgba(255, 179, 71, 0.6); }
.dist { padding: 0.15em 0.55em; border-radius: 0.4em; background: rgba(10, 11, 14, 0.55); color: var(--ink); font-family: var(--num); font-variant-ligatures: none; }

.toast {
  position: absolute; top: 24%; left: 50%; transform: translate(-50%, 0);
  font-size: clamp(18px, 2vw, 34px); font-weight: 600; letter-spacing: 0.02em; color: #fff;
  text-shadow: 0 0 1em rgba(99, 228, 156, 0.8), 0 2px 10px rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.toast.warn { text-shadow: 0 0 1em rgba(255, 90, 78, 0.8), 0 2px 10px rgba(0, 0, 0, 0.6); }
.toast.on { animation: toast 1.4s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.92); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.04); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -18px) scale(1); } }

/* Screens */
.screen {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 1.3vh; padding: 24px; text-align: center; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
}
.screen p { margin: 0; }
.screen-title { background: radial-gradient(ellipse 70% 60% at 50% 46%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.15) 70%, rgba(0, 0, 0, 0) 100%); }
.kicker { font-size: clamp(12px, 1vw, 17px); letter-spacing: 0.34em; text-transform: uppercase; color: var(--amber); font-weight: 600; }
.screen-title h1 { margin: 0 0 0.3vh; font-size: clamp(56px, 8vw, 140px); line-height: 1.02; font-weight: 600; letter-spacing: -0.035em; color: #fff; }
.tagline { font-size: clamp(15px, 1.35vw, 22px); color: rgba(255, 255, 255, 0.86); max-width: 32em; }
.keys { color: rgba(255, 255, 255, 0.72); font-size: clamp(12px, 0.9vw, 15px); }
.meta { color: var(--amber); font-size: clamp(12px, 0.85vw, 14px); letter-spacing: 0.12em; text-transform: uppercase; }
.meta span + span::before { content: "· "; color: rgba(255, 255, 255, 0.5); }
.meta span:empty, .meta span:empty + span::before { display: none; }
.fact { margin-top: 1.4vh !important; color: rgba(255, 255, 255, 0.5); font-size: clamp(11px, 0.8vw, 13px); letter-spacing: 0.06em; }
.loading { font-size: 16px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

#app > .card {
  inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%);
  min-width: min(460px, 88vw); padding: 34px 44px 30px; border-radius: 22px;
  background: rgba(12, 13, 16, 0.78); backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, 0.6);
}
.card h2 { margin: 0 0 4px; font-size: clamp(30px, 3.2vw, 52px); font-weight: 600; letter-spacing: -0.02em; }
.big { font-size: clamp(20px, 1.9vw, 30px); font-family: var(--num); font-variant-ligatures: none; color: var(--amber); }

.cta {
  margin-top: 1.6vh; font: inherit; font-size: clamp(14px, 1.1vw, 19px); font-weight: 600; letter-spacing: 0.04em;
  color: #111; background: linear-gradient(#ffd08a, #ffad3d); border: 0; border-radius: 999px; padding: 0.85em 2.1em;
  cursor: pointer; text-shadow: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3) inset, 0 0.6em 2em rgba(255, 160, 50, 0.35);
}
.cta:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }

.status {
  position: absolute; left: 50%; bottom: 2.6vh; transform: translateX(-50%); margin: 0; padding: 0.5em 1.2em;
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 999px;
  font-size: clamp(12px, 0.9vw, 15px); background: var(--glass); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line); pointer-events: none;
}
.is-capturing .status, .status:empty { display: none; }

.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 90, 78, 0) 45%, rgba(255, 90, 78, 0.45)); }
.flash.on { animation: flash 0.5s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.touch { position: absolute; inset: 0; pointer-events: none; }
.stick { pointer-events: auto; position: absolute; left: 28px; bottom: 110px; width: 128px; height: 128px; border-radius: 50%; background: rgba(10, 11, 14, 0.35); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4); touch-action: none; }
.knob { position: absolute; left: 34px; top: 34px; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 255, 255, 0.65); }
.touch button { pointer-events: auto; position: absolute; border: 0; border-radius: 50%; color: #111; font: inherit; touch-action: none; }
.touch-brake { right: 30px; bottom: 120px; width: 88px; height: 88px; font-size: 26px; background: rgba(255, 255, 255, 0.75); }
.touch-pause { right: 20px; top: 110px; width: 46px; height: 46px; font-size: 14px; background: rgba(255, 255, 255, 0.6); }

@media (prefers-reduced-motion: reduce) { .loading { animation: none; } }
