:root {
  --bg: #05070f;
  --panel: rgba(10, 16, 32, 0.82);
  --line: rgba(90, 220, 255, 0.22);
  --gold: #f4c14a;
  --gold-2: #ffe9a8;
  --text: #eef6ff;
  --muted: #8ea0b8;
  --ok: #5ee0a0;
  --danger: #ff5d4a;
  --cyan: #5ee7ff;
  --magenta: #ff4d9a;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

#bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.58) 100%),
    linear-gradient(180deg, rgba(20, 40, 90, 0.18), transparent 30%, transparent 70%, rgba(80, 10, 40, 0.28));
}

.topbar,
main,
.overlay {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 8px;
  gap: 12px;
}

.logo {
  font-family: "Noto Serif SC", serif;
  font-size: clamp(18px, 3vw, 34px);
  letter-spacing: 0.12em;
  text-shadow: 0 0 24px rgba(94, 231, 255, 0.35);
}

.gold-chip,
.round-chip,
.timer-chip,
.support-banner {
  min-width: 88px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.72);
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}

.gold-chip {
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gold-chip.is-gain {
  animation: goldPulse 0.7s ease;
}

.gold-icon {
  color: var(--gold-2);
}

.round-chip,
.timer-chip {
  color: var(--muted);
  font-size: 14px;
}

.timer-chip {
  color: var(--cyan);
  min-width: 112px;
  font-variant-numeric: tabular-nums;
}

.screen {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 40px;
}

.tagline {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 28px;
  font-size: 15px;
  line-height: 1.6;
}

.car-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (min-width: 1100px) {
  .car-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.car-card {
  position: relative;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  padding: 22px 16px 18px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.car-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--c) 32%, transparent), transparent 58%);
  pointer-events: none;
}

.car-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--c) 70%, white);
}

.car-card.is-selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 12px 40px color-mix(in srgb, var(--c) 28%, transparent);
  transform: translateY(-6px);
}

.card-odds {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}

.car-card-bolt {
  border-color: rgba(94, 231, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(20, 48, 70, 0.55), rgba(10, 16, 32, 0.82)),
    repeating-linear-gradient(-55deg, transparent 0 10px, rgba(94, 231, 255, 0.05) 10px 12px);
}

.car-card-flame {
  border-color: rgba(255, 90, 42, 0.32);
  background:
    radial-gradient(circle at 50% 110%, rgba(255, 80, 20, 0.28), transparent 46%),
    linear-gradient(180deg, rgba(52, 16, 10, 0.7), rgba(10, 16, 32, 0.82));
}

.car-card-ghost {
  border-style: dashed;
  border-color: rgba(201, 184, 255, 0.4);
  background:
    radial-gradient(circle at 70% 20%, rgba(201, 184, 255, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(28, 22, 48, 0.7), rgba(10, 16, 32, 0.82));
}

.car-card-gold {
  border-color: rgba(255, 210, 74, 0.45);
  background:
    linear-gradient(180deg, rgba(70, 50, 12, 0.55), rgba(10, 16, 32, 0.86)),
    repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 210, 74, 0.06) 14px 15px);
  box-shadow: inset 0 0 0 1px rgba(255, 210, 74, 0.12);
}

