/* =========================================================================
   NEON VELOCITY — interface stylesheet
   Design language: near-black glass, two-tone neon (cyan/magenta), heavy
   uppercase display type, tabular numerics, and motion on every state change.
   ========================================================================= */

:root {
  --bg: #05060c;
  --bg-2: #0a0c16;
  --ink: #eaf2ff;
  --ink-dim: #8e9ab8;
  --ink-faint: #5a6480;

  --cyan: #22e7ff;
  --cyan-dk: #0b8fa8;
  --magenta: #ff2fa0;
  --amber: #ffd166;
  --green: #2fffb0;
  --red: #ff3b5c;
  --violet: #b14bff;

  --glass: rgba(16, 22, 38, 0.62);
  --glass-hi: rgba(38, 52, 84, 0.5);
  --stroke: rgba(120, 160, 220, 0.20);
  --stroke-hi: rgba(34, 231, 255, 0.45);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  /* Orbitron for display: the canonical geometric sci-fi face, used only for
     titles, scores and speed where its wide letterforms are an asset.
     Rajdhani for everything else: a condensed techno face that stays readable
     at 9px, which Orbitron does not. Both vendored, both SIL OFL. */
  --font-display: 'Orbitron', 'DIN Condensed', 'Bahnschrift', 'Arial Narrow', system-ui, sans-serif;
  --font: 'Rajdhani', 'DIN Alternate', 'Bahnschrift', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'Orbitron', 'DIN Alternate', ui-monospace, 'SF Mono', monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  font-weight: 600;          /* Rajdhani is light at 400 */
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

body.context-lost::after {
  font-family: var(--font-display);
  content: 'GRAPHICS CONTEXT LOST — RESTORING';
  position: fixed; inset: auto 0 40% 0;
  text-align: center; letter-spacing: .18em; font-size: 13px;
  color: var(--red); z-index: 999;
}

/* ---------------------------------------------------------------- utilities */
.hidden { display: none !important; }
/* Any `display` rule silently defeats the `hidden` attribute — restore it. */
[hidden] { display: none !important; }
i.coin, i.core {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 5px; vertical-align: -1px; flex: none;
}
i.coin { background: linear-gradient(145deg, #ffe9a8, var(--amber)); box-shadow: 0 0 8px rgba(255, 209, 102, .6); }
i.core { background: linear-gradient(145deg, #fff, var(--violet)); box-shadow: 0 0 9px rgba(177, 75, 255, .75); border-radius: 2px; transform: rotate(45deg); }
i.play-ico {
  width: 0; height: 0; display: inline-block; margin-right: 8px;
  border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}

/* ==========================================================================
   BOOT SCREEN
   ========================================================================== */
#loader {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 8%, #101a33 0%, #05060c 62%);
  transition: opacity .7s ease, filter .7s ease;
  overflow: hidden;
}
#loader.is-done { opacity: 0; pointer-events: none; filter: blur(14px); }

.loader-grid {
  position: absolute; inset: -40% -10% -10% -10%;
  background:
    linear-gradient(transparent 0 96%, rgba(34, 231, 255, .16) 96% 100%) 0 0 / 100% 42px,
    linear-gradient(90deg, transparent 0 96%, rgba(255, 47, 160, .10) 96% 100%) 0 0 / 42px 100%;
  transform: perspective(420px) rotateX(66deg);
  animation: gridRun 4.5s linear infinite;
  opacity: .5;
  mask-image: linear-gradient(to top, #000 0%, transparent 72%);
}
@keyframes gridRun { to { background-position: 0 42px, 42px 0; } }

.loader-inner { position: relative; z-index: 2; width: min(88vw, 420px); text-align: center; }

.loader-mark svg { width: 74px; height: 74px; filter: drop-shadow(0 0 18px rgba(34, 231, 255, .8)); }
.lm-bolt { fill: none; stroke: var(--cyan); stroke-width: 6; stroke-linejoin: round; animation: boltPulse 1.6s ease-in-out infinite; }
@keyframes boltPulse { 50% { stroke: var(--magenta); } }

.loader-title, .brand-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 900; letter-spacing: .22em; line-height: 1.12;
  margin: 18px 0 6px;
}
.loader-title span, .brand-title span { display: block; color: var(--ink); }
/* Solid colour first, gradient-clipped text only where it is actually
   supported — an unsupported background-clip renders the text fully
   transparent, i.e. the game's own title disappears. */
.loader-title em, .brand-title em {
  display: block; font-style: normal; color: var(--cyan);
  filter: drop-shadow(0 0 22px rgba(255, 47, 160, .45));
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .loader-title em, .brand-title em {
    background: linear-gradient(96deg, var(--cyan), var(--magenta) 70%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}

.loader-bar {
  height: 3px; border-radius: 3px; margin: 26px 0 12px;
  background: rgba(120, 160, 220, .16); overflow: hidden;
}
.loader-fill {
  height: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 14px rgba(34, 231, 255, .8);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.loader-status { font-size: 11px; letter-spacing: .26em; color: var(--ink-dim); text-transform: uppercase; }
.loader-tip {
  margin-top: 26px; font-size: 12px; line-height: 1.6; color: var(--ink-faint);
  min-height: 3em; padding: 0 8px;
}

#fatal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: #05060c; }
.fatal-box {
  max-width: 400px; padding: 30px; text-align: center;
  border: 1px solid var(--stroke); border-radius: var(--r-lg); background: var(--glass);
}
.fatal-box h2 { font-size: 16px; letter-spacing: .2em; color: var(--red); margin-bottom: 12px; }
.fatal-box p { font-size: 13px; line-height: 1.7; color: var(--ink-dim); }
.fatal-box button {
  margin-top: 20px; padding: 12px 26px; border-radius: 999px; cursor: pointer;
  background: var(--cyan); color: #04202a; border: 0; font-weight: 800; letter-spacing: .16em;
}

/* ==========================================================================
   HUD
   ========================================================================== */
#ui-hud { position: fixed; inset: 0; z-index: 40; pointer-events: none; }

.hud {
  position: absolute; inset: 0;
  color: var(--ink);           /* explicit — the HUD lives in its own root */
  font-variant-numeric: tabular-nums;
}
.hud.hidden { display: none; }

.hud-vignette {
  position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease;
  background: radial-gradient(120% 80% at 50% 50%, transparent 45%, rgba(255, 40, 70, .35) 100%);
}
.hud-vignette.is-critical { opacity: 1; animation: critPulse 1.5s ease-in-out infinite; }
@keyframes critPulse { 50% { opacity: .5; } }

.hud.is-hit { animation: hudHit .32s ease; }
@keyframes hudHit {
  0% { filter: brightness(2.4) saturate(0); transform: scale(1.012); }
  100% { filter: none; transform: none; }
}

.hud-tl { position: absolute; top: calc(14px + var(--safe-t)); left: calc(16px + var(--safe-l)); }
.hud-score-row { display: flex; align-items: baseline; gap: 10px; }
.hud-score {
  font-family: var(--font-num);
  font-size: clamp(26px, 5.6vw, 40px); font-weight: 700; letter-spacing: .02em;
  text-shadow: 0 0 24px rgba(34, 231, 255, .5), 0 3px 12px rgba(0, 0, 0, .8);
}
.mult-chip {
  display: flex; align-items: baseline; padding: 3px 11px; border-radius: 999px;
  font-family: var(--font-num);
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  background: rgba(34, 231, 255, .14); border: 1px solid rgba(34, 231, 255, .45); color: var(--cyan);
}
.mult-chip i { font-style: normal; font-size: 10px; opacity: .8; margin-left: 1px; }
.mult-chip[data-tier="mid"] { background: rgba(255, 209, 102, .14); border-color: rgba(255, 209, 102, .5); color: var(--amber); }
.mult-chip[data-tier="high"] { background: rgba(255, 47, 160, .16); border-color: rgba(255, 47, 160, .55); color: var(--magenta); }
.mult-chip[data-tier="max"] {
  background: rgba(255, 47, 160, .28); border-color: #fff; color: #fff;
  box-shadow: 0 0 20px rgba(255, 47, 160, .8);
  animation: maxGlow .8s ease-in-out infinite;
}
@keyframes maxGlow { 50% { box-shadow: 0 0 34px rgba(34, 231, 255, .9); } }
.mult-chip.is-bump { animation: chipBump .34s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes chipBump { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }

.combo-wrap { margin-top: 8px; opacity: 0; transform: translateY(-4px); transition: .22s ease; }
.combo-wrap.is-active { opacity: 1; transform: none; }
.combo-label { font-size: 10px; letter-spacing: .22em; color: var(--ink-dim); }
.combo-label b { color: var(--magenta); font-size: 13px; }
.combo-bar { width: 128px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); margin-top: 4px; overflow: hidden; }
.combo-fill {
  height: 100%; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--magenta), var(--amber));
  box-shadow: 0 0 10px rgba(255, 47, 160, .8);
}

.hud-tr {
  position: absolute; top: calc(14px + var(--safe-t)); right: calc(16px + var(--safe-r));
  text-align: right; display: grid; gap: 8px;
}
.hud-stat span { display: block; font-family: var(--font-num); font-size: 17px; font-weight: 700; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.hud-stat label { font-size: 9px; letter-spacing: .22em; color: var(--ink-faint); }
.hud-stat--coin span { color: var(--amber); }

.hud-tc {
  position: absolute; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
.hud-district { font-size: 11px; letter-spacing: .30em; color: rgba(234, 242, 255, .72); }
.hud-weather { font-size: 9px; letter-spacing: .24em; color: var(--ink-faint); margin-top: 3px; }

.hud-announce {
  position: absolute; top: 27%; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: clamp(16px, 4vw, 25px); font-weight: 900; letter-spacing: .18em;
  color: #fff; opacity: 0; white-space: nowrap;
  text-shadow: 0 0 26px rgba(255, 47, 160, .9);
}
.hud-announce.is-show { animation: announce 2.4s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes announce {
  0% { opacity: 0; transform: translateX(-50%) scale(1.35); letter-spacing: .5em; filter: blur(6px); }
  16% { opacity: 1; transform: translateX(-50%) scale(1); letter-spacing: .22em; filter: none; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(.97); }
}

.hud-popups { position: absolute; inset: 0; }
.hud-popup {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 14px; font-weight: 800; letter-spacing: .10em; white-space: nowrap;
  color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .9); opacity: 0;
}
.hud-popup.is-live { animation: popRise 1s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes popRise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  18% { opacity: 1; transform: translate(-50%, -55%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(.95); }
}
.hud-popup--good { color: var(--cyan); }
.hud-popup--kill { color: var(--amber); }
.hud-popup--power { color: var(--green); }
.hud-popup--core { color: #fff; text-shadow: 0 0 22px var(--violet); }

.hud-powerups {
  position: absolute; top: 34%; right: calc(16px + var(--safe-r)); display: grid; gap: 6px; justify-items: end;
}
.pu {
  display: flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px;
  font-size: 10px; letter-spacing: .16em; font-weight: 700;
  background: rgba(10, 14, 26, .7); border: 1px solid var(--stroke); backdrop-filter: blur(8px);
}
.pu b { color: var(--ink); }
.pu--magnet { border-color: rgba(177, 75, 255, .5); color: var(--violet); }
.pu--mult { border-color: rgba(255, 47, 160, .5); color: var(--magenta); }
.pu--over {
  border-color: var(--amber); color: #201400;
  background: linear-gradient(100deg, var(--amber), #fff8d6);
  box-shadow: 0 0 22px rgba(255, 209, 102, .7);
  animation: overPulse .55s ease-in-out infinite;
}
.pu--over b { color: #201400; }
@keyframes overPulse { 50% { box-shadow: 0 0 34px rgba(255, 255, 255, .9); } }

/* Whole-HUD tell that Overdrive is active. */
.hud.is-overdrive .hud-score { text-shadow: 0 0 26px rgba(255, 209, 102, .9); }

.hud-bl { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(20px + var(--safe-b)); }
.shield-row { display: flex; gap: 6px; margin-bottom: 10px; }
.shield-pip {
  width: 22px; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, .14); transition: .25s ease;
}
.shield-pip.is-on { background: var(--cyan); box-shadow: 0 0 12px rgba(34, 231, 255, .9); }
.boost-wrap label { font-size: 9px; letter-spacing: .24em; color: var(--ink-faint); margin-top: 4px; display: block; }
.boost-bar {
  width: 148px; height: 7px; border-radius: 4px; overflow: hidden;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .08);
}
.boost-fill {
  height: 100%; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--cyan-dk), var(--cyan) 55%, #fff);
  box-shadow: 0 0 12px rgba(34, 231, 255, .7);
  transition: background .2s;
}
.boost-wrap.is-firing .boost-fill { background: linear-gradient(90deg, var(--amber), #fff); box-shadow: 0 0 20px rgba(255, 209, 102, .9); }
.boost-wrap.is-low .boost-fill { background: linear-gradient(90deg, #7a1030, var(--red)); }
.boost-wrap.is-low label { color: var(--red); }

.hud-bc {
  position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%);
  text-align: center;
}
.speed-readout span {
  font-family: var(--font-num);
  font-size: clamp(32px, 7.6vw, 52px); font-weight: 900; line-height: .9; letter-spacing: .01em;
  text-shadow: 0 0 26px rgba(34, 231, 255, .45), 0 4px 16px rgba(0, 0, 0, .9);
}
.speed-readout label { display: block; font-size: 9px; letter-spacing: .34em; color: var(--ink-faint); margin-top: 2px; }

.hud-fps {
  position: absolute; bottom: calc(6px + var(--safe-b)); right: calc(10px + var(--safe-r));
  font-size: 10px; letter-spacing: .1em; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   TOUCH CONTROLS
   ========================================================================== */
.touch-layer { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.touch-layer.hidden { display: none; }

.touch-stick-zone {
  position: absolute; left: 0; top: 0; bottom: 0; width: 52%;
  pointer-events: auto; touch-action: none;
}
.touch-stick {
  position: fixed; width: 138px; height: 138px; margin: -69px 0 0 -69px;
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.touch-stick.is-active { opacity: 1; }
.touch-stick-base {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(34, 231, 255, .30);
  background: radial-gradient(circle, rgba(34, 231, 255, .10), transparent 68%);
}
.touch-stick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .85), rgba(34, 231, 255, .35) 55%, rgba(10, 14, 26, .8));
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 0 24px rgba(34, 231, 255, .6);
}
/* Sits clear of the shield/boost cluster in the bottom-left corner. */
.touch-hint {
  position: absolute; left: 26px; bottom: calc(168px + var(--safe-b));
  font-size: 10px; letter-spacing: .26em; color: rgba(180, 200, 230, .45);
  animation: hintFade 2.6s ease-in-out infinite;
}
.touch-hint.is-hidden { display: none; }
@keyframes hintFade { 50% { opacity: .3; } }

.touch-actions {
  position: absolute; right: calc(20px + var(--safe-r)); bottom: calc(24px + var(--safe-b));
  display: grid; grid-template-columns: repeat(2, auto); gap: 12px; align-items: end;
  pointer-events: none;
}
.touch-btn {
  pointer-events: auto; touch-action: none; position: relative;
  border-radius: 50%; border: 1.5px solid var(--stroke);
  background: rgba(12, 16, 30, .5); backdrop-filter: blur(10px);
  color: var(--ink); display: grid; place-items: center; cursor: pointer;
  transition: transform .1s ease, background .15s ease, box-shadow .15s ease;
}
.touch-btn svg { width: 46%; height: 46%; fill: currentColor; }
.touch-btn.is-down { transform: scale(.9); }
.touch-btn--fire { width: 62px; height: 62px; color: var(--magenta); border-color: rgba(255, 47, 160, .4); grid-column: 1; grid-row: 2; }
.touch-btn--jump { width: 62px; height: 62px; color: var(--green); border-color: rgba(47, 255, 176, .4); grid-column: 1; grid-row: 1; }
.touch-btn--boost { width: 96px; height: 96px; color: var(--cyan); border-color: rgba(34, 231, 255, .5); grid-column: 2; grid-row: 1 / span 2; }
.touch-btn--fire.is-down { background: rgba(255, 47, 160, .3); box-shadow: 0 0 30px rgba(255, 47, 160, .6); }
.touch-btn--jump.is-down { background: rgba(47, 255, 176, .28); box-shadow: 0 0 30px rgba(47, 255, 176, .5); }
.touch-btn--boost.is-down { background: rgba(34, 231, 255, .3); box-shadow: 0 0 42px rgba(34, 231, 255, .75); }
.touch-btn-ring {
  position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(var(--cyan) calc(var(--charge, 1) * 360deg), transparent 0);
  mask: radial-gradient(circle, transparent 0 47%, #000 48%);
  -webkit-mask: radial-gradient(circle, transparent 0 47%, #000 48%);
  opacity: .85; pointer-events: none;
}

/* ==========================================================================
   SCREENS / SHELL
   ========================================================================== */
#ui {
  position: fixed; inset: 0; z-index: 60;
  color: var(--ink);          /* explicit, so nothing depends on body inheritance */
  display: grid;
  /* Explicit 100% tracks: with `auto` tracks the grid sizes to its content,
     the screens grow past the viewport, and the scroll containers inside them
     never overflow — so long panels become silently unreachable on a phone. */
  grid-template-rows: 100%;
  grid-template-columns: 100%;
  overflow: hidden;
}
#ui.is-hidden { pointer-events: none; }
#ui.is-hidden .screen { pointer-events: none; }

.screen {
  grid-area: 1 / 1; position: relative;
  min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(14px) scale(.995);
  transition: opacity .3s ease, transform .35s cubic-bezier(.22, 1, .36, 1), visibility .3s;
}
.screen.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }

.screen--menu, .screen--panel {
  background:
    radial-gradient(130% 80% at 50% -10%, rgba(28, 44, 88, .55) 0%, transparent 60%),
    linear-gradient(180deg, rgba(5, 6, 12, .82) 0%, rgba(5, 6, 12, .93) 100%);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}
.screen--modal {
  background: rgba(3, 4, 9, .74);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  display: grid; place-items: center;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + var(--safe-t)) calc(18px + var(--safe-r)) 12px calc(18px + var(--safe-l));
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(10, 14, 26, .8), transparent);
  flex: none;
}
.wallet { display: flex; gap: 8px; }
.wallet-item {
  display: flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
/* Badge sits in its own column and spans both rows — no absolute positioning,
   so it can never drift out of alignment with the bar it labels. */
.level-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 9px;
  align-items: center;
  justify-items: end;
}
.level-badge {
  grid-row: 1 / span 2; grid-column: 1;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: linear-gradient(145deg, var(--cyan), var(--cyan-dk)); color: #04202a;
  box-shadow: 0 0 16px rgba(34, 231, 255, .5);
}
.level-bar {
  grid-column: 2; width: 118px; height: 4px; border-radius: 3px;
  background: rgba(255, 255, 255, .12); overflow: hidden;
}
.level-fill {
  height: 100%; width: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.level-block small { grid-column: 2; font-size: 9px; letter-spacing: .12em; color: var(--ink-faint); }

/* -------------------------------------------------------------------- menu */
.menu-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 20px calc(20px + var(--safe-l)) calc(28px + var(--safe-b)) calc(20px + var(--safe-r));
  text-align: center;
}
.brand { margin-bottom: 4px; }
.brand-sub { font-size: 10px; letter-spacing: .32em; color: var(--ink-faint); margin-top: 4px; }
.menu-best { font-size: 11px; letter-spacing: .24em; color: var(--ink-dim); margin: 6px 0 22px; }
.menu-best b { color: var(--amber); font-size: 15px; letter-spacing: .06em; }

.menu-actions { display: grid; gap: 11px; width: min(94vw, 380px); }
.menu-row { display: grid; grid-auto-flow: column; gap: 11px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  position: relative; appearance: none; cursor: pointer; overflow: hidden;
  font-family: inherit; font-weight: 700; letter-spacing: .18em; font-size: 12px;
  color: var(--ink); text-transform: uppercase;
  padding: 15px 20px; border-radius: var(--r-md);
  background: var(--glass); border: 1px solid var(--stroke);
  transition: transform .12s ease, border-color .2s, background .2s, box-shadow .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--stroke-hi); background: var(--glass-hi); }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; pointer-events: none; }

/* Sweep highlight on hover — cheap, and it makes the menu feel expensive. */
.btn::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .16) 45%, transparent 60%);
  transform: translateX(-120%); transition: transform .55s ease;
}
.btn:hover::after { transform: translateX(120%); }

.btn--play {
  padding: 20px; border: 0; color: #041820; flex-direction: column; gap: 2px;
  background: linear-gradient(120deg, var(--cyan) 0%, #7af1ff 40%, var(--magenta) 130%);
  box-shadow: 0 0 44px rgba(34, 231, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.btn--play span { font-family: var(--font-display); font-size: 18px; letter-spacing: .26em; font-weight: 900; }
.btn--play small { font-size: 9px; letter-spacing: .28em; opacity: .7; }
.btn--play:hover { box-shadow: 0 0 60px rgba(34, 231, 255, .55); }

.btn--ghost { background: rgba(14, 20, 36, .5); }
.btn--sm { padding: 12px 14px; font-size: 10px; letter-spacing: .14em; }
.btn--back {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 22px; letter-spacing: 0;
  flex: none; line-height: 1;
}
.btn--danger { border-color: rgba(255, 59, 92, .4); color: var(--red); }
.btn--danger:hover { background: rgba(255, 59, 92, .12); }

.btn--daily { border-color: rgba(255, 209, 102, .3); justify-content: space-between; }
.btn--daily b { color: var(--ink-faint); font-size: 11px; }
.btn--daily.is-ready { border-color: var(--amber); box-shadow: 0 0 24px rgba(255, 209, 102, .25); }
.btn--daily.is-ready b { color: var(--amber); }

.btn--ad {
  border-color: rgba(47, 255, 176, .34); color: var(--green);
  background: rgba(12, 30, 24, .5);
}
.btn--ad:hover { background: rgba(47, 255, 176, .12); }
.btn--ad b { color: #fff; margin-left: 4px; }

.btn--buy { padding: 10px; font-size: 11px; letter-spacing: .08em; width: 100%; }
.btn--buy.is-poor { color: var(--ink-faint); border-color: rgba(255, 59, 92, .3); }
.btn--buy.is-maxed { color: var(--green); border-color: rgba(47, 255, 176, .35); }
.btn--claim { padding: 9px 13px; font-size: 10px; background: rgba(255, 209, 102, .16); border-color: rgba(255, 209, 102, .5); color: var(--amber); }

.badge {
  position: absolute; top: 6px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--magenta); color: #fff;
  font-size: 10px; font-style: normal; display: grid; place-items: center; letter-spacing: 0;
  box-shadow: 0 0 12px rgba(255, 47, 160, .8);
}

/* ------------------------------------------------------------------- panels */
.panel {
  flex: 1; min-height: 0;   /* required for the flex child to actually scroll */
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 18px calc(18px + var(--safe-r)) calc(40px + var(--safe-b)) calc(18px + var(--safe-l));
  width: min(100%, 860px); margin: 0 auto;
}
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { font-family: var(--font-display); font-size: 14px; letter-spacing: .24em; font-weight: 700; }
.head-count { margin-left: auto; font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; }

.section-title {
  font-size: 10px; letter-spacing: .28em; color: var(--ink-dim);
  margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px;
}
.section-title small { font-size: 9px; letter-spacing: .14em; color: var(--ink-faint); font-weight: 400; }
.section-title:first-of-type { margin-top: 10px; }

.tabs {
  display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: none; touch-action: pan-x;
  /* Fade the trailing edge so it is obvious more tabs exist off-screen. */
  mask-image: linear-gradient(90deg, #000 0 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0 88%, transparent 100%);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; appearance: none; cursor: pointer; font-family: inherit;
  padding: 9px 15px; border-radius: 999px; font-size: 10px; letter-spacing: .16em; font-weight: 700;
  background: rgba(14, 20, 36, .55); border: 1px solid var(--stroke); color: var(--ink-dim);
  transition: .2s;
}
.tab.is-active { color: #04202a; background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 20px rgba(34, 231, 255, .4); }

/* ------------------------------------------------------------------- garage */
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }

.item-card {
  appearance: none; font-family: inherit; text-align: left; cursor: pointer; color: inherit;
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border-radius: var(--r-md); border: 1px solid var(--stroke); background: var(--glass);
  transition: transform .16s cubic-bezier(.22, 1, .36, 1), border-color .2s, box-shadow .2s;
}
.item-card:hover { transform: translateY(-3px); border-color: var(--stroke-hi); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.item-card.is-equipped { border-color: var(--cyan); box-shadow: 0 0 26px rgba(34, 231, 255, .22); }
.item-card.is-locked { opacity: .82; }
.item-swatch {
  height: 52px; border-radius: var(--r-sm);
  background: linear-gradient(120deg, var(--c1) 0%, var(--c1) 42%, var(--c2) 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .55), 0 0 22px color-mix(in srgb, var(--c2) 40%, transparent);
  position: relative; overflow: hidden;
}
.item-swatch::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .32) 50%, transparent 60%);
}
.item-body h4 { font-size: 12px; letter-spacing: .12em; font-weight: 800; color: var(--ink); }
.item-body p { font-size: 10px; line-height: 1.55; color: var(--ink-dim); margin-top: 4px; }
.item-foot { margin-top: auto; }

.tag {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 9px; letter-spacing: .14em; font-weight: 700;
  background: rgba(255, 255, 255, .07); color: var(--ink-dim);
}
.tag--eq { background: rgba(34, 231, 255, .18); color: var(--cyan); }
.tag--price { background: rgba(255, 209, 102, .12); color: var(--amber); }
.tag--price.is-poor { background: rgba(255, 59, 92, .12); color: var(--red); }

.stat-bars { display: grid; gap: 4px; margin-top: 8px; }
.stat-bar { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 7px; }
.stat-bar label { font-size: 8px; letter-spacing: .1em; color: var(--ink-faint); }
.stat-bar-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.stat-bar-track div { height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--cyan), var(--magenta)); }

.garage-grid--upgrades { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.upgrade-card {
  display: grid; gap: 9px; padding: 15px; border-radius: var(--r-md);
  border: 1px solid var(--stroke); background: var(--glass);
}
.upgrade-head { display: flex; align-items: baseline; justify-content: space-between; }
.upgrade-head h4 { font-size: 12px; letter-spacing: .12em; }
.upgrade-lvl { font-size: 10px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.upgrade-card p { font-size: 10px; color: var(--ink-dim); line-height: 1.5; }
.upgrade-pips { display: flex; gap: 3px; }
.upgrade-pips i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .12); }
.upgrade-pips i.on { background: var(--cyan); box-shadow: 0 0 8px rgba(34, 231, 255, .7); }
.upgrade-effect { font-size: 10px; letter-spacing: .1em; color: var(--green); }

.bonus-offer {
  margin-top: 22px; padding: 15px; border-radius: var(--r-md);
  border: 1px dashed rgba(47, 255, 176, .35); background: rgba(12, 30, 24, .35);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.bonus-offer span { font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; }

/* ----------------------------------------------------------------- missions */
.mission-list { display: grid; gap: 9px; }
.mission {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border-radius: var(--r-md); border: 1px solid var(--stroke); background: var(--glass);
  transition: .2s;
}
.mission.is-done { border-color: rgba(255, 209, 102, .45); }
.mission.is-claimed { opacity: .5; }
.mission-info { flex: 1; min-width: 0; }
.mission-info h4 { font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.mission-bar { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; margin: 8px 0 4px; }
.mission-bar div { height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--cyan), var(--green)); transition: transform .5s cubic-bezier(.22, 1, .36, 1); }
.mission-progress { font-size: 9px; color: var(--ink-faint); letter-spacing: .1em; }
.mission-reward { flex: none; }
.empty { font-size: 11px; color: var(--ink-faint); padding: 14px; }

/* ------------------------------------------------------------- achievements */
.ach-list { display: grid; gap: 8px; }
.ach {
  display: flex; align-items: center; gap: 14px; padding: 13px;
  border-radius: var(--r-md); border: 1px solid var(--stroke); background: var(--glass); opacity: .55;
}
.ach.is-got { opacity: 1; border-color: rgba(255, 209, 102, .35); }
.ach-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .06); font-size: 15px; color: var(--ink-faint);
}
.ach.is-got .ach-icon { background: rgba(255, 209, 102, .16); color: var(--amber); box-shadow: 0 0 18px rgba(255, 209, 102, .3); }
.ach-body { flex: 1; min-width: 0; }
.ach-body h4 { font-size: 12px; letter-spacing: .08em; }
.ach-body p { font-size: 10px; color: var(--ink-dim); margin-top: 3px; }
.ach-reward { font-size: 11px; color: var(--amber); display: flex; align-items: center; flex: none; }

/* -------------------------------------------------------------------- stats */
.stats-list { display: grid; gap: 1px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--stroke); }
.stat-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 11px 14px; background: rgba(12, 17, 30, .6); font-size: 11px;
}
.stat-row span { color: var(--ink-dim); letter-spacing: .06em; }
.stat-row b { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.stat-row--total { background: rgba(34, 231, 255, .10); }
.stat-row--total b { color: var(--amber); font-size: 14px; }

/* ----------------------------------------------------------------- settings */
.setting {
  display: flex; align-items: center; gap: 14px; padding: 12px 2px;
  border-bottom: 1px solid rgba(120, 160, 220, .1);
}
.setting label { flex: 1; font-size: 12px; color: var(--ink-dim); letter-spacing: .06em; }
.setting output { font-size: 11px; color: var(--cyan); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.setting select {
  appearance: none; font-family: inherit; font-size: 11px; letter-spacing: .1em; cursor: pointer;
  padding: 9px 34px 9px 13px; border-radius: var(--r-sm); color: var(--ink);
  background: rgba(14, 20, 36, .8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2322e7ff' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center/11px;
  border: 1px solid var(--stroke);
}
.setting input[type="range"] {
  flex: 2; appearance: none; height: 3px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--cyan), rgba(255, 255, 255, .14));
}
.setting input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px rgba(34, 231, 255, .9); cursor: pointer;
}
.setting input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px rgba(34, 231, 255, .9); cursor: pointer;
}
.setting--toggle input[type="checkbox"] {
  appearance: none; width: 46px; height: 25px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--stroke); position: relative;
  transition: .22s;
}
.setting--toggle input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: var(--ink-faint); transition: .22s cubic-bezier(.22, 1, .36, 1);
}
.setting--toggle input[type="checkbox"]:checked { background: rgba(34, 231, 255, .28); border-color: var(--cyan); }
.setting--toggle input[type="checkbox"]:checked::after { left: 23px; background: var(--cyan); box-shadow: 0 0 12px rgba(34, 231, 255, .9); }

