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

:root {
  --bg-dark: #0a0e1a;
  --bg-gradient: linear-gradient(180deg, #0a0e1a 0%, #1a1025 50%, #0f1428 100%);
  --primary: #8b5cf6;
  --primary-glow: #a78bfa;
  --accent: #06b6d4;
  --accent-glow: #22d3ee;
  --danger: #ef4444;
  --gold: #fbbf24;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
}

body {
  background: var(--bg-gradient);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* HUD */
.hud-top {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
}

.score-display,
.ammo-display,
.wave-display {
  background: rgba(15, 20, 35, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  min-width: 80px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
}

.label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.ammo-display .value {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.wave-display .value {
  color: var(--primary-glow);
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(15px);
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 40px 24px;
  text-align: center;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

.game-title {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
  margin-bottom: 8px;
  line-height: 1;
}

.game-title .accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.instructions {
  margin-top: 40px;
  text-align: left;
}

.instructions p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border: none;
  border-radius: 14px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
  text-transform: uppercase;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.5);
}

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

/* Game Over Screen */
.gameover-title {
  font-size: 42px;
  font-weight: 900;
  color: var(--danger);
  text-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.final-score {
  background: rgba(139, 92, 246, 0.15);
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 20px 40px;
  margin-bottom: 32px;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

.final-score .label {
  font-size: 12px;
  margin-bottom: 8px;
}

.final-score .value {
  font-size: 48px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  width: 100%;
  max-width: 400px;
}

.stat {
  flex: 1;
  background: rgba(15, 20, 35, 0.8);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 16px 12px;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

/* Power-up Notification */
.notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: linear-gradient(135deg, var(--gold) 0%, #f59e0b 100%);
  padding: 16px 32px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 800;
  color: #1a1025;
  box-shadow: 0 8px 40px rgba(251, 191, 36, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.notification.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Responsive */
@media (max-height: 700px) {
  .game-title {
    font-size: 36px;
  }
  
  .hud-top {
    padding: 12px 16px;
  }
  
  .score-display,
  .ammo-display,
  .wave-display {
    padding: 8px 12px;
    min-width: 70px;
  }
  
  .value {
    font-size: 18px;
  }
}
