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

:root {
  --neon-cyan:   #00fff5;
  --neon-pink:   #ff006e;
  --neon-yellow: #ffd60a;
  --neon-green:  #39ff14;
}

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

body {
  overflow: hidden;
  background: #000;
  font-family: 'Orbitron', 'Courier New', monospace;
}

#map {
  width: 100vw;
  height: 100vh;
}

.leaflet-container:focus { outline: none; }

#map {   transition: transform 0.1s linear;  }

/* ── Sprite animations ────────────────────────────── */
/* Applied directly to the <img> tags created in script.js */

.asteroid-spin {
  animation: tumble 10s linear infinite;
  transform-origin: center;
}

.health-pulse {
  animation: hpulse 1s ease-in-out infinite;
  transform-origin: center;
}

.timeboost-pulse {
  animation: tpulse 0.85s ease-in-out infinite;
  transform-origin: center;
}

.explode-anim {
  animation: explode 0.5s ease-out forwards;
  transform-origin: center;
}

@keyframes tumble {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes hpulse {
  0%, 100% { transform: scale(1);    opacity: 1;    }
  50%      { transform: scale(1.18); opacity: 0.75; }
}

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

@keyframes explode {
  from { opacity: 1; transform: scale(0.4); }
  to   { opacity: 0; transform: scale(2.2); }
}

/* ── HUD ──────────────────────────────────────────── */
#hud {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 1000;
  pointer-events: none;
}

#health {
  width: 300px;
  height: 22px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  overflow: hidden;
  padding: 2px;
  box-shadow: 0 0 12px rgba(0, 255, 245, 0.6), inset 0 0 8px rgba(0, 0, 0, 0.8);
}

#healthbar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg,
    var(--neon-pink) 0%,
    #ff7b00 40%,
    var(--neon-yellow) 70%,
    var(--neon-green) 100%);
  background-size: 300px 100%;
  background-position: right;
  border-radius: 8px;
  transition: width 0.25s ease-out;
}

#score {
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan), 0 0 18px var(--neon-cyan);
  letter-spacing: 2px;
  white-space: nowrap;
}

#score #number {
  color: white;
  margin-right: 6px;
  text-shadow: 0 0 8px white, 0 0 18px var(--neon-pink), 0 0 28px var(--neon-pink);
}

/* ── Instructions ─────────────────────────────────── */
#instructions {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  letter-spacing: 2px;
  z-index: 1000;
  pointer-events: none;
  text-transform: uppercase;
}

/* ── Game Over overlay ────────────────────────────── */
#gameover {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  background: radial-gradient(ellipse at center,
    rgba(255, 0, 110, 0.25) 0%,
    rgba(0, 0, 0, 0.92) 70%);
  z-index: 2000;
  text-align: center;
  backdrop-filter: blur(2px);
}

.gameover-title {
  color: var(--neon-pink);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow:
    0 0 12px var(--neon-pink),
    0 0 30px var(--neon-pink),
    0 0 60px white;
  animation: gameover-pulse 1.6s ease-in-out infinite;
}

.gameover-credit {
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(0, 255, 245, 0.6);
}

.gameover-source {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-style: italic;
  letter-spacing: 1px;
  max-width: 560px;
}

/* ── Leaderboard display ──────────────────────────────── */
#leaderboard-list {
  font-family: 'Courier New', monospace;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 255, 245, 0.1);
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
}

.leaderboard-row:hover {
  background: rgba(0, 255, 245, 0.05);
  color: var(--neon-cyan);
}

.leaderboard-row.first {
  background: rgba(255, 215, 10, 0.15);
  color: var(--neon-yellow);
  font-weight: 700;
  border-left: 3px solid var(--neon-yellow);
  padding-left: 5px;
}

.leaderboard-row.second {
  background: rgba(200, 200, 200, 0.08);
  color: #d0d0d0;
  font-weight: 600;
  border-left: 3px solid #d0d0d0;
  padding-left: 5px;
}

