/* NEON CIRCUIT — commercial polish (design handoff: Saira Condensed / Chakra Petch / JetBrains Mono) */
@import url("https://fonts.googleapis.com/css2?family=Saira+Condensed:wght@400;600;700;800;900&family=Chakra+Petch:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap");

:root {
  --bg: #06080b;
  --bg2: #0d1116;
  --panel: rgba(20, 25, 31, 0.92);
  --surface: #14191f;
  --cyan: #22e0ff;
  --cyan-dim: #0fb6d4;
  --magenta: #ff2e8a;
  --magenta-soft: #ff8ac0;
  --violet: #8f7bff;
  --lime: #7bff9b;
  --gold: #ffc23d;
  --text: #e7f2f7;
  --muted: rgba(231, 242, 247, 0.55);
  --danger: #ff6f3d;
  --border: rgba(34, 224, 255, 0.18);
  --border-strong: rgba(34, 224, 255, 0.4);
  --glow: 0 0 24px rgba(34, 224, 255, 0.35);
  --glow-mag: 0 0 22px rgba(255, 46, 138, 0.4);
  --font: "Chakra Petch", system-ui, -apple-system, sans-serif;
  --font-display: "Saira Condensed", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 4px;
  --radius-lg: 6px;
  --max: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(34, 224, 255, 0.1), transparent 55%),
    radial-gradient(900px 480px at 92% 0%, rgba(255, 46, 138, 0.09), transparent 50%),
    radial-gradient(700px 420px at 50% 100%, rgba(34, 224, 255, 0.05), transparent 45%),
    linear-gradient(180deg, var(--bg), #05070a 60%, var(--bg2));
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(255, 46, 138, 0.4); color: #fff; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #7cf0ff; text-shadow: 0 0 12px rgba(34, 224, 255, 0.35); }

.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(6, 8, 11, 0.82);
  border-bottom: 1px solid rgba(34, 224, 255, 0.14);
}
.header-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1rem; flex-wrap: wrap;
}
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-display); font-weight: 900;
  letter-spacing: 0.02em; font-size: 1.15rem;
  color: var(--text); text-transform: uppercase;
}
.logo::before {
  content: ""; width: 18px; height: 18px; border-radius: 3px;
  background: linear-gradient(135deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 14px rgba(34, 224, 255, 0.45);
}
.logo span { color: var(--cyan); text-shadow: var(--glow); }
.nav { display: flex; gap: 0.35rem; flex-wrap: wrap; flex: 1; }
.nav a {
  color: var(--muted); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.65rem; border-radius: 3px;
  border: 1px solid transparent;
}
.nav a:hover, .nav a.active {
  color: var(--cyan); border-color: transparent;
  background: rgba(34, 224, 255, 0.06);
  box-shadow: inset 0 -2px 0 var(--cyan);
  text-shadow: none;
}
.lang-switch {
  display: flex; gap: 0.25rem; flex-wrap: wrap;
  font-size: 0.7rem; font-family: var(--mono);
}
.lang-switch a {
  color: var(--muted); padding: 0.25rem 0.4rem;
  border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.12);
}
.lang-switch a:hover, .lang-switch a.active {
  color: var(--cyan); border-color: rgba(34, 224, 255, 0.45);
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.wrap > h1 {
  font-family: var(--font-display); font-weight: 900;
  text-transform: uppercase; letter-spacing: -0.01em;
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 0.35rem;
}

.hero {
  display: grid; gap: 1.5rem;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center; margin: 1.5rem 0 2rem;
}
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } }

