/* ═══════════════════════════════════════════════════════════════════════
   LAGOS STREET RACE — PREMIUM CYBER-ARCADE RACING CONTROLS HUD
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --ctrl-cyan: #00f0ff;
  --ctrl-cyan-glow: rgba(0, 240, 255, 0.45);
  --ctrl-gold: #f5c518;
  --ctrl-gold-glow: rgba(245, 197, 24, 0.5);
  --ctrl-purple: #b537f2;
  --ctrl-purple-glow: rgba(181, 55, 242, 0.5);
  --ctrl-bg: rgba(9, 14, 24, 0.82);
  --ctrl-border: rgba(255, 255, 255, 0.16);
}

/* Ensure controls container sits cleanly on screen */
.touch-controls {
  left: 24px !important;
  right: 24px !important;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 8 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-end !important;
  pointer-events: none !important;
}

.touch-cluster {
  gap: 12px !important;
  pointer-events: none !important;
  display: flex !important;
  flex-direction: column !important;
}

/* ── BASE RACING CONTROL BUTTON ─────────────────────────────────────── */
.touch-btn {
  pointer-events: auto !important;
  position: relative !important;
  cursor: pointer !important;
  background: var(--ctrl-bg) !important;
  border: 1.5px solid var(--ctrl-border) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
  box-shadow: 
    0 10px 28px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -2px 4px rgba(0, 0, 0, 0.6) !important;
  color: #ffffff !important;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.15s ease, 
              border-color 0.15s ease, 
              background 0.15s ease !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  overflow: visible !important;
}

.touch-btn:hover {
  border-color: rgba(0, 240, 255, 0.45) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.8), 0 0 18px var(--ctrl-cyan-glow) !important;
  transform: translateY(-2px) !important;
}

.touch-btn:active,
.touch-btn.active,
.touch-btn.key-active {
  transform: scale(0.92) translateY(2px) !important;
  border-color: var(--ctrl-cyan) !important;
  box-shadow: 
    0 4px 14px rgba(0, 0, 0, 0.9),
    0 0 28px var(--ctrl-cyan-glow),
    inset 0 0 14px rgba(0, 240, 255, 0.35) !important;
}

/* Vector SVG Icon in Buttons */
.ctrl-svg {
  width: 22px;
  height: 22px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transition: transform 0.12s ease, filter 0.15s ease;
}

.touch-btn:active .ctrl-svg,
.touch-btn.active .ctrl-svg,
.touch-btn.key-active .ctrl-svg {
  transform: scale(1.12);
  filter: drop-shadow(0 0 8px var(--ctrl-cyan));
}

/* Subtle Desktop Keyboard Keycap Badge */
.ctrl-key {
  position: absolute;
  top: -8px;
  right: -6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(14, 20, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 2px 5px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: all 0.15s ease;
}

.touch-btn:active .ctrl-key,
.touch-btn.active .ctrl-key,
.touch-btn.key-active .ctrl-key {
  background: var(--ctrl-cyan);
  color: #06080e;
  border-color: var(--ctrl-cyan);
  box-shadow: 0 0 10px var(--ctrl-cyan);
}

.ctrl-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  text-transform: uppercase;
}

/* ── 1. CIRCULAR STEERING DISCS (LEFT & RIGHT) ───────────────────────── */
.touch-steer-row {
  display: flex !important;
  gap: 14px !important;
}

.touch-btn.touch-lane {
  width: 66px !important;
  height: 66px !important;
  border-radius: 50% !important;
  border-width: 2px !important;
  background: radial-gradient(circle at 45% 45%, rgba(18, 26, 42, 0.88) 0%, rgba(8, 12, 20, 0.96) 80%) !important;
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.8),
    0 0 18px rgba(0, 240, 255, 0.12),
    inset 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.touch-btn.touch-lane .ctrl-svg {
  width: 26px;
  height: 26px;
  color: var(--ctrl-cyan);
}

/* ── 2. 360° BARREL ROLL SATELLITE DISCS ─────────────────────────────── */
.touch-btn.touch-roll {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  min-width: unset !important;
  border-color: rgba(181, 55, 242, 0.35) !important;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.7),
    0 0 14px rgba(181, 55, 242, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.25) !important;
}

.touch-btn.touch-roll .ctrl-svg {
  width: 20px;
  height: 20px;
  color: #d880ff;
}

.touch-btn.touch-roll:hover {
  border-color: var(--ctrl-purple) !important;
  box-shadow: 0 0 20px var(--ctrl-purple-glow) !important;
}

.touch-btn.touch-roll:active,
.touch-btn.touch-roll.active,
.touch-btn.touch-roll.key-active {
  border-color: var(--ctrl-purple) !important;
  box-shadow: 0 0 28px var(--ctrl-purple-glow), inset 0 0 12px rgba(181, 55, 242, 0.4) !important;
}

