/* ═══════════════════════════════════════════════════════════════════════
   LAGOS STREET RACE — ARCADE SPEEDOMETER & NITRO (AIR) GAUGE HUD
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --gauge-size: 148px;
  --gauge-bg: rgba(8, 12, 20, 0.78);
  --gauge-border: rgba(255, 255, 255, 0.12);
  --gauge-cyan: #00f0ff;
  --gauge-cyan-glow: rgba(0, 240, 255, 0.65);
  --gauge-red: #ff2a44;
  --gauge-red-glow: rgba(255, 42, 68, 0.75);
  --gauge-gold: #f5c518;
}

#speedometer-cluster {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

/* Align HUD right elements (Pause, Sound, Coins) gracefully to the left of the speedometer */
#hud .hud-right {
  right: calc(var(--gauge-size) + 32px) !important;
  transition: right 0.3s ease;
}

@media (max-width: 820px) {
  #hud .hud-right {
    right: calc(var(--gauge-size) + 18px) !important;
  }
}

#speedometer-cluster.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Speedometer Dial Circular Body */
.speedo-dial {
  position: relative;
  width: var(--gauge-size);
  height: var(--gauge-size);
  border-radius: 50%;
  background: radial-gradient(circle at 48% 48%, rgba(14, 20, 32, 0.88) 0%, rgba(6, 8, 14, 0.96) 80%);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1.5px solid var(--gauge-border);
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.8),
    0 0 24px rgba(0, 240, 255, 0.14),
    inset 0 1px 2px rgba(255, 255, 255, 0.25),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

/* High Speed Vibration */
.speedo-dial.shake {
  animation: speedo-rumble 0.08s infinite alternate ease-in-out;
}

@keyframes speedo-rumble {
  0% { transform: translate(-0.8px, -0.6px); }
  100% { transform: translate(0.8px, 0.6px); }
}

/* Boosting Flare on Dial */
.speedo-dial.boosting {
  border-color: rgba(0, 240, 255, 0.55);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.9),
    0 0 35px var(--gauge-cyan-glow),
    inset 0 0 20px rgba(0, 240, 255, 0.3);
}

/* Redline Alert */
.speedo-dial.redline {
  border-color: rgba(255, 42, 68, 0.65);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.9),
    0 0 35px var(--gauge-red-glow),
    inset 0 0 20px rgba(255, 42, 68, 0.25);
}

/* SVG Radial Meter Layer */
.speedo-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Dial Center Typography */
.speedo-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -6px;
}

.speedo-digits {
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-size: 44px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 16px rgba(255, 255, 255, 0.4);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.speedo-dial.boosting .speedo-digits {
  color: #d6f9ff;
  text-shadow: 0 0 20px var(--gauge-cyan), 0 0 35px var(--gauge-cyan);
}

.speedo-dial.redline .speedo-digits {
  color: #fff1f2;
  text-shadow: 0 0 20px var(--gauge-red), 0 0 35px var(--gauge-red);
}

.speedo-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 3px;
  text-transform: uppercase;
}

/* ── INTEGRATED NITRO / AIR CANISTER ─────────────────────────────────── */
.nitro-bottle-wrap {
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 38px;
  height: 48px;
  z-index: 5;
  transform: rotate(-32deg);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

.nitro-bottle-wrap.active-boost {
  transform: rotate(-32deg) scale(1.15);
  filter: drop-shadow(0 0 16px var(--gauge-cyan)) drop-shadow(0 0 30px #00e5ff);
}

.nitro-bottle-wrap.low-air {
  animation: nitro-pulse-red 0.5s infinite alternate ease-in-out;
}

@keyframes nitro-pulse-red {
  0% { filter: drop-shadow(0 0 4px rgba(255, 42, 68, 0.4)); }
  100% { filter: drop-shadow(0 0 20px rgba(255, 42, 68, 0.9)); }
}

.nitro-bottle-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Nitro Flame Burst when Boosting */
.nitro-exhaust-glow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 22px;
  background: radial-gradient(circle, #ffffff 10%, #00f0ff 60%, transparent 90%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  filter: blur(2px);
}

.active-boost .nitro-exhaust-glow {
  opacity: 0.95;
  animation: exhaust-flicker 0.08s infinite alternate ease-in-out;
}

@keyframes exhaust-flicker {
  0% { transform: translateX(-50%) scale(0.9); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.25); opacity: 1; }
}

/* ── RESPONSIVE SCALING ──────────────────────────────────────────────── */
@media (max-width: 820px) {
  :root {
    --gauge-size: 116px;
  }
  #speedometer-cluster {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
  }
  .speedo-digits {
    font-size: 32px;
  }
  .speedo-unit {
    font-size: 9px;
  }
  .nitro-bottle-wrap {
    width: 30px;
    height: 38px;
    right: -6px;
    bottom: -4px;
  }
}

/* ── HIDE OLD AIR METER & OLD METER ELEMENTS ON LEFT ──────────────── */
#hud .hud-left .air-wrap,
#hud .air-wrap {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Clean score card layout without the old air bar */
.score-card {
  padding-bottom: 12px !important;
}
