/* Rocket X Landing — styles. No external fonts or assets. */
:root {
  --bg: #05070f;
  --panel: rgba(10, 16, 30, 0.78);
  --panel-solid: #0b1222;
  --line: rgba(140, 180, 255, 0.18);
  --text: #e8eefc;
  --muted: #8d9ab8;
  --accent: #5ad1ff;
  --accent-2: #4dff9a;
  --warn: #ffc23d;
  --danger: #ff4d5e;
  --success: #4dff9a;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text); font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

#stage {
  position: absolute; inset: 0; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-top {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left));
}
.hud-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-family: var(--mono); font-size: 12px;
}
.hud-left { min-width: 170px; }
.hud-level { font-family: var(--font); font-weight: 700; font-size: 13px; margin-bottom: 6px; white-space: nowrap; }
.hud-level .muted { font-weight: 500; }
.fuel-label { display: flex; justify-content: space-between; letter-spacing: 0.08em; color: var(--muted); }
.fuel-label span:last-child { color: var(--text); font-weight: 700; }
.fuel-bar { height: 8px; border-radius: 5px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 4px 0 6px; }
#hud-fuel-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #2bd47d, #5ad1ff); transition: width 0.1s linear; }
.fuel.low #hud-fuel-bar { background: var(--danger); animation: blink 0.6s steps(2) infinite; }
.fuel.low .fuel-label span:last-child { color: var(--danger); }
.fuel.mid #hud-fuel-bar { background: var(--warn); }
.hud-small { display: flex; gap: 12px; color: var(--muted); }
.hud-small b { color: var(--text); }

.hud-right { display: grid; grid-template-columns: auto auto; column-gap: 12px; row-gap: 2px; align-items: center; }
.tele { display: grid; grid-template-columns: 52px 54px 24px; align-items: baseline; }
.tele span { color: var(--muted); letter-spacing: 0.06em; font-size: 11px; }
.tele b { text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.tele i { font-style: normal; color: var(--muted); font-size: 10px; padding-left: 4px; }
.tele.warn b { color: var(--warn); }
.tele.danger b { color: var(--danger); }
.tele.good b { color: var(--success); }
#guide { grid-column: 2; grid-row: 1 / span 4; width: 72px; height: 72px; }
.hud-right .tele { grid-column: 1; }

.hud-buttons { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--text); }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:focus-visible, .btn:focus-visible, .back:focus-visible, .chip:focus-visible, .toggle:focus-visible, .seg button:focus-visible, .level:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

#hud-warnings {
  position: absolute; top: calc(118px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.15s ease-out; pointer-events: none;
}
.warning {
  font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.1em;
  padding: 4px 10px; border-radius: 6px; background: rgba(40, 25, 0, 0.75);
  color: var(--warn); border: 1px solid rgba(255, 194, 61, 0.5); white-space: nowrap;
}
.warning.danger { color: #fff; background: rgba(150, 10, 25, 0.85); border-color: var(--danger); animation: pulse 0.7s ease-in-out infinite; }

.hud-status {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--safe-bottom));
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.12em;
  padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  white-space: nowrap; max-width: calc(100vw - 20px); overflow: hidden; text-overflow: ellipsis;
}
.hud-status.good { color: var(--success); border-color: rgba(77,255,154,0.5); }
.hud-status.warn { color: var(--warn); border-color: rgba(255,194,61,0.5); }
.hud-status.danger { color: var(--danger); border-color: rgba(255,77,94,0.6); }
body.touch-on .hud-status { bottom: calc(150px + var(--safe-bottom)); }

/* ---------------------------------------------------------- ready banner */
/* Sits to the left of centre so it never covers the rocket (camera keeps the
   rocket horizontally centred) or the pad arrow. */
