:root {
  --neon-blue: #00d2ff;
  --neon-cyan: #00f6ff;
  --neon-magenta: #ff007f;
  --neon-purple: #9d00ff;
  --neon-red: #ff3333;
  --neon-green: #39ff14;
  --neon-orange: #ffaa00;
  
  --glass-bg: rgba(6, 11, 30, 0.7);
  --glass-border: rgba(0, 246, 255, 0.2);
  --glass-border-alert: rgba(255, 51, 81, 0.3);
  
  --font-title: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

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

body {
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: var(--font-body);
  font-size: 18px;
  width: 100vw;
  height: 100vh;
}

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

/* CRT Scanline Overlay */
#crt-scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.06) 0px,
    rgba(0, 0, 0, 0.06) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  animation: scanlineFlicker 8s linear infinite;
}

@keyframes scanlineFlicker {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.55; }
  75% { opacity: 0.4; }
}

/* Vignette Overlay */
#vignette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.5) 100%
  );
}

/* Enhanced Glitch Title Animation */
.game-title {
  position: relative;
}
.game-title::before,
.game-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.game-title::before {
  color: var(--neon-cyan);
  animation: glitchTop 3s infinite;
  clip-path: inset(0 0 60% 0);
  text-shadow: -2px 0 var(--neon-magenta);
}
.game-title::after {
  color: var(--neon-magenta);
  animation: glitchBottom 4s infinite;
  clip-path: inset(60% 0 0 0);
  text-shadow: 2px 0 var(--neon-cyan);
}

@keyframes glitchTop {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-3px, -1px); }
  94% { transform: translate(3px, 1px); }
  96% { transform: translate(-1px, 0); }
}

@keyframes glitchBottom {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(2px, 1px); }
  93% { transform: translate(-3px, -1px); }
  95% { transform: translate(1px, 0); }
}

/* Enhanced Level Card Hover with Scan Effect */
.level-card::before {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 246, 255, 0.06) 50%,
    transparent 100%
  );
  transition: top 0.6s ease;
  pointer-events: none;
  z-index: 1;
}
.level-card:hover::before {
  top: 100%;
}

/* Skin Card Premium Hover */
.skin-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.skin-card:hover::after {
  opacity: 1;
}


/* Common Screen Settings */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(10, 15, 45, 0.4) 0%, rgba(0, 0, 0, 0.85) 100%);
}

.screen.active {
  display: flex;
}

/* Glassmorphism Panel styles */
.cyber-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 0 35px rgba(0, 246, 255, 0.15), inset 0 0 15px rgba(0, 246, 255, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.cyber-panel-alert {
  background: rgba(25, 5, 10, 0.75);
  border: 1px solid var(--glass-border-alert);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 0 35px rgba(255, 51, 81, 0.2), inset 0 0 15px rgba(255, 51, 81, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.cyber-panel-sub {
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(0, 246, 255, 0.15);
  border-radius: 10px;
  padding: 10px 15px;
  box-shadow: 0 0 15px rgba(0, 246, 255, 0.05);
}

/* Sound Button (Persistent) */
#sound-toggle-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 50;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  box-shadow: 0 0 15px rgba(0, 246, 255, 0.3);
  transition: all 0.3s ease;
}

#sound-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 25px rgba(0, 246, 255, 0.6);
  background: rgba(0, 246, 255, 0.15);
}

#sound-toggle-btn:active {
  transform: scale(0.95);
}

/* Welcome Screen Specifics */
.game-title {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 6px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px var(--neon-blue), 0 0 30px var(--neon-purple);
  margin-bottom: 2px;
}

.game-subtitle {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 8px;
  text-shadow: 0 0 10px var(--neon-cyan);
  margin-bottom: 10px;
}

.game-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 15px;
}

.instructions-panel {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 15px;
  width: 100%;
  text-align: left;
}

.instructions-panel h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
  color: var(--neon-cyan);
  border-bottom: 1px solid rgba(0, 246, 255, 0.2);
  padding-bottom: 5px;
}

.ctrl-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ctrl-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.key-cap {
  font-family: var(--font-title);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.9rem;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.2);
  display: inline-block;
  min-width: 30px;
  text-align: center;
}

.ctrl-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Buttons */
.cyber-btn {
  position: relative;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 15px 35px;
  background: transparent;
  border: 1px solid var(--neon-cyan);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 0 15px rgba(0, 246, 255, 0.2);
}