.hero h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  letter-spacing: -0.02em; line-height: 0.9;
  text-transform: uppercase;
  background: linear-gradient(96deg, #e7f2f7 20%, #22e0ff 62%, #ff2e8a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); font-size: 1.05rem; margin: 0 0 1rem; max-width: 36rem; }
.blurb { color: var(--text); opacity: 0.88; max-width: 42rem; }
.season-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.75rem; margin-bottom: 1rem;
  border: 1px solid rgba(255, 46, 138, 0.45);
  border-radius: 999px; background: rgba(255, 46, 138, 0.1);
  font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.14em; color: var(--magenta-soft); text-transform: uppercase;
}
.season-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; align-items: center; }
.btn {
  appearance: none; border: 1px solid transparent;
  background: linear-gradient(100deg, var(--cyan), var(--cyan-dim));
  color: #06080b; font-family: var(--font); font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.85rem 1.4rem; border-radius: 3px; cursor: pointer;
  box-shadow: 0 0 32px rgba(34, 224, 255, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  font-size: 0.9rem;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 48px rgba(34, 224, 255, 0.55); background: #7cf0ff; }
.btn.secondary {
  border-color: rgba(34, 224, 255, 0.4);
  background: transparent; color: var(--text);
  box-shadow: none;
}
.btn.secondary:hover { background: rgba(34, 224, 255, 0.1); border-color: var(--cyan); box-shadow: none; }
.btn.ghost {
  background: transparent; box-shadow: none;
  border-color: rgba(255, 255, 255, 0.16); color: var(--muted);
}
.btn.ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
.btn.ready-glow {
  background: var(--lime); color: #06080b;
  box-shadow: 0 0 28px rgba(123, 255, 155, 0.4);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.panel {
  background: linear-gradient(180deg, rgba(20, 25, 31, 0.94), rgba(13, 17, 22, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: inset 0 0 40px rgba(34, 224, 255, 0.03), 0 16px 48px rgba(0, 0, 0, 0.4);
}
.panel h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.25rem; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--cyan);
}

.hero-card {
  min-height: 240px;
  background:
    linear-gradient(160deg, rgba(34, 224, 255, 0.1), transparent 40%),
    linear-gradient(320deg, rgba(255, 46, 138, 0.1), transparent 45%),
    #0d1116;
  border: 1px dashed rgba(34, 224, 255, 0.35);
  border-radius: var(--radius);
  position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.hero-card::before {
  content: ""; position: absolute; inset: -40%;
  background: repeating-linear-gradient(
    -18deg, transparent 0 14px, rgba(34, 224, 255, 0.04) 14px 15px
  );
  animation: drift 12s linear infinite;
}
.hero-card .pulse {
  width: 96px; height: 52px; border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 40px rgba(34, 224, 255, 0.5), 0 0 70px rgba(255, 46, 138, 0.3);
  position: relative; z-index: 1;
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes drift { to { transform: translateX(40px); } }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
@keyframes ncr-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.game-shell { display: grid; gap: 0.75rem; }
.hud {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.45rem;
  font-family: var(--mono); font-size: 0.72rem;
}
@media (max-width: 700px) { .hud { grid-template-columns: repeat(3, 1fr); } }
.hud .stat {
  background: rgba(6, 8, 11, 0.72);
  border: 1px solid rgba(34, 224, 255, 0.22);
  border-radius: 3px; padding: 0.45rem 0.55rem;
}
.hud .stat label {
  display: block; color: var(--muted);
  font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.hud .stat strong {
  color: var(--text); font-size: 1.05rem; font-weight: 700;
  font-family: var(--font-display); letter-spacing: 0.02em;
}
.hud .stat.nitro strong { color: var(--magenta); }
.nitro-bar {
  margin-top: 0.25rem; height: 5px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.09); overflow: hidden;
}
.nitro-bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--magenta), #ff8ac0);
  box-shadow: 0 0 8px rgba(255, 46, 138, 0.55);
  transition: width 0.08s linear;
}
.nitro-bar.boosting > i {
  background: linear-gradient(90deg, var(--lime), var(--magenta));
}

.hud-tools {
  display: flex; gap: 0.45rem; align-items: center; justify-content: flex-end; flex-wrap: wrap;
}
.icon-btn {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35); color: var(--muted);
  border-radius: 3px; padding: 0.4rem 0.7rem; cursor: pointer;
  font-size: 0.72rem; font-family: var(--mono); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.icon-btn:hover, .icon-btn.active {
  color: var(--cyan); border-color: rgba(34, 224, 255, 0.5);
}

.canvas-wrap {
  position: relative; width: 100%;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--glow); background: #02040a;
  touch-action: none;
  aspect-ratio: 16 / 10; max-height: 70vh;
}
#game { display: block; width: 100%; height: 100%; background: #02040a; }

.minimap {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 120px; height: 120px; border-radius: 3px;
  border: 1px solid rgba(34, 224, 255, 0.4);
  box-shadow: 0 0 16px rgba(34, 224, 255, 0.2);
  background: rgba(6, 8, 11, 0.78);
  pointer-events: none;
}
@media (max-width: 600px) {
  .minimap { width: 88px; height: 88px; top: 8px; right: 8px; }
}

.ghost-banner {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  font-size: 0.7rem; font-family: var(--mono); letter-spacing: 0.08em;
  color: var(--magenta-soft); background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 46, 138, 0.4);
  border-radius: 3px; padding: 0.3rem 0.65rem;
  pointer-events: none; display: none; text-transform: uppercase;
}
.ghost-banner.show { display: inline-block; }

.touch-controls {
  position: absolute; inset: 0; pointer-events: none; display: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}
.touch-controls.show { display: block; }
.stick, .boost-btn, .brake-btn {
  pointer-events: auto; position: absolute; border-radius: 50%;
  border: 2px solid rgba(34, 224, 255, 0.45);
  background: rgba(0, 20, 40, 0.4); backdrop-filter: blur(4px);
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
}
.stick {
  left: max(12px, env(safe-area-inset-left, 0px));
  width: 128px; height: 128px;
}
.stick-knob {
  position: absolute; width: 56px; height: 56px; border-radius: 50%;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 30%, var(--cyan), #006688);
  box-shadow: var(--glow);
}
.boost-btn {
  right: max(12px, env(safe-area-inset-right, 0px));
  width: 104px; height: 104px; display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.06em; color: var(--magenta);
  border-color: rgba(255, 46, 138, 0.55); user-select: none;
}
.boost-btn.active {
  background: rgba(255, 46, 138, 0.25);
  box-shadow: 0 0 24px rgba(255, 46, 138, 0.45);
}
.brake-btn {
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(max(18px, env(safe-area-inset-bottom, 0px)) + 118px);
  width: 72px; height: 72px; display: grid; place-items: center;
  font-weight: 800; font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--muted); border-color: rgba(138, 160, 192, 0.45); user-select: none;
}
.brake-btn.active {
  background: rgba(255, 111, 61, 0.25); color: var(--danger);
  box-shadow: 0 0 18px rgba(255, 111, 61, 0.35);
}

