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

:root {
  --bg-dark: #060a12;
  --bg-panel: rgba(8, 16, 28, 0.88);
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.45);
  --cyan: #00d4ff;
  --danger: #ff3355;
  --danger-glow: rgba(255, 51, 85, 0.5);
  --warning: #ffaa00;
  --text: #e8f0fe;
  --text-dim: #6a7d96;
  --border: rgba(0, 255, 136, 0.22);
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --hud-rail-width: 200px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text);
  cursor: default;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #080e18;
}

.hidden {
  display: none !important;
}

/* ── HUD corners ── */

.hud-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.5;
  pointer-events: none;
}

.hud-corner-tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; }
.hud-corner-tr { top: 12px; right: calc(var(--hud-rail-width) + 12px); border-width: 2px 2px 0 0; }
.hud-corner-bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; }
.hud-corner-br { bottom: 12px; right: calc(var(--hud-rail-width) + 12px); border-width: 0 2px 2px 0; }

#app #hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ── Right HUD rail ── */

.hud-rail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--hud-rail-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(4, 8, 16, 0.82);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(14px);
  pointer-events: none;
  z-index: 15;
  overflow-y: auto;
  overflow-x: hidden;
}

.hud-rail > * {
  flex-shrink: 0;
}

.hud-top {
  position: static;
  transform: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.hud-panel {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  text-align: center;
  backdrop-filter: blur(12px);
  min-width: 0;
  padding: 4px 6px;
  overflow: hidden;
}

.hud-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.hud-panel .label {
  display: block;
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.hud-panel .value {
  font-size: 15px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  line-height: 1;
}

.hud-rank-panel {
  position: static;
  padding: 6px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-rail-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.squad-badge,
.ai-badge {
  position: static;
  transform: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1.5px;
  box-sizing: border-box;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.squad-badge {
  background: rgba(8, 16, 32, 0.85);
  border: 1px solid rgba(68, 170, 255, 0.35);
  color: #44aaff;
}

.ai-badge {
  background: rgba(8, 16, 28, 0.9);
  border: 1px solid rgba(68, 170, 255, 0.45);
  color: #44aaff;
  animation: ai-badge-pulse 2s ease-in-out infinite;
}

.minimap-label {
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding: 3px 6px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

#app #minimap {
  position: static;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

#minimap-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.hud-controls {
  position: static;
  pointer-events: auto;
}

.hud-rail-abilities {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.hud-rail-abilities .health-container {
  flex-wrap: wrap;
  gap: 6px;
}

.hud-rail-abilities .health-label {
  writing-mode: horizontal-tb;
  transform: none;
  font-size: 8px;
  width: 100%;
}

.hud-rail-abilities .health-bar {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 14px;
}

.hud-rail-abilities .health-text {
  font-size: 16px;
  min-width: 36px;
}

.hud-rail-abilities .boost-meter,
.hud-rail-abilities .missile-meter,
.hud-rail-abilities .mine-meter,
.hud-rail-abilities .emp-meter {
  gap: 6px;
}

.hud-rail-abilities .boost-label,
.hud-rail-abilities .missile-label,
.hud-rail-abilities .mine-label,
.hud-rail-abilities .emp-label {
  font-size: 8px;
  min-width: 44px;
}

.hud-rail-abilities .boost-bar,
.hud-rail-abilities .missile-bar,
.hud-rail-abilities .mine-bar,
.hud-rail-abilities .emp-bar {
  flex: 1;
  width: auto;
  min-width: 0;
}

.hud-rail-abilities .boost-key,
.hud-rail-abilities .missile-key,
.hud-rail-abilities .mine-key,
.hud-rail-abilities .emp-key,
.hud-rail-abilities .mine-count {
  font-size: 8px;
  min-width: 24px;
  text-align: right;
}

.hud-rail-abilities .powerup-display {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
}

.hud-rail-abilities .powerup-name {
  font-size: 9px;
  letter-spacing: 1px;
  text-align: center;
}

.hud-rail-abilities .powerup-timer {
  width: 100%;
}

/* ── Combo (over play area) ── */

.combo-display {
  position: absolute;
  top: 16px;
  left: calc((100% - var(--hud-rail-width)) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--warning);
  border-radius: 2px;
  padding: 5px 14px;
  backdrop-filter: blur(10px);
  animation: combo-glow 0.6s ease-in-out infinite alternate;
}

@keyframes combo-glow {
  from { box-shadow: 0 0 12px rgba(255, 170, 0, 0.3); }
  to { box-shadow: 0 0 28px rgba(255, 170, 0, 0.6); }
}

.combo-display.on-fire {
  border-color: #ff3355;
  animation: combo-fire 0.35s ease-in-out infinite alternate;
}

@keyframes combo-fire {
  from {
    box-shadow: 0 0 16px rgba(255, 50, 80, 0.5);
    transform: translateX(-50%) scale(1);
  }
  to {
    box-shadow: 0 0 36px rgba(255, 100, 50, 0.9);
    transform: translateX(-50%) scale(1.04);
  }
}

.combo-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.combo-count {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--warning);
  text-shadow: 0 0 12px rgba(255, 170, 0, 0.5);
}

.combo-mult {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffee44;
  letter-spacing: 1px;
}

.combo-timer {
  width: 50px;
  height: 3px;
  background: rgba(255, 170, 0, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.combo-timer::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 100%);
  background: var(--warning);
  transition: width 0.1s linear;
}

/* ── Ability meters ── */

.health-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.health-bar {
  position: relative;
  width: 260px;
  height: 16px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--danger), var(--warning) 45%, var(--accent));
  border-radius: 1px;
  transition: width 0.25s ease;
  box-shadow: 0 0 12px var(--accent-glow);
}

.health-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.health-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  min-width: 44px;
  text-shadow: 0 0 8px var(--accent-glow);
}

/* ── Boost meter ── */

.boost-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.boost-meter.ready {
  opacity: 1;
}

.boost-meter.ready .boost-fill {
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.boost-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.boost-bar {
  width: 100px;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.boost-fill {
  height: 100%;
  width: 100%;
  background: rgba(0, 212, 255, 0.5);
  transition: width 0.1s linear;
}

.boost-key {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--cyan);
  letter-spacing: 1px;
}

/* ── Missile meter ── */

.missile-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.missile-meter.ready { opacity: 1; }
.missile-meter.ready .missile-fill {
  background: #ff8800;
  box-shadow: 0 0 10px rgba(255, 136, 0, 0.5);
}

.missile-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.missile-bar {
  width: 100px;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 136, 0, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.missile-fill {
  height: 100%;
  width: 100%;
  background: rgba(255, 136, 0, 0.45);
  transition: width 0.1s linear;
}

.missile-key {
  font-family: var(--font-display);
  font-size: 9px;
  color: #ff8800;
  letter-spacing: 1px;
}

.mine-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.mine-meter.ready { opacity: 1; }
.mine-meter.ready .mine-fill {
  background: #ff6644;
  box-shadow: 0 0 10px rgba(255, 100, 68, 0.5);
}

.mine-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.mine-bar {
  width: 80px;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 100, 68, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.mine-fill {
  height: 100%;
  width: 100%;
  background: rgba(255, 100, 68, 0.45);
  transition: width 0.1s linear;
}

.mine-count {
  font-family: var(--font-display);
  font-size: 10px;
  color: #ff8844;
  min-width: 28px;
}

.mine-key {
  font-family: var(--font-display);
  font-size: 9px;
  color: #ff6644;
  letter-spacing: 1px;
}

.emp-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.emp-meter.ready { opacity: 1; }
.emp-meter.ready .emp-fill {
  background: #44aaff;
  box-shadow: 0 0 10px rgba(68, 170, 255, 0.55);
}

.emp-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.emp-bar {
  width: 80px;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(68, 170, 255, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.emp-fill {
  height: 100%;
  width: 100%;
  background: rgba(68, 170, 255, 0.45);
  transition: width 0.1s linear;
}

.emp-key {
  font-family: var(--font-display);
  font-size: 9px;
  color: #44aaff;
  letter-spacing: 1px;
}

/* ── Top scores ── */

.top-scores {
  margin-top: 20px;
  text-align: left;
  display: inline-block;
  min-width: 200px;
}

.top-score-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  margin: 4px 0;
  background: rgba(0, 255, 136, 0.04);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 12px;
}

.top-rank { color: var(--text-dim); min-width: 24px; }
.top-pts { color: var(--warning); font-weight: 700; flex: 1; }
.top-wave { color: var(--text-dim); font-size: 10px; }

.top-score-empty {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.achievements-panel {
  margin: 20px 0 8px;
  text-align: center;
}

.achievements-label {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.achievements-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 2px;
  opacity: 0.45;
  transition: all 0.3s;
}

.achievement.unlocked {
  opacity: 1;
  border-color: rgba(255, 221, 68, 0.4);
  background: rgba(255, 221, 68, 0.06);
}

.ach-icon { font-size: 14px; }
.ach-name {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.achievement.unlocked .ach-name { color: #ffdd88; }

.pause-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 20px 0 28px;
}

.pause-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pause-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.pause-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.upgrade-tip {
  font-size: 13px;
  color: rgba(0, 212, 255, 0.85);
  letter-spacing: 1px;
  margin: -16px 0 24px;
  padding: 10px 16px;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 2px;
  font-style: italic;
}

/* ── Wave countdown ── */

.wave-countdown {
  position: absolute;
  top: 42%;
  left: calc((100% - var(--hud-rail-width)) / 2);
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 120px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 60px var(--accent-glow);
  z-index: 25;
  pointer-events: none;
  animation: count-pulse 1s ease infinite;
}

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

/* ── Power-up ── */

.powerup-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--warning);
  border-radius: 2px;
  padding: 10px 18px;
  backdrop-filter: blur(10px);
  animation: powerup-pulse 1s ease-in-out infinite;
}

@keyframes powerup-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 170, 0, 0.25); }
  50% { box-shadow: 0 0 24px rgba(255, 170, 0, 0.55); }
}

.powerup-icon {
  font-size: 22px;
}

.powerup-name {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--warning);
}

.powerup-timer {
  width: 64px;
  height: 4px;
  background: rgba(255, 170, 0, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.powerup-timer::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 100%);
  background: var(--warning);
  transition: width 0.1s linear;
}

/* ── Rank / Threat labels ── */

.rank-label, .threat-label {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.rank-value {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.threat-value {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--warning);
}

.threat-value[data-level="critical"] { color: #ff1144; text-shadow: 0 0 10px rgba(255, 17, 68, 0.5); }
.threat-value[data-level="extreme"] { color: #ff3355; }
.threat-value[data-level="high"] { color: #ff8844; }
.threat-value[data-level="elevated"] { color: var(--warning); }
.threat-value[data-level="moderate"] { color: var(--accent); }

/* ── Crosshair ── */

#crosshair {
  position: fixed;
  width: 36px;
  height: 36px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 100;
  transition: transform 0.08s ease;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: all 0.08s ease;
}

#crosshair::before {
  top: 50%;
  left: 6px;
  right: 6px;
  height: 1px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 1px;
  transform: translateX(-50%);
}

.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px var(--accent-glow);
}

#crosshair.firing {
  transform: translate(-50%, -50%) scale(1.3);
}

#crosshair.firing::before,
#crosshair.firing::after {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.6);
}