.card-preview {
  height: 92px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.card-preview .car-sprite {
  transform-origin: center center;
}

.preview-scale {
  transform: scale(1.55);
  transform-origin: center center;
}

.card-name {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 900;
}

.card-stats {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.card-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.bet-panel {
  margin: 28px auto 0;
  width: min(640px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8, 12, 24, 0.78);
  text-align: center;
}

.bet-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.bet-label {
  color: var(--muted);
}

#bet-amount {
  font-size: 32px;
  color: var(--gold);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip,
.btn-primary,
.btn-ghost {
  font: inherit;
  cursor: pointer;
}

.chip {
  min-width: 64px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text);
}

.chip.is-active {
  background: var(--gold);
  color: #2a1600;
  border-color: var(--gold);
  font-weight: 800;
}

.payout-hint {
  margin: 14px 0 16px;
  color: var(--muted);
  min-height: 22px;
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  max-width: 280px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #9af6ff, var(--cyan) 38%, #2aa0c8);
  color: #041018;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 8px 24px rgba(94, 231, 255, 0.28);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 10px 18px;
}

.hidden {
  display: none !important;
}

.screen-race {
  width: min(1180px, calc(100% - 20px));
}

.race-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.support-banner {
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track {
  --flash: transparent;
  position: relative;
  height: min(74vh, 680px);
  min-height: 480px;
  border-radius: 32px;
  border: 1px solid rgba(90, 220, 255, 0.22);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 78% 28%, rgba(30, 50, 90, 0.25), transparent 28%),
    radial-gradient(circle at 18% 62%, rgba(20, 60, 90, 0.2), transparent 26%),
    linear-gradient(180deg, #0b1a12 0%, #07140c 55%, #061018 100%);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.45),
    0 20px 50px rgba(0, 0, 0, 0.35);
}

.track::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: var(--flash);
  transition: background 0.15s ease;
}

.track.is-shake {
  animation: arenaShake 0.38s ease;
}

.track.is-flash-boost { --flash: rgba(80, 255, 180, 0.18); }
.track.is-flash-blow { --flash: rgba(255, 70, 50, 0.22); }
.track.is-flash-pass { --flash: rgba(255, 220, 80, 0.18); }
.track.is-flash-nitro { --flash: rgba(80, 200, 255, 0.22); }

.course-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lanes {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: none;
}

.boost-pad {
  position: absolute;
  width: 36px;
  height: 14px;
  margin: 0;
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      -32deg,
      rgba(90, 255, 180, 0.2) 0 6px,
      rgba(90, 255, 180, 0.7) 6px 12px
    );
  box-shadow: 0 0 16px rgba(80, 255, 170, 0.7);
  animation: padPulse 0.6s ease-in-out infinite;
  z-index: 2;
}

.sector-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(6, 10, 20, 0.72);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cyan);
  backdrop-filter: blur(8px);
}

.racer {
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  height: 42px;
  z-index: 3;
  transition: filter 0.2s ease;
  will-change: transform, left, top;
  transform: translate(-50%, -50%) rotate(var(--ang, 0deg)) translateY(var(--hop, 0px));
}

.racer .car-sprite {
  animation: none !important;
  transform: scale(0.56);
  transform-origin: center center;
  opacity: 1 !important;
}

.racer.is-air .car-sprite {
  filter: drop-shadow(0 14px 5px rgba(0, 0, 0, 0.55));
}

.racer.is-tunnel .car-body {
  filter: brightness(0.62) saturate(1.2);
}

.racer.is-supported .car-body {
  box-shadow:
    0 0 0 2px var(--gold),
    0 8px 18px rgba(0, 0, 0, 0.45),
    0 0 22px color-mix(in srgb, var(--c) 70%, transparent);
}

.racer.is-blowout {
  filter: grayscale(0.35);
}

.racer.is-blowout .car-sprite {
  animation: blowShake 0.12s linear infinite !important;
}

.racer.is-nitro .car-body {
  filter: brightness(1.25);
}

.racer.is-ghosting {
  opacity: 0.55;
  filter: blur(0.4px);
}

.car-sprite {
  position: relative;
  width: 96px;
  height: 42px;
  pointer-events: none;
}

.car-aura,
.car-extra,
.car-body,
.car-cabin,
.car-stripe,
.car-mark,
.car-wheel,
.car-trail,
.smoke {
  position: absolute;
}

.car-body {
  z-index: 3;
}

.car-wheel {
  z-index: 4;
  background: #111;
}

.car-trail {
  right: 86px;
  top: 16px;
  width: 0;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--c));
  opacity: 0;
  z-index: 1;
}

.racer.is-boost .car-trail,
.racer.is-nitro .car-trail,
.racer.is-pass .car-trail {
  width: 70px;
  opacity: 0.9;
  box-shadow: 0 0 12px var(--c);
}

.smoke {
  left: 18px;
  bottom: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(180, 180, 180, 0.35);
  opacity: 0;
  z-index: 5;
}

.racer.is-blowout .smoke {
  opacity: 1;
  animation: smokePuff 0.5s ease-out infinite;
}