.leaderboard-row.third {
  background: rgba(205, 127, 50, 0.15);
  color: #cd7f32;
  font-weight: 600;
  border-left: 3px solid #cd7f32;
  padding-left: 5px;
}

.leaderboard-row .rank {
  min-width: 30px;
  font-weight: 700;
}

.leaderboard-row .name {
  flex: 1;
  text-align: left;
  padding: 0 8px;
}

.leaderboard-row .lb-meta {
  font-size: 9px;
  color: #445;
  text-align: right;
  margin-left: 6px;
  white-space: nowrap;
}

.leaderboard-row .score {
  text-align: right;
  font-weight: 700;
  color: var(--neon-green);
}

.restart-btn {
  margin-top: 8px;
  padding: 12px 36px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(0, 255, 245, 0.5);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.restart-btn:hover {
  background: rgba(0, 255, 245, 0.12);
  box-shadow: 0 0 24px rgba(0, 255, 245, 0.8);
  color: #ffffff;
}

/* ── Mobile responsive ────────────────────────────── */
@media (max-width: 600px) {
  .gameover-title {
    font-size: 28px;
    letter-spacing: 2px;
  }

  .restart-btn {
    font-size: 13px;
    padding: 10px 24px;
    letter-spacing: 1px;
  }

  #gameover {
    padding: 15px;
    gap: 12px;
  }

  .gameover-credit {
    font-size: 11px;
  }

  .gameover-source {
    font-size: 9px;
  }
}

@keyframes gameover-pulse {
  0%, 100% { opacity: 1;    transform: scale(1);    }
  50%       { opacity: 0.75; transform: scale(1.04); }
}

/* ── Version tag ──────────────────────────────────── */
#version {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
  z-index: 1000;
  pointer-events: none;
  font-family: 'Orbitron', monospace;
}

/* ── Leaflet attribution ──────────────────────────── */
.leaflet-control-attribution {
  font-size: 9px !important;
  opacity: 0.5;
}

/* ── Intro / Story Screen ─────────────────────────── */
#introscreen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #05001a 0%, #000000 100%);
  z-index: 2900;
  animation: fadeIn 0.8s ease;
}
#introscreen.visible {
  display: flex;
}
.intro-box {
  max-width: 620px;
  width: 90%;
  padding: 40px 36px 100px 36px;
  text-align: left;
  border: 1px solid rgba(0, 255, 245, 0.15);
  border-radius: 8px;
  background: rgba(0, 10, 40, 0.6);
  box-shadow: 0 0 60px rgba(0, 255, 245, 0.08);
  max-height: 85vh;
  overflow-y: auto;
}
.intro-date {
  font-family: 'Orbitron', monospace;
  color: var(--neon-pink);
  font-size: 12px;
  letter-spacing: 3px;
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeIn 1s ease 0.3s forwards;
}
.intro-text {
  font-family: 'Courier New', monospace;
  color: #c8d8e8;
  font-size: 12px;
  line-height: 1.8;
  min-height: 100px;
  white-space: pre-wrap;
}
.intro-text .pilot-name {
  color: var(--neon-cyan);
  font-weight: bold;
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
}
.intro-cursor {
  display: inline-block;
  width: 10px;
  height: 16px;
  background: var(--neon-cyan);
  vertical-align: middle;
  animation: blink 0.7s step-end infinite;
}
.intro-skip-btn {
  display: none;
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 10, 40, 0.92);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  padding: 11px 28px;
  cursor: pointer;
  border-radius: 4px;
  animation: pulse-glow 1.5s ease-in-out infinite;
  transition: background 0.2s;
  white-space: nowrap;
  z-index: 3100;
}
.intro-skip-btn:hover {
  background: rgba(0, 255, 245, 0.12);
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0,255,245,0.4); }
  50%       { box-shadow: 0 0 20px rgba(0,255,245,0.9); }
}

