@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800;900&family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;700&display=swap');

:root {
  --bg-dark: #07070f;
  --bg-panel: rgba(14, 13, 26, 0.82);
  --bg-panel-solid: #0d0c1a;
  --neon-pink: #ff007f;
  --neon-cyan: #00f3ff;
  --neon-purple: #9d00ff;
  --neon-yellow: #ffe600;
  --neon-green: #00ff88;
  --neon-blue: #0088ff;
  --text-main: #f0f4ff;
  --text-muted: #8c96b5;
  --border-glow: 0 0 15px rgba(0, 243, 255, 0.4);
  --pink-glow: 0 0 20px rgba(255, 0, 127, 0.6);
  --cyan-glow: 0 0 20px rgba(0, 243, 255, 0.6);
  --font-display: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sub: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 50%, #15112d 0%, #06050c 100%);
}

#canvas-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* CRT Scanline & Vignette Effect */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.65) 100%),
              linear-gradient(rgba(18, 16, 38, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
  background-size: 100% 100%, 100% 4px;
  mix-blend-mode: overlay;
}

/* Speed Lines Overlay */
#speed-lines-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* Flash Overlay */
#screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  background: white;
  transition: opacity 0.1s ease-out;
}

/* -------------------------------------------
   UI OVERLAY SYSTEM & HIDDEN TOGGLE
------------------------------------------- */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 4, 12, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden,
.ui-layer.hidden,
.modal-overlay.hidden,
#menu-screen.hidden,
#garage-screen.hidden,
#track-select-screen.hidden,
#results-screen.hidden,
#pause-screen.hidden,
#hud-overlay.hidden,
#settings-modal.hidden,
#challenges-modal.hidden,
#achievements-modal.hidden,
#leaderboard-modal.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.interactive {
  pointer-events: auto;
}

/* -------------------------------------------
   GLOW BUTTONS & COMPONENTS
------------------------------------------- */
.cyber-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.2) 0%, rgba(0, 243, 255, 0.1) 100%);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 2px;
  padding: 12px 28px;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.25), inset 0 0 10px rgba(0, 243, 255, 0.1);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.cyber-btn:hover {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.6) 0%, rgba(0, 243, 255, 0.4) 100%);
  border-color: #fff;
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.7), inset 0 0 15px rgba(255, 0, 127, 0.4);
  transform: translateY(-2px) scale(1.02);
  color: #ffffff;
}

.cyber-btn:active {
  transform: translateY(1px) scale(0.98);
}

.cyber-btn.pink {
  border-color: var(--neon-pink);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3), inset 0 0 10px rgba(255, 0, 127, 0.15);
}

.cyber-btn.pink:hover {
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.8), inset 0 0 15px rgba(0, 243, 255, 0.4);
}

.cyber-btn.gold {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.3);
}

.cyber-btn.gold:hover {
  background: linear-gradient(135deg, rgba(255, 230, 0, 0.4) 0%, rgba(255, 0, 127, 0.3) 100%);
  box-shadow: 0 0 25px rgba(255, 230, 0, 0.8);
}

.cyber-btn.disabled, .cyber-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  border-color: #555;
  background: rgba(40, 40, 50, 0.3);
}

.cyber-panel {
  background: var(--bg-panel);
  border: 1px solid rgba(0, 243, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 243, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  position: relative;
}

.cyber-panel::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 15px;
  width: 40px;
  height: 2px;
  background: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
}

.cyber-panel::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 15px;
  width: 40px;
  height: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

/* -------------------------------------------
   HEADER HUD (TOP)
------------------------------------------- */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 36px;
  width: 100%;
}

.hud-stats-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-card {
  background: rgba(10, 9, 20, 0.75);
  border: 1px solid rgba(0, 243, 255, 0.3);
  padding: 8px 18px;
  border-radius: 4px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  min-width: 140px;
}

