/* ============================================================
   HAVOC — Tactical FPS Browser Game
   Master Stylesheet
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-deep:        #0a0a0f;
  --bg-panel:       #111118;
  --bg-card:        #16161f;
  --bg-card-hover:  #1c1c28;
  --bg-overlay:     rgba(8, 8, 14, 0.88);
  --bg-input:       #1a1a24;

  /* Accents */
  --cyan:           #00d4ff;
  --cyan-dim:       #00d4ff66;
  --cyan-glow:      0 0 12px #00d4ff88, 0 0 32px #00d4ff33;
  --cyan-glow-strong: 0 0 18px #00d4ffcc, 0 0 48px #00d4ff55, 0 0 80px #00d4ff22;
  --red:            #ff3333;
  --red-dim:        #ff333366;
  --red-glow:       0 0 12px #ff333388, 0 0 32px #ff333333;
  --gold:           #f5c842;
  --gold-dim:       #f5c84266;
  --gold-glow:      0 0 12px #f5c84288, 0 0 32px #f5c84233;

  /* Text */
  --text-primary:   #eaeaf0;
  --text-secondary: #8888a0;
  --text-muted:     #55556a;

  /* Misc */
  --border-subtle:  #ffffff0d;
  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --transition:     0.2s ease;

  /* Fonts */
  --font-heading:   'Rajdhani', 'Orbitron', sans-serif;
  --font-display:   'Orbitron', 'Rajdhani', sans-serif;
  --font-body:      'Inter', sans-serif;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: default;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden        { display: none !important; }
.no-interact   { pointer-events: none; }
.flex-center    { display: flex; justify-content: center; align-items: center; }
.flex-col       { display: flex; flex-direction: column; }

/* ============================================================
   BUTTONS  (global .btn)
   ============================================================ */
.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 36px;
  border: 1px solid var(--cyan);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: rgba(0, 212, 255, 0.08);
  box-shadow: var(--cyan-glow);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn--primary {
  background: var(--cyan);
  color: var(--bg-deep);
  font-weight: 700;
}

.btn--primary:hover {
  background: #33dfff;
  box-shadow: var(--cyan-glow-strong);
}

.btn--danger {
  border-color: var(--red);
  color: var(--red);
}

.btn--danger:hover {
  background: rgba(255, 51, 51, 0.08);
  box-shadow: var(--red-glow);
}

.btn--gold {
  border-color: var(--gold);
  color: var(--gold);
}

.btn--gold:hover {
  background: rgba(245, 200, 66, 0.08);
  box-shadow: var(--gold-glow);
}

.btn--large {
  font-size: 1.25rem;
  padding: 16px 56px;
}

.btn:disabled, .btn--disabled {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(0.6);
}

/* ============================================================
   HUD WRAPPER
   ============================================================ */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.hud > * {
  pointer-events: none;
}

/* Elements that need clicks (buy menu, scoreboard, etc.) get
   pointer-events: auto on their own containers. */

/* ============================================================
   1. TITLE SCREEN
   ============================================================ */
#title-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background:
    /* subtle grid pattern */
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 40%, #111120 0%, var(--bg-deep) 70%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
}

#title-screen h1 {
  font-family: var(--font-display);
  font-size: clamp(5rem, 12vw, 10rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow:
    0 0 20px var(--cyan),
    0 0 60px rgba(0, 212, 255, 0.5),
    0 0 120px rgba(0, 212, 255, 0.25);
  line-height: 1;
  margin-bottom: 0;
  animation: titlePulse 4s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 20px var(--cyan), 0 0 60px rgba(0,212,255,0.5), 0 0 120px rgba(0,212,255,0.25); }
  50%      { text-shadow: 0 0 30px var(--cyan), 0 0 80px rgba(0,212,255,0.6), 0 0 160px rgba(0,212,255,0.35); }
}

#title-screen .subtitle {
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.45em;
  color: var(--text-secondary);
  margin-top: 8px;
  text-transform: uppercase;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 56px;
  min-width: 240px;
}

.title-buttons .btn {
  width: 100%;
  text-align: center;
}

.title-version {
  position: absolute;
  bottom: 24px;
  right: 32px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   2. AGENT SELECT
   ============================================================ */
#agent-select {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: var(--bg-deep);
  padding: 40px;
}

#agent-select h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

#agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 960px;
  width: 100%;
}

@media (min-width: 1100px) {
  #agent-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.agent-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  text-align: center;
}

.agent-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-4px);
}

