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

body {
  background: #0a0a0a;
  color: #fff;
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

/* ── Screens ── */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.overlay {
  position: fixed;
  top: 0; left: 0;
  background: rgba(0,0,0,0.80);
  z-index: 100;
}

/* ─────────────────────────────────────────────
   SPLASH SCREEN
───────────────────────────────────────────── */
#loading-screen {
  background: #000;
  cursor: none;
}

#loading-text {
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 6px;
  color: #aaa;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
}

#intro-screen {
  background: #000;
  cursor: pointer;
  position: relative;
}

#intro-click {
  font-size: 0.85rem;
  letter-spacing: 5px;
  color: #f0c040;
  text-transform: uppercase;
  animation: splashClickPulse 1.2s ease-in-out infinite;
  z-index: 1;
}

#intro-video {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#splash-screen {
  background: #000;
  cursor: none;
}

#splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  animation: splashFadeIn 0.8s ease-out 0.3s both;
}

#splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#splash-logo-img {
  width: clamp(260px, 38vw, 520px);
  filter: drop-shadow(0 0 28px rgba(240,192,64,0.55))
          drop-shadow(0 0 60px rgba(240,192,64,0.25));
  animation: splashLogoPulse 2s ease-in-out infinite;
}

#splash-tagline {
  font-size: 0.9rem;
  letter-spacing: 6px;
  color: #666;
  text-transform: lowercase;
  font-style: italic;
}

#splash-click {
  margin-top: 32px;
  font-size: 0.85rem;
  letter-spacing: 5px;
  color: #f0c040;
  text-transform: uppercase;
  opacity: 0;
  animation: splashClickPulse 1.2s ease-in-out 1.2s infinite;
  cursor: pointer;
}

@keyframes splashClickPulse {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1.0; }
}

@keyframes splashFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splashFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.04); }
}
@keyframes splashLogoPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(240,192,64,0.45))
                     drop-shadow(0 0 50px rgba(240,192,64,0.20)); }
  50%       { filter: drop-shadow(0 0 36px rgba(240,192,64,0.80))
                     drop-shadow(0 0 80px rgba(240,192,64,0.40)); }
}

/* ─────────────────────────────────────────────
   MENU SCREEN
───────────────────────────────────────────── */
#menu-screen {
  background: radial-gradient(ellipse at center, #0d0d2e 0%, #0a0a0a 100%);
  gap: 16px;
  position: relative;
}

/* Logo above the game title */
#menu-logo {
  width: clamp(160px, 22vw, 300px);
  opacity: 0.90;
  filter: drop-shadow(0 0 12px rgba(240,192,64,0.35));
  margin-bottom: -4px;
}

#menu-screen h1 {
  font-size: 3.5rem;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #f0c040;
  text-shadow: 0 0 30px #f0c04088, 0 0 60px #f0c04044;
}

.subtitle {
  color: #aaa;
  font-size: 1rem;
  letter-spacing: 2px;
}

/* Copyright line at the very bottom of the menu */
#menu-copyright {
  position: absolute;
  bottom: 18px;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: #333;
  text-transform: uppercase;
}

.menu-options {
  display: flex;
  gap: 30px;
  font-size: 0.9rem;
  color: #ccc;
}
.menu-options label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.menu-options select {
  background: #222;
  color: #fff;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ── Buttons ── */
.btn-primary {
  background: #f0c040;
  color: #000;
  border: none;
  padding: 12px 40px;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 3px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover {
  background: #ffd060;
  transform: scale(1.04);
}
.btn-secondary {
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
  padding: 10px 30px;
  font-size: 0.95rem;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}
.btn-secondary:hover {
  color: #fff;
  border-color: #aaa;
}
.btn-quit {
  background: transparent;
  color: #cc3333;
  border: 1px solid #662222;
  padding: 10px 30px;
  font-size: 0.95rem;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-quit:hover {
  color: #fff;
  border-color: #cc3333;
  background: #cc333322;
}

/* ── Game Screen ── */
#game-screen {
  position: relative;
  background: #000;
  justify-content: flex-start;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ── HUD ── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}
#hud-left, #hud-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: #eee;
  text-shadow: 0 1px 4px #000;
}
#hud-left div, #hud-right div {
  background: rgba(0,0,0,0.45);
  padding: 4px 12px;
  border-radius: 6px;
}
#hud-left span, #hud-right span {
  color: #f0c040;
  font-weight: bold;
}
#hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
#hud-msg {
  font-size: 1.4rem;
  font-weight: bold;
  color: #f0c040;
  letter-spacing: 4px;
  text-shadow: 0 0 16px #f0c04099;
  text-align: center;
  min-height: 2rem;
}

#controls-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #555;
  letter-spacing: 1px;
  pointer-events: none;
}

#version-badge {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 0.85rem;
  color: #aaa;
  letter-spacing: 1px;
  font-family: Arial, sans-serif;
  pointer-events: none;
}

/* ── Modal ── */
.modal {
  background: #111;
  border: 2px solid #333;
  border-radius: 16px;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 340px;
}
.modal h2 {
  font-size: 2rem;
  letter-spacing: 4px;
  color: #f0c040;
}
#finish-stats {
  color: #ccc;
  font-size: 0.95rem;
  line-height: 2;
  text-align: center;
  letter-spacing: 1px;
}
#finish-stats .highlight {
  color: #f0c040;
  font-weight: bold;
}

/* Logo inside modals (pause, game over) */
.modal-logo {
  width: clamp(100px, 14vw, 180px);
  opacity: 0.55;
  filter: drop-shadow(0 0 8px rgba(240,192,64,0.2));
  margin-top: -8px;
}

/* ─────────────────────────────────────────────
   LEADERBOARD (menu screen)
───────────────────────────────────────────── */
#leaderboard {
  background: rgba(0,0,0,0.55);
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 14px 28px;
  min-width: 300px;
  max-width: 380px;
  width: 100%;
}

#lb-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #f0c040;
  text-align: center;
  margin-bottom: 10px;
}

#lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-loading {
  text-align: center;
  color: #555;
  font-size: 0.8rem;
  letter-spacing: 2px;
  padding: 8px 0;
}

.lb-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  padding: 3px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.lb-row:hover { background: rgba(255,255,255,0.04); }
.lb-row.lb-top { color: #f0c040; }
.lb-row.lb-mine { background: rgba(240,192,64,0.08); color: #fff; }

.lb-rank  { color: #555; font-size: 0.7rem; text-align: right; }
.lb-name  { color: #ccc; letter-spacing: 1px; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: #f0c040; font-weight: bold; text-align: right; }
.lb-wave  { color: #555; font-size: 0.7rem; text-align: right; }

.lb-row.lb-top .lb-rank  { color: #f0c040; }
.lb-row.lb-top .lb-name  { color: #fff; }

/* ── Name entry in game-over modal ── */
#finish-rank {
  font-size: 0.85rem;
  color: #aaa;
  letter-spacing: 2px;
  text-align: center;
  min-height: 1.2em;
}
#finish-rank .highlight { color: #f0c040; font-weight: bold; }

#name-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
#name-entry-label {
  font-size: 0.85rem;
  color: #ccc;
  letter-spacing: 1px;
  text-align: center;
}
#player-name {
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  letter-spacing: 3px;
  padding: 8px 16px;
  text-align: center;
  width: 220px;
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.2s;
}
#player-name:focus { border-color: #f0c040; }
#score-submitted {
  font-size: 0.85rem;
  color: #44cc88;
  letter-spacing: 2px;
}