.hud-card-label {
  font-family: var(--font-sub);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hud-card-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.hud-stats-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* COMBO BANNER (TOP-CENTER) */
.hud-center-combo {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hud-center-combo.active {
  animation: comboPulse 0.4s infinite alternate ease-in-out;
}

@keyframes comboPulse {
  0% { transform: translateX(-50%) scale(1); filter: drop-shadow(0 0 10px rgba(255, 0, 127, 0.5)); }
  100% { transform: translateX(-50%) scale(1.06); filter: drop-shadow(0 0 25px rgba(0, 243, 255, 0.8)); }
}

.combo-badge {
  font-family: var(--font-sub);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  text-transform: uppercase;
}

.combo-multiplier {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px rgba(255, 230, 0, 0.8), 0 0 30px rgba(255, 0, 127, 0.6);
  line-height: 1;
  font-style: italic;
}

.combo-score {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neon-pink);
  text-shadow: 0 0 12px var(--neon-pink);
  margin-top: 2px;
}

.combo-timer-bar-wrapper {
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.combo-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.05s linear;
}

/* -------------------------------------------
   LIVE MISSION OBJECTIVE HUD CARD
------------------------------------------- */
.hud-mission-card {
  position: absolute;
  top: 95px;
  left: 36px;
  width: 250px;
  background: rgba(9, 8, 22, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.4);
  border-left: 4px solid var(--neon-cyan);
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 243, 255, 0.15);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.hud-mission-card.completed {
  border-left-color: var(--neon-yellow);
  box-shadow: 0 0 25px rgba(255, 230, 0, 0.6);
  animation: pulseGoal 0.5s ease 2;
}

@keyframes pulseGoal {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.mission-tag {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.mission-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 900;
  color: #ffffff;
  margin-top: 2px;
}

.mission-desc {
  font-family: var(--font-sub);
  font-size: 0.75rem;
  color: #9aa5c4;
  line-height: 1.2;
  margin-top: 3px;
}

.mission-progress-bar-bg {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.mission-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-yellow));
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.15s ease-out;
}

.mission-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

/* -------------------------------------------
   RIGHT-SIDE FLOATING NOTIFICATIONS (NON-OBSTRUCTIVE)
------------------------------------------- */
.hud-side-notifications {
  position: absolute;
  top: 100px;
  right: 36px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.notification-popup {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 8px 16px;
  border-radius: 4px;
  background: rgba(9, 8, 24, 0.90);
  border: 1px solid rgba(0, 243, 255, 0.4);
  border-right: 4px solid var(--neon-cyan);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 243, 255, 0.25);
  backdrop-filter: blur(10px);
  color: #ffffff;
  animation: slideInRight 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  white-space: nowrap;
}

.notification-popup.notif-perfect {
  border-right-color: var(--neon-yellow);
  color: var(--neon-yellow);
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.4);
}

.notification-popup.notif-closecall {
  border-right-color: var(--neon-pink);
  color: var(--neon-pink);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.notification-popup.notif-checkpoint {
  border-right-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

@keyframes slideInRight {
  0% { opacity: 0; transform: translateX(50px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* CENTER 3-2-1 COUNTDOWN */
.hud-center-countdown {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
}

.countdown-text {
  font-family: var(--font-display);
  font-size: 5.5rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 25px rgba(255, 230, 0, 0.9), 0 0 50px rgba(255, 0, 127, 0.8);
  font-style: italic;
  animation: popScale 0.75s ease-out forwards;
}

@keyframes popScale {
  0% { transform: scale(0.4); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1.0); opacity: 0.9; }
}

/* -------------------------------------------
   BOTTOM HUD
------------------------------------------- */
.hud-bottom-bar {
  position: absolute;
  bottom: 24px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 36px;
}

/* MINI-MAP (BOTTOM-LEFT) */
.hud-minimap-container {
  position: relative;
  width: 160px;
  height: 160px;
  background: rgba(9, 8, 20, 0.82);
  border: 2px solid rgba(0, 243, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

#minimap-canvas {
  width: 100%;
  height: 100%;
}

.minimap-compass {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--neon-pink);
  font-weight: 800;
}

/* DRIFT ANGLE & NITRO (BOTTOM-CENTER) */
.hud-center-meters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.drift-angle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.drift-angle-label {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.drift-angle-bar-wrapper {
  width: 220px;
  height: 8px;
  background: rgba(20, 20, 35, 0.8);
  border: 1px solid rgba(255, 0, 127, 0.4);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.drift-angle-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink), var(--neon-yellow));
  box-shadow: 0 0 10px var(--neon-pink);
  border-radius: 3px;
  transition: width 0.05s ease-out;
}

.drift-angle-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
}

/* NITRO BAR */
.nitro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nitro-label {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--neon-cyan);
}

.nitro-segments {
  display: flex;
  gap: 6px;
}

.nitro-seg {
  width: 32px;
  height: 10px;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid rgba(0, 243, 255, 0.4);
  transform: skewX(-20deg);
  transition: all 0.15s ease-out;
  border-radius: 2px;
}

.nitro-seg.filled {
  background: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
  border-color: #ffffff;
}

.nitro-seg.active-boost {
  background: #ffffff;
  box-shadow: 0 0 18px #ffffff, 0 0 30px var(--neon-cyan);
  animation: nitroThrob 0.2s infinite alternate;
}

@keyframes nitroThrob {
  0% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* SPEEDOMETER (BOTTOM-RIGHT) */
.hud-speedo-container {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#speedo-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.speedo-digital {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  margin-top: 15px;
}

.speedo-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
  line-height: 1;
}

.speedo-unit {
  font-family: var(--font-sub);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--neon-pink);
}