/* ── Pause button ────────────────────────────────── */
#pause-btn {
  background: transparent;
  border: 1px solid rgba(255,255,245,0.25);
  border-radius: 6px;
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  width: 36px; height: 36px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-user-select: none;
}
#pause-btn.used {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ── Pause overlay ───────────────────────────────── */
#pause-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,10,0.85);
  z-index: 2500;
  align-items: center;
  justify-content: center;
}
.pause-box {
  text-align: center;
  padding: 48px 40px;
  border: 1px solid rgba(0,255,245,0.2);
  border-radius: 10px;
  background: rgba(0,5,30,0.9);
}
.pause-title {
  font-family: 'Orbitron', monospace;
  font-size: 36px;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan);
  letter-spacing: 8px;
  margin-bottom: 12px;
}
.pause-sub {
  font-size: 12px;
  color: #445;
  letter-spacing: 2px;
  margin-bottom: 28px;
}
.pause-resume-btn {
  background: transparent;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  padding: 12px 32px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}
.pause-resume-btn:hover { background: rgba(0,255,245,0.1); }

/* ── Level transition (compact top banner) ───────── */
#level-transition {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 15, 0.88);
  border: 1px solid rgba(0, 255, 245, 0.28);
  border-radius: 10px;
  padding: 10px 28px 12px;
  z-index: 2000;
  animation: lt-drop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  text-align: center;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(0, 255, 245, 0.12);
}
#level-transition.lt-fade {
  opacity: 0;
  transition: opacity 0.35s ease;
}
@keyframes lt-drop {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.lt-inner { text-align: center; }
.lt-tag {
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--neon-pink);
  margin-bottom: 3px;
  text-transform: uppercase;
}
.lt-name {
  font-size: 20px;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
  letter-spacing: 3px;
  margin-bottom: 4px;
}
.lt-hint {
  font-size: 10px;
  color: #889;
  letter-spacing: 1px;
}

/* ── Shield powerup pulse ────────────────────────── */
.shield-pulse {
  animation: shieldBob 1.4s ease-in-out infinite;
}
@keyframes shieldBob {
  0%,100% { transform: translateY(0) scale(1); opacity:1; }
  50%      { transform: translateY(-5px) scale(1.05); opacity:0.85; }
}

/* ── Personal best badge ─────────────────────────── */
.personal-best-badge {
  background: linear-gradient(90deg, #ffd700, #ff8c00);
  color: #000;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 6px 16px;
  border-radius: 20px;
  margin: 6px auto;
  display: inline-block;
  animation: pulse-glow 1s infinite;
}
.personal-best-info {
  font-size: 11px;
  color: #445;
  letter-spacing: 1px;
  margin: 4px 0 6px;
}

/* ── Share buttons ───────────────────────────────── */
.share-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 12px 0 4px;
}
.share-btn {
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.15s, opacity 0.15s;
}
.share-btn:hover { transform: scale(1.05); opacity: 0.9; }
.share-btn.whatsapp { background: #25d366; color: #fff; }
.share-btn.insta    { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color:#fff; }

/* ── Start Screen ─────────────────────────────────── */
#startscreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center,
    rgba(0, 30, 60, 0.95) 0%,
    rgba(0, 0, 0, 0.98) 70%);
  z-index: 3000;
}

.start-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 48px 56px;
  border: 1px solid rgba(0, 255, 245, 0.25);
  border-radius: 16px;
  background: rgba(0, 10, 20, 0.7);
  box-shadow: 0 0 60px rgba(0, 255, 245, 0.1), inset 0 0 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}

.start-title {
  color: var(--neon-cyan);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  text-shadow:
    0 0 10px var(--neon-cyan),
    0 0 28px var(--neon-cyan),
    0 0 56px rgba(0, 255, 245, 0.4);
}

.start-version {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: -10px;
}

.name-input {
  width: 280px;
  padding: 12px 18px;
  background: rgba(0, 255, 245, 0.05);
  border: 2px solid rgba(0, 255, 245, 0.4);
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.name-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 400;
  letter-spacing: 1px;
}

.name-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 255, 245, 0.4);
}