#ready-banner {
  position: absolute; left: calc(20px + var(--safe-left)); top: 50%; transform: translateY(-50%);
  text-align: left; pointer-events: none; width: min(30vw, 400px);
  padding: 18px 20px; border-radius: var(--radius);
  background: rgba(5, 8, 18, 0.62); border: 1px solid var(--line);
  animation: rise 0.4s ease-out;
}
.ready-level { font-family: var(--mono); color: var(--accent); letter-spacing: 0.25em; font-size: 12px; text-transform: uppercase; }
.ready-name { font-size: clamp(26px, 6vw, 40px); font-weight: 800; letter-spacing: -0.01em; margin: 4px 0; }
.ready-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; gap: 6px 12px; flex-wrap: wrap; }
.ready-brief { margin: 10px 0 12px; color: #c7d2ec; font-size: 14px; line-height: 1.45; }
.ready-go { font-family: var(--mono); font-size: 12px; letter-spacing: 0.15em; color: var(--accent-2); text-transform: uppercase; animation: blink 1.2s ease-in-out infinite; }

/* ------------------------------------------------------- touch controls */
#touch {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  pointer-events: none;
}
.touch-left, .touch-right {
  position: absolute; bottom: calc(18px + var(--safe-bottom)); display: flex; gap: 12px; pointer-events: auto;
}
.touch-left { left: calc(16px + var(--safe-left)); }
.touch-right { right: calc(16px + var(--safe-right)); }
.pad-btn {
  width: 84px; height: 84px; border-radius: 22px;
  background: rgba(20, 30, 55, 0.55); border: 1.5px solid rgba(140, 180, 255, 0.35);
  display: grid; place-items: center; touch-action: none; cursor: pointer;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: transform 0.05s, background 0.05s;
}
.pad-btn svg { width: 38px; height: 38px; fill: none; stroke: var(--text); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pad-btn.thrust { width: 118px; height: 118px; border-radius: 50%; border-color: rgba(255, 160, 80, 0.6); background: rgba(80, 30, 10, 0.5); grid-template-rows: auto auto; align-content: center; gap: 2px; }
.pad-btn.thrust svg { fill: #ffb347; stroke: none; width: 40px; height: 40px; }
.pad-btn.thrust span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em; color: #ffd8a8; pointer-events: none; }
.pad-btn.active { transform: scale(0.94); background: rgba(90, 209, 255, 0.35); border-color: var(--accent); }
.pad-btn.thrust.active { background: rgba(255, 120, 40, 0.55); border-color: #ffb347; }
/* Left-handed layout: thrust bottom-left, rotate pads bottom-right. */
body.thrust-left .touch-left { left: auto; right: calc(16px + var(--safe-right)); }
body.thrust-left .touch-right { right: auto; left: calc(16px + var(--safe-left)); }

/* --------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  animation: fade 0.25s ease-out;
}
.screen.dim { background: rgba(2, 4, 10, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#screen-menu { background: radial-gradient(ellipse at 30% 40%, rgba(5,7,15,0.15), rgba(5,7,15,0.75) 70%); justify-content: flex-start; }

.menu-card { width: min(420px, 100%); margin-left: clamp(0px, 6vw, 90px); }
.kicker { font-family: var(--mono); color: var(--accent); letter-spacing: 0.3em; font-size: 12px; text-transform: uppercase; }
.title {
  font-size: clamp(48px, 11vw, 92px); line-height: 0.9; margin: 10px 0 10px; font-weight: 900; letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 30%, #9fb6e8); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(90, 209, 255, 0.15);
}
.tagline { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; }
.menu-foot { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; align-items: center; }

.btn {
  appearance: none; border: 1px solid var(--line); background: rgba(16, 24, 44, 0.85);
  padding: 13px 18px; border-radius: 12px; font-weight: 650; font-size: 16px; cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.btn:hover { border-color: rgba(90, 209, 255, 0.6); background: rgba(22, 34, 62, 0.95); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(135deg, #1aa0d8, #2bd47d); border-color: transparent; color: #021018; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(120, 10, 25, 0.8); border-color: rgba(255, 77, 94, 0.6); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn .sub { display: block; font-size: 12px; font-weight: 500; opacity: 0.75; }

.chip {
  border: 1px solid var(--line); background: rgba(16, 24, 44, 0.7); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip.static { cursor: default; }

/* Spotter's Log — easter eggs found */
.spot-intro { color: #cdd6ec; line-height: 1.5; margin: 0 0 14px; }
.spot-intro #spot-count { color: var(--text); font-weight: 700; }
.spot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.spot-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px;
  border: 1px dashed var(--line); background: rgba(16, 24, 44, 0.55); }
.spot-card.found { border-style: solid; border-color: rgba(255, 200, 90, 0.55); background: rgba(40, 32, 20, 0.55); }
.spot-icon { flex: 0 0 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); font-weight: 800; }
.spot-card.found .spot-icon { background: rgba(255, 200, 90, 0.16); }
.spot-name { font-weight: 700; color: var(--text); }
.spot-card:not(.found) .spot-name { color: var(--muted); }
.spot-text { font-size: 14px; color: #cdd6ec; line-height: 1.4; margin-top: 3px; }
.spot-card:not(.found) .spot-text { font-style: italic; }
.spot-credits { font-size: 12px; color: var(--muted); margin-top: 6px; }
.spot-card.found .spot-credits { color: #ffcf6a; }

/* "Get it on Google Play" — Android browsers only (see RL.Native.androidWeb) */
.play-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px 7px 12px; border-radius: 10px; background: #000; color: #fff;
  border: 1px solid #a6a6a6; text-decoration: none; line-height: 1.05;
  transition: border-color 0.15s, transform 0.08s;
}
.play-badge[hidden] { display: none; }
.play-badge:hover { border-color: #fff; }
.play-badge:active { transform: scale(0.97); }
.play-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.play-badge-icon { width: 22px; height: 22px; fill: var(--accent-2); flex: none; }
.play-badge-text { display: flex; flex-direction: column; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.play-badge-text small { font-size: 10px; font-weight: 500; letter-spacing: 0.06em; opacity: 0.9; }
@media (max-height: 500px) {
  .menu-foot { margin-top: 10px; }
  .play-badge { padding: 4px 12px 4px 9px; gap: 7px; }
  .play-badge-icon { width: 17px; height: 17px; }
  .play-badge-text { font-size: 14px; }
  .play-badge-text small { font-size: 8px; }
}

.panel {
  width: min(560px, 100%); max-height: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; display: flex; flex-direction: column;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.panel.wide { width: min(820px, 100%); }
.panel.narrow { width: min(400px, 100%); }
.panel.center { text-align: center; }
.panel h2 { margin: 0 0 12px; font-size: 24px; letter-spacing: -0.01em; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; flex: 1; }
.back {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; font-size: 18px; cursor: pointer;
}
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; min-height: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.stack .btn { text-align: center; }
.stack.row { flex-direction: row; justify-content: center; }
.stack.row .btn { flex: 1; }

/* level grid */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 2px; }
.campaign-head { grid-column: 1 / -1; margin: 10px 2px 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb4ff; font-weight: 700; }
.campaign-head:first-child { margin-top: 0; }
.new-tag { font-style: normal; font-size: 9px; padding: 1px 5px; margin-left: 4px; border-radius: 6px; background: #4dff9a; color: #052; letter-spacing: 0.05em; vertical-align: 1px; }
#hud.deck-relative #tele-vs > span::after, #hud.deck-relative #tele-hs > span::after { content: ' DECK'; color: #5ad1ff; font-size: 0.85em; }
#hud.globe-relative #tele-vs > span::after, #hud.globe-relative #tele-hs > span::after { content: ' LOCAL'; }
.level {
  position: relative; text-align: left; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(16, 24, 44, 0.85); padding: 12px; cursor: pointer; min-height: 112px;
  display: flex; flex-direction: column; gap: 4px; transition: border-color 0.15s, transform 0.08s;
}
.level:hover:not(:disabled) { border-color: var(--accent); }
.level:active:not(:disabled) { transform: scale(0.98); }
.level .num { font-family: var(--mono); color: var(--accent); font-size: 12px; letter-spacing: 0.15em; }
.level .name { font-weight: 750; font-size: 15px; }
.level .planet { color: var(--muted); font-size: 12px; }
.level .lstars { margin-top: auto; color: #39435c; letter-spacing: 2px; }
.level .lstars .on { color: #ffd34d; }
.level .best { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.level:disabled { opacity: 0.45; cursor: not-allowed; }
.level:disabled .name::after { content: " 🔒"; font-size: 12px; }

/* how to */
.howto { line-height: 1.5; color: #cdd6ec; font-size: 15px; }
.howto h3 { margin: 16px 0 6px; font-size: 16px; color: var(--text); }
.howto ul { padding-left: 20px; margin: 4px 0; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 12px; margin: 10px 0; }
.keys div { display: flex; align-items: center; gap: 4px; }
.keys span { margin-left: 6px; color: var(--muted); }
kbd {
  font-family: var(--mono); font-size: 12px; padding: 3px 7px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2); border-bottom-width: 2px; background: rgba(255,255,255,0.06);
}
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }

/* settings */
.settings { display: flex; flex-direction: column; gap: 14px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.setting.column { flex-direction: column; align-items: stretch; }
.setting-name { font-weight: 650; }
.setting-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.toggle { width: 52px; height: 30px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.08); position: relative; cursor: pointer; flex: none; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: left 0.15s, background 0.15s; }
.toggle[aria-checked="true"] { background: rgba(43, 212, 125, 0.3); border-color: rgba(43, 212, 125, 0.6); }
.toggle[aria-checked="true"] span { left: 25px; background: var(--success); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.seg button { flex: 1; padding: 10px; background: transparent; border: 0; cursor: pointer; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: rgba(90, 209, 255, 0.2); color: var(--accent); }
input[type="range"] { width: 160px; accent-color: var(--accent); }

/* results */
.result-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--accent-2); }
.result.fail .result-kicker { color: var(--danger); }
.result h2 { font-size: 30px; margin: 6px 0 4px; }
.result.success h2 { color: var(--success); }
.result.fail h2 { color: #ff8a94; }
.stars { font-size: 40px; letter-spacing: 6px; color: #2a3247; margin: 2px 0 4px; }
.stars span { display: inline-block; transform: scale(0.6); opacity: 0.5; transition: transform 0.35s cubic-bezier(.2,1.6,.4,1), opacity 0.3s, color 0.3s; }
.stars span.on { color: #ffd34d; transform: scale(1); opacity: 1; text-shadow: 0 0 18px rgba(255, 211, 77, 0.6); }
.result.fail .stars { display: none; }
.result-detail { color: #cdd6ec; margin: 4px 0 10px; line-height: 1.45; }
.breakdown { font-family: var(--mono); font-size: 13px; text-align: left; margin: 0 auto; width: 100%; max-width: 300px; }
.breakdown div { display: flex; justify-content: space-between; padding: 2px 0; color: var(--muted); }
.breakdown div b { color: var(--text); font-weight: 600; }
.breakdown .mult { border-top: 1px dashed rgba(255,255,255,0.15); margin-top: 4px; padding-top: 4px; }
.result-total { font-size: 28px; font-weight: 800; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.result-total small { display: block; font-size: 12px; color: var(--accent-2); font-weight: 600; letter-spacing: 0.1em; }
.result-tip { color: var(--warn); font-size: 14px; margin: 4px 0 8px; }
.result-tip:empty { display: none; }

/* tutorial */
.tutorial p { color: #cdd6ec; line-height: 1.5; min-height: 66px; }
.tut-step { font-family: var(--mono); color: var(--accent); font-size: 12px; letter-spacing: 0.2em; }
.tut-art { height: 84px; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 4px; }

/* toast */
.toast {
  position: absolute; left: 50%; bottom: calc(70px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--panel-solid); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  animation: rise 0.25s ease-out; pointer-events: none;
}

@keyframes blink { 50% { opacity: 0.35; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; } }
.toast { animation-name: fade; }

/* --------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .hud-panel { padding: 6px 8px; font-size: 11px; }
  .hud-left { min-width: 0; width: 132px; }
  .hud-level #hud-name { display: none; }
  .tele { grid-template-columns: 44px 44px 18px; }
  .tele b { font-size: 13px; }
  #guide { width: 56px; height: 56px; }
  .hud-right { column-gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }
  .hud-buttons { gap: 6px; }
  .pad-btn { width: 72px; height: 72px; }
  .pad-btn.thrust { width: 104px; height: 104px; }
  #hud-warnings { top: calc(108px + var(--safe-top)); }
  #ready-banner { left: 50%; top: calc(112px + var(--safe-top)); transform: translateX(-50%); width: calc(100vw - 24px); text-align: center; padding: 10px 12px; }
  #ready-banner .ready-meta { justify-content: center; }
  #ready-banner .ready-brief { font-size: 13px; margin: 6px 0; }
  .ready-name { font-size: 24px; }
  .menu-card { margin-left: 0; }
  #screen-menu { justify-content: center; align-items: flex-end; padding-bottom: calc(28px + var(--safe-bottom)); }
}
@media (max-width: 400px) {
  .hud-buttons { flex-direction: column; }
  .tele { grid-template-columns: 40px 40px 14px; }
}
@media (max-height: 500px) {
  .title { font-size: 44px; }
  .tagline { margin-bottom: 12px; }
  .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-buttons .btn { padding: 10px 14px; }
  .pad-btn { width: 66px; height: 66px; }
  .pad-btn.thrust { width: 92px; height: 92px; }
  body.touch-on .hud-status { bottom: calc(10px + var(--safe-bottom)); }
  /* Landscape phones: compact intro card between the top HUD and the touch pads. */
  #ready-banner { top: calc(104px + var(--safe-top)); transform: none; width: min(36vw, 340px); padding: 10px 14px; }
  #ready-banner .ready-name { font-size: 22px; margin: 2px 0; }
  #ready-banner .ready-meta { font-size: 11px; }
  #ready-banner .ready-brief { font-size: 12.5px; margin: 6px 0; line-height: 1.35; }
  #ready-banner .ready-go { font-size: 11px; }
  .result h2 { font-size: 24px; }
  .stars { font-size: 30px; }
  .panel { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* The "X" in the title */
.title .x {
  background: linear-gradient(180deg, #ffd27a, #ff6a3d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ------------------------------------------------------------ pilot profile */
.pilot-chip {
  position: absolute; top: calc(14px + var(--safe-top)); right: calc(14px + var(--safe-right));
  display: flex; align-items: center; gap: 10px; max-width: min(280px, 70vw);
  padding: 6px 14px 6px 6px; border-radius: 999px; cursor: pointer; text-align: left;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pilot-chip:hover { border-color: rgba(90, 209, 255, 0.6); }
.pilot-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pilot-text { display: flex; flex-direction: column; min-width: 0; }
.pilot-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilot-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilot-chip.signed-in .pilot-sub { color: var(--accent-2); }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff; background: #2a3550; letter-spacing: 0.02em;
}
.avatar.big { width: 64px; height: 64px; font-size: 24px; }

.profile { display: flex; flex-direction: column; gap: 12px; line-height: 1.45; }
.pf-view { display: flex; flex-direction: column; gap: 12px; }
.pf-intro { margin: 0; color: #cdd6ec; }
.pf-note { margin: 0; font-size: 13px; color: var(--muted); }
.pf-legal { margin: 4px 0 0; font-size: 12px; text-align: center; }
.pf-legal a { color: var(--muted); }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; }
.btn.google:hover { background: #f1f3f4; }
.btn.google svg { width: 20px; height: 20px; }
.pf-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.pf-or::before, .pf-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#pf-mode button[aria-selected="true"] { background: rgba(90, 209, 255, 0.2); color: var(--accent); }
.pf-form { display: flex; flex-direction: column; gap: 10px; }
.pf-form .btn { text-align: center; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .pf-rename input {
  font: inherit; font-size: 16px; color: var(--text); padding: 11px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); outline: none;
  user-select: text; -webkit-user-select: text;
}
.field input:focus, .pf-rename input:focus { border-color: var(--accent); }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; font-size: 14px; align-self: center; text-decoration: underline; text-underline-offset: 3px; }
.pf-card { display: flex; align-items: center; gap: 14px; }
.pf-who { min-width: 0; flex: 1; }
.pf-name-row { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.pf-name-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-name-row .linkish { font-size: 13px; font-weight: 500; }
.pf-rename { display: flex; gap: 8px; margin: 6px 0; }
.pf-rename input { flex: 1; min-width: 0; padding: 8px 10px; }
.small { font-size: 13px; }
.pf-sync { font-size: 13px; color: var(--accent-2); margin-top: 2px; }
.pf-sync.warn { color: var(--warn); }
.pf-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.pf-danger { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; color: var(--muted); }
.pf-danger summary { cursor: pointer; color: #ff8a94; }
.pf-danger[open] { display: flex; flex-direction: column; gap: 8px; }
.pf-error { margin: 0; color: #ff8a94; font-size: 14px; }
.pf-ok { margin: 0; color: var(--accent-2); font-size: 14px; }
.btn.busy { opacity: 0.6; pointer-events: none; }
#result-profile { display: block; margin: 0 auto 8px; font-size: 13px; }
#result-profile.hidden { display: none; }
@media (max-width: 640px) {
  .pilot-chip { top: calc(10px + var(--safe-top)); right: calc(10px + var(--safe-right)); padding-right: 10px; }
  .pilot-sub { display: none; }
}

/* ------------------------------------------------------------ leaderboards */
.lb-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.lb-level { display: flex; align-items: center; gap: 10px; }
.lb-level .icon-btn { flex: none; color: var(--text); }
.lb-level .icon-btn svg { fill: none; stroke: currentColor; }
.lb-level .icon-btn:disabled { opacity: 0.35; cursor: default; }
.lb-level-name { flex: 1; text-align: center; display: flex; flex-direction: column; }
.lb-level-name span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--accent); }
.lb-level-name b { font-size: 18px; }
#lb-diff { margin-top: 0; }
.lb-body { min-height: 120px; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 28px 30px 1fr auto auto auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid transparent;
}
.lb-row.me { border-color: rgba(77, 255, 154, 0.55); background: rgba(77, 255, 154, 0.08); }
.lb-rank { font-family: var(--mono); font-weight: 800; text-align: center; color: var(--muted); }
.lb-rank.gold { color: #ffd34d; } .lb-rank.silver { color: #d6dde8; } .lb-rank.bronze { color: #e0995a; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.lb-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name em { font-style: normal; color: var(--accent-2); font-weight: 500; font-size: 12px; }
.lb-stars { color: #ffd34d; font-size: 11px; letter-spacing: 1px; }
.lb-time { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-status { color: var(--muted); text-align: center; margin: 14px 0; }
.lb-status:empty { display: none; }
.lb-mine {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px;
  padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line); font-size: 14px;
}
.lb-mine:empty { display: none; }
.lb-myrank { font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--accent-2); }
.result-time { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 0 8px; }
.rt-clock { font-family: var(--mono); font-size: 22px; font-weight: 800; }
.result-time.pb .rt-clock { color: var(--accent-2); }
.rt-note { font-size: 13px; color: var(--muted); }
.result-time.pb .rt-note { color: #c9ffe0; }
@media (max-width: 400px) {
  .lb-row { grid-template-columns: 24px 26px 1fr auto auto; }
  .lb-stars { display: none; }
}
@media (max-height: 500px) {
  .menu-buttons .btn#btn-leaderboard { grid-column: auto; }
}

/* side thruster pads (only when the upgrade is equipped) */
.touch-slide { position: absolute; left: calc(16px + var(--safe-left)); bottom: calc(18px + 84px + 12px + var(--safe-bottom)); display: none; gap: 12px; pointer-events: auto; }
body.has-thrusters .touch-slide { display: flex; }
.pad-btn.slide { width: 84px; height: 54px; border-radius: 16px; background: rgba(40, 30, 60, 0.55); border-color: rgba(200, 160, 255, 0.4); }
.pad-btn.slide svg { width: 30px; height: 30px; }
.pad-btn.slide.active { background: rgba(170, 120, 255, 0.45); border-color: #c4a5ff; }
body.thrust-left .touch-slide { left: auto; right: calc(16px + var(--safe-right)); }
@media (max-width: 640px) { .touch-slide { bottom: calc(18px + 72px + 10px + var(--safe-bottom)); } .pad-btn.slide { width: 72px; height: 48px; } }
@media (max-height: 500px) { .touch-slide { bottom: calc(18px + 66px + 8px + var(--safe-bottom)); } .pad-btn.slide { width: 66px; height: 40px; } }

/* ------------------------------------------------------------ hangar & shop */
.credits-badge { font-family: var(--mono); font-weight: 800; color: #ffd34d; background: rgba(255, 211, 77, 0.1); border: 1px solid rgba(255, 211, 77, 0.35); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.hangar { display: flex; flex-direction: column; gap: 10px; }
.hangar h3 { margin: 8px 0 0; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hangar-intro { margin: 0; color: #cdd6ec; font-size: 14px; line-height: 1.45; }
.hangar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.hangar-card { border: 1px solid var(--line); border-radius: 14px; background: rgba(16, 24, 44, 0.85); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.hangar-card.equipped { border-color: rgba(77, 255, 154, 0.6); box-shadow: 0 0 0 1px rgba(77, 255, 154, 0.2) inset; }
.hc-top { display: flex; gap: 10px; align-items: flex-start; }
.mini-rocket { width: 58px; height: 84px; flex: none; border-radius: 10px; background: radial-gradient(ellipse at 50% 85%, rgba(90, 209, 255, 0.12), rgba(0, 0, 0, 0) 70%); }
.hc-perk { font-size: 12px; color: #8dffcf; margin-top: 4px; line-height: 1.35; }
.tag.new { color: #04121a; background: #2ed58a; border-color: transparent; }
.hc-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(170, 120, 255, 0.2); color: #c4a5ff; font-weight: 800; }
.hc-name { font-weight: 800; font-size: 16px; }
.hc-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.hc-note { font-size: 12px; color: var(--muted); }
.tag { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); border: 1px solid rgba(90, 209, 255, 0.4); border-radius: 6px; padding: 1px 5px; vertical-align: middle; }
.stat-bar { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.stat-bar i { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat-bar b { display: block; height: 100%; background: linear-gradient(90deg, #2bd47d, #5ad1ff); border-radius: 4px; }
.buy-row { display: flex; gap: 8px; margin-top: 4px; }
.buy-row .btn { flex: 1; text-align: center; padding: 8px 10px; }
.need { font-size: 11.5px; color: var(--muted); text-align: center; }
.equipped-label { color: var(--accent-2); font-weight: 700; font-size: 14px; margin-top: 4px; }
.hangar-card > .btn { text-align: center; margin-top: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; margin-top: 4px; }
.bundle-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; padding: 14px; border-radius: 14px; border: 1px solid rgba(255, 179, 71, 0.5); background: linear-gradient(135deg, rgba(255, 140, 50, 0.15), rgba(90, 209, 255, 0.08)); }
.bundle-card div { display: flex; flex-direction: column; gap: 2px; }
.bundle-card span { font-size: 13px; color: var(--muted); }
.buy-sheet { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 4, 10, 0.7); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 5; }
.buy-sheet .panel { gap: 10px; }
.buy-desc { margin: 0; color: #cdd6ec; }
.buy-price { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.paypal-box { min-height: 50px; background: #fff; border-radius: 12px; padding: 10px; }
.paypal-box:empty { display: none; }
.paypal-box .muted { color: #555; margin: 4px 0; text-align: center; }
.buy-note { font-size: 12px; color: var(--muted); margin: 0; }
.result-credits { color: #ffd34d; font-weight: 800; font-family: var(--mono); margin: 0 0 6px; }
.result-credits span { color: var(--muted); font-weight: 500; }
.lb-rocket { font-size: 11px; font-weight: 600; color: #c4a5ff; border: 1px solid rgba(196, 165, 255, 0.35); border-radius: 6px; padding: 0 5px; margin-left: 4px; }
#lb-class { margin-top: 0; }

/* ---------------------------------------------------------- ghost racing */
.ghost-chip {
  pointer-events: auto; margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px var(--mono, ui-monospace, monospace); color: #bfe9ff; cursor: pointer;
  background: rgba(90,209,255,0.12); border: 1px solid rgba(90,209,255,0.45); border-radius: 999px; padding: 6px 10px;
}
.ghost-chip:hover, .ghost-chip:focus-visible { background: rgba(90,209,255,0.22); outline: none; }
.ghost-chip.off { color: var(--muted); background: rgba(255,255,255,0.05); border-color: var(--line); }
.ghost-chip .gc-key { font-size: 10px; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; opacity: 0.7; }
body.touch-on .ghost-chip .gc-key { display: none; }
#hud-ghost.ahead { color: #4dff9a; }
#hud-ghost.behind { color: #ff7a7a; }
.result-ghost { text-align: center; margin: -2px 0 8px; color: #bfe9ff; font-size: 14px; }
.result-ghost.win { color: #4dff9a; }
.lb-race {
  margin-left: 8px; font: 600 11px system-ui, sans-serif; color: #bfe9ff; cursor: pointer;
  background: rgba(90,209,255,0.12); border: 1px solid rgba(90,209,255,0.4); border-radius: 8px; padding: 4px 8px;
}
.lb-race:hover { background: rgba(90,209,255,0.25); }
.lb-race:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 480px) {
  .lb-row { grid-template-columns: 22px 26px 1fr auto auto; gap: 8px; padding: 8px; }
  .lb-row .lb-stars { display: none; }
  .lb-race { margin-left: 0; padding: 4px 7px; }
}
@media (max-height: 500px) {
  .ghost-chip { margin-top: 4px; padding: 3px 9px; font-size: 11px; }
  #ready-banner .ready-go { margin-bottom: 0; }
}

/* ---------------------------------------------------------- Android app */
/* Google's sign-in page is blocked inside app web views; email sign-in is used there. */
html.app #pf-google, html.app .pf-or, html.portal-itch #pf-google, html.portal-itch .pf-or { display: none; }
.portal-note { font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; line-height: 1.45; }
.portal-note a { color: var(--accent); }
.app-only { display: none; }
html.app .app-only { display: block; }

/* --------------------------------------------------------- friend challenges */
.screen.layer { z-index: 20; }
.btn.challenge {
  width: 100%; margin-top: 8px;
  background: linear-gradient(135deg, rgba(255, 140, 60, 0.22), rgba(255, 77, 94, 0.22));
  border-color: rgba(255, 150, 90, 0.55); color: #ffe2cf; font-weight: 700;
}
.btn.challenge:hover { filter: brightness(1.12); }
.share h2, .invite h2 { margin: 6px 0 8px; }
.share-text { color: #cdd6ec; line-height: 1.45; margin: 0 0 12px; }
.share-link { display: flex; gap: 8px; margin: 0 0 6px; }
.share-link input {
  flex: 1; min-width: 0; font: 600 14px var(--mono); color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.share-status { font-size: 13px; color: var(--muted); min-height: 1.2em; margin: 4px 0 12px; line-height: 1.4; }
.share-status.ok { color: var(--accent-2); }
.share-status.error { color: #ff8a94; }
.share-actions { margin-bottom: 8px; }
.btn.whatsapp { background: #1fa855; border-color: transparent; color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.whatsapp:hover { filter: brightness(1.08); }
.share #share-close { width: 100%; }
.invite-time { font-family: var(--mono); font-size: 34px; font-weight: 800; color: var(--warn); margin: 2px 0 4px; }
.invite-text { color: #cdd6ec; margin: 0 0 10px; line-height: 1.45; }
.invite .ready-meta { justify-content: center; margin-bottom: 10px; }
.invite-note { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0 0 14px; }
.ghost-chip.locked { cursor: default; }
.ghost-chip.locked .gc-key { display: none; }
.challenge-result .breakdown div { font-size: 15px; padding: 4px 0; }
.challenge-result .breakdown div.win, .challenge-result .breakdown div.win b { color: var(--accent-2); }
.challenge-result.won .result-total { color: var(--accent-2); letter-spacing: 0.12em; }
.challenge-result.lost h2 { color: var(--warn); }
.challenge-result.lost .result-kicker { color: var(--warn); }
.challenge-result .result-total { font-size: 22px; letter-spacing: 0.12em; }
.panel.share, .panel.invite { background: var(--panel-solid); }

/* --------------------------------------------------------- live races */
.race-body { display: flex; flex-direction: column; gap: 12px; }
.race-intro { color: #cdd6ec; line-height: 1.5; margin: 0 0 4px; }
.race-or { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 -2px; }
.race-join { display: flex; gap: 8px; }
.race-join input {
  flex: 1; min-width: 0; text-align: center; text-transform: uppercase;
  font: 800 22px var(--mono); letter-spacing: 0.35em; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.race-join input::placeholder { color: rgba(255, 255, 255, 0.25); }
.race-msg { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--muted); }
.race-msg.error { color: #ff8a94; }
.race-msg.ok { color: var(--accent-2); }
.race-code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.race-code { font: 800 38px var(--mono); letter-spacing: 0.22em; color: var(--warn); line-height: 1.1; }
.race-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.race-player { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.race-player.empty { opacity: 0.45; border-style: dashed; }
.race-player em, .race-row em { color: var(--muted); font-style: normal; font-size: 0.9em; }
.race-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: rgba(255, 255, 255, 0.2); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); }
.race-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-tag { font: 700 10px var(--mono); letter-spacing: 0.15em; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; }
.race-kick { font-size: 12px; color: var(--muted); }
.race-settings { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.race-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.race-field select {
  font: 600 15px system-ui, sans-serif; color: var(--text); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 260px;
}
.race-field select option { background: #0b1222; }
.race-field select:disabled, .race-settings .seg button:disabled { opacity: 0.75; cursor: default; }
.race-wait { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.race-hud {
  position: absolute; left: 12px; top: calc(118px + var(--safe-top)); z-index: 3;
  background: rgba(5, 8, 18, 0.62); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px;
  font-size: 12px; min-width: 150px; max-width: 200px;
}
.race-hud ul { list-style: none; margin: 0; padding: 0; }
.race-hud li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.race-hud .race-dot { width: 9px; height: 9px; }
.race-hud .race-s { font-family: var(--mono); color: var(--accent-2); }
#race-hud-leave {
  margin-top: 4px; width: 100%; font: 600 11px system-ui, sans-serif; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; cursor: pointer;
}
#race-hud-leave:hover { color: var(--text); }
body.racing .hud-buttons { visibility: hidden; }

.race-count {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none;
  font: 900 min(28vw, 150px) system-ui, sans-serif; color: #fff; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
  animation: countPop 0.25s ease-out;
}
.race-count.small { font-size: min(9vw, 46px); letter-spacing: 0.06em; color: var(--accent); }
.race-count.go { color: var(--accent-2); }
@keyframes countPop { from { transform: translate(-50%, -50%) scale(1.25); opacity: 0.4; } }

.race-results h2 { margin: 6px 0 10px; }
.race-res-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.race-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.race-row.me { border-color: rgba(90, 209, 255, 0.6); background: rgba(90, 209, 255, 0.1); }
.race-row b { font-family: var(--mono); }
.race-rank { font: 800 16px var(--mono); width: 18px; text-align: center; color: var(--warn); }
.race-flying { color: var(--accent); font-size: 13px; animation: blink 1.2s ease-in-out infinite; }
.race-out { color: #ff8a94; font-size: 13px; }
.race-res-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.race-results .btn { width: 100%; margin-top: 6px; }
@media (max-width: 640px) {
  .race-hud { top: calc(104px + var(--safe-top)); left: 8px; min-width: 130px; }
  body.race-wait .race-hud { display: none; }      /* the level intro is there until GO */
  .race-code { font-size: 32px; }
}

/* --------------------------------------------------------- Invasion mode */
.btn.invasion { border-color: rgba(141, 255, 207, 0.45); background: linear-gradient(135deg, rgba(40, 120, 90, 0.28), rgba(20, 40, 70, 0.5)); }
.btn.invasion:hover { border-color: rgba(141, 255, 207, 0.8); }
.invasion-body { display: flex; flex-direction: column; gap: 14px; }
.invasion-intro { margin: 0; color: #cdd6ec; line-height: 1.5; }
.invasion-intro .red { color: #ff6b6b; }
.invasion-intro .green { color: #8dffcf; }
.invasion-intro .blue { color: #8ce1ff; }
.invasion-progress { display: block; margin-top: 6px; font: 700 12px var(--mono); letter-spacing: 0.15em; color: #8dffcf; text-transform: uppercase; }
.level.invasion-mission .num { color: #8dffcf; }
.level.invasion-mission:hover:not(:disabled) { border-color: #8dffcf; }

/* ------------------------------------------------- main menu: always fits */
/* Nine buttons don't fit one column on a laptop screen: pair them up, keep
   Play full width, and size the title by the screen height. If it still
   doesn't fit (a very short window) the menu scrolls instead of clipping. */
#screen-menu { overflow-y: auto; align-items: safe center; }
.menu-buttons #btn-play { grid-column: 1 / -1; }
@media (min-width: 641px) {
  .menu-card { width: min(600px, 100%); }
  .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .title { font-size: clamp(44px, min(11vw, 11vh), 92px); }
  .tagline { margin-bottom: clamp(12px, 2.6vh, 26px); }
}
@media (min-width: 641px) and (max-height: 760px) {
  .kicker { font-size: 11px; }
  .title { margin: 6px 0 8px; }
  .menu-buttons { gap: 8px; }
  .menu-buttons .btn { padding: 10px 16px; }
  .menu-foot { margin-top: 12px; }
}
/* Phones: one column while it fits, two once the list gets too tall. */
@media (max-width: 640px) {
  #screen-menu { align-items: safe flex-end; }
}
@media (max-width: 640px) and (max-height: 820px) {
  .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-buttons .btn { padding: 11px 13px; font-size: 15px; }
  .title { font-size: clamp(40px, 9.5vh, 72px); }
  .tagline { margin-bottom: 14px; }
}
/* Landscape phones and very short windows: title on one line, three columns. */
@media (min-width: 641px) and (max-height: 500px) {
  .menu-card { width: min(760px, 100%); }
  .title { font-size: 36px; margin: 4px 0 4px; }
  .title br { display: none; }
  .tagline { margin-bottom: 8px; font-size: 13px; }
  .menu-buttons { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .menu-buttons .btn { padding: 7px 12px; font-size: 14px; }
  .menu-buttons .btn .sub { font-size: 11px; }
  .menu-foot { margin-top: 8px; }
}
