/* ============================================================
   NITRO SURGE — Sci-Fi Kart Racing
   Stylesheet
   ============================================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --bg-deep:       #0a0a1a;
  --bg-panel:      #0d0d20;
  --bg-card:       #111128;
  --bg-card-hover: #181840;
  --cyan:          #00d4ff;
  --magenta:       #ff00cc;
  --green:         #00ff88;
  --gold:          #ffd700;
  --silver:        #c0c0c0;
  --bronze:        #cd7f32;
  --white:         #e8e8f0;
  --muted:         #6a6a8a;
  --danger:        #ff3355;
  --font-title:    'Orbitron', sans-serif;
  --font-body:     'Rajdhani', sans-serif;
  --glow-cyan:     0 0 10px var(--cyan), 0 0 30px rgba(0, 212, 255, 0.4);
  --glow-magenta:  0 0 10px var(--magenta), 0 0 30px rgba(255, 0, 204, 0.4);
  --glow-green:    0 0 10px var(--green), 0 0 30px rgba(0, 255, 136, 0.4);
  --radius:        8px;
  --radius-lg:     14px;
  --transition:    0.3s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* --- Utility --- */
.hidden { display: none !important; }
.flex-center { display: flex; justify-content: center; align-items: center; }

/* ============================================================
   SCREENS — shared wrapper
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-deep);
  transition: opacity 0.5s ease;
  z-index: 1;
}

.screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   TITLE SCREEN
   ============================================================ */

/* Animated neon grid background */
#title-screen {
  background:
    linear-gradient(180deg, transparent 60%, rgba(0, 212, 255, 0.03) 100%),
    var(--bg-deep);
  overflow: hidden;
}

#title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.07) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridScroll 8s linear infinite;
  mask-image: linear-gradient(180deg, transparent 0%, white 30%, white 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, white 30%, white 70%, transparent 100%);
}

@keyframes gridScroll {
  0%   { transform: perspective(400px) rotateX(45deg) translateY(0); }
  100% { transform: perspective(400px) rotateX(45deg) translateY(60px); }
}

/* Horizontal neon scanline */
#title-screen::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.4;
  animation: scanline 4s ease-in-out infinite;
}

@keyframes scanline {
  0%, 100% { top: 15%; opacity: 0; }
  50%      { top: 85%; opacity: 0.4; }
}

.title-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 40px rgba(0, 212, 255, 0.6),
    0 0 80px rgba(0, 212, 255, 0.3);
  animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 10px var(--cyan), 0 0 40px rgba(0,212,255,0.6), 0 0 80px rgba(0,212,255,0.3); }
  50%      { text-shadow: 0 0 20px var(--cyan), 0 0 60px rgba(0,212,255,0.8), 0 0 120px rgba(0,212,255,0.5); }
}

.game-subtitle {
  font-family: var(--font-title);
  font-size: clamp(0.9rem, 2.5vw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--magenta);
  text-shadow: 0 0 10px var(--magenta), 0 0 30px rgba(255,0,204,0.4);
  margin-top: 0.5rem;
}

.title-menu {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* ============================================================
   BUTTONS — Neon Style
   ============================================================ */
.btn {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 0.8rem 2.8rem;
  border: 1px solid var(--cyan);
  border-radius: var(--radius);
  background: rgba(0, 212, 255, 0.06);
  color: var(--cyan);
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: rgba(0, 212, 255, 0.15);
  box-shadow: var(--glow-cyan);
  transform: scale(1.04);
}

.btn:active {
  transform: scale(0.97);
}

/* Magenta variant */
.btn--magenta {
  border-color: var(--magenta);
  color: var(--magenta);
  background: rgba(255, 0, 204, 0.06);
}
.btn--magenta:hover {
  background: rgba(255, 0, 204, 0.15);
  box-shadow: var(--glow-magenta);
}

/* Green variant */
.btn--green {
  border-color: var(--green);
  color: var(--green);
  background: rgba(0, 255, 136, 0.06);
}
.btn--green:hover {
  background: rgba(0, 255, 136, 0.15);
  box-shadow: var(--glow-green);
}

/* Solid accent */
.btn--solid {
  background: linear-gradient(135deg, var(--cyan), #0090b0);
  border: none;
  color: #000;
}
.btn--solid:hover {
  box-shadow: var(--glow-cyan);
}

/* Small */
.btn--sm {
  font-size: 0.85rem;
  padding: 0.5rem 1.6rem;
}

/* Disabled */
.btn:disabled,
.btn--disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ============================================================
   VEHICLE SELECT SCREEN
   ============================================================ */
#vehicle-select {
  padding: 40px 2rem 2rem;
  gap: 1rem;
  overflow-y: auto;
  justify-content: flex-start;
}

.screen-heading {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0,212,255,0.5);
  text-transform: uppercase;
}

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  max-width: 900px;
  width: 100%;
}

