/* =================================================================
   OVER THE HORIZON: The Dual-Planet Odyssey
   Modern Glassmorphic Web App Stylesheet
   ================================================================= */

:root {
  --bg-glass: rgba(18, 22, 28, 0.72);
  --bg-glass-card: rgba(24, 30, 40, 0.82);
  --bg-glass-btn: rgba(255, 255, 255, 0.08);
  --bg-glass-btn-hover: rgba(255, 255, 255, 0.18);
  --bg-glass-btn-active: rgba(255, 160, 40, 0.35);
  --border-glass: rgba(255, 255, 255, 0.15);
  --text-main: #FFFFFF;
  --text-dim: #A8B2C1;
  --accent-gold: #F5A623;
  --accent-cyan: #26D0CE;
  --accent-green: #34D399;
  --accent-red: #EF4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: #0A0D14;
  font-family: var(--font-family);
  color: var(--text-main);
  touch-action: none;
}

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

/* -----------------------------------------------------------------
   Glassmorphic UI Overlay Layer
   ----------------------------------------------------------------- */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  width: 100dvw;
  height: 100dvh;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

.hud-interactive {
  pointer-events: auto;
}

/* Glass panel utility */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  color: var(--text-main);
}

/* -----------------------------------------------------------------
   Top Header Bar
   ----------------------------------------------------------------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.title-card {
  padding: 12px 20px;
}

/* -----------------------------------------------------------------
   Modern Floating Telemetry & Navigation Instrument Cluster
   ----------------------------------------------------------------- */
.hud-pill-card {
  background: rgba(8, 20, 28, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #F8FAFC;
  transition: all 0.2s ease;
}

/* Top-Left: Game Brand & Planet Sector Pill */
.title-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
}

.hud-brand-crest {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
  background: #08111C;
}

.brand-crest-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}


.hud-title-text-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hud-brand-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.hud-planet-subtitle {
  font-size: 9px;
  font-weight: 700;
  color: #94A3B8;
  margin: 0;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Top-Right: Navigation Waypoint & Precision Odometer */
.mission-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding: 8px 16px;
  min-width: 200px;
}

.waypoint-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.waypoint-icon-pin {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mission-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #F59E0B;
  text-transform: uppercase;
}

.mission-status-row {
  display: flex;
  align-items: center;
}

.mission-status {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #34D399;
  font-variant-numeric: tabular-nums;
}

/* Banner Notification */
.banner-container {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 28px;
  text-align: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  border-radius: 9999px;
  background: rgba(8, 20, 28, 0.92);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.banner-container.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

.banner-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: #F59E0B;
  text-transform: uppercase;
}

.banner-subtitle {
  font-size: 11.5px;
  font-weight: 600;
  color: #E2E8F0;
  margin-top: 2px;
}

/* -----------------------------------------------------------------
   Bottom Controls & Status Dashboard
   ----------------------------------------------------------------- */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  gap: 16px;
}

/* Left: Minimalist Tactile Keycaps Guide */
.controls-guide {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px;
  width: auto;
  max-width: 360px;
}

.controls-keycap-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.keycap-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.controls-guide .keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid #020617;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
}

.controls-guide .keycap-space {
  min-width: 50px;
  font-size: 8.5px;
  letter-spacing: 0.8px;
}

.controls-guide .keycap-xs {
  min-width: 18px;
  height: 18px;
  font-size: 8.5px;
  padding: 0 3px;
}

.keycap-action {
  font-size: 9px;
  font-weight: 700;
  color: #94A3B8;
  margin-left: 4px;
  white-space: nowrap;
}

.keycap-divider {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

.controls-aux-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 9px;
  color: #64748B;
  font-weight: 600;
  white-space: nowrap;
}

.aux-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Center: Speedometer & Nitro Energy Core */
.speedometer-box {
  padding: 10px 18px;
  text-align: center;
  min-width: 165px;
}

.speedometer-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.speed-num-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.speed-value {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
}

.speed-unit {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #00d2ff;
}

.nitro-gauge-container {
  width: 100%;
  margin-top: 2px;
}

.nitro-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #00d2ff;
  margin-bottom: 3px;
}

.nitro-hint {
  color: #64748B;
  font-size: 7.5px;
}

