:root {
  --accent: #29e3ff;
  --accent2: #ff6a1a;
  --danger: #ff3040;
  --panel: rgba(8, 10, 18, 0.78);
  --line: rgba(120, 220, 255, 0.35);
  --text: #e8f4ff;
  --dim: #8aa0b8;
  --hud-font: 'Orbitron', 'Rajdhani', system-ui, sans-serif;
  --body-font: 'Rajdhani', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--body-font); user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#game.freemouse { cursor: crosshair; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; font-family: var(--hud-font); text-shadow: 0 0 6px rgba(0, 0, 0, 0.8); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair div { position: absolute; background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 3px rgba(0, 0, 0, 0.9); transition: transform 0.05s; }
#crosshair .ch-dot { width: 3px; height: 3px; left: -1.5px; top: -1.5px; border-radius: 50%; }
#crosshair .ch-l, #crosshair .ch-r { width: 9px; height: 2px; top: -1px; }
#crosshair .ch-t, #crosshair .ch-b { width: 2px; height: 9px; left: -1px; }
#crosshair .ch-l { left: calc(-9px - var(--gap, 6px)); }
#crosshair .ch-r { left: var(--gap, 6px); }
#crosshair .ch-t { top: calc(-9px - var(--gap, 6px)); }
#crosshair .ch-b { top: var(--gap, 6px); }
#crosshair.melee .ch-l, #crosshair.melee .ch-r, #crosshair.melee .ch-t, #crosshair.melee .ch-b { opacity: 0.35; }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; opacity: 0; }
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; left: 14px; top: 0; width: 2px; height: 30px; background: #fff; box-shadow: 0 0 4px #000; transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.kill::before, #hitmarker.kill::after { background: #ff3030; }
#hitmarker.head::before, #hitmarker.head::after { background: #ffd020; }
#dmg-ind { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.dmg-arc { position: absolute; width: 220px; height: 220px; left: -110px; top: -110px; border-radius: 50%; border: 8px solid transparent; border-top-color: rgba(255, 30, 30, 0.85); filter: drop-shadow(0 0 6px red); transition: opacity 0.6s; }

#top-center { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); text-align: center; }
#timer { font-size: 26px; font-weight: 700; letter-spacing: 2px; padding: 4px 16px; background: var(--panel); border: 1px solid var(--line); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%); }
#goal { font-size: 11px; color: var(--dim); margin-top: 3px; letter-spacing: 2px; }
#team-scores { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.ts { min-width: 70px; padding: 3px 10px; font-size: 22px; font-weight: 900; }
.ts.red { background: rgba(255, 40, 40, 0.55); }
.ts.blue { background: rgba(40, 110, 255, 0.55); }

#top-right { position: absolute; top: 16px; right: 22px; text-align: right; }
#frags { font-size: 44px; font-weight: 900; line-height: 1; color: #fff; }
#frags .lbl { font-size: 12px; margin-left: 6px; color: var(--accent); letter-spacing: 2px; }
#rank { font-size: 16px; color: var(--accent); margin-top: 2px; }
#spread { font-size: 13px; color: var(--dim); }