.vehicle-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.vehicle-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-3px);
}

.vehicle-card.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,212,255,0.4), 0 0 40px rgba(0,212,255,0.15);
}

.vehicle-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(255,0,204,0.08));
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  overflow: hidden;
}

.vehicle-name {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--white);
}

.vehicle-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-label {
  width: 70px;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 600;
}

.stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.stat-bar-fill--speed   { background: var(--cyan); box-shadow: 0 0 6px rgba(0,212,255,0.5); }
.stat-bar-fill--accel   { background: var(--green); box-shadow: 0 0 6px rgba(0,255,136,0.5); }
.stat-bar-fill--handling { background: var(--magenta); box-shadow: 0 0 6px rgba(255,0,204,0.5); }

/* ============================================================
   TRACK SELECT SCREEN
   ============================================================ */
#track-select {
  padding: 2rem;
  gap: 1.5rem;
}

.track-list {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  max-width: 100%;
  padding: 1rem 0.5rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) var(--bg-panel);
}

.track-list::-webkit-scrollbar {
  height: 6px;
}
.track-list::-webkit-scrollbar-track {
  background: var(--bg-panel);
  border-radius: 3px;
}
.track-list::-webkit-scrollbar-thumb {
  background: var(--cyan);
  border-radius: 3px;
}

.track-card {
  flex: 0 0 220px;
  scroll-snap-align: center;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
}

.track-card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-3px);
}

.track-card.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,212,255,0.4), 0 0 40px rgba(0,212,255,0.15);
}

.track-card.locked {
  opacity: 0.45;
  pointer-events: none;
}

.track-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