#crosshair.combo-active .crosshair-dot {
  background: #ffaa00;
  box-shadow: 0 0 14px rgba(255, 170, 0, 0.8);
  animation: crosshair-pulse 0.4s ease-in-out infinite alternate;
}

#crosshair.ai-aim .crosshair-dot {
  background: #44aaff;
  box-shadow: 0 0 12px rgba(68, 170, 255, 0.8);
}

#crosshair.ai-aim::before,
#crosshair.ai-aim::after {
  background: rgba(68, 170, 255, 0.85);
}

@keyframes ai-badge-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(68, 170, 255, 0.2); }
  50% { box-shadow: 0 0 18px rgba(68, 170, 255, 0.45); }
}

.btn-sound.active {
  color: #44aaff;
  border-color: rgba(68, 170, 255, 0.55);
  box-shadow: 0 0 12px rgba(68, 170, 255, 0.2);
}

body.ai-mode #crosshair {
  opacity: 0.85;
}

@keyframes crosshair-pulse {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.4); }
}

/* ── Overlays ── */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.9);
  backdrop-filter: blur(16px);
  z-index: 50;
  cursor: default;
  overflow: hidden;
}

.overlay-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-drift 20s linear infinite;
  pointer-events: none;
}

@keyframes grid-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(50px, 50px); }
}