.nitro-bar {
  width: 100%;
  height: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.nitro-fill {
  height: 100%;
  background: linear-gradient(90deg, #0077ff 0%, #00f0ff 100%);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
  transition: width 0.06s linear;
}

.nitro-fill.lockout {
  background: linear-gradient(90deg, #D97706 0%, #FBBF24 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
  animation: pulseRecharge 0.8s infinite alternate;
}

.nitro-label.lockout {
  color: #FBBF24 !important;
}

@keyframes pulseRecharge {
  0% { opacity: 0.65; }
  100% { opacity: 1.0; }
}

.pill-autopilot {
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #64748B;
  transition: all 0.2s ease;
}

.pill-autopilot.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10B981;
  color: #34D399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Right: Planetary Atmosphere Dial & Environment Console */
.atmosphere-box {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.atmosphere-label-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.atmosphere-title {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #F59E0B;
}

.atmosphere-time-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: #FBBF24;
  letter-spacing: 0.4px;
}

.slider-track-wrap {
  width: 100%;
}

.time-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, #F59E0B 0%, #38BDF8 30%, #F59E0B 70%, #1E1B4B 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FBBF24;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 10px #F59E0B, 0 2px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.weather-buttons {
  display: flex;
  gap: 6px;
}

.btn-weather {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #94A3B8;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-weather:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  color: #F8FAFC;
  transform: translateY(-1px);
}

.btn-weather.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #F59E0B;
  color: #FBBF24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

/* -----------------------------------------------------------------
   Welcome & Pause Modal Overlays
   ----------------------------------------------------------------- */
.hidden {
  display: none !important;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  width: 100dvw;
  height: 100dvh;
  z-index: 100;
  background: rgba(6, 8, 12, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s ease;
  pointer-events: auto !important;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden;
}

.modal-card {
  max-width: 540px;
  width: 100%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  pointer-events: auto !important;
}

.modal-card h2 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #FFF 0%, #F5A623 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-card p.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: -12px;
}

.modal-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #F5A623 0%, #D6581C 100%);
  color: #FFF;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 166, 35, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(245, 166, 35, 0.5);
}

.btn-primary:active {
  transform: scale(0.96) !important;
  filter: brightness(1.2) !important;
  box-shadow: 0 2px 10px rgba(245, 166, 35, 0.6) !important;
}

.btn-secondary {
  padding: 11px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass-btn);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.btn-secondary:hover {
  background: var(--bg-glass-btn-hover);
}

.btn-secondary:active {
  transform: scale(0.96) !important;
  filter: brightness(1.2) !important;
  border-color: var(--accent-gold) !important;
}

.modal-info-box {
  text-align: left;
  padding: 14px 18px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.modal-info-box strong {
  color: #FFF;
}

/* -----------------------------------------------------------------
   Mobile Virtual Controls & Quick Actions (Desktop Hidden)
   ----------------------------------------------------------------- */
.mobile-quick-actions {
  display: none !important;
}

.mobile-controls {
  display: none !important;
}

.mobile-atmo-header {
  display: none;
}

.touch-btn {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
}

@media (max-width: 768px), (max-height: 520px), (pointer: coarse) {
  .hud-layer {
    padding: 10px 12px;
  }

  /* 1. Unified Mobile Top App Bar */
  .top-bar {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    padding: 0;
    pointer-events: none;
  }

  /* Row 1: Brand title pill on left, Quick Actions on right */
  .top-bar .title-card {
    pointer-events: auto;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(8, 20, 28, 0.90);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    max-width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
  }

  .top-bar .title-card .hud-brand-crest {
    width: 16px;
    height: 16px;
  }

  .top-bar .title-card .hud-brand-title {
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: 0.8px;
    color: #FFFFFF;
    line-height: 1;
  }

  .top-bar .title-card .hud-planet-subtitle {
    display: none;
  }

  /* Mobile Quick Actions Row: Right-aligned in header row */
  .top-bar .mobile-quick-actions {
    display: flex !important;
    position: static;
    gap: 6px;
    pointer-events: auto;
    margin-left: auto;
  }

  .mobile-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(10, 24, 34, 0.92);
    border: 1.5px solid rgba(245, 158, 11, 0.45);
    border-radius: 9999px;
    padding: 0 9px;
    height: 32px;
    color: #F8FAFC;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    outline: none;
    touch-action: manipulation;
  }

  .mobile-action-pill:active {
    background: rgba(245, 158, 11, 0.35);
    transform: scale(0.93);
  }

  .mobile-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Row 2: Centered Floating Objective Chip */
  .mission-card {
    pointer-events: auto;
    align-self: center;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 14px;
    border-radius: 9999px;
    background: rgba(8, 20, 28, 0.88);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    min-width: 0;
    width: fit-content;
    max-width: 92vw;
  }

  .waypoint-row {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .mission-title {
    font-size: 9.5px;
    font-weight: 800;
    color: #F59E0B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mission-status-row {
    display: flex;
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    padding-left: 8px;
    margin-left: 2px;
  }

  .mission-status {
    font-size: 8.5px;
    font-weight: 700;
    color: #34D399;
    white-space: nowrap;
  }

  .arcade-card {
    pointer-events: auto;
    align-self: center;
    margin: 0 auto;
    padding: 5px 14px;
    border-radius: 9999px;
    min-width: 0;
    width: fit-content;
    max-width: 94vw;
  }

  .controls-guide {
    display: none !important;
  }

  /* 2. Atmosphere & Time: Centered Dedicated Modal Sheet */
  .bottom-bar .atmosphere-box {
    display: none;
  }

  .atmosphere-box.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 32px);
    max-width: 360px;
    z-index: 999;
    background: rgba(7, 21, 29, 0.98);
    border: 2px solid rgba(245, 158, 11, 0.65);
    border-radius: 20px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.95), 0 0 50px rgba(245, 158, 11, 0.25);
    padding: 18px 20px;
    animation: atmoModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes atmoModalPop {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  }

  .mobile-atmo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 900;
    color: #F59E0B;
    letter-spacing: 1px;
  }

  .btn-close-atmo {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .btn-close-atmo:active {
    background: rgba(245, 158, 11, 0.4);
    transform: scale(0.9);
  }

  .atmosphere-box.mobile-open .time-row {
    margin-bottom: 4px;
  }

  .atmosphere-box.mobile-open .slider-track-wrap {
    margin: 8px 0 14px 0;
  }

  .atmosphere-box.mobile-open .time-slider {
    height: 8px;
  }

  .atmosphere-box.mobile-open .time-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  .atmosphere-box.mobile-open .weather-buttons {
    gap: 8px;
  }

  .atmosphere-box.mobile-open .btn-weather {
    padding: 10px 6px;
    font-size: 10.5px;
    min-height: 44px;
    border-radius: 10px;
  }

  /* 3. Center Elevated Speedometer Pill (Zero Pedal / Thumb Collision) */
  .bottom-bar {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
  }

  .speedometer-box {
    position: absolute;
    bottom: clamp(108px, 16vh, 136px); /* cleanly elevated above touch pedals */
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    padding: 4px 12px;
    border-radius: 9999px;
    background: rgba(8, 20, 28, 0.92);
    border: 1.5px solid rgba(0, 240, 255, 0.45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65), 0 0 12px rgba(0, 240, 255, 0.2);
    min-width: 0;
    width: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .speedometer-cluster {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .speed-num-row {
    display: flex;
    align-items: baseline;
    gap: 3px;
  }

  .speed-value {
    font-size: 22px;
    font-weight: 900;
    color: #FFFFFF;
    line-height: 1;
  }

  .speed-unit {
    font-size: 8px;
    font-weight: 800;
    color: #38BDF8;
  }

  .nitro-gauge-container {
    margin: 0;
    width: 62px;
  }

  .nitro-label {
    display: none;
  }

  .nitro-bar {
    height: 5px;
    margin-top: 0;
    border-radius: 3px;
  }

  .speedometer-status-strip {
    display: none;
  }

  /* 4. Ergonomic Virtual Controls Cluster (Spacious Safe-Area Inset) */
  .mobile-controls {
    display: flex !important;
    position: absolute;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    width: calc(100% - max(28px, calc(env(safe-area-inset-left) + env(safe-area-inset-right))));
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 30;
  }

  .mobile-steer-zone {
    display: flex;
    gap: 8px;
    pointer-events: auto;
  }

  .touch-steer-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #FFF;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    user-select: none;
    -webkit-user-select: none;
  }

  .touch-steer-btn:active {
    background: rgba(245, 158, 11, 0.55);
    border-color: #F59E0B;
    transform: scale(0.92);
  }

  .mobile-action-zone {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
    pointer-events: auto;
  }

  .touch-nitro-btn {
    width: 70px;
    height: 32px;
    border-radius: 16px;
    background: rgba(0, 240, 255, 0.35);
    border: 1.8px solid #00F0FF;
    color: #FFF;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.8px;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 240, 255, 0.35);
    user-select: none;
    -webkit-user-select: none;
    margin-right: 2px;
  }

  .touch-nitro-btn:active {
    background: rgba(0, 240, 255, 0.7);
    transform: scale(0.92);
  }

  .touch-nitro-btn.lockout {
    background: rgba(245, 158, 11, 0.22);
    border-color: #F59E0B;
    color: #FDE047;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    opacity: 0.9;
  }

  .touch-nitro-btn.lockout svg {
    fill: #F59E0B !important;
  }

  .mobile-pedal-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .touch-brake-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.35);
    border: 2px solid #EF4444;
    color: #FFF;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.6px;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    user-select: none;
    -webkit-user-select: none;
  }

  .touch-brake-btn:active {
    background: rgba(239, 68, 68, 0.7);
    transform: scale(0.92);
  }

  .touch-gas-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.38);
    border: 2.5px solid #10B981;
    color: #FFF;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
    user-select: none;
    -webkit-user-select: none;
  }

  .touch-gas-btn:active {
    background: rgba(16, 185, 129, 0.7);
    transform: scale(0.92);
  }

  /* 5. Center Banner Positioning */
  .banner-container {
    top: 96px;
    max-width: 88vw;
    padding: 6px 14px;
  }

  .banner-title {
    font-size: 10px;
    letter-spacing: 1.2px;
  }

  .banner-subtitle {
    font-size: 9px;
  }
}

