/* ═══════════════════════════════════════════════════════
   BattleZone — Main Stylesheet
   Aesthetic: Dark military / tactical HUD
════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=Share+Tech+Mono&display=swap');

:root {
  --bg:        #0a0c10;
  --bg2:       #111520;
  --surface:   #161b26;
  --border:    #2a3245;
  --accent:    #f5c400;
  --accent2:   #ff4444;
  --accent3:   #44aaff;
  --hp-color:  #2ecc71;
  --sh-color:  #44aaff;
  --text:      #e0e8ff;
  --text-dim:  #6b7a9c;
  --font-head: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --radius:    4px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-head);
  user-select: none;
}

/* ── SCREENS ─────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.screen.active { display: flex; }

/* ── MAIN MENU ───────────────────────────────────── */
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(245,196,0,0.07) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(42,50,69,0.4) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(42,50,69,0.4) 40px),
    var(--bg);
  animation: bgPulse 8s ease-in-out infinite;
}
@keyframes bgPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

.menu-content {
  position: relative;
  text-align: center;
  max-width: 520px;
  width: 100%;
  padding: 40px 24px;
  animation: fadeUp 0.6s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: clamp(52px, 10vw, 88px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 8px;
}
.logo-battle { color: var(--text); }
.logo-zone   {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(245,196,0,0.5);
}

.menu-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 40px;
}

.menu-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 36px;
}

input {
  width: 100%;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245,196,0,0.2);
}
input::placeholder { color: var(--text-dim); font-weight: 400; }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #111;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 24px rgba(245,196,0,0.4); }
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: scale(0.97); }

.menu-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
}
.menu-controls h3 {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--text-dim);
}
.controls-grid kbd {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-right: 4px;
}

/* ── LOBBY ───────────────────────────────────────── */
.lobby-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 36px 40px;
  max-width: 500px;
  width: 100%;
  animation: fadeUp 0.4s ease both;
}
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.lobby-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.room-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg2);
  padding: 4px 10px;
  border-radius: 3px;
}
.lobby-countdown {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.lobby-status {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.player-list {
  min-height: 80px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.player-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
}
.player-entry .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--hp-color);
  flex-shrink: 0;
}
.player-entry.self { border-color: var(--accent); }
.lobby-tip {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ── GAME CONTAINER ─────────────────────────────── */
#gameContainer {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
}
#gameContainer.active { display: block; }
#gameContainer canvas { display: block; }

/* ── HUD ─────────────────────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
#hud.hidden { display: none; }

/* Health bar row */
#hudHealth {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 16px;
  min-width: 340px;
}
.hud-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 700;
}
.bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.15s ease;
}
.hp-bar     { background: var(--hp-color); }
.shield-bar { background: var(--sh-color); }
#hudHealth span {
  font-family: var(--font-mono);
  font-size: 14px;
  min-width: 28px;
  text-align: right;
}

/* Weapon HUD */
#hudWeapon {
  position: absolute;
  bottom: 74px;
  right: 24px;
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 18px;
  text-align: right;
}
#weaponName {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
}
#ammoDisplay {
  font-family: var(--font-mono);
  font-size: 22px;
  margin-top: 2px;
}
#reloadBar {
  margin-top: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  height: 4px;
  overflow: hidden;
  position: relative;
}
#reloadBar span {
  position: absolute;
  top: 8px;
  right: 0;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
#reloadProgress {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* Kill feed */
#killFeed {
  position: absolute;
  top: 60px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 300px;
}
.kill-entry {
  background: rgba(10,12,16,0.8);
  border-left: 3px solid var(--accent2);
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 0 3px 3px 0;
  animation: slideIn 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kill-entry.own { border-left-color: var(--accent); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Top info */
#topInfo {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
}
#aliveCounter, #killCounter {
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Minimap */
#minimapContainer {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
}
#minimap {
  display: block;
  border-radius: 2px;
}
.minimap-label {
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-align: center;
  margin-top: 3px;
}

/* Zone warning */
#zoneWarning {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,68,68,0.85);
  border: 1px solid var(--accent2);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 20px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  animation: dangerPulse 0.8s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Loot prompt */
#lootPrompt {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 14px;
  padding: 6px 18px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  animation: pulse 1.2s ease-in-out infinite;
}
#lootPrompt kbd {
  background: var(--accent);
  color: #111;
  border-radius: 2px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Spectating */
#spectatingBanner {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(10,12,16,0.85);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.2em;
  padding: 6px 14px;
  border-radius: 4px;
}

/* ── GAME OVER ───────────────────────────────────── */
#gameOverScreen, #victoryScreen {
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
.go-content, .victory-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: fadeUp 0.5s ease both;
}
.go-result {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.go-kills {
  font-size: 18px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 24px;
}
.victory-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-shadow: 0 0 30px rgba(245,196,0,0.5);
  margin-bottom: 8px;
  animation: victoryGlow 2s ease-in-out infinite;
}
@keyframes victoryGlow {
  0%, 100% { text-shadow: 0 0 30px rgba(245,196,0,0.5); }
  50%       { text-shadow: 0 0 60px rgba(245,196,0,0.9); }
}
.victory-kills {
  font-size: 18px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 24px;
}
.go-content h3, .victory-content h3 {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
  max-height: 260px;
  overflow-y: auto;
}
.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 14px;
  font-size: 15px;
}
.lb-rank {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  min-width: 24px;
}
.lb-rank.gold   { color: var(--accent); }
.lb-rank.silver { color: #aaa; }
.lb-rank.bronze { color: #cd7f32; }
.lb-name { flex: 1; font-weight: 600; text-align: left; }
.lb-kills {
  font-family: var(--font-mono);
  color: var(--accent2);
}
.lb-bot { color: var(--text-dim); font-size: 11px; }

/* ── UTILITIES ───────────────────────────────────── */
.hidden { display: none !important; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