.speedo-gear {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--neon-yellow);
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255, 230, 0, 0.4);
}

/* -------------------------------------------
   CENTER NOTIFICATIONS & COUNTDOWN
------------------------------------------- */
#center-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  z-index: 15;
}

.countdown-text {
  font-family: var(--font-display);
  font-size: 5.5rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-pink);
  letter-spacing: 6px;
  animation: countdownPop 0.8s ease-out forwards;
}

@keyframes countdownPop {
  0% { transform: scale(0.4); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

.notification-popup {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
  padding: 8px 24px;
  border-radius: 4px;
  animation: notifAnim 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  margin-top: 10px;
}

.notif-perfect {
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow);
  border: 1px solid var(--neon-yellow);
  background: rgba(255, 230, 0, 0.15);
}

.notif-closecall {
  color: var(--neon-pink);
  text-shadow: 0 0 20px var(--neon-pink);
  border: 1px solid var(--neon-pink);
  background: rgba(255, 0, 127, 0.15);
}

.notif-checkpoint {
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  background: rgba(0, 243, 255, 0.15);
}

@keyframes notifAnim {
  0% { transform: translateY(20px) scale(0.8); opacity: 0; }
  20% { transform: translateY(0) scale(1.1); opacity: 1; }
  80% { transform: translateY(-5px) scale(1); opacity: 1; }
  100% { transform: translateY(-25px) scale(0.9); opacity: 0; }
}

/* -------------------------------------------
   MAIN MENU
------------------------------------------- */
#menu-screen {
  background: radial-gradient(circle at 70% 50%, rgba(15, 10, 30, 0.6) 0%, rgba(5, 4, 12, 0.95) 100%);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 60px 80px;
}

.menu-left {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  z-index: 2;
}

.game-title-group {
  margin-bottom: 24px;
}

.game-logo {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 0.95;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(0, 243, 255, 0.8), 0 0 40px rgba(255, 0, 127, 0.6);
  position: relative;
  display: inline-block;
}

.game-logo span {
  color: var(--neon-pink);
  text-shadow: 0 0 25px var(--neon-pink);
}

.game-tagline {
  font-family: var(--font-sub);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  margin-top: 10px;
  text-transform: uppercase;
}

.menu-nav-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.menu-nav-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 14px 24px;
  font-size: 1.1rem;
  background: rgba(14, 13, 28, 0.7);
  border-color: rgba(0, 243, 255, 0.35);
}

.menu-nav-btn:hover {
  border-color: var(--neon-pink);
  background: linear-gradient(90deg, rgba(255, 0, 127, 0.4), rgba(0, 243, 255, 0.15));
  padding-left: 32px;
}

.currency-display {
  display: flex;
  gap: 20px;
  margin-top: 25px;
  padding: 12px 18px;
  background: rgba(10, 9, 22, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 6px;
  width: fit-content;
}

.currency-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.currency-item.credits { color: var(--neon-yellow); }
.currency-item.tokens { color: var(--neon-cyan); }

.menu-right-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
  z-index: 2;
}

.info-box {
  background: var(--bg-panel);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 8px;
  padding: 20px;
  max-width: 380px;
}

.info-box h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--neon-pink);
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.controls-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  font-family: var(--font-sub);
  font-size: 0.95rem;
}

.key-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.5);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--neon-cyan);
  text-align: center;
}

/* -------------------------------------------
   GARAGE & CUSTOMIZATION SCREEN
------------------------------------------- */
#garage-screen {
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 45px;
}

.garage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.garage-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffffff;
  text-shadow: 0 0 15px var(--neon-cyan);
}

.garage-main-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 2;
  margin-bottom: 10px;
}

