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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

/* ====== FONTS ====== */
body { font-family: 'Inter', 'Segoe UI', sans-serif; }

/* ====== LANDING ====== */
#landing {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 30%, #24243e 60%, #16213e 100%);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* Animated snowflakes */
.snowflakes {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 1;
}
.snowflake {
  position: absolute; top: -10%;
  color: rgba(255,255,255,0.6);
  font-size: 1.4rem;
  animation: snowfall linear infinite;
}
.snowflake:nth-child(1)  { left: 5%;  animation-duration: 10s; animation-delay: 0s;   font-size: 1.2rem; }
.snowflake:nth-child(2)  { left: 15%; animation-duration: 12s; animation-delay: 2s;   font-size: 1.6rem; }
.snowflake:nth-child(3)  { left: 25%; animation-duration: 8s;  animation-delay: 4s;   font-size: 1.0rem; }
.snowflake:nth-child(4)  { left: 35%; animation-duration: 14s; animation-delay: 1s;   font-size: 1.8rem; }
.snowflake:nth-child(5)  { left: 45%; animation-duration: 11s; animation-delay: 3s;   font-size: 1.3rem; }
.snowflake:nth-child(6)  { left: 55%; animation-duration: 9s;  animation-delay: 5s;   font-size: 1.5rem; }
.snowflake:nth-child(7)  { left: 65%; animation-duration: 13s; animation-delay: 0.5s; font-size: 1.1rem; }
.snowflake:nth-child(8)  { left: 75%; animation-duration: 10s; animation-delay: 2.5s; font-size: 1.7rem; }
.snowflake:nth-child(9)  { left: 85%; animation-duration: 15s; animation-delay: 1.5s; font-size: 1.4rem; }
.snowflake:nth-child(10) { left: 92%; animation-duration: 11s; animation-delay: 3.5s; font-size: 1.2rem; }
.snowflake:nth-child(11) { left: 10%; animation-duration: 9s;  animation-delay: 6s;   font-size: 1.0rem; }
.snowflake:nth-child(12) { left: 50%; animation-duration: 12s; animation-delay: 0.8s; font-size: 1.6rem; }

@keyframes snowfall {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 0.8; }
  25%  { opacity: 0.6; }
  50%  { opacity: 0.4; }
  75%  { opacity: 0.6; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0.3; }
}

.landing-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
  text-align: center;
  max-width: 640px;
  padding: 40px 24px;
}

/* Logo */
.logo-area {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.logo-icon {
  font-size: 4rem;
  animation: logoBounce 2s ease-in-out infinite;
}
@keyframes logoBounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title {
  font-family: 'Russo One', 'Impact', sans-serif;
  font-size: 4.2rem;
  letter-spacing: 6px;
  line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 0%, #88ccff 50%, #4488cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(100,180,255,0.5));
}

.subtitle {
  font-size: 1.15rem;
  color: rgba(255,255,255,0.7);
  font-weight: 400;
  letter-spacing: 1px;
}

/* Features */
.features {
  display: flex; flex-direction: column;
  gap: 10px; width: 100%;
}
.feature {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.9rem; color: rgba(255,255,255,0.8);
  transition: background 0.2s, border-color 0.2s;
}
.feature:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}
.feature-icon { font-size: 1.3rem; flex-shrink: 0; }

/* Controls showcase */
.controls-showcase {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 18px 24px;
  border: 1px solid rgba(255,255,255,0.06);
}
.controls-showcase h3 {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 14px;
}
.keys-grid {
  display: flex; flex-direction: column;
  gap: 8px;
}
.key-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: rgba(255,255,255,0.7);
}
.key-row span { margin-left: auto; }
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 28px;
  padding: 0 7px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem; font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
}

/* Play button */
.play-btn {
  position: relative;
  background: linear-gradient(135deg, #ff4444 0%, #cc2222 50%, #aa1111 100%);
  border: none;
  border-radius: 16px;
  padding: 18px 64px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 32px rgba(255,50,50,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  animation: btnPulse 2s ease-in-out infinite;
}
.play-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 40px rgba(255,50,50,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.play-btn:active {
  transform: translateY(1px) scale(0.98);
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 8px 32px rgba(255,50,50,0.35); }
  50% { box-shadow: 0 8px 48px rgba(255,50,50,0.55); }
}
.play-btn-text {
  display: block;
  font-family: 'Russo One', 'Impact', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.play-btn-hint {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}

.players-note {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
}

/* Landing footer */
.landing-footer {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 2px;
  display: flex; gap: 10px;
  flex-wrap: wrap; justify-content: center;
}

/* ====== GAME CONTAINER ====== */
#game-container { position: fixed; inset: 0; z-index: 5; }

/* Loading */
#loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0f0f23;
  font-size: 2rem; color: #00ffcc;
  z-index: 1000;
  font-family: 'Courier New', monospace;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Canvas */
canvas { display: block; position: fixed; inset: 0; z-index: 1; }

/* HUD */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Courier New', monospace;
}
#hud > * { pointer-events: auto; }

/* Crosshair */
#crosshair {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 24px; height: 24px;
}
.ch-line { position: absolute; background: rgba(255,255,255,0.7); }
.ch-h { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%); }
.ch-v { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%); }