.overlay {
  position: absolute; inset: 0; display: none; place-items: center;
  background: rgba(2, 4, 10, 0.78); backdrop-filter: blur(6px); z-index: 5;
}
.overlay.show { display: grid; }
.overlay .card {
  width: min(460px, 94%); text-align: center;
  background: linear-gradient(180deg, rgba(20, 25, 31, 0.98), rgba(6, 8, 11, 0.96));
  border: 1px solid rgba(34, 224, 255, 0.35);
  border-radius: var(--radius); padding: 1.35rem 1.25rem;
  box-shadow: 0 0 40px rgba(34, 224, 255, 0.18);
}
.overlay .card h2 {
  font-family: var(--font-display); font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.5rem;
}
.overlay input {
  width: 100%; margin: 0.75rem 0; padding: 0.7rem 0.85rem;
  border-radius: 3px; border: 1px solid rgba(34, 224, 255, 0.35);
  background: rgba(0, 0, 0, 0.45); color: var(--text); font-size: 1rem;
  font-family: var(--mono);
}
.overlay .share-box {
  margin: 0.75rem 0; padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.4); border-radius: 3px;
  border: 1px solid rgba(34, 224, 255, 0.2);
  font-family: var(--mono); font-size: 0.78rem; color: var(--lime);
  word-break: break-word; text-align: left;
}
.overlay .winner {
  color: var(--lime); font-family: var(--font-display); font-weight: 800;
  font-size: 1.35rem; margin: 0.35rem 0 0.75rem; text-transform: uppercase;
  text-shadow: 0 0 16px rgba(123, 255, 155, 0.45);
}
.overlay .cta-row { justify-content: center; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 0.75rem; }