.agent-card.selected {
  border-color: var(--cyan);
  box-shadow: var(--cyan-glow), inset 0 0 24px rgba(0, 212, 255, 0.06);
}

.agent-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #1a2a3a, #0f1520);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

/* Unique accent stripe per agent */
.agent-card:nth-child(1) .agent-portrait { border-top: 3px solid var(--cyan); }
.agent-card:nth-child(2) .agent-portrait { border-top: 3px solid var(--red); }
.agent-card:nth-child(3) .agent-portrait { border-top: 3px solid var(--gold); }
.agent-card:nth-child(4) .agent-portrait { border-top: 3px solid #a855f7; }
.agent-card:nth-child(5) .agent-portrait { border-top: 3px solid #22c55e; }
.agent-card:nth-child(6) .agent-portrait { border-top: 3px solid #f97316; }

.agent-card .agent-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 12px 2px;
}

.agent-card .agent-role {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.08);
  padding: 2px 8px;
  border-radius: 2px;
  width: fit-content;
  margin: 4px auto;
}

.agent-card .agent-abilities {
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 6px 12px 14px;
  line-height: 1.5;
}

.agent-select-timer {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
}

#lock-in-btn {
  margin-top: 8px;
}

/* ============================================================
   3. BUY MENU  (B key overlay)
   ============================================================ */
#buy-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: none;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  max-height: 70vh;
  overflow-y: auto;
  top: 15vh;
}

#buy-items {
  max-height: 55vh;
  overflow-y: auto;
}

.buy-inner {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Left sidebar — categories */
.buy-categories {
  width: 200px;
  background: rgba(10, 10, 16, 0.6);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.buy-category-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(10, 10, 20, 0.95);
}

.buy-category-title:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.buy-category-title.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(0, 212, 255, 0.05);
}

/* Center — weapon grid */
.buy-weapons {
  flex: 1;
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  align-content: start;
  overflow-y: auto;
}

.buy-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.buy-item:hover {
  border-color: rgba(0, 212, 255, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.buy-item.too-expensive {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.buy-item.owned {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.05);
}

.buy-item .weapon-icon {
  width: 100%;
  height: 56px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}

.buy-item .weapon-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
}

.buy-item .cost {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--gold);
}

.buy-item .dmg {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--red);
  opacity: 0.85;
}

.buy-item .weapon-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.buy-item .weapon-stat {
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 2px;
}

.weapon-stat-bar {
  height: 3px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
}

.weapon-stat-bar-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Buy menu money + hint */
#buy-money {
  position: absolute;
  top: 24px;
  right: 32px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  text-shadow: var(--gold-glow);
  z-index: 2;
}

#buy-money::before {
  content: '$';
  font-size: 1rem;
  margin-right: 4px;
  opacity: 0.7;
}

#buy-menu h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  padding: 24px 32px 0;
}

#buy-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================================
   4. HUD ELEMENTS  (overlay on canvas)
   ============================================================ */

/* --- Crosshair --- */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

.crosshair-dot {
  width: var(--ch-dot-size, 4px);
  height: var(--ch-dot-size, 4px);
  background: var(--ch-color, #fff);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: var(--ch-dot-opacity, 1);
}

.crosshair-line {
  position: absolute;
  background: var(--ch-color, #fff);
  opacity: var(--ch-line-opacity, 0.9);
}

.crosshair-line--top {
  width: var(--ch-thickness, 2px);
  height: var(--ch-length, 10px);
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(50% + var(--ch-gap, 4px));
}

.crosshair-line--bottom {
  width: var(--ch-thickness, 2px);
  height: var(--ch-length, 10px);
  left: 50%;
  transform: translateX(-50%);
  top: calc(50% + var(--ch-gap, 4px));
}

.crosshair-line--left {
  height: var(--ch-thickness, 2px);
  width: var(--ch-length, 10px);
  top: 50%;
  transform: translateY(-50%);
  right: calc(50% + var(--ch-gap, 4px));
}

.crosshair-line--right {
  height: var(--ch-thickness, 2px);
  width: var(--ch-length, 10px);
  top: 50%;
  transform: translateY(-50%);
  left: calc(50% + var(--ch-gap, 4px));
}

/* --- HP / Armor Bar --- */
#hp-area {
  position: absolute;
  bottom: 28px;
  left: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
}

#hp-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

#armor-text {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: #60a5fa;
  letter-spacing: 0.05em;
}

#hp-bar-bg,
#armor-bar-bg {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  border: none;
  overflow: hidden;
  width: 100%;
}