@keyframes drawerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -----------------------------------------------------------------
   Cataclysm 2012 Danger Vignette & HUD Elements
   ----------------------------------------------------------------- */
.danger-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
  box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.0);
  transition: box-shadow 0.15s ease;
}

.danger-vignette.danger-high {
  box-shadow: inset 0 0 140px rgba(255, 30, 0, 0.65);
  animation: pulseDanger 0.45s infinite alternate;
}

@keyframes pulseDanger {
  from { box-shadow: inset 0 0 80px rgba(255, 30, 0, 0.4); }
  to { box-shadow: inset 0 0 160px rgba(255, 50, 0, 0.85); }
}

/* -----------------------------------------------------------------
   Arcade Suite HUD & Scoring Elements
   ----------------------------------------------------------------- */
.arcade-card {
  padding: 10px 18px;
  border-color: rgba(0, 240, 255, 0.35);
  background: rgba(14, 20, 30, 0.88);
  min-width: 290px;
}

.arcade-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.arcade-hearts {
  display: flex;
  gap: 4px;
  font-size: 18px;
}

.heart-icon {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  display: inline-block;
}

.heart-icon.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.8);
}

.arcade-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.score-label, .hi-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.score-value {
  font-size: 18px;
  font-weight: 900;
  color: #FFF;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
  letter-spacing: 0.5px;
}