.cyber-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 25px var(--neon-cyan);
  transform: scale(1.03);
}

.cyber-btn:active {
  transform: scale(0.97);
}

.cyber-btn.secondary-btn {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
  font-size: 0.9rem;
  padding: 10px 25px;
  margin-top: 15px;
}

.cyber-btn.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.pulse-glow {
  animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 10px rgba(0, 246, 255, 0.3);
  }
  100% {
    box-shadow: 0 0 25px rgba(0, 246, 255, 0.7);
    border-color: #fff;
  }
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  max-width: 600px;
  width: 100%;
  pointer-events: auto;
  z-index: 10;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.welcome-content .instructions-panel {
  background: rgba(10, 15, 35, 0.45);
  border: 1px solid rgba(0, 246, 255, 0.2);
  backdrop-filter: blur(5px);
}

/* Corner buttons (SVG only) */
.corner-btn {
  position: absolute;
  z-index: 50;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(10, 15, 35, 0.85);
  border: 1px solid rgba(0, 246, 255, 0.4);
  color: var(--neon-cyan);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 15px rgba(0, 246, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.corner-btn svg {
  transition: transform 0.3s ease;
}

.corner-btn:hover {
  transform: scale(1.12);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 25px rgba(0, 246, 255, 0.6);
  color: #fff;
}

.corner-btn:hover svg {
  transform: rotate(30deg);
}

#corner-garage-btn {
  bottom: 30px;
  left: 30px;
}

#corner-logs-btn {
  bottom: 30px;
  right: 30px;
  color: var(--neon-magenta);
  border-color: rgba(255, 0, 127, 0.4);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
}

#corner-logs-btn:hover {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.6);
  color: #fff;
}

#corner-logs-btn:hover svg {
  transform: translateY(-2px) scale(1.05);
}

.corner-btn:active {
  transform: scale(0.92);
}

/* Tooltip style */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 75px;
  background: rgba(10, 15, 35, 0.95);
  color: #fff;
  border: 1px solid var(--neon-cyan);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 246, 255, 0.2);
  transform: translateY(10px);
}

#corner-logs-btn.tooltip::before {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.2);
}

.tooltip:hover::before {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .corner-btn {
    width: 50px;
    height: 50px;
  }
  #corner-garage-btn {
    bottom: 20px;
    left: 20px;
  }
  #corner-logs-btn {
    bottom: 20px;
    right: 20px;
  }
}

/* Level Selection Screen Specifics */
.level-panel {
  max-width: 900px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 0 35px rgba(0, 246, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 95%;
}

.section-title {
  font-family: var(--font-title);
  font-size: 2rem;
  letter-spacing: 5px;
  color: #fff;
  text-shadow: 0 0 15px var(--neon-cyan);
  margin-bottom: 25px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  margin-bottom: 20px;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.level-card {
  position: relative;
  background: rgba(10, 15, 35, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.level-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.3);
}

.level-card.active:hover {
  border-color: var(--neon-cyan);
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.level-num {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

.level-difficulty {
  font-family: var(--font-title);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 1px;
}

.level-difficulty.easy { background: rgba(0, 210, 255, 0.2); color: var(--neon-blue); }
.level-difficulty.medium { background: rgba(0, 246, 255, 0.2); color: var(--neon-cyan); }
.level-difficulty.hard { background: rgba(255, 0, 127, 0.2); color: var(--neon-magenta); }
.level-difficulty.extreme { background: rgba(255, 51, 51, 0.2); color: var(--neon-red); }

.level-name {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.level-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}

.level-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
}

/* Card Outer Glow borders based on theme */
.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.level-card:hover .card-glow {
  opacity: 1;
}

.border-blue { border: 1.5px solid var(--neon-blue); box-shadow: 0 0 15px rgba(0, 210, 255, 0.2); }
.border-cyan { border: 1.5px solid var(--neon-cyan); box-shadow: 0 0 15px rgba(0, 246, 255, 0.2); }
.border-magenta { border: 1.5px solid var(--neon-magenta); box-shadow: 0 0 15px rgba(255, 0, 127, 0.2); }
.border-red { border: 1.5px solid var(--neon-red); box-shadow: 0 0 15px rgba(255, 51, 51, 0.2); }

/* Locked Level cards styling */
.level-card.locked {
  cursor: not-allowed;
  opacity: 0.55;
}

.level-card.locked:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.1);
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.85);
  z-index: 5;
  border-radius: 12px;
}