.form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.form-row input {
  flex: 1; min-width: 120px; padding: 0.7rem 0.85rem;
  border-radius: 3px; border: 1px solid rgba(34, 224, 255, 0.35);
  background: rgba(0, 0, 0, 0.4); color: var(--text); font-family: var(--mono);
}
.status-line {
  font-family: var(--mono); font-size: 0.82rem; color: var(--lime);
  min-height: 1.4em; margin: 0.5rem 0;
}
.status-line.err { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table.lb {
  width: 100%; border-collapse: collapse; font-size: 0.9rem; font-family: var(--mono);
}
table.lb th, table.lb td {
  text-align: left; padding: 0.6rem 0.65rem;
  border-bottom: 1px solid rgba(34, 224, 255, 0.1);
}
table.lb th {
  color: var(--muted); font-weight: 700; font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase;
}
table.lb tr:hover td { background: rgba(34, 224, 255, 0.04); }
table.lb .rank { color: var(--cyan); width: 2.5rem; font-weight: 700; }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.tabs button {
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted); border-radius: 3px; padding: 0.4rem 0.85rem; cursor: pointer;
  font-family: var(--font); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  font-size: 0.75rem;
}
.tabs button.active {
  color: #06080b; border-color: var(--cyan); background: var(--cyan);
}

.site-footer {
  max-width: var(--max); margin: 0 auto; padding: 1.5rem 1rem 2.5rem;
  color: var(--muted); font-size: 0.75rem; font-family: var(--mono);
  border-top: 1px solid rgba(34, 224, 255, 0.12);
}
.particles { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.particles i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: var(--cyan); opacity: 0.35; box-shadow: 0 0 6px var(--cyan);
  animation: rise linear infinite;
}
@keyframes rise {
  from { transform: translateY(100vh); opacity: 0; }
  20% { opacity: 0.4; }
  to { transform: translateY(-10vh); opacity: 0; }
}

/* Selectors: track / paint / AI */
.select-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.65rem 0 0.35rem; align-items: center; }
.select-row .sel-label {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); min-width: 4.5rem;
}
.chip {
  appearance: none; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35); color: var(--muted);
  border-radius: 3px; padding: 0.4rem 0.7rem;
  font-family: var(--font); font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.chip:hover { border-color: rgba(34, 224, 255, 0.4); color: var(--text); }
