* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
  overflow: hidden; 
  background: #0a0a1a; 
  font-family: 'Chakra Petch', sans-serif;
  cursor: crosshair;
  user-select: none;
}
#scene-container { 
  position: fixed; 
  top: 0; left: 0; 
  width: 100%; height: 100%; 
  z-index: 1; 
}
canvas { display: block; }

/* START SCREEN */
#start-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1000;
  background: linear-gradient(135deg, #0a0e27 0%, #1a0a2e 30%, #0d1b3e 60%, #0a0e27 100%);
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;
}
.start-content {
  text-align: center;
  padding: 20px;
  max-width: 600px;
  width: 100%;
}
.title-glow {
  font-family: 'Bungee', cursive;
  font-size: clamp(2.5rem, 8vw, 5rem);
  background: linear-gradient(90deg, #00d4ff, #7b2ff7, #ff2d87, #ffaa00);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(123,47,247,0.5));
  margin-bottom: 8px;
}
@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.subtitle {
  font-size: 1rem;
  color: #8888aa;
  font-style: italic;
  margin-bottom: 6px;
}
.flavor-text {
  font-size: 0.85rem;
  color: #6666aa;
  margin-bottom: 24px;
}
.difficulty-select {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 20px;
}
.diff-btn {
  padding: 10px 24px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.15);
  color: #aaa;
  font-family: 'Bungee', cursive;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.diff-btn:hover { border-color: #7b2ff7; color: #fff; }
.diff-btn.active {
  background: linear-gradient(135deg, #7b2ff7, #ff2d87);
  border-color: transparent;
  color: #fff;
}
#drop-in-btn {
  font-family: 'Bungee', cursive;
  font-size: 1.5rem;
  padding: 16px 60px;
  background: linear-gradient(135deg, #ffaa00, #ff6600);
  color: #1a0a2e;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  margin: 16px 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 30px rgba(255,170,0,0.4);
  display: inline-block;
}
#drop-in-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 40px rgba(255,170,0,0.6);
}
.controls-panel {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.controls-title {
  font-family: 'Bungee', cursive;
  color: #7b2ff7;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 0.75rem;
  color: #999;
}
.controls-grid span:nth-child(odd) {
  text-align: right;
  color: #ffaa00;
  font-weight: 700;
}
.controls-grid span:nth-child(even) {
  text-align: left;
}
.loading-tip {
  color: #555;
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 16px;
}

/* HUD */
#hud { 
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  z-index: 10; pointer-events: none; 
}
#hud * { pointer-events: none; }

/* Crosshair */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.ch-line {
  position: absolute;
  background: rgba(255,255,255,0.9);
}
.ch-top { width: 2px; height: 14px; left: -1px; top: -20px; }
.ch-bottom { width: 2px; height: 14px; left: -1px; top: 6px; }
.ch-left { width: 14px; height: 2px; top: -1px; left: -20px; }
.ch-right { width: 14px; height: 2px; top: -1px; left: 6px; }

/* Health */
#health-area {
  position: absolute;
  bottom: 80px; left: 20px;
  width: 240px;
}
#shield-bar-bg, #health-bar-bg {
  height: 24px;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
  margin-bottom: 4px;
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
#shield-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0088ff, #00ccff);
  border-radius: 3px;
  transition: width 0.3s;
}
#health-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00cc44, #44ff66);
  border-radius: 3px;
  transition: width 0.3s;
}
#shield-text, #health-text {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Ammo */
#ammo-area {
  position: absolute;
  bottom: 80px; right: 20px;
  text-align: right;
}
#ammo-count {
  font-family: 'Bungee', cursive;
  font-size: 1.8rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
#weapon-name {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: -4px;
}

/* Score */
#score-area {
  position: absolute;
  top: 16px; right: 20px;
  text-align: right;
}
#kill-count {
  font-family: 'Bungee', cursive;
  font-size: 1.2rem;
  color: #ff4444;
  text-shadow: 0 2px 8px rgba(255,0,0,0.3);
}
#score-count {
  font-size: 0.85rem;
  color: #ffaa00;
}