/* ── 3. DIVE STREAK BUTTON ───────────────────────────────────────────── */
.touch-btn.touch-aux {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  min-width: unset !important;
  border-color: rgba(0, 240, 255, 0.3) !important;
}

.touch-btn.touch-aux .ctrl-svg {
  width: 20px;
  height: 20px;
  color: var(--ctrl-cyan);
}

.touch-aux-row {
  display: flex !important;
  gap: 14px !important;
  justify-content: flex-end !important;
}

.touch-primary-row {
  display: flex !important;
  gap: 14px !important;
  align-items: flex-end !important;
}

/* ── 4. VTOL ION THRUSTER (FLY / JUMP) ───────────────────────────────── */
.touch-btn.touch-fly {
  width: 66px !important;
  height: 78px !important;
  border-radius: 20px !important;
  border-color: rgba(245, 197, 24, 0.35) !important;
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.8),
    0 0 18px rgba(245, 197, 24, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.touch-btn.touch-fly .ctrl-svg {
  width: 26px;
  height: 26px;
  color: var(--ctrl-gold);
}

.touch-btn.touch-fly:hover {
  border-color: var(--ctrl-gold) !important;
  box-shadow: 0 0 22px var(--ctrl-gold-glow) !important;
}

.touch-btn.touch-fly:active,
.touch-btn.touch-fly.active,
.touch-btn.touch-fly.key-active {
  border-color: var(--ctrl-gold) !important;
  box-shadow: 0 0 32px var(--ctrl-gold-glow), inset 0 0 14px rgba(245, 197, 24, 0.4) !important;
}

/* ── 5. AUTHENTIC PERFORATED RACING THROTTLE PEDAL (ACCELERATE / BOOST) ─ */
.touch-btn.touch-accel {
  width: 86px !important;
  height: 98px !important;
  border-radius: 22px !important;
  border-width: 2px !important;
  min-width: unset !important;
  background: linear-gradient(165deg, rgba(22, 32, 50, 0.94) 0%, rgba(8, 12, 20, 0.98) 100%) !important;
  border-color: rgba(0, 240, 255, 0.45) !important;
  box-shadow: 
    0 14px 36px rgba(0, 0, 0, 0.85),
    0 0 24px var(--ctrl-cyan-glow),
    inset 0 2px 2px rgba(255, 255, 255, 0.35),
    inset 0 -4px 8px rgba(0, 0, 0, 0.7) !important;
  padding: 10px !important;
  position: relative !important;
}

/* Perforated Grip Holes on Pedal Face */
.pedal-perforations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.pedal-perforations span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #04060a;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 0.5px 1px rgba(255, 255, 255, 0.2);
  display: block;
}

.pedal-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.pedal-flame-svg {
  width: 26px;
  height: 26px;
  color: var(--ctrl-cyan);
  filter: drop-shadow(0 0 8px var(--ctrl-cyan));
  transition: transform 0.12s ease;
}

.pedal-text {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ffffff;
  text-shadow: 0 0 10px var(--ctrl-cyan);
}

.touch-btn.touch-accel:hover {
  border-color: var(--ctrl-cyan) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9), 0 0 32px var(--ctrl-cyan-glow) !important;
  transform: translateY(-3px) scale(1.02) !important;
}

.touch-btn.touch-accel:active,
.touch-btn.touch-accel.active,
.touch-btn.touch-accel.key-active {
  transform: scale(0.94) translateY(4px) !important;
  border-color: #ffffff !important;
  background: linear-gradient(165deg, rgba(0, 168, 255, 0.28) 0%, rgba(8, 12, 20, 0.98) 100%) !important;
  box-shadow: 
    0 6px 18px rgba(0, 0, 0, 0.9),
    0 0 45px var(--ctrl-cyan),
    inset 0 0 20px rgba(0, 240, 255, 0.5) !important;
}

.touch-btn.touch-accel:active .pedal-flame-svg,
.touch-btn.touch-accel.active .pedal-flame-svg,
.touch-btn.touch-accel.key-active .pedal-flame-svg {
  transform: scale(1.22);
  color: #ffffff;
  filter: drop-shadow(0 0 14px #ffffff) drop-shadow(0 0 24px var(--ctrl-cyan));
}

/* ── RESPONSIVE SCALING ──────────────────────────────────────────────── */
@media (max-width: 820px) {
  .touch-controls {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .touch-btn.touch-lane {
    width: 56px !important;
    height: 56px !important;
  }
  .touch-btn.touch-lane .ctrl-svg {
    width: 22px;
    height: 22px;
  }
  .touch-btn.touch-roll,
  .touch-btn.touch-aux {
    width: 44px !important;
    height: 44px !important;
  }
  .touch-btn.touch-fly {
    width: 56px !important;
    height: 66px !important;
  }
  .touch-btn.touch-accel {
    width: 72px !important;
    height: 84px !important;
  }
  .ctrl-key {
    display: none !important;
  }
}