.chip.active {
  border-color: var(--cyan); color: #06080b; background: var(--cyan);
  box-shadow: 0 0 16px rgba(34, 224, 255, 0.3);
}
.chip.paint { display: inline-flex; align-items: center; gap: 0.4rem; }
.chip.paint .swatch {
  width: 12px; height: 12px; border-radius: 2px;
  box-shadow: 0 0 8px currentColor;
}
.chip.paint[data-paint="cyan"] .swatch { background: #22e0ff; color: #22e0ff; }
.chip.paint[data-paint="magenta"] .swatch { background: #ff2e8a; color: #ff2e8a; }
.chip.paint[data-paint="volt"] .swatch { background: #7bff9b; color: #7bff9b; }
.chip.paint.active[data-paint="magenta"] { background: var(--magenta); border-color: var(--magenta); }
.chip.paint.active[data-paint="volt"] { background: var(--lime); border-color: var(--lime); }

/* Versus lobby polish */
.lobby-code {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.75rem 0;
}
.lobby-code .code-big {
  font-family: var(--font-display); font-size: clamp(1.9rem, 6vw, 2.8rem);
  letter-spacing: 0.18em; color: var(--cyan);
  text-shadow: var(--glow); font-weight: 900;
  padding: 0.4rem 0.85rem;
  border: 1px dashed rgba(34, 224, 255, 0.45);
  border-radius: 3px; background: rgba(34, 224, 255, 0.06);
}
.player-list { list-style: none; padding: 0; margin: 0.75rem 0; }
.player-list li {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.6rem 0.75rem; margin-bottom: 0.4rem;
  background: rgba(0, 0, 0, 0.35); border-radius: 3px;
  border: 1px solid rgba(34, 224, 255, 0.14);
  font-family: var(--mono); font-size: 0.88rem;
}
.player-list .badge {
  font-size: 0.62rem; letter-spacing: 0.1em; padding: 0.18rem 0.45rem;
  border-radius: 2px; border: 1px solid rgba(255, 255, 255, 0.16); color: var(--muted);
  text-transform: uppercase;
}
.player-list .badge.host { color: var(--cyan); border-color: rgba(34, 224, 255, 0.5); background: rgba(34, 224, 255, 0.08); }
.player-list .badge.ready { color: #06080b; background: var(--lime); border-color: var(--lime); }
.player-list .badge.you { color: #06080b; background: var(--magenta); border-color: var(--magenta); }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.lobby-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  margin: 0.5rem 0; font-family: var(--mono); font-size: 0.75rem;
}
.ping-indicator {
  padding: 0.3rem 0.55rem; border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12); color: var(--muted);
  letter-spacing: 0.06em;
}
.ping-indicator.good { color: var(--lime); border-color: rgba(123, 255, 155, 0.4); }
.ping-indicator.ok { color: var(--gold); border-color: rgba(255, 194, 61, 0.4); }
.ping-indicator.bad { color: var(--danger); border-color: rgba(255, 111, 61, 0.4); }

.vs-waiting {
  display: none; align-items: center; gap: 0.65rem;
  margin: 0.65rem 0; padding: 0.65rem 0.85rem;
  border: 1px solid rgba(34, 224, 255, 0.25);
  border-radius: 3px; background: rgba(34, 224, 255, 0.05);
  font-family: var(--mono); font-size: 0.8rem; color: var(--cyan);
}
.vs-waiting.show { display: flex; }
.vs-waiting .pulse-dot {
  width: 8px; height: 8px; border-radius: 99px; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan); animation: ncr-pulse 1.2s ease-in-out infinite;
}

#vs-lobby.in-room .pre-room { display: none; }
#vs-lobby:not(.in-room) .in-room-only { display: none; }

/* Tips + help modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: none; place-items: center;
  background: rgba(2, 4, 10, 0.78); backdrop-filter: blur(8px); padding: 1rem;
}
.modal-overlay.show { display: grid; }
.modal-card {
  width: min(440px, 96%);
  background: linear-gradient(180deg, #14191f, #0d1116);
  border: 1px solid rgba(34, 224, 255, 0.35);
  border-radius: var(--radius); padding: 1.35rem 1.25rem;
  box-shadow: 0 0 48px rgba(34, 224, 255, 0.2);
}
.modal-card h2 {
  margin: 0 0 0.75rem; font-family: var(--font-display); font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.02em; color: var(--cyan);
}
.modal-card ul { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--text); }
.modal-card li { margin: 0.35rem 0; }
.modal-card kbd {
  font-family: var(--mono); font-size: 0.75rem;
  padding: 0.1rem 0.35rem; border-radius: 2px;
  border: 1px solid rgba(34, 224, 255, 0.35);
  background: rgba(34, 224, 255, 0.08); color: var(--cyan);
}
.tip-kicker {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.16em;
  color: var(--lime); text-transform: uppercase; margin-bottom: 0.35rem;
}

.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  margin: 1.5rem 0; border: 1px solid rgba(34, 224, 255, 0.16);
  border-radius: 3px; overflow: hidden; background: rgba(13, 17, 22, 0.8);
}
.stats-bar .cell {
  padding: 0.85rem 1rem; border-right: 1px solid rgba(34, 224, 255, 0.12);
  text-align: center;
}
.stats-bar .cell:last-child { border-right: none; }
.stats-bar strong {
  display: block; font-family: var(--font-display); font-weight: 900;
  font-size: 1.4rem; color: var(--cyan); letter-spacing: 0.02em;
}
.stats-bar span {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em;
  color: var(--muted); text-transform: uppercase;
}
@media (max-width: 600px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .stats-bar .cell:nth-child(2) { border-right: none; }
}

.jump-cards { display: grid; gap: 0.55rem; }
.jump-card {
  display: block; padding: 0.85rem 1rem;
  border: 1px solid rgba(34, 224, 255, 0.18);
  border-radius: 3px; background: rgba(13, 17, 22, 0.7);
  color: var(--text); transition: border-color 0.12s, background 0.12s;
}
.jump-card:hover { border-color: var(--cyan); background: rgba(34, 224, 255, 0.06); text-shadow: none; }
.jump-card .n {
  font-family: var(--mono); font-size: 0.65rem; color: var(--cyan); letter-spacing: 0.12em;
}
.jump-card strong {
  display: block; font-family: var(--font-display); font-weight: 800;
  text-transform: uppercase; font-size: 1.15rem; margin: 0.2rem 0;
}
.jump-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 480px) {
  .site-header { display: none; }
  body.racing-focus .site-footer { display: none; }
  body.racing-focus .wrap > h1,
  body.racing-focus .wrap > .hint,
  body.racing-focus .garage-bar { display: none; }
  .stick { width: 140px; height: 140px; }
  .boost-btn { width: 112px; height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card::before, .hero-card .pulse, .particles i, .vs-waiting .pulse-dot { animation: none !important; }
}


.home-split {
  display: grid; gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
  margin: 1.25rem 0 2rem;
}
@media (max-width: 800px) {
  .home-split { grid-template-columns: 1fr; }
}

/* ---- Pass 3: boot loader ---- */
.boot-loader {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 30%, #0e1520 0%, #06080b 70%);
  transition: opacity 0.35s ease, visibility 0.35s;
}
.boot-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card {
  width: min(360px, 90vw); text-align: center; padding: 1.5rem 1.25rem;
  border: 1px solid rgba(34, 224, 255, 0.3);
  border-radius: 3px; background: rgba(13, 17, 22, 0.92);
  box-shadow: 0 0 40px rgba(34, 224, 255, 0.15);
}
.boot-kicker {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.2em;
  color: var(--lime); text-transform: uppercase; margin-bottom: 0.35rem;
}
.boot-title {
  font-family: var(--font-display); font-weight: 900; font-size: 1.35rem;
  text-transform: uppercase; color: var(--cyan); letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.boot-bar {
  height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08);
  overflow: hidden; margin-bottom: 0.55rem;
}
.boot-bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 10px rgba(34, 224, 255, 0.5);
  transition: width 0.18s ease;
}
.boot-pct {
  font-family: var(--mono); font-size: 0.85rem; color: var(--text);
}
.boot-step {
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  letter-spacing: 0.08em; margin-top: 0.25rem;
}

/* ---- Pass 3: mobile pedals + visual stick ---- */
.touch-controls .pedal-stack {
  pointer-events: none;
  position: absolute;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column-reverse; align-items: center; gap: 10px;
}
.throttle-btn, .brake-btn, .boost-btn, .item-btn {
  pointer-events: auto;
  position: relative; right: auto; bottom: auto; left: auto;
}
.throttle-btn {
  width: 88px; height: 88px; border-radius: 50%;
  border: 2px solid rgba(123, 255, 155, 0.55);
  background: rgba(0, 30, 18, 0.45); backdrop-filter: blur(4px);
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--lime); user-select: none;
}
.throttle-btn.active {
  background: rgba(123, 255, 155, 0.28);
  box-shadow: 0 0 22px rgba(123, 255, 155, 0.4);
  color: #06080b;
}
.stick {
  box-shadow: inset 0 0 24px rgba(34, 224, 255, 0.12);
}
.stick-ring {
  position: absolute; inset: 10px; border-radius: 50%;
  border: 1px dashed rgba(34, 224, 255, 0.35);
  pointer-events: none;
}
.stick-cross {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(34,224,255,0.18), rgba(34,224,255,0.18)) center/2px 36% no-repeat,
    linear-gradient(rgba(34,224,255,0.18), rgba(34,224,255,0.18)) center/36% 2px no-repeat;
}
.stick.active {
  border-color: rgba(34, 224, 255, 0.75);
  box-shadow: 0 0 18px rgba(34, 224, 255, 0.25), inset 0 0 24px rgba(34, 224, 255, 0.15);
}
.stick.active .stick-knob {
  box-shadow: 0 0 18px rgba(34, 224, 255, 0.65);
}
.brake-btn {
  width: 76px; height: 76px;
}
.boost-btn {
  width: 96px; height: 96px;
}
@media (max-width: 480px) {
  .stick { width: 132px; height: 132px; }
  .throttle-btn { width: 80px; height: 80px; }
  .brake-btn { width: 70px; height: 70px; }
  .boost-btn { width: 92px; height: 92px; }
}