.arcade-hi-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 10px;
}

.hi-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
}

.arcade-combo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.combo-badge {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #F5A623;
  min-width: 65px;
}

.combo-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.combo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F5A623 0%, #EF4444 100%);
  border-radius: 3px;
  transition: width 0.08s linear;
}

.lockon-warning-badge {
  margin-top: 8px;
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid #EF4444;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  color: #EF4444;
  letter-spacing: 0.8px;
  text-align: center;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.55);
  animation: lockonPulse 0.4s infinite alternate ease-in-out;
}

@keyframes lockonPulse {
  0% { transform: scale(0.98); opacity: 0.85; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.02); opacity: 1.0; box-shadow: 0 0 18px rgba(239, 68, 68, 0.85); }
}

/* Floating Notification Toasts */
.arcade-toast-container {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 25;
}

.arcade-toast {
  padding: 8px 20px;
  border-radius: 20px;
  background: rgba(12, 17, 26, 0.90);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-align: center;
  animation: toastPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.arcade-toast .toast-sub {
  font-size: 9px;
  font-weight: 600;
  color: #A8B2C1;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

@keyframes toastPop {
  from { transform: translateY(-8px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1.0); opacity: 1; }
}

/* Nitro Boost Gauge */
.nitro-gauge-container {
  margin: 8px 0 4px 0;
  width: 100%;
}

.nitro-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #00d2ff;
  text-align: center;
}

.nitro-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.nitro-fill {
  height: 100%;
  background: linear-gradient(90deg, #0099ff 0%, #00f0ff 100%);
  border-radius: 3px;
  transition: width 0.05s linear;
}

/* -----------------------------------------------------------------
   Diegetic 3D Planetary Carousel Menu (Variation 1)
   The 3D Game World IS the Menu
   ----------------------------------------------------------------- */
#welcome-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.22) 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  pointer-events: auto !important;
  touch-action: pan-y;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  overflow: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#welcome-modal.hidden {
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden;
}

/* While welcome menu is active, hide in-game HUD and mobile controls */
body:has(#welcome-modal:not(.hidden)) #hud-layer,
body:has(#welcome-modal:not(.hidden)) #mobile-controls {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.planetary-carousel-menu {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  padding: max(20px, env(safe-area-inset-top)) 28px max(24px, calc(env(safe-area-inset-bottom) + 12px)) 28px;
}

/* 1. Top Bar: Clean Brand Pill & Guide Action */
.carousel-top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  pointer-events: auto;
  z-index: 20;
}

.carousel-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 20, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  padding: 7px 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.carousel-compass-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
  background: #08111C;
}

