/* ==========================================================================
   CYBER HORIZON 3D - Cyberpunk Synthwave Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --neon-cyan: #00f0ff;
  --neon-pink: #ff0077;
  --neon-amber: #ffaa00;
  --neon-purple: #aa00ff;
  --bg-dark: #060713;
  --panel-bg: rgba(10, 14, 28, 0.78);
  --panel-border: rgba(0, 240, 255, 0.4);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Rajdhani', sans-serif;
  color: #fff;
}

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

/* Subtle Retro Scanline Overlay */
.scanline-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 38, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
  opacity: 0.8;
}

/* Vignette Shadow */
.vignette-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8), inset 0 0 40px rgba(0, 240, 255, 0.15);
}

/* ==========================================================================
   HEADS-UP DISPLAY (HUD)
   ========================================================================== */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  transition: opacity 0.3s ease;
}

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

.hud-stats-group {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.hud-pill {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15), inset 0 0 10px rgba(0, 240, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.hud-pill.highlight {
  border-color: var(--neon-pink);
  box-shadow: 0 0 18px rgba(255, 0, 119, 0.3);
}

.hud-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: #7b8ea8;
  text-transform: uppercase;
}

.hud-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.hud-pill.highlight .hud-value {
  color: #ff3388;
  text-shadow: 0 0 10px rgba(255, 0, 119, 0.8);
}

/* Control Buttons (Right Top) */
.hud-btn-group {
  display: flex;
  gap: 0.6rem;
  pointer-events: auto;
}

.hud-mini-btn {
  background: var(--panel-bg);
  border: 1px solid rgba(0, 240, 255, 0.5);
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.hud-mini-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
  transform: translateY(-1px);
}

/* Powerup Status Stack (Left) */
.hud-powerup-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1rem;
}

.powerup-pill {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  width: 170px;
  backdrop-filter: blur(10px);
}

.powerup-pill.shield-active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.powerup-pill.nitro-active {
  border-color: var(--neon-amber);
  box-shadow: 0 0 12px rgba(255, 170, 0, 0.4);
}

.powerup-pill.magnet-active {
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(170, 0, 255, 0.4);
}

.powerup-icon {
  font-size: 1.1rem;
}

.powerup-info {
  flex: 1;
}

.powerup-name {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.powerup-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.powerup-bar {
  height: 100%;
  width: 100%;
  transition: width 0.1s linear;
}

.powerup-bar.nitro-bg {
  background: linear-gradient(90deg, #ff5500, #ffaa00);
}

.powerup-bar.magnet-bg {
  background: linear-gradient(90deg, #aa00ff, #00f0ff);
}

/* Touch Controls (Mobile) */
.hud-touch-controls {
  display: none;
  pointer-events: auto;
  width: 100%;
  justify-content: space-between;
  padding-bottom: 0.5rem;
}

.touch-btn {
  background: rgba(0, 240, 255, 0.2);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 1.1rem;
  font-weight: 800;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
  .hud-touch-controls {
    display: flex;
  }
}

/* ==========================================================================
   MENUS & MODALS (Start, Game Over, Pause)
   ========================================================================== */

.ui-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 5, 12, 0.72);
  backdrop-filter: blur(14px);
  transition: opacity 0.3s ease, visibility 0.3s;
}

.ui-screen.hidden, #hud.hidden, .hidden {
  display: none !important;
}

.modal-card {
  background: linear-gradient(135deg, rgba(14, 18, 38, 0.92) 0%, rgba(8, 10, 22, 0.96) 100%);
  border: 1.5px solid var(--neon-cyan);
  border-radius: 16px;
  padding: 2.5rem 3rem;
  max-width: 580px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 45px rgba(0, 240, 255, 0.25), inset 0 0 25px rgba(0, 240, 255, 0.08);
  position: relative;
  overflow: hidden;
  animation: modalAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.gameover-card {
  border-color: var(--neon-pink);
  box-shadow: 0 0 45px rgba(255, 0, 119, 0.35), inset 0 0 25px rgba(255, 0, 119, 0.1);
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 20%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.6));
  line-height: 1.1;
  margin-bottom: 0.3rem;
}

.game-subtitle {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 5px;
  color: var(--neon-pink);
  text-transform: uppercase;
  margin-bottom: 1.8rem;
  text-shadow: 0 0 10px rgba(255, 0, 119, 0.7);
}

.mission-briefing {
  font-size: 1rem;
  color: #9cb1cb;
  line-height: 1.5;
  margin-bottom: 1.8rem;
}

/* Ship Customization */
.skin-selector-wrap {
  margin-bottom: 1.8rem;
}

.section-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #7b8ea8;
  margin-bottom: 0.7rem;
  text-transform: uppercase;
}

.skin-options {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
}

.skin-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.skin-btn:hover {
  border-color: var(--neon-cyan);
  transform: translateY(-2px);
}

.skin-btn.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

/* Controls Hint Grid */
.controls-guide {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: left;
}

.ctrl-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: #c0d1e5;
}

.key-badge {
  background: #182035;
  border: 1px solid #384b6f;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--neon-cyan);
  box-shadow: 0 2px 0 #0d1220;
}

/* Primary Neon Buttons */
.cyber-cta-btn {
  background: linear-gradient(135deg, #00f0ff 0%, #0088ff 100%);
  border: none;
  border-radius: 8px;
  color: #030611;
  font-family: 'Orbitron', monospace;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 1rem 2.5rem;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.5);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  text-transform: uppercase;
}

.cyber-cta-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.85), inset 0 0 15px rgba(255, 255, 255, 0.8);
}

.cyber-cta-btn.danger {
  background: linear-gradient(135deg, #ff0077 0%, #ff4400 100%);
  color: #fff;
  box-shadow: 0 0 25px rgba(255, 0, 119, 0.6);
}

.cyber-cta-btn.danger:hover {
  box-shadow: 0 0 35px rgba(255, 0, 119, 0.9);
}

/* Game Over Statistics Grid */
.gameover-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.8rem 0;
}

.stat-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.8rem 0.5rem;
}

.stat-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  color: #8da4be;
}

.stat-val {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-top: 0.2rem;
}

.stat-val.gold {
  color: #ffcc00;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.7);
}

.highscore-badge {
  background: linear-gradient(90deg, #ffaa00, #ff0077);
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 1.2rem;
  animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
  from {
    transform: scale(0.97);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
  }
  to {
    transform: scale(1.03);
    box-shadow: 0 0 22px rgba(255, 0, 119, 0.8);
  }
}