/* ---- Pass 3: lap splits + replay scrubber ---- */
.lap-splits {
  margin: 0.65rem 0 0.35rem; text-align: left;
}
.lap-splits .splits-title {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem;
}
.lap-splits ol {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0.3rem;
}
.lap-splits li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.35rem 0.55rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(34, 224, 255, 0.14);
  border-radius: 3px;
  font-family: var(--mono); font-size: 0.82rem;
}
.lap-splits li.best {
  border-color: rgba(123, 255, 155, 0.45);
  color: var(--lime);
}
.lap-splits li span { color: var(--muted); letter-spacing: 0.08em; }
.replay-panel { margin: 0.65rem 0 0.35rem; }
.replay-row {
  display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: center;
  margin-bottom: 0.45rem;
}
.replay-scrub {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.45rem; align-items: center;
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.replay-scrub input[type="range"] {
  width: 100%; accent-color: var(--cyan);
}
.overlay.replay-mode {
  background: rgba(2, 4, 10, 0.42);
  backdrop-filter: blur(2px);
  align-items: end;
  padding-bottom: 1rem;
}
.overlay.replay-mode .card {
  width: min(520px, 96%);
}
.btn.active, #btn-ready.active {
  box-shadow: 0 0 18px rgba(123, 255, 155, 0.35);
  border-color: var(--lime);
}