.carousel-brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
}

.carousel-main-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2.2px;
  color: #FFFFFF;
  margin: 0;
  text-transform: uppercase;
}

.carousel-sub-title {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #94A3B8;
  text-transform: uppercase;
}

.carousel-top-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}

.btn-carousel-guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 20, 28, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #CBD5E1;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  outline: none;
  pointer-events: auto;
}

.btn-carousel-guide:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #F59E0B;
  color: #FBBF24;
  transform: translateY(-1px);
}

/* 2. Floating Chevrons (< and >) */
.carousel-chevron {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(10, 22, 32, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 30;
  outline: none;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.chevron-prev {
  left: 28px;
}

.chevron-next {
  right: 28px;
}

.carousel-chevron:hover {
  background: rgba(245, 158, 11, 0.35);
  border-color: #F59E0B;
  color: #FDE047;
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.carousel-chevron:active {
  transform: translateY(-50%) scale(0.94);
  background: #F59E0B;
  color: #07151D;
}

/* 3. Planet Hero Title & Meta (Naturally stacked above bottom dock) */
.carousel-planet-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  z-index: 25;
  margin-bottom: 2px;
}

.planet-hero-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.planet-hero-name {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #FFFFFF;
  text-transform: uppercase;
  margin: 0;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), 0 1px 3px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.planet-hero-real {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #FBBF24;
  text-transform: capitalize;
  opacity: 0.95;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.planet-hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(8, 18, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 3px 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.planet-hero-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #FBBF24;
  text-transform: uppercase;
}

.meta-dot {
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
}

.planet-hero-vehicle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94A3B8;
}

/* 4. Bottom Dock: Mode Selector + DRIVE Pill */
.carousel-dock-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  pointer-events: auto;
  z-index: 30;
  margin-top: auto;
}

.carousel-dock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 22, 32, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 5px 6px 5px 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  max-width: 95vw;
}

.carousel-mode-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.carousel-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 8px 14px;
  color: #CBD5E1;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.mode-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: all 0.2s ease;
}

.carousel-mode-chip:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.carousel-mode-chip.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(52, 211, 153, 0.45);
  color: #FFFFFF;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.carousel-mode-chip.active .mode-chip-dot {
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
}

.carousel-mode-chip[data-mode="cascade"].active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.45);
}
.carousel-mode-chip[data-mode="cascade"].active .mode-chip-dot {
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
}

.carousel-mode-chip[data-mode="crossy"].active {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.45);
}
.carousel-mode-chip[data-mode="crossy"].active .mode-chip-dot {
  background: #F59E0B;
  box-shadow: 0 0 8px #F59E0B;
}

/* Tactile Candy Amber DRIVE Launch Button */
.btn-carousel-drive {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  border: 1px solid rgba(254, 240, 138, 0.4);
  border-radius: 9999px;
  padding: 9px 22px;
  color: #07151D;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  margin-left: 4px;
}