.garage-car-info {
  background: var(--bg-panel);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 8px;
  padding: 24px;
  width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.car-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.car-display-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--neon-yellow);
  letter-spacing: 2px;
}

.car-class-badge {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(255, 0, 127, 0.2);
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
}

.car-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sub);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 0 8px var(--neon-cyan);
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.garage-carousel-nav {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

/* GARAGE SIDE TABS & UPGRADE / CUSTOMIZE PANEL */
.garage-controls-panel {
  background: var(--bg-panel);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 8px;
  padding: 24px;
  width: 440px;
  max-height: 75vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.garage-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active, .tab-btn:hover {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
}

.upgrades-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upgrade-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 18, 38, 0.7);
  border: 1px solid rgba(0, 243, 255, 0.2);
  padding: 12px 16px;
  border-radius: 6px;
}

.upgrade-info h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: #fff;
}

.upgrade-level-dots {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.lvl-dot {
  width: 12px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.lvl-dot.filled {
  background: var(--neon-yellow);
  box-shadow: 0 0 6px var(--neon-yellow);
}

.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.color-swatch {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover, .color-swatch.active {
  transform: scale(1.12);
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.spoiler-option-list, .wheel-option-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.item-select-btn {
  background: rgba(20, 18, 38, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.25);
  color: #fff;
  padding: 12px;
  border-radius: 6px;
  font-family: var(--font-sub);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.item-select-btn.active, .item-select-btn:hover {
  background: rgba(0, 243, 255, 0.25);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

/* -------------------------------------------
   TRACK SELECT & MODES
------------------------------------------- */
#track-select-screen {
  background: rgba(8, 7, 16, 0.9);
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
}

.track-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 30px 0;
  overflow-y: auto;
  max-height: 65vh;
  padding: 10px;
}

.track-card {
  background: rgba(16, 14, 30, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.track-card:hover, .track-card.active {
  transform: translateY(-5px);
  border-color: var(--neon-pink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 0, 127, 0.4);
  background: rgba(24, 18, 42, 0.9);
}

.track-thumb {
  width: 100%;
  height: 110px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.track-thumb-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.8) 100%);
}

.track-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}

.track-meta {
  font-family: var(--font-sub);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* -------------------------------------------
   RESULTS SCREEN
------------------------------------------- */
#results-screen {
  background: rgba(6, 5, 14, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.results-modal {
  width: 520px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.35);
  border-radius: 10px;
  padding: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.results-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 20px var(--neon-pink);
  margin-bottom: 20px;
}

.results-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
}

.results-item {
  background: rgba(20, 18, 38, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.2);
  padding: 12px;
  border-radius: 6px;
  text-align: left;
}

.results-label {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  color: var(--neon-cyan);
  font-weight: 700;
  letter-spacing: 1px;
}

.results-val {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
}

.results-reward {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px var(--neon-yellow);
  margin-bottom: 24px;
}

.results-actions {
  display: flex;
  gap: 15px;
  width: 100%;
  justify-content: center;
}

/* -------------------------------------------
   PAUSE OVERLAY & SETTINGS MODAL
------------------------------------------- */
#pause-screen {
  background: rgba(5, 4, 12, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.pause-menu-card {
  width: 360px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--neon-pink);
  box-shadow: 0 0 35px rgba(255, 0, 127, 0.4);
  border-radius: 8px;
  padding: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.pause-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 0 0 20px var(--neon-pink);
  margin-bottom: 10px;
}

/* Modals */
.modal-content {
  width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-panel-solid);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.3);
  border-radius: 8px;
  padding: 30px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 15px var(--neon-cyan);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--neon-pink);
  font-size: 1.6rem;
  cursor: pointer;
  font-weight: 900;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 16, 32, 0.6);
  padding: 12px 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-label {
  font-family: var(--font-sub);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.slider-ctrl {
  accent-color: var(--neon-cyan);
  cursor: pointer;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 9, 20, 0.8);
}
::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-pink);
}

/* ==========================================================================
   UI / UX POLISH LAYER
   Appended last so it refines the existing HUD rather than replacing them.
   Goals: legibility over a bright neon 3D scene, a clear visual hierarchy
   (speed > race state > secondary stats), real interaction feedback on every
   control, and graceful behaviour on small screens.
   ========================================================================== */