/* HUD System Overlay */
.hud-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none; /* Let clicks pass to 3D world unless targeted */
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

.hud-container.active {
  display: flex;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  pointer-events: auto;
}

.hud-stat-box {
  min-width: 140px;
  text-align: center;
}

.hud-label {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  display: block;
  margin-bottom: 2px;
}

.hud-value {
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 246, 255, 0.3);
}

.target-val {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 2px;
}

.hud-center-title {
  text-align: center;
  max-width: 350px;
  width: 100%;
  font-family: var(--font-title);
  font-size: 1.1rem;
  letter-spacing: 3px;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.level-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 246, 255, 0.15);
}

.level-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  transition: width 0.3s ease;
}

/* Alert Notification Banner */
.game-alert-message {
  align-self: center;
  font-family: var(--font-title);
  font-size: 1.8rem;
  letter-spacing: 6px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 15px var(--neon-cyan);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 246, 255, 0.2);
  padding: 8px 30px;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 246, 255, 0.1);
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  z-index: 12;
}

/* HUD Bottom info */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  pointer-events: auto;
}

.boost-meter-container {
  width: 200px;
}

.meter-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 170, 0, 0.2);
}

.meter-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-orange), var(--neon-yellow, #ffe600));
  box-shadow: 0 0 8px var(--neon-orange);
  transition: width 0.1s linear;
}

.hud-action-btn {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 2px;
  background: rgba(10, 15, 35, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 25px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hud-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
}

.hud-action-btn:active {
  transform: scale(0.95);
}

/* Mobile Controls Overlay */
.mobile-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  pointer-events: auto;
}

.steer-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(5, 10, 30, 0.65);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(0, 246, 255, 0.15);
  transition: all 0.2s ease;
}

.steer-btn:active {
  background: rgba(0, 246, 255, 0.25);
  transform: scale(0.9);
  box-shadow: 0 0 25px rgba(0, 246, 255, 0.5);
}

.boost-btn {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: rgba(30, 10, 5, 0.65);
  border: 1px solid var(--neon-orange);
  color: var(--neon-orange);
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(255, 170, 0, 0.15);
  margin-top: 15px;
  transition: all 0.2s ease;
}

.boost-btn:active {
  background: rgba(255, 170, 0, 0.25);
  transform: scale(0.9);
  box-shadow: 0 0 25px rgba(255, 170, 0, 0.5);
}

/* Hide mobile controls by default on desktop, reveal with JS if touch device detected, or keep visible/responsive */
@media (min-width: 1025px) {
  .mobile-controls {
    display: none; /* Hide on large desktop screen unless touch simulation */
  }
}

/* Overlay Screen Settings (Pause, etc) */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 40;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.overlay-screen.active {
  display: flex;
}

.overlay-panel {
  max-width: 420px;
  gap: 25px;
}

.panel-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 15px var(--neon-cyan);
}

.overlay-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

.option-btn {
  max-width: none;
}

.option-btn.secondary {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.option-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

/* Game Over Screen Specifics */
.gameover-panel {
  max-width: 600px;
}

.alert-icon {
  font-size: 3rem;
  margin-bottom: 5px;
  animation: pulseAlert 1.5s infinite alternate;
}

@keyframes pulseAlert {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(255, 51, 81, 0.3)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(255, 51, 81, 0.8)); }
}

.alert-title {
  font-family: var(--font-title);
  font-size: 2.5rem;
  letter-spacing: 5px;
  color: #fff;
  text-shadow: 0 0 15px var(--neon-red);
}

.alert-desc {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.05rem;
  line-height: 1.5;
}

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

.stat-card {
  background: rgba(10, 5, 10, 0.5);
  border: 1px solid rgba(255, 51, 81, 0.15);
  border-radius: 10px;
  padding: 15px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  letter-spacing: 1px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
}

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

.alert-btn {
  max-width: 220px;
}

.alert-btn.primary-btn {
  border-color: var(--neon-red);
  box-shadow: 0 0 15px rgba(255, 51, 81, 0.2);
}

.alert-btn.primary-btn:hover {
  background: var(--neon-red);
  color: #000;
  box-shadow: 0 0 25px var(--neon-red);
}

