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

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050709;
  font-family: 'Chakra Petch', sans-serif;
  color: #fff;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

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

/* Crosshair */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.ch-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ch-bar {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
  transition: transform 0.08s ease-out;
}

.ch-top {
  top: 6px;
  left: 50%;
  width: 2px;
  height: 8px;
  transform: translateX(-50%);
}

.ch-bottom {
  bottom: 6px;
  left: 50%;
  width: 2px;
  height: 8px;
  transform: translateX(-50%);
}

.ch-left {
  left: 6px;
  top: 50%;
  width: 8px;
  height: 2px;
  transform: translateY(-50%);
}

.ch-right {
  right: 6px;
  top: 50%;
  width: 8px;
  height: 2px;
  transform: translateY(-50%);
}

/* Hitmarker */
#hitmarker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 36px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.04s, transform 0.04s;
}

#hitmarker.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.hm-line {
  position: absolute;
  background: #fff;
  width: 10px;
  height: 2.5px;
  box-shadow: 0 0 5px rgba(255,255,255,0.8);
}

.hm-tl { top: 6px; left: 6px; transform: rotate(45deg); }
.hm-tr { top: 6px; right: 6px; transform: rotate(-45deg); }
.hm-bl { bottom: 6px; left: 6px; transform: rotate(-45deg); }
.hm-br { bottom: 6px; right: 6px; transform: rotate(45deg); }

#hitmarker.headshot .hm-line {
  background: #ff2222;
  box-shadow: 0 0 8px #ff2222;
}

#hitmarker.kill .hm-line {
  background: #ff3300;
  box-shadow: 0 0 10px #ff3300;
  width: 13px;
}

/* Sniper Scope Overlay */
#sniper-scope {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease-in;
  z-index: 8;
  background: radial-gradient(circle at center, transparent 38%, rgba(0, 0, 0, 0.96) 42%, #000 70%);
}

#sniper-scope.active {
  opacity: 1;
  visibility: visible;
}

.scope-reticle-h {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: rgba(20, 20, 20, 0.85);
  box-shadow: 0 0 2px rgba(255, 0, 0, 0.5);
}

.scope-reticle-v {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1.5px;
  height: 100%;
  background: rgba(20, 20, 20, 0.85);
  box-shadow: 0 0 2px rgba(255, 0, 0, 0.5);
}

.scope-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: #ff1100;
  border-radius: 50%;
  box-shadow: 0 0 6px #ff0000;
}

.scope-markings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border: 1px dashed rgba(255, 50, 50, 0.4);
  border-radius: 50%;
}

/* Damage Screen Indicator & Bloody Border */
#damage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 100px rgba(180, 0, 0, 0);
  transition: box-shadow 0.2s;
  z-index: 5;
}

#damage-overlay.pulsing {
  animation: pulseLowHp 1s infinite alternate;
}

@keyframes pulseLowHp {
  0% { box-shadow: inset 0 0 70px rgba(220, 10, 10, 0.6); }
  100% { box-shadow: inset 0 0 140px rgba(255, 0, 0, 0.95); }
}

#damage-indicator-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240px;
  height: 240px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.damage-arc {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border-top: 6px solid #ff1111;
  filter: drop-shadow(0 0 8px #ff0000);
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

/* Radar / Mini-map (Top Left) */
#radar-container {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 160px;
  height: 160px;
  background: rgba(8, 14, 18, 0.85);
  border: 2px solid rgba(80, 150, 200, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(20, 60, 90, 0.4);
  overflow: hidden;
}

#radar-canvas {
  width: 100%;
  height: 100%;
}

#radar-sweep {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(0, 255, 170, 0.25) 0deg, transparent 60deg, transparent 360deg);
  animation: radarRotate 3s linear infinite;
  pointer-events: none;
}