#hp-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.25s ease;
}

#hp-bar.low {
  background: linear-gradient(90deg, var(--red), #ff6666);
  animation: hpPulse 0.8s ease-in-out infinite;
}

@keyframes hpPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

#armor-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.25s ease;
}

/* --- Ammo --- */
#ammo-area {
  position: absolute;
  bottom: 28px;
  right: 28px;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

#weapon-name {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#ammo-current {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

#ammo-reserve {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-secondary);
}

#reload-text {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: reloadPulse 1s ease-in-out infinite;
}

@keyframes reloadPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* --- Money (HUD) --- */
#money {
  position: absolute;
  top: 20px;
  right: 28px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 700;
}

/* --- Minimap --- */
#minimap-container {
  position: absolute;
  top: 20px;
  left: 20px;
}

#minimap {
  width: 180px;
  height: 180px;
  background: rgba(10, 10, 16, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.minimap-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.minimap-dot--ally  { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.minimap-dot--enemy { background: var(--red); box-shadow: 0 0 4px var(--red); }
.minimap-dot--self  { background: #fff; box-shadow: 0 0 6px #fff; width: 8px; height: 8px; }

/* --- Kill Feed --- */
#kill-feed {
  position: absolute;
  top: 56px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 360px;
}

.kill-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(10, 10, 16, 0.7);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  animation: killfeedSlide 0.3s ease-out;
  white-space: nowrap;
}

@keyframes killfeedSlide {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.kill-entry.fade-out {
  animation: killfeedFade 0.5s ease-in forwards;
}

@keyframes killfeedFade {
  to { opacity: 0; transform: translateX(20px); }
}

.kill-entry .attacker { color: var(--cyan); font-weight: 600; }
.kill-entry .defender { color: var(--red); font-weight: 600; }
.kill-entry .weapon   { color: var(--text-muted); font-size: 0.7rem; }
.kill-entry .headshot { color: var(--gold); font-size: 0.7rem; }

/* --- Ability Bar --- */
#abilities {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.ability-box {
  width: 56px;
  height: 56px;
  background: rgba(10, 10, 16, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ability-box .key {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  position: absolute;
  top: 3px;
  left: 5px;
}

.ability-box .charges {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.ability-box.ready {
  border-color: var(--cyan-dim);
}

.ability-box.ready .charges {
  color: var(--cyan);
}

.ability-box.active {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.ability-box.cooldown {
  border-color: rgba(255, 51, 51, 0.4);
}

.ability-box.empty {
  border-color: #222;
  opacity: 0.4;
}

.ability-cd-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.65);
  transition: height 0.1s linear;
}

.ability-cooldown-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

/* --- Round Timer + Score (top center) --- */
#top-bar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  text-align: center;
}

#timer {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  min-width: 72px;
  text-align: center;
  background: rgba(10, 10, 16, 0.6);
  padding: 6px 18px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border: 1px solid var(--border-subtle);
  border-top: none;
}

#timer.warning {
  color: var(--red);
  animation: timerWarn 1s ease-in-out infinite;
}

@keyframes timerWarn {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

#score {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.score-attack  { color: var(--cyan); }
.score-defense { color: var(--red); }

.score-divider {
  width: 2px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 1px;
  display: inline-block;
}

#phase-text {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ============================================================
   5. SCOREBOARD  (Tab key)
   ============================================================ */
#scoreboard {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  display: none;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-width: 640px;
  max-width: 900px;
  width: 90%;
  overflow: hidden;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

#scoreboard h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

#scoreboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#scoreboard th {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

#scoreboard td {
  padding: 10px 14px;
  text-align: left;
  color: var(--text-secondary);
  transition: background var(--transition);
}

#scoreboard tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Team color coding */
#scoreboard .team-attack td.player-name   { color: var(--cyan); font-weight: 600; }
#scoreboard .team-defense td.player-name  { color: var(--red); font-weight: 600; }
#scoreboard .team-attack td:first-child   { border-left: 3px solid var(--cyan); }
#scoreboard .team-defense td:first-child  { border-left: 3px solid var(--red); }

#scoreboard td.money-col {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.8rem;
}

#scoreboard td.score-col {
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   6. ROUND RESULTS
   ============================================================ */
#round-result {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 70;
}

#round-result.show {
  opacity: 1;
  animation: roundResultIn 0.5s ease-out;
}