:root {
  /* Elevation + glass tokens */
  --glass-bg: linear-gradient(160deg, rgba(20, 19, 38, 0.78) 0%, rgba(10, 9, 20, 0.86) 100%);
  --glass-border: rgba(120, 160, 220, 0.22);
  --glass-border-hot: rgba(0, 243, 255, 0.55);
  --elev-1: 0 2px 10px rgba(0, 0, 0, 0.45);
  --elev-2: 0 8px 28px rgba(0, 0, 0, 0.60);
  --elev-3: 0 18px 60px rgba(0, 0, 0, 0.70);
  --ring: 0 0 0 2px rgba(0, 243, 255, 0.9), 0 0 18px rgba(0, 243, 255, 0.45);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --hud-scale: 1;
}

/* Slightly heavier vignette keeps HUD text off the brightest part of frame */
.screen-overlay {
  background:
    radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(rgba(18, 16, 38, 0) 50%, rgba(0, 0, 0, 0.14) 50%);
  background-size: 100% 100%, 100% 3px;
}

/* --------------------------------------------------------------------------
   1. HUD PANELS — frosted glass, hairline top highlight, readable over neon
   -------------------------------------------------------------------------- */
.hud-card,
.hud-mission-card,
.hud-minimap-container,
.hud-speedo-container,
.drift-angle-container,
.nitro-container {
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
}

.hud-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 9px 16px;
  box-shadow: var(--elev-2), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  min-width: 132px;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

/* Hairline neon accent on the leading edge — orients the eye without noise */
.hud-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--neon-cyan), rgba(0, 243, 255, 0));
  opacity: 0.85;
}
.hud-stats-right .hud-card::before {
  left: auto;
  right: 0;
  background: linear-gradient(180deg, var(--neon-pink), rgba(255, 0, 127, 0));
}

.hud-card-label {
  font-size: 0.60rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-sub);
  font-weight: 600;
}

.hud-card-value {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  /* Dark halo so bright digits survive a white headlight behind them */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 243, 255, 0.22);
}

.hud-top-bar {
  padding: 20px 30px;
  gap: 14px;
}
.hud-stats-left,
.hud-stats-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   2. SPEEDOMETER — the primary read. Bigger, tabular, redline-aware.
   -------------------------------------------------------------------------- */
.hud-speedo-container {
  background: radial-gradient(120% 120% at 50% 100%, rgba(0, 243, 255, 0.10) 0%, rgba(8, 7, 16, 0.88) 62%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--elev-3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 10px 22px 12px;
}

.speedo-number {
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.95;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 26px rgba(0, 243, 255, 0.42);
  transition: color 0.18s linear, text-shadow 0.18s linear;
}

/* HUD.js can toggle these to signal the top of the rev range */
.speedo-number.is-fast {
  color: var(--neon-yellow);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 230, 0, 0.6);
}
.speedo-number.is-redline {
  color: #ff3355;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 34px rgba(255, 51, 85, 0.75);
  animation: redlinePulse 0.32s steps(2) infinite;
}
@keyframes redlinePulse {
  50% { opacity: 0.72; }
}

