/**
 * Neon Runner - Stylesheet
 * Dark cyberpunk neon aesthetic
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Arial', sans-serif;
  overflow: hidden;
  background: #0a0a12;
}

/* ============================================
   CANVAS
   ============================================ */

#gameCanvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

/* ============================================
   UI OVERLAY
   ============================================ */

#gameUI {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10;
}

#gameUI > * {
  pointer-events: auto;
}

/* ============================================
   HUD
   ============================================ */

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 16px;
  pointer-events: none;
}

#scoreDisplay,
#coinDisplay,
#speedDisplay {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  padding: 10px 18px;
  backdrop-filter: blur(6px);
}

.hud-label {
  color: rgba(0, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.hud-value {
  color: #00ffff;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

#coinDisplay .hud-value {
  color: #ffcc00;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.6);
}

#coinDisplay {
  border-color: rgba(255, 204, 0, 0.3);
}

#speedDisplay .hud-value {
  color: #ff4488;
  text-shadow: 0 0 10px rgba(255, 68, 136, 0.6);
}

#speedDisplay {
  border-color: rgba(255, 68, 136, 0.3);
}

/* ============================================
   HIGH SCORE BADGE
   ============================================ */

#highScoreBadge {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.2), rgba(255, 68, 136, 0.2));
  border: 1px solid rgba(255, 204, 0, 0.6);
  padding: 8px 24px;
  border-radius: 20px;
  color: #ffcc00;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
  animation: badgePulse 1s ease-in-out infinite;
  pointer-events: none;
}

#highScoreBadge .badge-icon {
  font-size: 16px;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.8; transform: translateX(-50%) scale(1.05); }
}

/* ============================================
   CONTROLS HINT
   ============================================ */

.controls-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 255, 0.3);
  padding: 10px 24px;
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.controls-hint.fade-out {
  opacity: 0;
  pointer-events: none;
}

.hint-mobile {
  display: none;
}

.key {
  display: inline-block;
  background: rgba(0, 255, 255, 0.15);
  border: 1px solid rgba(0, 255, 255, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 800;
  color: #00ffff;
  font-size: 12px;
  margin: 0 2px;
}

/* ============================================
   OVERLAY SCREENS (Start / Game Over)
   ============================================ */

.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 15, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease;
}

.overlay-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  padding: 48px 40px;
  background: linear-gradient(145deg, rgba(10, 10, 25, 0.95), rgba(15, 15, 35, 0.95));
  border: 1px solid rgba(0, 255, 255, 0.25);
  border-radius: 24px;
  box-shadow:
    0 0 40px rgba(0, 255, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 500px;
  width: 90%;
}

.game-title {
  font-size: 56px;
  font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(135deg, #00ffff, #ff4488);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  letter-spacing: 4px;
  filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.4));
}

.game-description {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
  margin-bottom: 32px;
  line-height: 1.6;
}

.game-over-title {
  font-size: 52px;
  font-weight: 900;
  color: #ff4488;
  margin-bottom: 24px;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(255, 68, 136, 0.5);
  animation: glitch 0.5s ease-in-out;
}

@keyframes glitch {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px); }
  20% { transform: translateX(8px); }
  30% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  50% { transform: translateX(-2px); }
}

/* ============================================
   STATS
   ============================================ */

.final-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 100px;
  background: rgba(0, 255, 255, 0.06);
  border: 1px solid rgba(0, 255, 255, 0.15);
  padding: 16px 12px;
  border-radius: 12px;
}

.stat-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.stat-value {
  color: #00ffff;
  font-size: 28px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.high-score-label {
  color: #ffcc00;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 12px;
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
  animation: highScorePulse 1s ease-in-out infinite;
  text-align: center;
  width: 100%;
}

@keyframes highScorePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.high-score-label.hidden {
  display: none;
}

.best-score-row {
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.best-score-row span {
  color: #ffcc00;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
  background: linear-gradient(135deg, #00ffff, #0088aa);
  color: #000;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 48px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.controls-info {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.controls-info h3 {
  color: rgba(0, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.controls-desktop,
.controls-mobile {
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  font-weight: 500;
  margin: 6px 0;
}

.controls-mobile {
  display: none;
}

.leaderboard-msg {
  color: rgba(255, 255, 255, 0.25);
  font-size: 12px;
  font-weight: 500;
  margin-top: 16px;
  font-style: italic;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .hint-desktop,
  .controls-desktop {
    display: none;
  }

  .hint-mobile,
  .controls-mobile {
    display: block;
  }

  #hud {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 8px;
  }

  #scoreDisplay,
  #coinDisplay,
  #speedDisplay {
    padding: 8px 12px;
  }

  .hud-label {
    font-size: 8px;
  }

  .hud-value {
    font-size: 20px;
  }

  .game-title {
    font-size: 40px;
  }

  .game-over-title {
    font-size: 38px;
  }

  .overlay-content {
    padding: 32px 24px;
  }

  .btn-primary {
    font-size: 16px;
    padding: 14px 36px;
  }

  .stat-value {
    font-size: 22px;
  }

  .controls-hint {
    font-size: 12px;
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  .game-title {
    font-size: 32px;
  }

  .game-over-title {
    font-size: 30px;
  }

  .hud-value {
    font-size: 18px;
  }

  .stat {
    min-width: 80px;
    padding: 12px 8px;
  }

  .stat-value {
    font-size: 20px;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  .btn-primary {
    min-height: 56px;
    min-width: 180px;
  }

  .btn-primary:hover {
    transform: none;
  }

  .btn-primary:active {
    transform: scale(0.96);
  }
}

/* ============================================
   UTILITY
   ============================================ */

.hidden {
  opacity: 0;
  pointer-events: none;
}