.start-btn {
  padding: 13px 52px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(0, 255, 245, 0.4);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.start-btn:hover {
  background: rgba(0, 255, 245, 0.12);
  box-shadow: 0 0 28px rgba(0, 255, 245, 0.7);
  color: #ffffff;
}

.start-hint {
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Game Over player line ────────────────────────── */
.gameover-player {
  color: var(--neon-cyan);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 24px rgba(0, 255, 245, 0.4);
}

/* ── Level indicator ──────────────────────────────── */
#level-indicator {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow), 0 0 18px var(--neon-yellow);
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Level-up banner ──────────────────────────────── */
.level-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 10px;
  text-transform: uppercase;
  color: var(--neon-yellow);
  text-shadow:
    0 0 12px var(--neon-yellow),
    0 0 30px var(--neon-yellow),
    0 0 60px rgba(255,214,10,0.4);
  z-index: 1500;
  pointer-events: none;
  animation: level-pop 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
  opacity: 1;
  transition: opacity 0.6s ease;
}

@keyframes level-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Game Over level line ─────────────────────────── */
.gameover-level {
  color: var(--neon-yellow);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--neon-yellow);
}

/* ── Timer ────────────────────────────────────────── */
#timer {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  white-space: nowrap;
  transition: color 0.3s, text-shadow 0.3s;
}

#timer #timer-number {
  font-size: 22px;
  color: white;
  text-shadow: 0 0 8px white, 0 0 18px var(--neon-cyan);
}

#timer.urgent {
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink), 0 0 20px var(--neon-pink);
  animation: timer-pulse 0.5s ease-in-out infinite;
}

#timer.urgent #timer-number {
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink), 0 0 24px white;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.08); }
}

/* Timer flash when time boost collected */
#timer.time-gained {
  animation: time-gain-flash 0.9s ease-out forwards;
}

@keyframes time-gain-flash {
  0%   { color: var(--neon-green); text-shadow: 0 0 24px var(--neon-green), 0 0 48px var(--neon-green); transform: scale(1.25); }
  100% { color: var(--neon-cyan);  text-shadow: 0 0 8px var(--neon-cyan); transform: scale(1); }
}

/* ── Lock warning overlay ─────────────────────────── */
#lock-warning {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  z-index: 1200;
  display: none;
  white-space: nowrap;
  pointer-events: none;
  font-family: 'Orbitron', monospace;
}

#lock-warning.warn {
  color: var(--neon-yellow);
  border: 2px solid var(--neon-yellow);
  background: rgba(0, 0, 0, 0.8);
  text-shadow: 0 0 8px var(--neon-yellow);
  animation: timer-pulse 0.4s ease-in-out infinite;
}

#lock-warning.locked {
  color: var(--neon-pink);
  border: 2px solid var(--neon-pink);
  background: rgba(0, 0, 0, 0.8);
  text-shadow: 0 0 8px var(--neon-pink);
  box-shadow: 0 0 16px rgba(255, 0, 110, 0.35);
}

/* ── Generic game notice banner ───────────────────── */
.game-notice {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green), 0 0 24px var(--neon-green);
  z-index: 1500;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.7s ease;
}

/* ── Start screen logo ────────────────────────────── */
.start-logo {
  width: 90px;
  height: 120px;
  filter:
    drop-shadow(0 0 14px rgba(0, 255, 245, 0.9))
    drop-shadow(0 0 30px rgba(0, 255, 245, 0.5));
  animation: logo-float 3s ease-in-out infinite;
  margin-bottom: -6px;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ── Mobile touch controls ──────────────────────────– */
#touch-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  width: 100%;
  padding: 0 20px;
  z-index: 2000;
  pointer-events: auto;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

#touch-controls.show {
  display: flex;
}

/* ── Virtual joystick (replaces D-pad) ─────────────── */
#joystick-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

#joystick-base {
  position: relative;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(0, 255, 245, 0.05);
  border: 2px solid rgba(0, 255, 245, 0.22);
  box-shadow:
    0 0 22px rgba(0, 255, 245, 0.12),
    inset 0 0 30px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