.car-bolt .car-body {
  left: 8px;
  top: 12px;
  width: 86px;
  height: 16px;
  background: linear-gradient(90deg, #073445 0%, #1ec8e8 38%, #b8fbff 78%, #fff 100%);
  clip-path: polygon(0 28%, 12% 0, 72% 10%, 100% 48%, 72% 90%, 12% 100%, 0 72%);
  box-shadow: 0 0 16px #5ee7ff, 0 8px 10px rgba(0, 0, 0, 0.4);
}

.car-bolt .car-cabin {
  left: 28px;
  top: 2px;
  width: 22px;
  height: 8px;
  background: rgba(180, 245, 255, 0.7);
  clip-path: polygon(20% 100%, 40% 0, 80% 0, 100% 100%);
}

.car-bolt .car-stripe {
  left: 10px;
  top: 6px;
  width: 54px;
  height: 3px;
  background: #fff;
  opacity: 0.85;
}

.car-bolt .car-mark {
  left: 22px;
  top: -16px;
  font-size: 16px;
}

.car-bolt .car-mark::after {
  content: "⚡";
  filter: drop-shadow(0 0 6px #5ee7ff);
}

.car-bolt .car-wheel {
  width: 7px;
  height: 14px;
  border-radius: 2px;
  bottom: 2px;
  box-shadow: inset 0 0 0 1px #7adfff;
}

.car-bolt .car-wheel.rear { left: 18px; }
.car-bolt .car-wheel.front { right: 14px; }

.car-bolt .car-aura {
  right: -6px;
  top: 8px;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #fff 0 2px, transparent 8px);
  box-shadow: 0 0 16px #5ee7ff;
  animation: boltSpark 0.7s linear infinite;
}

.car-bolt .car-extra {
  left: -4px;
  top: 6px;
  width: 8px;
  height: 22px;
  background: #0a2a38;
  clip-path: polygon(0 0, 100% 18%, 100% 82%, 0 100%);
}

.card-preview .car-bolt,
.car-bolt {
  animation: boltIdle 1.6s ease-in-out infinite;
}

.car-flame .car-body {
  left: 16px;
  top: 8px;
  width: 64px;
  height: 28px;
  border-radius: 10px 16px 8px 10px;
  background:
    linear-gradient(180deg, #ffb070 0%, #ff4d18 42%, #7a1408 100%);
  box-shadow: 0 0 16px #ff5a2a, 0 8px 10px rgba(0, 0, 0, 0.45);
}

.car-flame .car-cabin {
  left: 18px;
  top: 4px;
  width: 24px;
  height: 10px;
  border-radius: 6px 10px 3px 3px;
  background: rgba(40, 10, 0, 0.55);
}

.car-flame .car-stripe {
  left: 6px;
  top: 14px;
  width: 50px;
  height: 6px;
  background: repeating-linear-gradient(90deg, #2a0600 0 8px, #ffdd55 8px 14px);
  opacity: 0.9;
}

.car-flame .car-mark {
  left: 26px;
  top: -14px;
  font-size: 16px;
}

.car-flame .car-mark::after {
  content: "🔥";
  filter: drop-shadow(0 0 6px #ff5a2a);
}

.car-flame .car-wheel {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  bottom: 0;
  box-shadow: inset 0 0 0 3px #3a1a10, 0 2px 0 #000;
}

.car-flame .car-wheel.rear { left: 18px; }
.car-flame .car-wheel.front { right: 14px; }

.car-flame .car-extra {
  left: 2px;
  top: 10px;
  width: 22px;
  height: 20px;
  background:
    radial-gradient(circle at 30% 50%, #ffe36a 0 3px, transparent 8px),
    radial-gradient(circle at 60% 40%, #ff7a20 0 6px, transparent 12px),
    radial-gradient(circle at 40% 70%, #ff3a00 0 5px, transparent 10px);
  filter: blur(0.2px);
  animation: flameFlicker 0.28s steps(2) infinite;
  z-index: 2;
}

.car-flame .car-aura {
  left: 6px;
  top: 4px;
  width: 10px;
  height: 8px;
  border-radius: 3px;
  background: #3a1208;
  box-shadow: 12px 10px 0 #3a1208;
  z-index: 4;
}

.card-preview .car-flame,
.car-flame {
  animation: flameIdle 0.9s ease-in-out infinite;
}

.car-ghost .car-body {
  left: 12px;
  top: 10px;
  width: 74px;
  height: 22px;
  border-radius: 40% 55% 50% 45%;
  background: linear-gradient(180deg, rgba(236, 230, 255, 0.42), rgba(140, 120, 220, 0.16));
  border: 2px dashed rgba(230, 220, 255, 0.75);
  box-shadow:
    14px 0 0 -4px rgba(201, 184, 255, 0.22),
    0 0 18px rgba(201, 184, 255, 0.45);
}

.car-ghost .car-cabin {
  left: 26px;
  top: 4px;
  width: 22px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.car-ghost .car-stripe {
  display: none;
}

.car-ghost .car-mark {
  left: 30px;
  top: -12px;
  font-size: 16px;
  opacity: 0.9;
}

.car-ghost .car-mark::after {
  content: "👻";
  filter: drop-shadow(0 0 8px #c9b8ff);
}

.car-ghost .car-wheel {
  display: none;
}

.car-ghost .car-extra {
  left: 22px;
  bottom: 2px;
  width: 54px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201, 184, 255, 0.28);
  filter: blur(2px);
  z-index: 1;
}

.car-ghost .car-aura {
  left: 4px;
  top: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(201, 184, 255, 0.18);
  box-shadow: 70px 4px 12px rgba(201, 184, 255, 0.2);
}

.card-preview .car-ghost,
.car-ghost {
  animation: ghostIdle 2.4s ease-in-out infinite;
}

.car-gold .car-body {
  left: 10px;
  top: 10px;
  width: 78px;
  height: 26px;
  border-radius: 16px 18px 10px 12px;
  background: linear-gradient(180deg, #fff6c8 0%, #ffd24a 38%, #c48912 78%, #7a5208 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.45),
    0 0 16px rgba(255, 210, 74, 0.55),
    0 8px 10px rgba(0, 0, 0, 0.4);
}

.car-gold .car-cabin {
  left: 22px;
  top: 4px;
  width: 28px;
  height: 10px;
  border-radius: 8px 10px 3px 3px;
  background: linear-gradient(180deg, rgba(80, 50, 10, 0.35), rgba(40, 20, 0, 0.55));
}

.car-gold .car-stripe {
  left: 8px;
  top: 16px;
  width: 60px;
  height: 3px;
  background: repeating-linear-gradient(90deg, #8a5a10 0 6px, #ffe9a8 6px 8px);
}

.car-gold .car-mark {
  left: 32px;
  top: -16px;
  font-size: 16px;
}

.car-gold .car-mark::after {
  content: "👑";
  filter: drop-shadow(0 0 6px #ffd24a);
}

.car-gold .car-wheel {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  bottom: -1px;
  background: #1a1a1a;
  box-shadow: inset 0 0 0 3px #f4f0e0, inset 0 0 0 5px #333, 0 2px 0 #000;
}

.car-gold .car-wheel.rear { left: 16px; }
.car-gold .car-wheel.front { right: 12px; }

.car-gold .car-extra {
  left: 36px;
  top: 2px;
  width: 22px;
  height: 10px;
  background: #ffd24a;
  clip-path: polygon(0 80%, 18% 20%, 36% 70%, 50% 0, 64% 70%, 82% 20%, 100% 80%);
  z-index: 5;
  filter: drop-shadow(0 0 4px #ffe9a8);
}

.car-gold .car-aura {
  right: 8px;
  top: 4px;
  width: 8px;
  height: 8px;
  background: #fff6c8;
  box-shadow: 0 0 10px #fff;
  animation: goldSparkle 1.4s ease-in-out infinite;
}

.card-preview .car-gold,
.car-gold {
  animation: goldIdle 2.8s ease-in-out infinite;
}

.car-bolt .car-trail {
  height: 4px;
  background: linear-gradient(90deg, transparent, #fff, #5ee7ff);
}

.car-flame .car-trail {
  height: 14px;
  top: 12px;
  background: linear-gradient(90deg, transparent, #ffb020, #ff3a00);
  filter: blur(0.6px);
}

.car-ghost .car-trail {
  height: 16px;
  top: 10px;
  background: linear-gradient(90deg, transparent, rgba(201, 184, 255, 0.7));
  filter: blur(2px);
}

.car-gold .car-trail {
  height: 6px;
  background: linear-gradient(90deg, transparent, #fff6c8, #ffd24a);
}

.finish-line {
  position: absolute;
  top: 42%;
  bottom: 88px;
  right: 7%;
  width: 14px;
  z-index: 2;
  background:
    repeating-linear-gradient(
      180deg,
      #f4f4f4 0 8px,
      #1a1a1a 8px 16px
    );
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.fx-canvas,
.fx-dom {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.fx-burst-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 12px currentColor;
  animation: floatEvent 0.9s ease-out forwards;
  white-space: nowrap;
}

.live-board {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  list-style: none;
  width: min(220px, 42%);
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(6, 10, 20, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.live-board li {
  display: grid;
  grid-template-columns: 22px 1fr 42px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}

.live-board .pos {
  font-weight: 900;
  color: var(--gold);
}

.live-board .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-board .pct {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(64px, 12vw, 140px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 28px var(--cyan), 0 8px 0 #000;
  pointer-events: none;
  opacity: 0;
}

.countdown.is-show {
  opacity: 1;
  animation: countPop 0.7s ease;
}

.countdown.is-go {
  color: #7dffb0;
  text-shadow: 0 0 28px #5ee0a0, 0 8px 0 #000;
}

.event-banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 6;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 22px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.event-banner.is-show {
  animation: bannerIn 1.6s ease forwards;
}

.event-banner[data-kind="boost"] { color: #7dffb0; }
.event-banner[data-kind="blowout"] { color: #ff8a78; }
.event-banner[data-kind="overtake"] { color: #ffe08a; }
.event-banner[data-kind="nitro"] { color: #7ae7ff; }

.race-log {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 5;
  height: 68px;
  overflow: hidden;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  pointer-events: none;
}

.race-log b {
  color: var(--text);
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(6px);
}

.overlay.hidden {
  display: none;
}

.result-card {
  width: min(460px, calc(100% - 32px));
  padding: 28px 24px 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 24, 44, 0.96), rgba(8, 12, 24, 0.96));
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.result-kicker {
  color: var(--muted);
  letter-spacing: 0.18em;
  font-size: 12px;
}

.result-ranks {
  list-style: none;
  margin: 16px 0 12px;
  text-align: left;
}

.result-ranks li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.result-ranks li.is-you {
  outline: 1px solid var(--gold);
  background: rgba(244, 193, 74, 0.1);
}

.result-ranks .medal {
  width: 42px;
  font-weight: 900;
}

.result-pick {
  margin: 8px 0;
  color: var(--muted);
}

#result-title {
  margin: 8px 0 6px;
  font-size: 26px;
}

.result-payout {
  color: var(--gold);
  margin-bottom: 18px;
  min-height: 24px;
}

.result-payout.is-loss {
  color: var(--danger);
}

@keyframes idleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes boltIdle {
  0%, 100% { transform: translate(0, 0); }
  40% { transform: translate(3px, -3px); }
  70% { transform: translate(-1px, 1px); }
}

@keyframes boltSpark {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.6); }
  70% { opacity: 1; transform: scale(1.2); }
}

@keyframes flameIdle {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-2px) rotate(1.5deg); }
}

@keyframes flameFlicker {
  0% { opacity: 0.75; transform: scaleX(1); }
  100% { opacity: 1; transform: scaleX(1.15) translateX(-2px); }
}

@keyframes ghostIdle {
  0%, 100% { transform: translateY(0); opacity: 0.82; }
  50% { transform: translateY(-8px); opacity: 1; }
}

@keyframes goldIdle {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-3px); filter: brightness(1.12); }
}

@keyframes goldSparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.6); }
  50% { opacity: 1; transform: scale(1.3); }
}

@keyframes goldPulse {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.08); box-shadow: 0 0 18px rgba(244, 193, 74, 0.45); }
}

@keyframes arenaShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes roadScroll {
  from { background-position: 0 0, 0 0; }
  to { background-position: -200px 0, 0 0; }
}

@keyframes padPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes blowShake {
  0%, 100% { transform: scale(0.56) translateX(0); }
  50% { transform: scale(0.56) translateX(-3px); }
}

@keyframes smokePuff {
  0% { transform: scale(0.6); opacity: 0.5; }
  100% { transform: translateX(-16px) scale(1.4); opacity: 0; }
}

@keyframes countPop {
  0% { transform: scale(0.4); opacity: 0; }
  35% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bannerIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.9); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(1); }
}

@keyframes floatEvent {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

@media (max-width: 800px) {
  .live-board {
    width: min(180px, 46%);
    padding: 8px;
    font-size: 12px;
  }

  .event-banner {
    font-size: 16px;
    top: 22%;
    max-width: 90%;
    white-space: normal;
    text-align: center;
  }

  .card-preview {
    height: 80px;
  }

  .preview-scale {
    transform: scale(1.28);
  }

  .racer .car-sprite {
    transform: scale(0.34);
    transform-origin: center center;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px;
  }

  .logo {
    letter-spacing: 0.04em;
  }

  .track {
    min-height: 430px;
    height: min(70vh, 560px);
  }

  .card-name {
    font-size: 18px;
  }

  .tagline {
    font-size: 13px;
  }
}