/* Health bar */
#health-bar {
  position: absolute; bottom: 40px; left: 40px;
  width: 260px; height: 18px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px; overflow: hidden;
}
#health-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #44ff44);
  transition: width 0.2s;
  width: 100%;
}
#health-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Weapon info */
#weapon-info { position: absolute; bottom: 40px; right: 40px; text-align: right; }
#weapon-name { font-size: 14px; font-weight: bold; letter-spacing: 3px; color: #00ffcc; }
#weapon-cooldown { font-size: 12px; color: #aaa; margin-top: 2px; }
#charge-indicator {
  margin-top: 4px; width: 120px; height: 6px;
  background: rgba(0,0,0,0.5);
  border: 1px solid #444;
  border-radius: 3px; overflow: hidden;
}
#charge-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffcc00, #ff6600);
  width: 0%; transition: width 0.05s linear;
}

/* Scoreboard */
#scoreboard {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  display: none;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; padding: 12px 20px;
  min-width: 280px;
  backdrop-filter: blur(10px);
}
#scoreboard.visible { display: block; }
#scoreboard-title {
  font-size: 14px; font-weight: bold;
  color: #00ffcc; text-align: center;
  margin-bottom: 8px; letter-spacing: 2px;
}
#scoreboard-list { font-size: 13px; }
.score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.score-row .name { flex: 1; }
.score-row .stats { color: #aaa; font-size: 11px; margin-left: 12px; }
.score-row.you { color: #00ffcc; }
.score-row.dead { color: #ff4444; text-decoration: line-through; }

/* Kill feed */
#kill-feed {
  position: absolute; top: 20px; right: 20px;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 4px;
}
.kill-entry {
  background: rgba(0,0,0,0.7);
  padding: 4px 10px; border-radius: 3px;
  font-size: 12px;
  animation: fadeIn 0.3s ease-out, fadeOut 0.5s ease-in 4s forwards;
  max-width: 350px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kill-entry .killer { color: #ff6644; }
.kill-entry .victim { color: #ff4444; }
.kill-entry .weapon { color: #ffcc00; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(20px); } }

/* Controls hint (in-game) */
#controls-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: rgba(255,255,255,0.35); text-align: center;
}
#controls-hint span { color: rgba(255,255,255,0.55); font-weight: bold; }

/* Death screen */
#death-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(180,0,0,0.35);
  z-index: 50;
  animation: fadeIn 0.3s ease-out;
}
#death-text {
  font-size: 3rem; font-weight: bold;
  text-shadow: 0 0 20px rgba(255,0,0,0.8);
  margin-bottom: 8px;
}
#death-by { font-size: 1.2rem; color: #ffaa88; margin-bottom: 20px; }
#death-timer { font-size: 1rem; color: #aaa; }

/* Hit marker */
#hit-marker {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  pointer-events: none;
  opacity: 0; z-index: 15;
}
#hit-marker::before, #hit-marker::after {
  content: ''; position: absolute; background: #ff0000;
  top: 0; left: 50%; width: 1px; height: 100%;
}
#hit-marker::before { transform: translateX(-50%) rotate(45deg); }
#hit-marker::after  { transform: translateX(-50%) rotate(-45deg); }
#hit-marker.active { animation: hitFlash 0.3s ease-out; }
@keyframes hitFlash {
  0% { opacity: 1; transform: translate(-50%,-50%) scale(1.5); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
}

/* Chat messages */
#chat-box {
  position: absolute; bottom: 70px; left: 20px;
  font-size: 13px; color: rgba(255,255,255,0.6);
  display: flex; flex-direction: column; gap: 2px;
}
#chat-box .msg {
  animation: chatFadeIn 0.3s ease-out, chatFadeOut 0.3s ease-in 5s forwards;
}
@keyframes chatFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes chatFadeOut { to { opacity: 0; } }