.btn-carousel-drive .drive-label {
  font-weight: 900;
  color: #07151D;
}

.btn-carousel-drive .drive-icon {
  fill: #07151D;
  transition: transform 0.18s ease;
}

.btn-carousel-drive:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  filter: brightness(1.06);
}

.btn-carousel-drive:hover .drive-icon {
  transform: translateX(2px);
}

.btn-carousel-drive:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* 5. 9-Planet Dot Indicator */
.carousel-planet-dots {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(10, 20, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 4px 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.planet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.planet-dot:hover {
  background: rgba(245, 158, 11, 0.7);
  border-color: #F59E0B;
  transform: scale(1.3);
}

.planet-dot.active {
  width: 18px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
  border-color: #FEF08A;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.85);
  transform: scale(1.05);
}

/* -----------------------------------------------------------------
   MOBILE RESPONSIVE MEDIA QUERIES (< 768px portrait & landscape)
   ----------------------------------------------------------------- */
@media (max-width: 768px) {
  .planetary-carousel-menu {
    padding: max(12px, env(safe-area-inset-top)) 14px max(18px, calc(env(safe-area-inset-bottom) + 8px)) 14px;
  }

  .carousel-brand-pill {
    padding: 5px 14px;
    gap: 7px;
  }

  .carousel-main-title {
    font-size: 11.5px;
    letter-spacing: 1.5px;
  }

  .carousel-sub-title {
    font-size: 7.5px;
    letter-spacing: 0.8px;
  }

  .btn-carousel-guide {
    padding: 5px 10px;
    font-size: 9px;
  }

  .btn-carousel-guide .guide-btn-label {
    display: none;
  }

  /* Side Chevrons on Mobile: 44px touch targets */
  .carousel-chevron {
    width: 44px;
    height: 44px;
  }
  .chevron-prev { left: 8px; }
  .chevron-next { right: 8px; }

  /* Mode text prefix collapse for compact mobile screens */
  .mode-prefix {
    display: none;
  }

  /* Planet Title */
  .carousel-planet-hero {
    margin-bottom: 2px;
  }

  .planet-hero-name {
    font-size: 20px;
    letter-spacing: 2px;
  }

  .planet-hero-real {
    font-size: 13px;
    margin-left: 4px;
  }

  .planet-hero-meta {
    padding: 2px 10px;
    font-size: 9px;
  }

  .planet-hero-tag,
  .planet-hero-vehicle {
    font-size: 8.5px;
  }

  /* Bottom Dock: Compact layout on mobile screens */
  .carousel-dock-footer {
    gap: 8px;
  }

  .carousel-dock-pill {
    padding: 4px 5px 4px 8px;
    gap: 4px;
    max-width: calc(100vw - 20px);
    flex-wrap: nowrap;
  }

  .carousel-mode-chip {
    padding: 7px 9px;
    font-size: 10px;
    gap: 4px;
  }

  .btn-carousel-drive {
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
    min-height: 44px;
  }

  .carousel-planet-dots {
    padding: 3px 10px;
    gap: 5px;
  }

  .planet-dot {
    width: 6px;
    height: 6px;
  }

  .planet-dot.active {
    width: 14px;
  }
}

/* Extra Compact Phones (< 400px, e.g. iPhone SE / 375px) */
@media (max-width: 400px) {
  .carousel-mode-chip {
    padding: 6px 7px;
    font-size: 9px;
  }
  .carousel-mode-chip .mode-chip-dot {
    display: none;
  }
  .btn-carousel-drive {
    padding: 8px 12px;
    font-size: 11px;
  }
}

/* Mobile Landscape (< 520px height) */
@media (max-height: 520px) {
  .planetary-carousel-menu {
    padding: 8px 16px max(10px, calc(env(safe-area-inset-bottom) + 4px)) 16px;
  }

  .carousel-top-bar {
    margin-bottom: 0;
  }

  .carousel-brand-pill {
    padding: 4px 12px;
  }

  .carousel-main-title {
    font-size: 10px;
  }

  .carousel-sub-title {
    display: none;
  }

  .carousel-chevron {
    width: 36px;
    height: 36px;
  }

  .carousel-dock-footer {
    gap: 4px;
  }

  .carousel-planet-hero {
    margin-bottom: 0;
  }

  .planet-hero-name {
    font-size: 15px;
    letter-spacing: 1.5px;
  }

  .planet-hero-real {
    font-size: 11px;
    margin-left: 4px;
  }

  .planet-hero-meta {
    padding: 1px 7px;
    font-size: 8px;
  }

  .carousel-dock-pill {
    padding: 3px 4px 3px 8px;
  }

  .carousel-mode-chip {
    padding: 5px 8px;
    font-size: 9.5px;
  }

  .btn-carousel-drive {
    padding: 6px 14px;
    font-size: 11px;
  }

  .carousel-planet-dots {
    display: none;
  }
}


/* -----------------------------------------------------------------
   MOBILE LANDSCAPE VIEWPORT (Height <= 520px, Orientation: Landscape)
   ----------------------------------------------------------------- */
@media (max-height: 520px) and (orientation: landscape) {
  /* In-Game HUD: Unified single-row top bar saving vertical height */
  .top-bar {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)) !important;
    gap: 8px !important;
  }

  .top-bar .title-card {
    margin: 0 !important;
    font-size: 9.5px !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
  }

  .mission-card,
  .arcade-card {
    margin: 0 !important;
    align-self: center !important;
    padding: 3px 10px !important;
    font-size: 9px !important;
    flex-shrink: 1 !important;
  }

  .top-bar .mobile-quick-actions {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    gap: 5px !important;
  }

  .mobile-action-pill {
    height: 28px !important;
    padding: 0 7px !important;
    font-size: 8.5px !important;
  }

  /* Dock Speedometer to bottom-left next to steer buttons, leaving center wide open */
  .speedometer-box {
    position: absolute !important;
    left: calc(max(14px, env(safe-area-inset-left)) + 116px) !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    transform: none !important;
    padding: 3px 10px !important;
    border-radius: 9999px !important;
    z-index: 25 !important;
  }

  .speedometer-cluster {
    gap: 6px !important;
  }

  .speed-value {
    font-size: 19px !important;
  }

  .nitro-gauge-container {
    width: 52px !important;
  }

  /* Compact controls in landscape */
  .mobile-controls {
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    width: calc(100% - max(28px, calc(env(safe-area-inset-left) + env(safe-area-inset-right)))) !important;
  }

  .touch-steer-btn {
    width: 44px !important;
    height: 44px !important;
  }

  .mobile-steer-zone {
    gap: 6px !important;
  }

  .touch-gas-btn {
    width: 48px !important;
    height: 48px !important;
  }

  .touch-brake-btn {
    width: 38px !important;
    height: 38px !important;
  }

  .touch-nitro-btn {
    width: 62px !important;
    height: 26px !important;
    font-size: 9px !important;
  }

  /* Landscape Menu Deck: 2-column layout */
  .solar-system-deck,
  .oakhaven-menu-deck {
    padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
    display: grid !important;
    grid-template-columns: 1.15fr 0.85fr !important;
    grid-template-rows: auto 1fr !important;
    column-gap: 12px !important;
    row-gap: 4px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
  }

  .solar-top-bar {
    grid-column: 1 / -1 !important;
  }

  .solar-orrery-stage {
    grid-column: 1 !important;
    grid-row: 2 !important;
    height: 100% !important;
    min-height: 170px !important;
    max-height: 260px !important;
  }

  .solar-mission-docket {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
  }

  .solar-bottom-bar {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: end !important;
  }
}