.menu-content {
  position: relative;
  text-align: center;
  animation: fadeIn 0.7s ease;
  z-index: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo {
  position: relative;
  margin-bottom: 8px;
}

.logo-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 50%;
  transform: translate(-50%, -60%);
  animation: ring-spin 12s linear infinite;
}

.logo-ring::after {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}

@keyframes ring-spin {
  from { transform: translate(-50%, -60%) rotate(0deg); }
  to { transform: translate(-50%, -60%) rotate(360deg); }
}

.logo-icon {
  font-size: 52px;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
  margin-bottom: 12px;
  animation: pulse-icon 3s ease-in-out infinite;
  position: relative;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.2); }
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 900;
  letter-spacing: 10px;
  color: var(--text);
  margin-bottom: 6px;
}

.logo .accent {
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
}

.tagline {
  font-size: 14px;
  letter-spacing: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.version-tag {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 4px;
  color: rgba(0, 255, 136, 0.45);
  margin-bottom: 28px;
  animation: version-blink 3s ease-in-out infinite;
}

@keyframes version-blink {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.load-status {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 3px;
  color: rgba(0, 212, 255, 0.7);
  transition: opacity 0.6s ease;
}

.menu-stats {
  margin-bottom: 36px;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--warning);
  text-shadow: 0 0 16px rgba(255, 170, 0, 0.4);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.btn-primary,
.btn-secondary {
  position: relative;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 5px;
  padding: 18px 52px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin: 8px;
  pointer-events: auto;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, #00aa55, var(--accent));
  color: var(--bg-dark);
  box-shadow: 0 0 30px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: btn-shine 3s infinite;
}

@keyframes btn-shine {
  0% { left: -100%; }
  40%, 100% { left: 150%; }
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 50px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--text-dim);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.15);
}