.speedo-gear {
  font-family: var(--font-sub);
  letter-spacing: 0.22em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   3. METERS — gradient fills, clear empty state, motion on change
   -------------------------------------------------------------------------- */
.drift-angle-bar-wrapper,
.stat-bar-bg,
.mission-progress-bar-bg {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.drift-angle-bar {
  background: linear-gradient(90deg, var(--neon-cyan) 0%, var(--neon-yellow) 55%, var(--neon-pink) 100%);
  box-shadow: 0 0 14px rgba(255, 0, 127, 0.45);
  border-radius: 999px;
  transition: width 0.09s linear;
}

.stat-bar-fill,
.mission-progress-bar-fill {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 999px;
  transition: width 0.45s var(--ease-out);
}

.nitro-seg {
  border-radius: 3px;
  transition: background 0.12s linear, box-shadow 0.12s linear, transform 0.12s var(--ease-out);
}
.nitro-seg.filled {
  background: linear-gradient(180deg, #6ff8ff, var(--neon-cyan));
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
}
.nitro-seg.active-boost {
  background: linear-gradient(180deg, #fff6a8, var(--neon-yellow));
  box-shadow: 0 0 16px rgba(255, 230, 0, 0.9);
  transform: scaleY(1.22);
}

/* --------------------------------------------------------------------------
   4. MINIMAP — framed so it reads as an instrument, not a floating sprite
   -------------------------------------------------------------------------- */
.hud-minimap-container {
  background: rgba(8, 7, 16, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--elev-2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 8px;
}

/* --------------------------------------------------------------------------
   5. MISSION CARD & NOTIFICATIONS — enter with motion, never pop
   -------------------------------------------------------------------------- */
.hud-mission-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--neon-yellow);
  border-radius: 10px;
  box-shadow: var(--elev-2);
}

.hud-side-notifications > * {
  animation: notifyIn 0.34s var(--ease-out) both;
  border-radius: 10px;
  box-shadow: var(--elev-2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@keyframes notifyIn {
  from { opacity: 0; transform: translateX(26px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.hud-center-countdown {
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.9), 0 0 60px rgba(0, 243, 255, 0.55);
}

.hud-center-combo {
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}

/* --------------------------------------------------------------------------
   6. CONTROLS — every interactive element gets hover / active / focus states
   -------------------------------------------------------------------------- */
button,
.btn,
.menu-btn,
.tab-btn,
.car-card,
.track-card,
.color-swatch {
  cursor: pointer;
  transition:
    transform 0.16s var(--ease-out),
    box-shadow 0.22s var(--ease-out),
    border-color 0.22s var(--ease-out),
    background-color 0.22s var(--ease-out),
    filter 0.22s var(--ease-out);
}

button:hover,
.btn:hover,
.menu-btn:hover,
.tab-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: var(--elev-2), 0 0 22px rgba(0, 243, 255, 0.30);
}

button:active,
.btn:active,
.menu-btn:active,
.tab-btn:active {
  transform: translateY(0) scale(0.985);
  filter: brightness(0.95);
  box-shadow: var(--elev-1);
}

button:disabled,
.btn:disabled,
.btn.disabled {
  cursor: not-allowed;
  opacity: 0.42;
  filter: grayscale(0.7);
  transform: none !important;
  box-shadow: none !important;
}

/* Keyboard accessibility: a visible ring, but only for keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring) !important;
  border-radius: 8px;
}

.car-card:hover,
.track-card:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow: var(--elev-3), 0 0 26px rgba(0, 243, 255, 0.28);
}

.color-swatch:hover {
  transform: scale(1.14);
  box-shadow: 0 0 16px currentColor;
}

/* --------------------------------------------------------------------------
   7. SCREENS — cinematic entrance, better panel depth
   -------------------------------------------------------------------------- */
.ui-layer.interactive:not(.hidden) {
  animation: screenIn 0.35s var(--ease-out) both;
}
@keyframes screenIn {
  from { opacity: 0; transform: scale(0.992); }
  to   { opacity: 1; transform: none; }
}

.modal-overlay:not(.hidden) > * {
  animation: modalIn 0.28s var(--ease-out) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* Custom scrollbars so long lists don't break the aesthetic */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); border-radius: 8px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 243, 255, 0.55), rgba(157, 0, 255, 0.55));
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--neon-cyan), var(--neon-purple)); }

/* --------------------------------------------------------------------------
   8. RESPONSIVE — the HUD must not eat the screen on a laptop or tablet
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  html, body { font-size: 14px; }
  .hud-top-bar { padding: 14px 20px; }
  .hud-card { min-width: 112px; padding: 7px 13px; }
}

@media (max-width: 940px) {
  html, body { font-size: 13px; }
  .hud-card { min-width: 96px; }
  .hud-mission-card { display: none; }   /* secondary info yields first */
  .hud-minimap-container { transform: scale(0.82); transform-origin: bottom left; }
  .hud-speedo-container { padding: 8px 16px 10px; }
}

@media (max-height: 620px) {
  .hud-top-bar { padding: 10px 18px; }
  .hud-mission-card { display: none; }
}

/* --------------------------------------------------------------------------
   9. ACCESSIBILITY — honour the OS "reduce motion" setting
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .screen-overlay { background-size: 100% 100%, 100% 100%; }
}

/* In-game toast (replaces browser alert) */
.game-toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%) translateY(12px);
  z-index: 12000;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(10, 12, 22, 0.94);
  border: 1px solid rgba(0, 243, 255, 0.35);
  color: #e8f0ff;
  font-family: var(--font-sub, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.game-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.game-toast[data-tone="warn"] {
  border-color: rgba(255, 180, 40, 0.55);
}
.game-toast[data-tone="info"] {
  border-color: rgba(0, 243, 255, 0.45);
}

#btn-revive-action.disabled,
#btn-revive-action:disabled {
  opacity: 0.45;
  pointer-events: none;
}