#killfeed { position: absolute; top: 120px; right: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-family: var(--body-font); font-weight: 700; font-size: 17px; }
.kf { background: rgba(0, 0, 0, 0.55); padding: 2px 10px; border-left: 3px solid var(--accent2); animation: kfin 0.2s ease-out; }
.kf .w { color: #ffd070; margin: 0 8px; font-family: var(--hud-font); font-size: 12px; }
.kf.me { border-left-color: var(--accent); background: rgba(20, 60, 80, 0.7); }
@keyframes kfin { from { transform: translateX(40px); opacity: 0; } }

#voice-list { position: absolute; top: 16px; left: 18px; font-family: var(--body-font); font-weight: 700; font-size: 16px; }
.vt { background: rgba(0, 0, 0, 0.5); padding: 2px 10px; margin-bottom: 3px; border-left: 3px solid #40ff80; }
.vt.team { border-left-color: #40a0ff; }

#center-msg { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); text-align: center; width: 90vw; }
#ann { font-size: 52px; font-weight: 900; letter-spacing: 3px; color: #fff; text-shadow: 0 0 18px var(--accent2), 0 0 4px #000; opacity: 0; transition: opacity 0.3s; }
#ann.show { opacity: 1; animation: annpop 0.35s ease-out; }
#ann.small { font-size: 30px; text-shadow: 0 0 14px var(--accent), 0 0 4px #000; }
#ann-sub { font-size: 18px; color: var(--accent); margin-top: 6px; font-family: var(--body-font); font-weight: 700; letter-spacing: 2px; }
@keyframes annpop { from { transform: scale(1.6); opacity: 0; } }
#pickup-msg { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); font-size: 18px; color: #fff; font-family: var(--body-font); font-weight: 700; letter-spacing: 2px; opacity: 0; transition: opacity 0.4s; }
#powerup { position: absolute; bottom: 190px; left: 50%; transform: translateX(-50%); font-size: 20px; color: #d080ff; text-shadow: 0 0 10px #a040ff; }

#bl { position: absolute; left: 22px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
#doll { position: absolute; left: 262px; bottom: 2px; width: 66px; height: 110px; filter: drop-shadow(0 0 4px rgba(0,0,0,0.9)); }
#doll .lp { fill: rgba(41, 227, 255, 0.55); stroke: rgba(150, 240, 255, 0.9); stroke-width: 1.2; transition: fill 0.2s; }
#doll .lp.hurt { fill: rgba(255, 190, 40, 0.75); stroke: #ffd060; }
#doll .lp.crit { fill: rgba(255, 70, 40, 0.85); stroke: #ff8060; }
#doll .lp.gone { fill: rgba(140, 0, 0, 0.25); stroke: #ff2020; stroke-dasharray: 3 2; }
.stat { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); padding: 4px 14px 4px 10px; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 100%, 0 100%); min-width: 240px; }
.stat .icon { font-size: 26px; color: var(--accent); width: 28px; text-align: center; }
.stat.armor .icon { color: #ffc020; }
.stat .val { font-size: 40px; font-weight: 900; min-width: 82px; }
.stat .bar { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.1); }
.stat .bar div { height: 100%; background: linear-gradient(90deg, var(--accent), #7ff); width: 100%; transition: width 0.15s; }
.stat.armor .bar div { background: linear-gradient(90deg, #ffa010, #ffe060); }
.stat.low .val { color: var(--danger); animation: blink 0.6s infinite; }
.stat.low .bar div { background: var(--danger); }
.stat.over .val { color: #7fd0ff; }
@keyframes blink { 50% { opacity: 0.45; } }
#br { position: absolute; right: 22px; bottom: 20px; text-align: right; background: var(--panel); border: 1px solid var(--line); padding: 6px 16px 4px 26px; clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%); min-width: 220px; }
#wname { font-size: 13px; letter-spacing: 2px; color: var(--accent); }
#ammo { font-size: 46px; font-weight: 900; line-height: 1.05; }
#ammo small { font-size: 22px; color: var(--dim); margin-left: 4px; }
#reload-msg { font-size: 12px; color: #ffd060; letter-spacing: 2px; }
#ammo.low { color: var(--danger); }
#weapon-bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.wslot { width: 54px; height: 46px; background: rgba(8, 10, 18, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); position: relative; font-size: 9px; padding: 3px 4px; color: var(--dim); opacity: 0.35; transition: all 0.12s; }
.wslot .n { position: absolute; top: 2px; left: 4px; font-size: 11px; color: #fff; }
.wslot .k { position: absolute; bottom: 12px; left: 4px; right: 4px; text-align: center; font-size: 9px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; }
.wslot .a { position: absolute; bottom: 3px; left: 4px; right: 4px; height: 4px; background: rgba(255, 255, 255, 0.12); }
.wslot .a div { height: 100%; background: var(--c, var(--accent)); }
.wslot.own { opacity: 0.85; }
.wslot.cur { opacity: 1; border-color: var(--c, var(--accent)); box-shadow: 0 0 12px var(--c, var(--accent)), inset 0 0 12px rgba(255, 255, 255, 0.08); transform: translateY(-6px); color: #fff; }

#chat { position: absolute; left: 22px; bottom: 150px; width: 520px; font-family: var(--body-font); font-weight: 600; font-size: 17px; }
.cl { background: rgba(0, 0, 0, 0.45); padding: 2px 8px; margin-top: 2px; animation: kfin 0.2s; }
.cl .who { color: var(--accent); }
.cl.team .who { color: #40a0ff; }
.cl.sys { color: #ffd070; }
#chat-input-wrap { pointer-events: auto; display: flex; gap: 6px; background: rgba(0, 0, 0, 0.75); border: 1px solid var(--line); padding: 4px 8px; margin-top: 4px; }
#chat-input { flex: 1; background: transparent; border: 0; color: #fff; font: inherit; outline: none; }
#chat-mode { color: var(--accent); }

#death { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); text-align: center; }
#death .d1 { font-size: 64px; font-weight: 900; color: var(--danger); letter-spacing: 6px; text-shadow: 0 0 20px #f00; }
#death-by { font-size: 22px; font-family: var(--body-font); font-weight: 700; margin-top: 6px; }
#death .d2 { font-size: 14px; color: var(--dim); margin-top: 18px; letter-spacing: 3px; animation: blink 1.2s infinite; }

#scoreboard { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); min-width: 640px; background: rgba(6, 8, 14, 0.88); border: 1px solid var(--line); padding: 18px 24px; font-family: var(--body-font); }
#scoreboard h3 { font-family: var(--hud-font); margin: 0 0 10px; letter-spacing: 3px; color: var(--accent); font-size: 18px; display: flex; justify-content: space-between; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 19px; font-weight: 700; }
#scoreboard th { text-align: left; color: var(--dim); font-size: 13px; letter-spacing: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
#scoreboard td { padding: 4px 8px; }
#scoreboard tr.me td { background: rgba(41, 227, 255, 0.14); }
#scoreboard .sw { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 2px; }
#scoreboard .winner { text-align: center; font-family: var(--hud-font); font-size: 28px; color: #ffd060; margin-bottom: 12px; text-shadow: 0 0 14px #ff9020; }
#fps { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #9f9; font-family: monospace; top: 70px; }
#talking { position: absolute; bottom: 120px; left: 22px; color: #40ff80; font-size: 14px; letter-spacing: 2px; animation: blink 1s infinite; }

#lockprompt { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--hud-font); font-size: 34px; letter-spacing: 6px; color: #fff; text-shadow: 0 0 20px var(--accent); background: rgba(0, 0, 0, 0.25); cursor: pointer; }
#lockprompt small { font-size: 13px; color: var(--dim); margin-top: 10px; letter-spacing: 3px; }

/* ----------------------------------------------------------- MENUS */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.82)); overflow-y: auto; padding: 24px 16px; }
#menu.ingame { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.logo { text-align: center; margin-bottom: 26px; font-family: var(--hud-font); font-weight: 900; line-height: 0.9; filter: drop-shadow(0 0 22px rgba(255, 90, 20, 0.5)); }
.logo .l1, .logo .l2 { font-size: clamp(48px, 9vw, 110px); letter-spacing: 6px; }
.logo .l1 { background: linear-gradient(180deg, #fff, #ffb070 55%, #ff4a10); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .l2 { background: linear-gradient(180deg, #fff, #7ff 55%, #1a8aff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .tag { font-size: 14px; letter-spacing: 12px; color: var(--dim); margin-top: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 22px 28px; min-width: min(560px, 100%); max-width: 860px; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(41, 227, 255, 0.05); clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); }
.panel h2 { font-family: var(--hud-font); letter-spacing: 4px; margin: 0 0 16px; color: var(--accent); font-size: 22px; }
.panel h3 { font-family: var(--hud-font); letter-spacing: 3px; color: var(--accent2); font-size: 13px; margin: 18px 0 8px; }
.main-buttons { display: flex; flex-direction: column; gap: 10px; min-width: 340px; }
button { font-family: var(--hud-font); font-weight: 700; letter-spacing: 3px; font-size: 14px; color: var(--text); background: linear-gradient(180deg, rgba(41, 227, 255, 0.12), rgba(41, 227, 255, 0.03)); border: 1px solid var(--line); padding: 12px 22px; cursor: pointer; transition: all 0.12s; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
button:hover { background: rgba(41, 227, 255, 0.28); border-color: var(--accent); color: #fff; text-shadow: 0 0 8px var(--accent); }
button.big { font-size: 20px; padding: 16px 22px; }
button.primary { background: linear-gradient(180deg, rgba(255, 106, 26, 0.6), rgba(255, 60, 10, 0.3)); border-color: var(--accent2); }
button.primary:hover { background: rgba(255, 106, 26, 0.85); text-shadow: 0 0 8px #fff; }
button.danger { border-color: var(--danger); background: rgba(255, 40, 60, 0.18); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 18px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; letter-spacing: 1px; color: var(--dim); }
label span { color: #fff; font-family: var(--hud-font); font-size: 12px; }
input, select { font-family: var(--body-font); font-size: 16px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); padding: 6px 8px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
.row { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; }
#room-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.room { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.room .info { font-size: 16px; font-weight: 700; }
.room .meta { font-size: 13px; color: var(--dim); }
.room button { padding: 8px 16px; font-size: 12px; }
.empty { color: var(--dim); padding: 8px 0; }
#mp-status { color: var(--dim); margin-bottom: 10px; font-size: 15px; }
#share-hint { margin-top: 12px; font-size: 14px; color: var(--dim); line-height: 1.4; }
#share-hint code { color: var(--accent); background: rgba(0, 0, 0, 0.5); padding: 1px 6px; user-select: text; }
table.keys { width: 100%; border-collapse: collapse; font-size: 16px; }
table.keys td { padding: 5px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
table.keys td:nth-child(odd) { color: var(--accent); font-family: var(--hud-font); font-size: 12px; white-space: nowrap; }
#arsenal { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ars { padding: 8px 10px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--c); font-size: 14px; }
.ars b { font-family: var(--hud-font); font-size: 12px; letter-spacing: 1px; color: #fff; display: block; margin-bottom: 2px; }
#mic-meter { height: 8px; background: rgba(255, 255, 255, 0.08); margin-top: 10px; }
#mic-meter div { height: 100%; width: 0; background: #40ff80; transition: width 0.05s; }
#menu-foot { position: fixed; bottom: 8px; right: 12px; font-size: 12px; color: rgba(255, 255, 255, 0.3); }
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.85); font-family: var(--hud-font); letter-spacing: 4px; z-index: 50; }
.spinner { width: 54px; height: 54px; border: 3px solid rgba(41, 227, 255, 0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); max-width: min(720px, 92vw); text-align: center; background: rgba(10, 12, 20, 0.92); border: 1px solid var(--line); padding: 10px 18px; font-size: 16px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 60; }
#toast.show { opacity: 1; }

@media (max-width: 1560px) {
  #weapon-bar { bottom: 132px; transform: translateX(-50%) scale(0.85); }
  #pickup-msg { bottom: 195px; }
  #chat { bottom: 200px; }
}
@media (max-width: 700px) {
  #weapon-bar { display: none; }
  .stat { min-width: 160px; }
  .stat .val { font-size: 28px; min-width: 56px; }
  #ammo { font-size: 32px; }
  #chat { width: 70vw; }
  #scoreboard { min-width: 92vw; }
}