@keyframes radarRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.compass-label {
  position: absolute;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #79a8c7;
  font-weight: 700;
}
.compass-n { top: 4px; left: 50%; transform: translateX(-50%); color: #ffdd44; }
.compass-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
.compass-e { right: 6px; top: 50%; transform: translateY(-50%); }
.compass-w { left: 6px; top: 50%; transform: translateY(-50%); }

/* Match Header & Objective (Top Center) */
#match-header {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#score-tracker {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(12, 16, 20, 0.85);
  padding: 6px 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.team-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.team-score .label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.team-score.allies .label { color: #3498db; }
.team-score.allies .val { color: #5dade2; font-size: 24px; font-weight: 700; }

.team-score.axis .label { color: #e74c3c; }
.team-score.axis .val { color: #f1948a; font-size: 24px; font-weight: 700; }

.score-divider {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 700;
}

#wave-tracker {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #f39c12;
  text-shadow: 0 0 8px rgba(243, 156, 18, 0.6);
}

/* Killstreak Banner / Notifications */
#banner-container {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.streak-banner {
  background: linear-gradient(90deg, transparent, rgba(230, 126, 34, 0.9), transparent);
  padding: 8px 50px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  animation: bannerFade 3s forwards ease-in-out;
}

@keyframes bannerFade {
  0% { opacity: 0; transform: scale(0.8) translateY(-10px); }
  15% { opacity: 1; transform: scale(1.05) translateY(0); }
  25% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-15px); }
}

/* Floating Kill Medal / Score Popup */
#medal-feed {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.kill-medal {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffcc00;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 10px rgba(255, 204, 0, 0.8);
  animation: medalFloat 1.2s forwards cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.kill-medal.headshot {
  color: #ff3344;
  text-shadow: 0 0 12px #ff2233;
}

@keyframes medalFloat {
  0% { opacity: 0; transform: scale(0.6) translateY(20px); }
  20% { opacity: 1; transform: scale(1.15) translateY(0); }
  35% { transform: scale(1); }
  75% { opacity: 1; transform: translateY(-15px); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* Killfeed (Top Right) */
#killfeed {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.killfeed-item {
  background: rgba(10, 15, 20, 0.8);
  border-left: 3px solid #ff3b30;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  animation: feedSlide 4s forwards;
}

.killfeed-killer { color: #3498db; }
.killfeed-weapon {
  color: #8899a6;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 2px;
}
.killfeed-victim { color: #e74c3c; }

@keyframes feedSlide {
  0% { opacity: 0; transform: translateX(30px); }
  8% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Bottom Left: Health & Status */
#player-status {
  position: absolute;
  bottom: 30px;
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 15, 22, 0.85);
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 4px solid #2ecc71;
  border-radius: 3px;
}

.health-icon {
  font-size: 14px;
  font-weight: 700;
  color: #2ecc71;
}

.health-track {
  width: 180px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

#health-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.2s ease-out, background 0.3s;
}

#health-num {
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  width: 40px;
  text-align: right;
  color: #fff;
}

.streak-counter {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: #f1c40f;
  background: rgba(10, 15, 22, 0.7);
  padding: 3px 8px;
  border-radius: 2px;
  width: fit-content;
}

/* Bottom Right: Weapon & Ammo HUD */
#weapon-hud {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.weapon-info-card {
  background: rgba(10, 15, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 5px solid #f39c12;
  padding: 12px 24px;
  border-radius: 3px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.weapon-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#weapon-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ecf0f1;
}

#fire-mode {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: #f39c12;
  margin-top: 2px;
}

.ammo-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Share Tech Mono', monospace;
}

#ammo-current {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
}

#ammo-current.low {
  color: #e74c3c;
  animation: blinkLow 0.5s infinite alternate;
}

@keyframes blinkLow {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

#ammo-reserve {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.5);
}

/* Grenades and Equipment */
.equipment-bar {
  display: flex;
  gap: 12px;
}

.eq-item {
  background: rgba(10, 15, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #bdc3c7;
}

.eq-item .key {
  background: #34495e;
  color: #fff;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
}

/* Reloading Prompt */
#reload-prompt {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(192, 57, 43, 0.85);
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

#reload-prompt.visible {
  opacity: 1;
}

/* ================= MODALS & OVERLAYS ================= */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 12, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.modal-content {
  background: #0d1218;
  border: 1px solid rgba(80, 150, 200, 0.3);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 0 15px rgba(52, 152, 219, 0.2);
  border-radius: 6px;
  padding: 40px 50px;
  width: 580px;
  max-width: 90vw;
  text-align: center;
}

.game-title {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(230, 126, 34, 0.7);
}

.game-title span {
  color: #f39c12;
}

.subtitle {
  font-size: 14px;
  color: #7f8c8d;
  letter-spacing: 2px;
  margin-bottom: 28px;
  text-transform: uppercase;
}

.mode-selector {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
}

.mode-btn {
  flex: 1;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
  color: #ecf0f1;
  transition: all 0.2s;
  text-align: left;
}

.mode-btn:hover {
  background: rgba(243, 156, 18, 0.15);
  border-color: #f39c12;
}

.mode-btn.active {
  background: rgba(243, 156, 18, 0.25);
  border-color: #f39c12;
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.3);
}

.mode-btn h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #f39c12;
}

.mode-btn p {
  font-size: 12px;
  color: #95a5a6;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 30px;
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 4px;
  font-size: 13px;
}

.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ctrl-key {
  font-family: 'Share Tech Mono', monospace;
  background: #2c3e50;
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
}

.primary-btn {
  width: 100%;
  padding: 16px;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #d35400, #e67e22);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(211, 84, 0, 0.5);
  transition: all 0.2s;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #e67e22, #f39c12);
  box-shadow: 0 6px 22px rgba(230, 126, 34, 0.7);
  transform: translateY(-2px);
}

.hidden {
  display: none !important;
}

/* Post-Match Summary / Game Over */
#game-over-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-box .stat-val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: #f39c12;
}

.stat-box .stat-name {
  font-size: 11px;
  color: #7f8c8d;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}