/* Responsiveness adjustments for smaller devices */
@media (max-width: 768px) {
  .game-title {
    font-size: 2.4rem;
  }
  .game-subtitle {
    font-size: 1.1rem;
    letter-spacing: 5px;
  }
  .level-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
  }
  
  /* Custom scrollbar for levels list on mobile */
  .level-grid::-webkit-scrollbar {
    width: 6px;
  }
  .level-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
  }
  .level-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 246, 255, 0.3);
    border-radius: 3px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 10px;
  }
  .cyber-panel, .cyber-panel-alert {
    padding: 25px 20px;
  }
  .gameover-options {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .alert-btn {
    width: 100%;
    max-width: 300px;
  }
  .hud-top {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    gap: 8px;
  }
  
  .hud-top .hud-stat-box {
    min-width: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  
  .hud-top .hud-label {
    font-size: 0.6rem;
    letter-spacing: 1px;
    margin-bottom: 0;
  }
  
  .hud-top .hud-value {
    font-size: 1.1rem;
  }

  .hud-center-title {
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .level-progress-track {
    height: 4px;
    margin-top: 4px;
  }

  .hud-bottom {
    display: contents;
  }

  .boost-meter-container {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    background: rgba(10, 15, 35, 0.85);
    border: 1px solid rgba(255, 170, 0, 0.2);
    border-radius: 8px;
    padding: 4px 8px;
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.1);
    z-index: 10;
  }
  
  .boost-meter-container .hud-label {
    font-size: 0.65rem;
    letter-spacing: 1px;
    margin-bottom: 2px;
  }
  
  .boost-meter-container .meter-track {
    height: 6px;
    margin-top: 2px;
  }

  .pause-btn {
    position: absolute;
    top: 75px;
    right: 15px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(10, 15, 35, 0.85);
    border: 1px solid var(--neon-cyan);
    color: #fff;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 246, 255, 0.25);
    padding: 0;
  }
  
  .pause-btn span {
    display: none;
  }
  
  .pause-btn::before {
    content: "⏸";
    font-size: 16px;
  }
  
  #sound-toggle-btn {
    top: 75px;
    right: 70px;
    width: 44px;
    height: 44px;
    font-size: 16px;
    box-shadow: 0 0 10px rgba(0, 246, 255, 0.25);
  }

  .mobile-controls {
    bottom: 25px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
  }
  
  .steer-btn {
    width: 72px;
    height: 72px;
    font-size: 1.8rem;
    box-shadow: 0 0 15px rgba(0, 246, 255, 0.25);
  }
  
  .boost-btn {
    width: 68px;
    height: 68px;
    font-size: 0.8rem;
    margin-top: 0;
    margin-bottom: 2px;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.25);
  }
}

@media (max-height: 600px) {
  .cyber-panel, .cyber-panel-alert {
    padding: 15px;
    gap: 10px;
  }
  .game-title {
    font-size: 2rem;
  }
  .game-subtitle {
    margin-bottom: 2px;
  }
  .game-description {
    display: none; /* Hide description to fit screens on landscape */
  }
  .instructions-panel {
    padding: 8px;
  }
  .level-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 40vh;
  }
  .level-card {
    padding: 10px;
    gap: 5px;
  }
  .mobile-controls {
    bottom: 5px;
  }
  .steer-btn {
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
  }
  .boost-btn {
    width: 55px;
    height: 55px;
    font-size: 0.75rem;
    margin-top: 5px;
  }
  .boost-meter-container {
    bottom: 70px;
    width: 130px;
  }
  .pause-btn {
    top: 60px;
    right: 10px;
  }
  #sound-toggle-btn {
    top: 60px;
    right: 60px;
  }
}

/* Audio settings floating panel */
.audio-panel {
  position: absolute;
  top: 85px;
  right: 20px;
  z-index: 100;
  width: 250px;
  display: none;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 15, 30, 0.95);
  border: 1px solid var(--neon-cyan);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 0 25px rgba(0, 246, 255, 0.35);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  pointer-events: auto;
}

.audio-panel.active {
  display: flex;
}

.audio-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--neon-cyan);
  letter-spacing: 1.5px;
  border-bottom: 1px solid rgba(0, 246, 255, 0.2);
  padding-bottom: 6px;
}

.close-panel-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.audio-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-title);
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 1px;
}

.toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
  padding: 4px 12px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn.active {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 10px rgba(0, 246, 255, 0.3);
  font-weight: 700;
}

.volume-slider-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.volume-slider-row input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

.volume-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  cursor: pointer;
}

@media (max-width: 768px) {
  .audio-panel {
    top: 130px;
    right: 15px;
    width: calc(100% - 30px);
  }
}

/* --- NEW PREMIUM PROGRESSION UI --- */

/* Global Coin Display */
#global-ui {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 15px;
}

#sound-toggle-btn {
  position: static;
}

.coin-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid var(--neon-orange);
  padding: 8px 15px;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(255, 170, 0, 0.2);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  transition: transform 0.2s;
}

.coin-display:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
}

.coin-icon {
  font-size: 1.2rem;
  filter: drop-shadow(0 0 5px var(--neon-orange));
}

/* Menu Layout */
.menu-secondary-row {
  display: flex;
  gap: 15px;
  width: 100%;
  max-width: 300px;
  margin-top: -5px;
}

.icon-text-btn {
  flex: 1;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  border-color: rgba(255, 255, 255, 0.4);
}
.icon-text-btn:hover {
  border-color: var(--neon-cyan);
}
.icon-text-btn .btn-icon {
  font-size: 1.2rem;
}

/* Garage (Shop) */
.garage-panel {
  max-width: 800px;
}
.garage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}
.garage-grid::-webkit-scrollbar { width: 6px; }
.garage-grid::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.garage-grid::-webkit-scrollbar-thumb { background: var(--neon-cyan); border-radius: 3px; }

.skin-card {
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
}
.skin-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.5); }
.skin-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  margin-bottom: 5px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.1);
}
.skin-name { font-family: var(--font-title); font-size: 1.1rem; color: #fff; }
.skin-status-btn {
  width: 100%; padding: 8px; font-size: 0.8rem;
}
.skin-card.equipped {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0,246,255,0.3);
}
.skin-card.locked .skin-icon {
  filter: grayscale(100%) brightness(0.4);
}

/* Data Logs (Achievements/Daily) */
.logs-panel {
  max-width: 800px;
  width: 95%;
}
.logs-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  text-align: left;
}
.log-section {
  background: rgba(0,0,0,0.4);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(255,255,255,0.1);
  max-height: 50vh;
  overflow-y: auto;
}
.log-section h3 {
  font-family: var(--font-title); color: var(--neon-cyan);
  font-size: 1rem; border-bottom: 1px solid rgba(0,246,255,0.2);
  padding-bottom: 5px; margin-bottom: 15px;
}
.log-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.05); padding: 10px;
  border-radius: 6px; margin-bottom: 10px;
}
.log-item-info h4 { font-size: 0.95rem; color: #fff; }
.log-item-info p { font-size: 0.8rem; color: rgba(255,255,255,0.6); margin-top: 2px;}
.log-item-reward { font-family: var(--font-title); font-size: 0.9rem; color: var(--neon-orange); }
.log-item.completed { border-left: 3px solid var(--neon-green); }

/* HUD adjustments */
.hud-stat-group {
  display: flex; flex-direction: column; gap: 8px;
}
.hud-stat-box.mini {
  min-width: 100px; padding: 5px 10px;
}
.hud-stat-box.mini .hud-value {
  font-size: 1.2rem;
}

/* Powerups UI */
.powerup-container {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: none;
}
.powerup-icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  position: relative;
}
.powerup-timer {
  position: absolute; bottom: -20px; width: 100%; text-align: center;
  font-family: var(--font-title); font-size: 0.75rem; color: #fff;
  text-shadow: 0 0 5px #000;
}
.powerup-icon.shield { border-color: var(--neon-blue); box-shadow: 0 0 10px var(--neon-blue); }
.powerup-icon.magnet { border-color: var(--neon-purple); box-shadow: 0 0 10px var(--neon-purple); }
.powerup-icon.score { border-color: var(--neon-orange); box-shadow: 0 0 10px var(--neon-orange); }

@media (max-width: 768px) {
  .menu-secondary-row { flex-direction: column; gap: 10px; }
  .logs-container { grid-template-columns: 1fr; }
  #global-ui { top: 15px; right: 15px; gap: 10px; }
  .coin-display { padding: 5px 10px; font-size: 0.9rem; }
  .powerup-container { top: 130px; left: 15px; flex-direction: row; }
}