@keyframes roundResultIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.15); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#round-result.attack-win {
  color: var(--cyan);
  text-shadow: 0 0 40px rgba(0, 212, 255, 0.6), 0 0 100px rgba(0, 212, 255, 0.3);
}

#round-result.defense-win {
  color: var(--red);
  text-shadow: 0 0 40px rgba(255, 51, 51, 0.6), 0 0 100px rgba(255, 51, 51, 0.3);
}

/* ============================================================
   7. GAME OVER
   ============================================================ */
#game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 80;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.game-over-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
}

.game-over-score {
  display: flex;
  align-items: center;
  gap: 28px;
}

.game-over-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.game-over-team-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.game-over-team-label.attack  { color: var(--cyan); }
.game-over-team-label.defense { color: var(--red); }

.game-over-team-value {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
}

.game-over-divider {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-muted);
}

/* MVP Highlight */
.mvp-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 24px 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--gold-glow);
}

.mvp-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: var(--gold);
  padding: 4px 12px;
  border-radius: 2px;
}

.mvp-name {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
}

.mvp-stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============================================================
   8. SETTINGS
   ============================================================ */
#settings {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.settings-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
}

.settings-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.settings-label {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.settings-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--cyan);
  min-width: 48px;
  text-align: right;
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
  cursor: pointer;
  transition: box-shadow var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.7);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
  cursor: pointer;
}

/* Crosshair preview (settings) */
.crosshair-preview {
  width: 120px;
  height: 120px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  margin: 16px auto;
}

/* Color picker row */
.settings-color-row {
  display: flex;
  gap: 8px;
}

.settings-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}

.settings-color-swatch.selected {
  border-color: #fff;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   9. DEATH SCREEN
   ============================================================ */
#death-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(60, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 40;
  backdrop-filter: blur(2px);
}

#death-screen h2 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--red);
  text-shadow: 0 0 30px rgba(255, 51, 51, 0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#death-screen p {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

/* ============================================================
   10. DAMAGE / FLASH OVERLAYS
   ============================================================ */
#damage-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 5;
  box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.5);
  background: transparent;
}

#damage-flash.active {
  opacity: 1;
}

#flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 6;
}

/* ============================================================
   11. MUZZLE FLASH
   ============================================================ */
#muzzle-flash {
  position: absolute;
  bottom: 80px;
  right: 200px;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(255,255,100,0.9) 0%, rgba(255,140,0,0.6) 40%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

/* ============================================================
   12. INTERACTION PROMPT
   ============================================================ */
#interact-prompt {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(245, 200, 66, 0.4);
  letter-spacing: 0.06em;
  display: none;
  z-index: 11;
  pointer-events: none;
}

/* ============================================================
   13. LOADING SCREEN
   ============================================================ */
#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--bg-deep);
}

.loading-bar-track {
  width: 320px;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--cyan);
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--cyan);
}

.loading-text {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================================
   14. NOTIFICATION / TOAST
   ============================================================ */
.toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  pointer-events: none;
  animation: toastIn 0.3s ease-out, toastOut 0.4s ease-in 2.5s forwards;
}

@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(-16px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(-50%) translateY(-12px); } }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  #minimap {
    width: 120px;
    height: 120px;
  }

  #abilities {
    gap: 6px;
  }

  .ability-box {
    width: 44px;
    height: 44px;
  }

  #hp-text {
    font-size: 1.5rem;
  }

  #ammo-current {
    font-size: 2rem;
  }

  #agent-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .buy-categories {
    width: 140px;
  }

  .buy-weapons {
    padding: 16px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  #scoreboard {
    min-width: 95%;
  }

  #scoreboard th,
  #scoreboard td {
    padding: 8px 8px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  #title-screen h1 {
    font-size: 3.5rem;
    letter-spacing: 0.08em;
  }

  #minimap {
    width: 90px;
    height: 90px;
  }

  #hp-area {
    min-width: 180px;
  }
}

/* Kill Streak Announcement */
#kill-streak-announce {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display, Arial, sans-serif);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  text-align: center;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  text-shadow: 0 0 20px currentColor, 0 2px 8px rgba(0,0,0,0.8);
}

/* Hit Marker */
#hit-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 15;
  font-size: 18px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.05s;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

/* DM Leaderboard */
#dm-leaderboard {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid #4ff4;
  border-radius: 8px;
  padding: 16px 24px;
  z-index: 55;
  min-width: 300px;
  pointer-events: none;
  font-family: Arial, sans-serif;
  color: #ccc;
  font-size: 13px;
}
