* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050608;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Space Grotesk", sans-serif;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* TOP HUD */
#hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
  gap: 12px;
}

.vital-bar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  width: 240px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.vital-label {
  font-size: 9px;
  font-weight: 800;
  color: #f87171;
  letter-spacing: 0.8px;
}

.vital-val {
  font-size: 11px;
  font-weight: 900;
  color: #fca5a5;
  font-family: monospace;
}

.bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

#barricade-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #dc2626, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  border-radius: 3px;
  transition: width 0.1s ease;
}

.wave-pill {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wave-label {
  font-size: 8px;
  font-weight: 800;
  color: #facc15;
  letter-spacing: 1px;
}

.wave-val {
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

.stat-badge {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 110px;
}

.badge-tag {
  font-size: 8px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.8px;
}

.badge-val {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

/* BOTTOM WEAPON HUD */
#hud-bottom {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 10;
  gap: 12px;
}

.weapon-selector {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.wpn-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 14px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: all 0.15s ease;
}

.wpn-btn.active {
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  background: rgba(15, 23, 42, 0.95);
}

.wpn-name {
  font-size: 11px;
  font-weight: 800;
}

.wpn-key {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  font-family: monospace;
}

.ammo-display {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ammo-label {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
}

.ammo-val {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

.repair-hint {
  font-size: 9px;
  font-weight: 700;
  color: #10b981;
}

/* OVERLAYS */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(17, 24, 39, 0.94) 0%, rgba(3, 7, 18, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 92%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(239, 68, 68, 0.2);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ef4444, #f97316, transparent);
}

.outpost-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fee2e2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 30px;
  margin-bottom: 12px;
}

.menu-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 4px;
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.7);
}

.subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #f87171;
  margin-bottom: 12px;
}

.desc {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.controls-guide {
  background: rgba(3, 7, 18, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-around;
  gap: 16px;
  text-align: left;
}

.guide-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-item {
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  font-family: monospace;
}

.btn-start {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 14px 28px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
  transition: all 0.2s ease;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(220, 38, 38, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 24px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 24px;
}

.stat-card {
  background: rgba(3, 7, 18, 0.65);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  color: #f87171;
  letter-spacing: 0.8px;
}

.stat-val {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
  margin-top: 4px;
}

.stat-val.highlight {
  color: #38bdf8;
  font-size: 24px;
}

/* TOUCH CONTROLS */
#touch-controls {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 16px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

@media (pointer: coarse), (max-width: 820px) {
  #touch-controls {
    display: flex;
  }
}

.touch-wpns, .touch-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.touch-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.fire-touch {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.7);
  padding: 12px 20px;
  font-size: 13px;
}

.repair-touch {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
}
