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

:root {
  --neon-yellow: #ffe14d;
  --neon-blue: #00d4ff;
  --neon-pink: #ff2d95;
  --neon-green: #39ff14;
  --neon-orange: #ff6b2b;
  --neon-red: #ff1744;
  --bg-dark: #0a0a1a;
  --bg-surface: #0f0f2a;
}

body {
  background: var(--bg-dark);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  max-height: 100vh;
  padding: 8px;
  gap: 6px;
}

/* ─── HUD ─── */
#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 4px 12px;
  background: rgba(15, 15, 42, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 7px;
  color: rgba(0, 212, 255, 0.6);
  letter-spacing: 2px;
}

.hud-value {
  font-size: 16px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 225, 77, 0.7), 0 0 20px rgba(255, 225, 77, 0.3);
}

.hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

#title-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--neon-yellow), var(--neon-orange), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── CANVAS ─── */
#game {
  display: block;
  width: 100%;
  flex: 1;
  border-radius: 10px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  box-shadow:
    0 0 30px rgba(0, 212, 255, 0.08),
    inset 0 0 60px rgba(10, 10, 26, 0.5);
  background: var(--bg-dark);
  image-rendering: pixelated;
}

/* ─── OVERLAY ─── */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#overlay.show {
  opacity: 1;
  pointer-events: auto;
}

#overlay-content {
  text-align: center;
}

#overlay-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(24px, 6vw, 48px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-yellow), var(--neon-orange), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255, 225, 77, 0.4));
  margin-bottom: 20px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 225, 77, 0.4)); }
  50% { filter: drop-shadow(0 0 40px rgba(255, 225, 77, 0.7)); }
}

#overlay-sub {
  font-size: clamp(8px, 2.5vw, 12px);
  color: rgba(0, 212, 255, 0.8);
  margin-bottom: 24px;
}

#overlay-sub kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 4px;
  font-family: inherit;
  color: var(--neon-blue);
}

#lives-display {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.life-icon {
  width: 28px;
  height: 28px;
  background: var(--neon-yellow);
  border-radius: 50%;
  clip-path: polygon(100% 50%, 50% 50%, 75% 0%, 100% 0%, 100% 25%);
  filter: drop-shadow(0 0 6px rgba(255, 225, 77, 0.7));
  transform: rotate(225deg);
}

/* ─── MOBILE CONTROLS ─── */
#mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 8px;
}

.ctrl-row {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.3);
  background: rgba(15, 15, 42, 0.8);
  color: var(--neon-blue);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.1s;
}

.ctrl-btn:active {
  background: rgba(0, 212, 255, 0.25);
  border-color: var(--neon-blue);
}

@media (hover: none) and (pointer: coarse) {
  #mobile-controls { display: flex; }
  #game-wrapper { max-height: calc(100vh - 140px); }
}

/* ─── GAME OVER / WIN TEXT ─── */
.overlay-big {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(20px, 5vw, 40px);
  font-weight: 900;
  margin-bottom: 16px;
}

.overlay-score {
  font-size: clamp(14px, 4vw, 24px);
  color: var(--neon-yellow);
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(255, 225, 77, 0.6);
}

.overlay-hint {
  font-size: clamp(8px, 2vw, 11px);
  color: rgba(0, 212, 255, 0.7);
}