.controls-info {
  margin-top: 44px;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.control-group {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

kbd {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  padding: 5px 9px;
  background: rgba(0, 255, 136, 0.06);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--accent);
  margin-right: 6px;
}

.overlay h2 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: 8px;
  margin-bottom: 8px;
}

.overlay-sub {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 32px;
}

.gameover-title {
  color: var(--danger) !important;
  text-shadow: 0 0 30px var(--danger-glow);
}

.final-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  margin-bottom: 36px;
}

.final-stat {
  text-align: center;
}

.final-label {
  display: block;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.final-value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

/* ── Skin picker ── */

.skin-picker { margin-bottom: 24px; }

.skin-picker-label {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.skin-btns { display: flex; gap: 12px; justify-content: center; }

.skin-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 2px solid transparent;
  background: #00ff88;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.3);
  pointer-events: auto;
}

.skin-btn.skin-cyan { background: #00d4ff; box-shadow: 0 0 12px rgba(0, 212, 255, 0.3); }
.skin-btn.skin-gold { background: #ffcc44; box-shadow: 0 0 12px rgba(255, 204, 68, 0.3); }
.skin-btn.active { border-color: #fff; transform: scale(1.15); }

.ally-picker { margin-bottom: 20px; }

.ally-picker-label {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.ally-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.ally-btn {
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 4px;
  border: 2px solid var(--border);
  background: rgba(68, 170, 255, 0.08);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
}

.ally-btn:hover {
  color: #44aaff;
  border-color: rgba(68, 170, 255, 0.5);
}

.ally-btn.active {
  color: #fff;
  border-color: #44aaff;
  background: rgba(68, 170, 255, 0.25);
  box-shadow: 0 0 14px rgba(68, 170, 255, 0.35);
}

.ally-picker-hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.squad-badge-icon { opacity: 0.8; }

/* ── HUD pause button ── */

.hud-btn {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 7px 12px;
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.hud-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.2);
}

.hud-btn-pause:hover {
  background: rgba(0, 255, 136, 0.08);
}

.btn-sound {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 2px;
  cursor: pointer;
  margin-top: 12px;
  pointer-events: auto;
}

.btn-sound:hover { color: var(--accent); border-color: var(--accent); }

.btn-help-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  line-height: 1.4;
  box-sizing: border-box;
}

a.btn-secondary,
a.btn-sound {
  cursor: pointer;
}

.asset-credit {
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  opacity: 0.6;
}

.asset-credit a {
  color: rgba(0, 255, 136, 0.7);
  text-decoration: none;
}

.asset-credit a:hover { color: var(--accent); }

/* ── Deploy overlay ── */

.deploy-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.75);
  z-index: 40;
  pointer-events: none;
}

.deploy-ring {
  width: 100px;
  height: 100px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: deploy-spin 1.5s linear infinite;
  border-top-color: transparent;
}

@keyframes deploy-spin { to { transform: rotate(360deg); } }

.deploy-text {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.deploy-sub {
  display: block;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ── Upgrade shop ── */

.upgrade-shop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.92);
  backdrop-filter: blur(14px);
  z-index: 45;
}

.upgrade-shop-inner { text-align: center; max-width: 720px; padding: 20px; }

.upgrade-title {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 6px;
  color: var(--accent);
  margin-bottom: 6px;
}

.upgrade-sub {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.upgrade-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.upgrade-card {
  width: 200px;
  padding: 24px 16px;
  background: rgba(8, 16, 28, 0.95);
  border: 1px solid var(--card-color, var(--border));
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.25s;
  text-align: center;
}

.upgrade-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-color: var(--card-color);
}

.upgrade-icon { display: block; font-size: 32px; margin-bottom: 10px; }

.upgrade-name {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--card-color, var(--accent));
  margin-bottom: 8px;
}