/* Themed track gradients */
.track-preview--neon-city   { background: linear-gradient(135deg, #0a1628, #1a0a3a, #00d4ff20); }
.track-preview--lava-canyon  { background: linear-gradient(135deg, #1a0a0a, #3a1a00, #ff330020); }
.track-preview--ice-nebula   { background: linear-gradient(135deg, #0a1a2a, #1a2a3a, #00ff8820); }
.track-preview--void-ring    { background: linear-gradient(135deg, #0d0020, #200040, #ff00cc20); }
.track-preview--solar-strip  { background: linear-gradient(135deg, #1a1a00, #2a2000, #ffd70020); }

.track-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
}

.track-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.track-difficulty {
  display: flex;
  gap: 3px;
}

.star {
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.1);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star.filled {
  background: var(--gold);
  filter: drop-shadow(0 0 3px rgba(255,215,0,0.5));
}

/* ============================================================
   RACE HUD
   ============================================================ */
#race-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  font-family: var(--font-title);
}

/* --- Timer (top center) --- */
.hud-timer {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--white);
  text-shadow: 0 0 8px rgba(255,255,255,0.3);
  background: rgba(10,10,26,0.6);
  padding: 0.3rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
}

/* --- Position badge (top right) --- */
.hud-position {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  text-align: right;
}

.hud-position-number {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,215,0,0.5);
}

.hud-position-ordinal {
  font-size: 1.1rem;
  font-weight: 600;
  vertical-align: super;
}

/* --- Lap counter (below position) --- */
.hud-lap {
  position: absolute;
  top: 4.5rem;
  right: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.hud-lap-current {
  color: var(--white);
  font-size: 1.2rem;
}

/* --- Speedometer (bottom right) --- */
.hud-speedometer {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 130px;
  height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.speed-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.06);
}

/* Neon arc — driven via JS conic-gradient or SVG */
.speed-arc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  filter: drop-shadow(0 0 6px var(--cyan));
  transition: transform 0.15s ease;
}

.speed-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  z-index: 1;
}

.speed-unit {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.15em;
  z-index: 1;
}

/* --- Power-up slot (bottom center) --- */
.hud-powerup {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.powerup-slot {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: rgba(10,10,26,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  transition: var(--transition);
}

.powerup-slot.active {
  border-color: var(--magenta);
  box-shadow: 0 0 10px rgba(255,0,204,0.4);
}

.powerup-hint {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: rgba(10,10,26,0.6);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* --- Nitro meter (bottom left) --- */
.hud-nitro {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.nitro-bar-track {
  width: 18px;
  height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.08);
}

.nitro-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, var(--cyan), #00a0cc);
  border-radius: 9px;
  transition: height 0.2s ease;
}

.nitro-bar-fill.full {
  background: linear-gradient(0deg, var(--cyan), var(--green));
  box-shadow: 0 0 12px var(--cyan), 0 0 24px rgba(0,212,255,0.4);
  animation: nitroPulse 0.6s ease-in-out infinite;
}

@keyframes nitroPulse {
  0%, 100% { box-shadow: 0 0 12px var(--cyan), 0 0 24px rgba(0,212,255,0.4); }
  50%      { box-shadow: 0 0 20px var(--cyan), 0 0 40px rgba(0,212,255,0.6); }
}

.nitro-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0,212,255,0.4);
}

/* --- Minimap (top left) --- */
.hud-minimap {
  position: absolute;
  top: 1rem;
  left: 1.5rem;
  width: 140px;
  height: 90px;
  background: rgba(10,10,26,0.7);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.minimap-track {
  position: absolute;
  inset: 15px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
}

.minimap-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.minimap-dot--player {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

.minimap-dot--opponent {
  background: var(--danger);
  box-shadow: 0 0 4px var(--danger);
}

/* ============================================================
   COUNTDOWN OVERLAY
   ============================================================ */
#countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10,10,26,0.7);
  backdrop-filter: blur(4px);
}

.countdown-number {
  font-family: var(--font-title);
  font-size: clamp(6rem, 18vw, 12rem);
  font-weight: 900;
  color: var(--white);
  text-shadow: 0 0 20px rgba(255,255,255,0.5);
  animation: countPulse 1s ease-out forwards;
}

.countdown-number.go {
  color: var(--green);
  text-shadow: 0 0 30px var(--green), 0 0 80px rgba(0,255,136,0.5);
  animation: goFlash 0.8s ease-out forwards;
}

@keyframes countPulse {
  0%   { transform: scale(0.3); opacity: 0; }
  30%  { transform: scale(1.15); opacity: 1; }
  60%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes goFlash {
  0%   { transform: scale(0.3); opacity: 0; }
  25%  { transform: scale(1.2); opacity: 1; }
  50%  { transform: scale(1); opacity: 1; filter: brightness(2); }
  100% { transform: scale(2); opacity: 0; }
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
#results-screen {
  z-index: 15;
  background: rgba(10,10,26,0.88);
  backdrop-filter: blur(12px);
}

.results-panel {
  background: var(--bg-panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 2.5rem 3rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.results-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.results-position {
  font-family: var(--font-title);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1.1;
}

.results-position.pos-1 { color: var(--gold);   text-shadow: 0 0 20px rgba(255,215,0,0.5); }
.results-position.pos-2 { color: var(--silver); text-shadow: 0 0 20px rgba(192,192,192,0.4); }
.results-position.pos-3 { color: var(--bronze); text-shadow: 0 0 20px rgba(205,127,50,0.4); }
.results-position.pos-other { color: var(--muted); }

.results-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.results-stat {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 500;
}

.results-stat-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.results-stat-value {
  color: var(--white);
  font-family: var(--font-title);
  font-weight: 600;
}

.results-credits {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255,215,0,0.4);
}

.results-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ============================================================
   GARAGE (Vehicle Upgrades)
   ============================================================ */
#garage-screen {
  padding: 2rem;
  gap: 1.5rem;
}

.garage-layout {
  display: flex;
  gap: 2rem;
  max-width: 950px;
  width: 100%;
  align-items: flex-start;
}

.garage-vehicle-display {
  flex: 1;
  aspect-ratio: 4 / 3;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 5rem;
  position: relative;
  overflow: hidden;
}

.garage-vehicle-display::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(0deg, rgba(0,212,255,0.05), transparent);
}

.garage-upgrades {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.garage-credits {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255,215,0,0.3);
  text-align: right;
  letter-spacing: 0.06em;
}

.upgrade-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.upgrade-card:hover {
  border-color: rgba(0,212,255,0.2);
}

.upgrade-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0,212,255,0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.upgrade-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.upgrade-name {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.upgrade-level {
  display: flex;
  gap: 4px;
}

.upgrade-pip {
  width: 28px;
  height: 5px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
}

.upgrade-pip.filled {
  background: var(--cyan);
  box-shadow: 0 0 4px rgba(0,212,255,0.4);
}

.upgrade-cost {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
}

.upgrade-buy {
  flex-shrink: 0;
}

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
#settings-screen {
  padding: 2rem;
  gap: 2rem;
}

.settings-panel {
  background: var(--bg-panel);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  max-width: 500px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.settings-label {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Slider */
.slider-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0,212,255,0.5);
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px rgba(0,212,255,0.7);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0,212,255,0.5);
  border: none;
  cursor: pointer;
}

/* Difficulty selector */
.difficulty-options {
  display: flex;
  gap: 0.6rem;
}

.difficulty-btn {
  flex: 1;
  padding: 0.6rem;
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.difficulty-btn:hover {
  border-color: rgba(0,212,255,0.3);
  color: var(--white);
}

.difficulty-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,212,255,0.1);
  box-shadow: 0 0 8px rgba(0,212,255,0.2);
}

/* Controls display */
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
}

.control-action {
  font-size: 0.9rem;
  color: var(--muted);
}

.control-key {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: var(--white);
}

/* ============================================================
   OVERLAY & MODAL SHARED
   ============================================================ */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,26,0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 25;
}

/* ============================================================
   CANVAS (Game rendering surface)
   ============================================================ */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
   ANIMATIONS — Reusable
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes glowBreathe {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.anim-fade-in  { animation: fadeIn 0.4s ease-out both; }
.anim-slide-up { animation: slideUp 0.5s ease-out both; }

/* Staggered children */
.stagger > :nth-child(1) { animation-delay: 0s; }
.stagger > :nth-child(2) { animation-delay: 0.07s; }
.stagger > :nth-child(3) { animation-delay: 0.14s; }
.stagger > :nth-child(4) { animation-delay: 0.21s; }
.stagger > :nth-child(5) { animation-delay: 0.28s; }
.stagger > :nth-child(6) { animation-delay: 0.35s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .vehicle-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .garage-layout {
    flex-direction: column;
  }

  .garage-vehicle-display {
    aspect-ratio: 16 / 9;
  }

  .track-card {
    flex: 0 0 180px;
  }

  .hud-speedometer {
    width: 100px;
    height: 100px;
  }

  .speed-value {
    font-size: 1.5rem;
  }

  .results-panel {
    padding: 1.8rem 2rem;
  }

  .settings-panel {
    padding: 1.5rem 1.8rem;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .vehicle-grid {
    grid-template-columns: 1fr;
  }

  .hud-minimap {
    width: 100px;
    height: 65px;
  }

  .title-menu .btn {
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
  }

  .results-buttons {
    flex-direction: column;
  }
}