/* -----------------------------------------------------------------
   TABLET VIEWPORT (681px - 1024px)
   ----------------------------------------------------------------- */
@media (min-width: 681px) and (max-width: 1024px) {
  .solar-system-deck,
  .oakhaven-menu-deck {
    width: 94vw;
    max-width: 680px;
    max-height: 94vh;
    padding: 20px 24px;
    gap: 12px;
    border-radius: 24px;
  }

  .solar-orrery-stage {
    height: clamp(260px, 38vh, 340px);
  }

  .solar-mission-docket {
    padding: 12px 18px;
    border-radius: 16px;
  }

  .solar-docket-content-row {
    gap: 16px;
  }

  .solar-mission-docket .map-preview-frame {
    width: 140px;
    height: 92px;
  }

  .solar-mission-docket .spec-val {
    font-size: 12px;
  }

  .solar-mode-pill {
    min-height: 50px;
    padding: 8px 10px;
  }

  .solar-mode-pill .mode-tab-name {
    font-size: 12px;
  }

  .solar-mode-pill .mode-card-sub {
    font-size: 8px;
  }

  .btn-solar-launch,
  .btn-timber-action {
    height: 52px;
    font-size: 15px;
  }
}

/* -----------------------------------------------------------------
   National Park Field Handbook Modal (#about-modal)
   ----------------------------------------------------------------- */