.upgrade-desc { display: block; font-size: 12px; color: var(--text-dim); }

/* ── Wave Announce ── */

.wave-announce {
  position: absolute;
  top: 50%;
  left: calc((100% - var(--hud-rail-width)) / 2);
  transform: translate(-50%, -50%);
  z-index: 30;
  pointer-events: none;
  text-align: center;
}

.wave-announce span:first-child {
  display: block;
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 14px;
  color: var(--accent);
  text-shadow: 0 0 50px var(--accent-glow);
  animation: wave-in 2.8s ease forwards;
}

.wave-announce.boss span:first-child {
  color: #ff1144;
  text-shadow: 0 0 60px rgba(255, 17, 68, 0.6);
  font-size: 56px;
  letter-spacing: 8px;
}

.wave-sub {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--text-dim);
  margin-top: 8px;
  animation: wave-sub-in 2.5s ease forwards;
}

@keyframes wave-in {
  0% { opacity: 0; transform: scale(2.2); }
  12% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}

@keyframes wave-sub-in {
  0%, 10% { opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Mission briefing ── */

.mission-brief {
  position: absolute;
  left: 24px;
  bottom: 120px;
  z-index: 22;
  pointer-events: none;
  animation: brief-in 0.5s ease-out;
}

.mission-brief-inner {
  background: rgba(8, 14, 26, 0.92);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  min-width: 280px;
  backdrop-filter: blur(12px);
}

.brief-label {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 4px;
  color: var(--text-dim);
}

.brief-wave {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--accent);
  margin: 4px 0 10px;
}

.brief-mod-name {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 4px;
}

.brief-mod-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.brief-intel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.brief-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0;
  font-size: 11px;
}

.brief-key {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.brief-val {
  font-family: var(--font-display);
  font-size: 10px;
  color: #aaccdd;
  text-align: right;
}

@keyframes brief-in {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Settings panel ── */

.settings-panel {
  margin-top: 16px;
  padding: 20px;
  background: rgba(8, 16, 28, 0.95);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: left;
  max-width: 360px;
  pointer-events: auto;
}

.settings-panel h3 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: 16px;
  text-align: center;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.setting-speed .speed-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.speed-btn {
  flex: 1 1 calc(33% - 6px);
  min-width: 72px;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 4px;
  background: rgba(0, 255, 136, 0.06);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.speed-btn.active {
  color: var(--bg-dark);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.settings-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.btn-sm {
  padding: 8px 20px !important;
  font-size: 11px !important;
}

/* ── Initials entry ── */

.initials-panel {
  margin: 20px 0;
  padding: 24px;
  background: rgba(255, 221, 68, 0.06);
  border: 1px solid rgba(255, 221, 68, 0.35);
  border-radius: 4px;
  animation: initials-glow 1.5s ease-in-out infinite alternate;
}

@keyframes initials-glow {
  from { box-shadow: 0 0 20px rgba(255, 221, 68, 0.15); }
  to { box-shadow: 0 0 40px rgba(255, 221, 68, 0.35); }
}

.initials-label {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 6px;
  color: #ffdd44;
  margin-bottom: 4px;
}

.initials-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.initials-input {
  display: block;
  width: 120px;
  margin: 0 auto 16px;
  padding: 12px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 8px;
  text-align: center;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #ffdd44;
  border-radius: 4px;
  color: #ffdd44;
  outline: none;
}

/* ── Responsive ── */

@media (max-width: 600px) {
  :root { --hud-rail-width: 168px; }
  .logo h1 { font-size: 34px; letter-spacing: 5px; }
  .hud-panel .value { font-size: 13px; }
  .combo-display { top: 12px; padding: 4px 10px; }
  .final-stats { flex-direction: column; gap: 20px; }
  .wave-announce span:first-child { font-size: 44px; letter-spacing: 8px; }
}