/* ---- Pass 3: leaderboard season / track filter ---- */
.season-bar { margin-bottom: 0.75rem; }
.season-pill {
  display: inline-block;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--cyan);
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(34, 224, 255, 0.3);
  border-radius: 99px; background: rgba(34, 224, 255, 0.06);
}
.lb-track-filter { margin: 0.75rem 0 0.5rem; }
.table-wrap { overflow-x: auto; }
.mono { font-family: var(--mono); }


/* ---- Kart arcade: item slot + fire ---- */
.hud .stat.item-slot-stat {
  min-width: 8.2rem;
}
.item-slot {
  --item-color: var(--cyan);
  position: relative;
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.15rem;
  padding: 0.32rem 0.5rem 0.32rem 0.38rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--item-color) 12%, transparent), rgba(0,0,0,0.45));
  min-height: 2.35rem;
  overflow: hidden;
}
.item-slot::before {
  content: "";
  width: 1.85rem; height: 1.85rem;
  border-radius: 5px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--item-color) 55%, transparent);
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--item-color) 55%, #fff), transparent 55%),
    color-mix(in srgb, var(--item-color) 22%, #0a0c12);
  box-shadow: inset 0 0 8px color-mix(in srgb, var(--item-color) 35%, transparent);
}
.item-slot[data-glyph="boost"]::before { box-shadow: 0 0 10px #ff8c3c88, inset 0 0 8px #ff8c3c55; }
.item-slot[data-glyph="oil"]::before { box-shadow: 0 0 8px #8a8aaa66, inset 0 0 8px #555; }
.item-slot[data-glyph="bolt"]::before { box-shadow: 0 0 10px #b8ff3c88, inset 0 0 8px #b8ff3c55; }
.item-slot[data-glyph="shield"]::before { box-shadow: 0 0 10px #00f0ff88, inset 0 0 8px #00f0ff55; }
.item-slot[data-glyph="fake"]::before { box-shadow: 0 0 10px #ff2bd688, inset 0 0 8px #ff2bd655; }
.item-slot[data-glyph="zap"]::before { box-shadow: 0 0 12px #fff06a99, inset 0 0 8px #fff06a66; }
.item-slot.has-item {
  border-color: color-mix(in srgb, var(--item-color) 75%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--item-color) 40%, transparent);
}
.item-slot.spinning {
  animation: itemRoulette 0.09s steps(2) infinite;
  border-color: var(--magenta);
}
.item-slot.spinning .item-icon {
  animation: itemIconFlicker 0.09s steps(2) infinite;
}
.item-slot.locked.pop {
  animation: itemLockPop 0.38s ease-out;
}
@keyframes itemRoulette {
  0% { filter: hue-rotate(0deg) brightness(1.15); }
  100% { filter: hue-rotate(75deg) brightness(1.35); }
}
@keyframes itemIconFlicker {
  0% { transform: translateY(0) scale(1); opacity: 0.85; }
  100% { transform: translateY(-1px) scale(1.08); opacity: 1; }
}
@keyframes itemLockPop {
  0% { transform: scale(0.86); filter: brightness(1.8); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}
.item-icon {
  position: absolute;
  left: 0.45rem;
  width: 1.85rem;
  font-family: var(--font-display), var(--mono);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.85rem;
  color: #fff;
  text-shadow: 0 0 8px var(--item-color), 0 1px 2px #000;
  text-align: center;
  z-index: 1;
  pointer-events: none;
}
.item-name {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.2rem;
  margin-left: 1.55rem;
}
.pos-of { font-size: 0.7em; color: var(--muted); margin-left: 0.1rem; }
#hud-pos { color: var(--lime); }

.item-btn {
  pointer-events: auto;
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.06em;
  color: var(--volt, #b8ff3c);
  border: 2px solid rgba(184, 255, 60, 0.55);
  background: rgba(20, 40, 10, 0.45);
  border-radius: 50%;
  user-select: none;
  width: 72px; height: 72px;
  font-size: 0.72rem;
}
.item-btn.active {
  background: rgba(184, 255, 60, 0.28);
  box-shadow: 0 0 22px rgba(184, 255, 60, 0.4);
}
.touch-controls .pedal-stack .item-btn {
  position: relative; right: auto; bottom: auto; left: auto;
}
.boost-btn {
  color: var(--magenta);
}

@media (max-width: 600px) {
  .hud .stat.item-slot-stat { min-width: 5.5rem; }
  .item-name { max-width: 4.5rem; font-size: 0.6rem; }
  .item-btn { width: 64px; height: 64px; }
}


/* Character avatar select */
.char-select { align-items: flex-start; }
.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1;
}
.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 224, 255, 0.22);
  background: rgba(8, 12, 22, 0.75);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.avatar-chip:hover { border-color: rgba(34, 224, 255, 0.5); color: var(--text); }
.avatar-chip.active {
  color: #041018;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(34, 224, 255, 0.35);
}
.avatar-chip[data-character="volt-viper"].active { background: #9dff20; border-color: #9dff20; }
.avatar-chip[data-character="pink-pulse"].active { background: #ff2bd6; border-color: #ff2bd6; color: #fff; }
.avatar-chip[data-character="circuit-crow"].active { background: #22e0ff; border-color: #22e0ff; }
.avatar-chip[data-character="jade-drift"].active { background: #3dffb5; border-color: #3dffb5; }
.avatar-chip[data-character="nova-kid"].active { background: #ffb020; border-color: #ffb020; }
.avatar-chip[data-character="glitch-monk"].active { background: #b388ff; border-color: #b388ff; color: #1a1028; }
.avatar-emoji { font-size: 1.05rem; line-height: 1; }