.handbook-container {
  max-width: 820px;
  width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.handbook-binder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  background: linear-gradient(175deg, #FAF6EE 0%, #F5EEDB 100%);
  border: 3px solid #8C531B;
  border-radius: 16px;
  padding: 22px;
  color: #1B3629;
  box-shadow: 0 25px 70px rgba(10, 22, 16, 0.8), inset 0 0 30px rgba(140, 83, 27, 0.08);
}

@media (max-width: 720px) {
  .handbook-binder {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }
}

.handbook-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1.5px solid rgba(27, 54, 41, 0.15);
  padding-bottom: 7px;
}

.park-stamp {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAF6EE;
  border: 1.5px solid #C07A2B;
  border-radius: 50%;
}

.handbook-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #1B3629;
  margin: 0;
}

.handbook-sub {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #8C531B;
  letter-spacing: 0.8px;
}

.handbook-section-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8C531B;
  margin-top: 4px;
}

.controls-keycaps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.keycap-item {
  font-size: 10.5px;
  font-weight: 600;
  color: #1B3629;
  display: flex;
  align-items: center;
  gap: 7px;
}

.handbook-modal .keycap,
.controls-keycaps-grid .keycap {
  display: inline-block;
  background: #EAE3D2;
  border: 1.5px solid #8C531B;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: monospace;
  font-weight: 800;
  font-size: 9.5px;
  color: #1B3629;
  box-shadow: 0 2px 0 #8C531B;
  min-width: 55px;
  text-align: center;
  flex-shrink: 0;
}

.handbook-blueprint-box {
  background: rgba(27, 54, 41, 0.05);
  border: 1.5px dashed rgba(27, 54, 41, 0.3);
  border-radius: 8px;
  padding: 6px;
  margin-top: 4px;
}

.blueprint-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8C531B;
  text-align: center;
  margin-bottom: 2px;
}

.handbook-mode-card {
  background: #FFFFFF;
  border: 1px solid rgba(27, 54, 41, 0.14);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 10px;
  line-height: 1.35;
  box-shadow: 0 1px 4px rgba(27, 54, 41, 0.04);
}

.handbook-mode-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: #1B3629;
  margin-bottom: 2px;
}

.mode-bullet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #1B3629;
  color: #FAF6EE;
  font-size: 8.5px;
  font-weight: 800;
}

.handbook-rules-box {
  background: #FFFFFF;
  border: 1px solid rgba(27, 54, 41, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  box-shadow: 0 1px 4px rgba(27, 54, 41, 0.04);
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #1B3629;
}

.rule-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.handbook-page-footer {
  margin-top: auto;
}

/* General SVG Icon Sizing */
.svg-icon {
  display: inline-block;
  vertical-align: middle;
}

.gameover-icon {
  font-size: 38px;
  margin-bottom: -8px;
}

.gameover-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0;
}

.go-stat-box {
  padding: 12px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.go-stat-box.highlight {
  background: rgba(245, 166, 35, 0.12);
  border-color: rgba(245, 166, 35, 0.4);
}

.go-stat-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.go-stat-value {
  font-size: 18px;
  font-weight: 900;
  color: #FFF;
}

.rank-text {
  color: var(--accent-gold);
}

.new-highscore-badge {
  padding: 6px 16px;
  background: linear-gradient(135deg, #F5A623 0%, #D6581C 100%);
  color: #FFF;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 1px;
  border-radius: 20px;
  display: inline-block;
  margin: 4px auto 10px auto;
  box-shadow: 0 4px 14px rgba(245, 166, 35, 0.4);
  animation: pulseHigh 0.5s infinite alternate;
}

@keyframes pulseHigh {
  from { transform: scale(1.0); }
  to { transform: scale(1.06); }
}

/* Accessible Screen Reader & Search Crawler Content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}