/* subtle cross-hair guides */
#joystick-base::before,
#joystick-base::after {
  content: '';
  position: absolute;
  background: rgba(0, 255, 245, 0.12);
  border-radius: 2px;
}
#joystick-base::before { width: 2px; height: 60%; top: 20%; left: 50%; transform: translateX(-50%); }
#joystick-base::after  { height: 2px; width: 60%; left: 20%; top: 50%;  transform: translateY(-50%); }

#joystick-thumb {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%,
    rgba(0, 255, 245, 0.55),
    rgba(0, 80, 100, 0.35));
  border: 2px solid var(--neon-cyan);
  box-shadow:
    0 0 14px rgba(0, 255, 245, 0.7),
    0 0 30px rgba(0, 255, 245, 0.25);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  touch-action: none;
  transition: box-shadow 0.1s;
}

.action-btn {
  padding: 12px 28px;
  background: transparent;
  border: 2px solid var(--neon-pink);
  color: var(--neon-pink);
  font-family: "Orbitron", monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: all 0.1s;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(255, 0, 110, 0.4);
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.action-btn:active {
  background: rgba(255, 0, 110, 0.2);
  box-shadow: 0 0 24px rgba(255, 0, 110, 0.8);
  transform: scale(0.95);
}

/* ── Mute button ────────────────────────────────────── */
#mute-btn {
  background: transparent;
  border: 1px solid rgba(0, 255, 245, 0.3);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  padding: 6px 10px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#mute-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 245, 0.4);
}

#mute-btn.muted {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 0, 110, 0.3);
}

#music-btn {
  background: transparent;
  border: 1px solid rgba(0, 255, 245, 0.3);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  padding: 6px 10px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#music-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 245, 0.4);
}
#music-btn.muted {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 0, 110, 0.3);
}

/* ── Mobile responsive layout ───────────────────────– */
@media (max-width: 768px) {

  /* ── HUD: locked horizontal bar across the top ── */
  #hud {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 48px 6px 10px; /* right padding for mute btn */
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1100;
    pointer-events: none;
  }

  #health {
    width: 100%;
    height: 14px;
    order: -1; /* health bar always first */
  }

  #score          { font-size: 13px; }
  #level-indicator { font-size: 11px; letter-spacing: 2px; }
  #timer          { font-size: 13px; }
  #timer #timer-number { font-size: 15px; }

  /* ── Mute button: fixed top-right, always visible ── */
  #mute-btn {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 6px);
    right: 8px;
    width: 34px;
    height: 34px;
    font-size: 16px;
    padding: 0;
    pointer-events: auto;
    z-index: 1200;
  }

  /* ── Touch controls: each element fixed individually ── */
  #touch-controls,
  #touch-controls.show {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background: none;
    padding: 0;
  }

  /* ── Joystick: fixed bottom-left ── */
  #joystick-zone {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    left: 16px;
    pointer-events: auto;
    width: 150px;
    height: 150px;
  }

  #joystick-base {
    width: 150px;
    height: 150px;
  }

  /* ── FIRE button: fixed bottom-right ── */
  #fire-btn {
    position: fixed !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    right: 16px;
    width: 90px;
    height: 90px;
    font-size: 14px;
    border-radius: 50%;
    pointer-events: auto;
  }

  /* ── Hide desktop instructions ── */
  #instructions { display: none; }

  /* ── Version tag: above FIRE button ── */
  #version {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
    right: 12px;
    font-size: 8px;
  }
}


@keyframes ship-shock {
  0%   { transform: translate(0, 0); filter: drop-shadow(0 0 20px #ff006e); }
  25%  { transform: translate(-10px, 8px); }
  50%  { transform: translate(8px, -10px); }
  75%  { transform: translate(-6px, 6px); }
  100% { transform: translate(0, 0); filter: drop-shadow(0 0 10px rgba(0,255,245,0.8)); }
}
.shock-anim { 
  animation: ship-shock 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; 
}