.fineprint { margin-top: 20px; font-size: 10px; line-height: 1.8; color: var(--ink-faint); }

/* ------------------------------------------------------------------- modals */
.modal {
  width: min(90vw, 400px); padding: 32px 26px; text-align: center;
  border-radius: var(--r-lg); border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(18, 24, 42, .92), rgba(8, 11, 20, .95));
  box-shadow: var(--shadow);
  animation: modalIn .35s cubic-bezier(.22, 1, .36, 1);
}
@keyframes modalIn { from { transform: translateY(24px) scale(.96); opacity: 0; } }
.modal h2 { font-family: var(--font-display); font-size: 15px; letter-spacing: .24em; font-weight: 700; margin-bottom: 22px; }
.modal p { font-size: 12px; line-height: 1.7; color: var(--ink-dim); margin-bottom: 20px; }
.modal-actions { display: grid; gap: 9px; }

.crash-title { color: var(--red); text-shadow: 0 0 30px rgba(255, 59, 92, .7); animation: crashIn .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes crashIn { from { letter-spacing: .8em; opacity: 0; filter: blur(10px); } }
.continue-timer {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px; font-weight: 800;
  border: 2px solid rgba(255, 59, 92, .4); color: var(--red);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse { 50% { border-color: var(--red); box-shadow: 0 0 26px rgba(255, 59, 92, .5); } }

/* ------------------------------------------------------------------ summary */
.screen--summary {
  background: radial-gradient(120% 80% at 50% 0%, rgba(30, 20, 60, .7), rgba(4, 5, 11, .95) 62%);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  align-items: center;
}
/* Flex, not grid: a grid row whose child has `overflow:hidden` gets an
   automatic minimum size of 0 and is silently squashed when the panel is
   shorter than its content, instead of scrolling. */
.panel--summary {
  max-width: 480px; display: flex; flex-direction: column; gap: 14px;
  padding-top: calc(26px + var(--safe-t));
}
.panel--summary > * { flex: 0 0 auto; }
.sum-head { text-align: center; padding: 16px 0 6px; }
.sum-head label { display: block; font-size: 9px; letter-spacing: .34em; color: var(--ink-faint); }
.sum-score {
  font-family: var(--font-num);
  font-size: clamp(40px, 11vw, 64px); font-weight: 900; line-height: 1; letter-spacing: .01em;
  color: #fff;
  filter: drop-shadow(0 0 30px rgba(34, 231, 255, .35));
  animation: scoreIn .7s cubic-bezier(.2, 1, .3, 1);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .sum-score {
    background: linear-gradient(100deg, var(--cyan), #fff 45%, var(--magenta));
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}
@keyframes scoreIn { from { transform: scale(.7); opacity: 0; filter: blur(12px); } }
.sum-head small { font-size: 10px; letter-spacing: .2em; color: var(--ink-faint); }
.sum-head small b { color: var(--amber); }
.sum-record {
  display: block; width: fit-content; margin: 0 auto 10px;
  padding: 5px 14px; border-radius: 999px;
  font-size: 10px; letter-spacing: .24em; font-weight: 800;
  background: var(--amber); color: #2a1c00;
  animation: recordPop .6s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes recordPop { from { transform: scale(0) rotate(-8deg); } }

.sum-extras { display: grid; gap: 6px; }
.sum-extra {
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 10px; letter-spacing: .14em; font-weight: 700;
  animation: extraIn .45s cubic-bezier(.22, 1, .36, 1) backwards;
}
.sum-extra:nth-child(2) { animation-delay: .1s; }
.sum-extra:nth-child(3) { animation-delay: .2s; }
@keyframes extraIn { from { transform: translateX(-14px); opacity: 0; } }
.sum-extra--mission { background: rgba(47, 255, 176, .12); color: var(--green); border-left: 2px solid var(--green); }
.sum-extra--ach { background: rgba(255, 209, 102, .12); color: var(--amber); border-left: 2px solid var(--amber); }
.sum-extra--level { background: rgba(34, 231, 255, .12); color: var(--cyan); border-left: 2px solid var(--cyan); }

.sum-wallet { display: grid; gap: 1px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--stroke); }
.sum-xp { padding: 10px 14px; background: rgba(177, 75, 255, .12); color: var(--violet); font-size: 11px; letter-spacing: .16em; text-align: center; font-weight: 700; }

/* ------------------------------------------------------------------ toasts */
.toast-host {
  position: fixed; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  z-index: 120; display: grid; gap: 8px; justify-items: center; pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  padding: 11px 20px; border-radius: 999px; font-size: 11px; letter-spacing: .14em; font-weight: 700;
  background: rgba(10, 14, 26, .88); border: 1px solid var(--stroke); backdrop-filter: blur(12px);
  opacity: 0; transform: translateY(-14px) scale(.95); transition: .3s cubic-bezier(.22, 1, .36, 1);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.toast.is-live { opacity: 1; transform: none; }
.toast--reward { border-color: rgba(255, 209, 102, .5); color: var(--amber); }
.toast--unlock { border-color: rgba(34, 231, 255, .5); color: var(--cyan); }
.toast--error { border-color: rgba(255, 59, 92, .5); color: var(--red); }
.toast--level { border-color: rgba(177, 75, 255, .5); color: var(--violet); }

.ach-popup {
  display: flex; align-items: center; gap: 14px; padding: 13px 20px 13px 14px;
  border-radius: var(--r-md); background: rgba(10, 14, 26, .93);
  border: 1px solid rgba(255, 209, 102, .5); box-shadow: 0 0 34px rgba(255, 209, 102, .22);
  opacity: 0; transform: translateY(-20px) scale(.94); transition: .4s cubic-bezier(.22, 1, .36, 1);
}
.ach-popup.is-live { opacity: 1; transform: none; }
.ach-popup-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: rgba(255, 209, 102, .18); color: var(--amber); font-size: 17px;
}
.ach-popup span { font-size: 8px; letter-spacing: .26em; color: var(--amber); }
.ach-popup h4 { font-size: 13px; letter-spacing: .06em; margin: 2px 0; }
.ach-popup p { font-size: 10px; color: var(--ink-dim); }

/* ==========================================================================
   AD PLACEHOLDER (simulated provider)
   ========================================================================== */
.ad-overlay {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background: rgba(2, 3, 7, .92);
  opacity: 0; transition: opacity .25s ease;
}
.ad-overlay.is-open { opacity: 1; }
.ad-overlay.is-closing { opacity: 0; }
.ad-panel {
  position: relative; width: min(90vw, 340px); padding: 24px;
  border-radius: var(--r-lg); border: 1px solid var(--stroke);
  background: linear-gradient(180deg, #131a2e, #080b14); text-align: center;
}
.ad-tag { font-size: 8px; letter-spacing: .3em; color: var(--ink-faint); }
.ad-art {
  position: relative; height: 160px; margin: 14px 0; border-radius: var(--r-md); overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #16213f, #2a1140);
  font-size: 13px; letter-spacing: .3em; font-weight: 800; color: rgba(255, 255, 255, .6);
}
.ad-art-glow {
  position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(34, 231, 255, .3), transparent 40%);
  animation: adSpin 4s linear infinite;
}
@keyframes adSpin { to { transform: rotate(360deg); } }
.ad-sub { font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; }
.ad-reward { margin-top: 8px; font-size: 11px; color: var(--green); letter-spacing: .1em; }
.ad-skip {
  margin-top: 18px; width: 100%; padding: 13px; border-radius: var(--r-md); cursor: pointer;
  font-family: inherit; font-size: 11px; letter-spacing: .2em; font-weight: 700;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--stroke); color: var(--ink-faint);
}
.ad-skip.is-ready { background: var(--green); color: #04231a; border-color: var(--green); cursor: pointer; }
.ad-close {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, .1); border: 0; color: var(--ink-dim); cursor: pointer; font-size: 13px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 560px) {
  .garage-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
  .item-swatch { height: 42px; }
  .menu-row { grid-auto-flow: row; }
  .menu-row:last-of-type { grid-auto-flow: column; }

  /* Phone HUD: the bottom band is the most crowded part of the screen, so the
     speed readout joins the shield/boost cluster as one left-aligned column
     instead of fighting it for the centre. */
  .hud-bc {
    left: calc(16px + var(--safe-l)); transform: none; text-align: left;
    bottom: calc(76px + var(--safe-b));
  }
  .speed-readout span { font-size: 38px; }
  .speed-readout label { letter-spacing: .24em; }
  .boost-bar { width: 124px; }

  /* Keep district/weather, just quieter — it is the only sense of place. */
  .hud-tc { top: calc(46px + var(--safe-t)); opacity: .75; }
  .hud-district { font-size: 9px; letter-spacing: .22em; }
  .hud-weather { font-size: 8px; }
}

@media (max-height: 460px) and (orientation: landscape) {
  .brand-title, .loader-title { font-size: 26px; letter-spacing: .2em; }
  .menu-best { margin: 4px 0 12px; }
  .btn--play { padding: 13px; }
  .btn--play span { font-size: 16px; }
  .menu-actions { width: min(70vw, 420px); }
  .hud-bc { bottom: calc(8px + var(--safe-b)); }
}

/* Native builds place the banner at the bottom; keep UI clear of it. */
body.has-banner .panel { padding-bottom: calc(90px + var(--safe-b)); }
body.has-banner .menu-body { padding-bottom: calc(80px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .08s !important;
  }
}

/* ==========================================================================
   PORTRAIT ROTATE PROMPT
   Shown only on touch devices held in portrait. A pointer:fine device (mouse)
   in a tall window is a resized desktop browser, not a phone, so it is left
   alone — the game simply letterboxes.
   ========================================================================== */
#rotate { display: none; }

@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    display: grid; place-items: center;
    position: fixed; inset: 0; z-index: 500;
    background: radial-gradient(120% 90% at 50% 30%, #0d1226 0%, #05060c 70%);
    padding: 24px; text-align: center;
  }
  /* Freeze the game behind it — no point rendering to a hidden viewport. */
  #ui, #ui-hud, #touch-layer { visibility: hidden; }
}

.rotate-inner { max-width: 300px; }
.rotate-ico {
  width: 72px; height: 72px; margin-bottom: 22px;
  stroke: var(--cyan); fill: none; stroke-width: 1.6;
  animation: rotateHint 2.4s ease-in-out infinite;
  transform-origin: 50% 50%;
}
.rotate-ico rect { stroke: var(--cyan); }
.rotate-arrow { stroke: var(--magenta); stroke-width: 2; }
@keyframes rotateHint {
  0%, 40% { transform: rotate(0deg); }
  70%, 100% { transform: rotate(-90deg); }
}
#rotate p {
  font-family: var(--font-display); font-size: 15px; letter-spacing: .22em;
  color: var(--ink); font-weight: 700;
}
#rotate small {
  display: block; margin-top: 10px; font-size: 11px; letter-spacing: .12em;
  color: var(--ink-dim);
}