/* Wave */
#wave-area {
  position: absolute;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Bungee', cursive;
  font-size: 1.1rem;
  color: #ff2d87;
  text-shadow: 0 2px 10px rgba(255,45,135,0.4);
  background: rgba(0,0,0,0.4);
  padding: 4px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,45,135,0.3);
}

/* Minimap */
#minimap {
  position: absolute;
  top: 16px; left: 16px;
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.5);
}
#minimap-canvas { 
  border-radius: 50%;
}

/* Hotbar */
#hotbar {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 4px;
}
.hotbar-slot {
  width: 64px; height: 64px;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
}
.hotbar-slot.active { border-color: #ffaa00; background: rgba(255,170,0,0.15); }
.hotbar-slot[data-rarity="common"] { border-color: #888; }
.hotbar-slot[data-rarity="uncommon"] { border-color: #0f0; }
.hotbar-slot[data-rarity="rare"] { border-color: #00f; }
.hotbar-slot[data-rarity="epic"] { border-color: #a020f0; }
.slot-key {
  position: absolute; top: 2px; left: 4px;
  font-size: 0.6rem; color: #888;
}
.slot-icon { font-size: 1.3rem; }
.slot-name { font-size: 0.55rem; color: #aaa; }

/* Build indicator */
#build-indicator {
  position: absolute;
  bottom: 90px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,100,255,0.2);
  border: 1px solid #0088ff;
  padding: 6px 20px;
  border-radius: 8px;
  display: flex; gap: 12px;
}
#build-mode-text {
  font-family: 'Bungee', cursive;
  font-size: 0.8rem;
  color: #00ccff;
}
#build-piece {
  font-weight: 700;
  color: #ffaa00;
}

/* Resources */
#resource-area {
  position: absolute;
  bottom: 130px; right: 20px;
  background: rgba(0,0,0,0.5);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #cc8844;
  font-weight: 700;
}

/* Kill feed */
#kill-feed {
  position: absolute;
  top: 70px; right: 20px;
  max-width: 260px;
}
.kill-feed-entry {
  font-size: 0.75rem;
  color: #ddd;
  background: rgba(0,0,0,0.5);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 3px;
  animation: fadeInOut 3s forwards;
  border-left: 3px solid #ff2d87;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(20px); }
  10% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Damage overlay */
#damage-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9;
}

/* Storm warning */
#storm-warning {
  position: absolute;
  top: 100px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Bungee', cursive;
  font-size: 1rem;
  color: #cc44ff;
  animation: pulseWarn 0.8s ease infinite;
  background: rgba(100,0,200,0.2);
  padding: 6px 20px;
  border-radius: 8px;
}
@keyframes pulseWarn {
  0%,100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* PAUSE */
#pause-menu {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 500;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.pause-content { text-align: center; }
.pause-title {
  font-family: 'Bungee', cursive;
  font-size: 2.5rem;
  color: white;
  margin-bottom: 20px;
}
.pause-btn {
  display: block;
  width: 220px;
  margin: 8px auto;
  padding: 12px;
  font-family: 'Bungee', cursive;
  font-size: 1rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 10px;
  cursor: pointer;
  pointer-events: all;
  transition: all 0.2s;
}
.pause-btn:hover {
  background: rgba(123,47,247,0.3);
  border-color: #7b2ff7;
}
.sensitivity-control {
  margin: 16px auto;
  color: #aaa;
  font-size: 0.85rem;
  pointer-events: all;
}
.sensitivity-control label { display: block; margin-bottom: 4px; }
.sensitivity-control input[type="range"] {
  width: 180px;
  accent-color: #7b2ff7;
}

/* GAME OVER */
#gameover-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 600;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.gameover-content { text-align: center; }
#gameover-title {
  font-family: 'Bungee', cursive;
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin-bottom: 20px;
}
#gameover-stats {
  color: #aaa;
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.8;
}
#gameover-stats span { color: #ffaa00; font-weight: 700; }

/* Footer */
#footer-bar {
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  z-index: 2;
  text-align: center;
  padding: 4px;
  background: rgba(0,0,0,0.3);
}
#footer-bar a {
  color: #555;
  font-size: 0.65rem;
  text-decoration: none;
}
#footer-bar a:hover { color: #7b2ff7; }