* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; font-family: 'Segoe UI', system-ui, sans-serif; color: #fff; user-select: none; }
canvas { display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; display: none; }
#hud.on { display: block; }
.txt { text-shadow: 0 2px 4px rgba(0,0,0,.6); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; transition: transform .05s; }
#crosshair i:nth-child(1), #crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; }
#crosshair i:nth-child(3), #crosshair i:nth-child(4) { width: 8px; height: 2px; top: -1px; }
#crosshair i:nth-child(1) { top: calc(-8px - var(--g, 5px)); }
#crosshair i:nth-child(2) { top: var(--g, 5px); }
#crosshair i:nth-child(3) { left: calc(-8px - var(--g, 5px)); }
#crosshair i:nth-child(4) { left: var(--g, 5px); }
#crosshair.hide { display: none; }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: 0;
  background:
    linear-gradient(45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px);
  color: #fff; transition: opacity .15s; }
#hitmarker.show { opacity: 1; transition: none; }
#hitmarker.head { color: #ff4040; }

#scope { position: absolute; inset: 0; display: none;
  background: radial-gradient(circle at center, transparent 0, transparent 34vh, #000 34.3vh),
    linear-gradient(#000, #000) center/100% 1px no-repeat, linear-gradient(#000, #000) center/1px 100% no-repeat; }
#scope.on { display: block; }

#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(200,0,0,.65) 100%); transition: opacity .4s; }
#dmgdir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; opacity: 0; transition: opacity .6s;
  border-top: 8px solid rgba(255,40,40,.85); border-radius: 50%; }

#top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#timer { display: block; font-size: 28px; font-weight: 800; background: rgba(0,0,0,.35); padding: 2px 16px; border-radius: 6px; }
#leader { display: block; font-size: 13px; margin-top: 4px; text-shadow: 0 1px 3px #000; }

#killfeed { position: absolute; top: 14px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
#killfeed div { background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 4px; font-size: 14px; font-weight: 600; transition: opacity .5s; }
#killfeed .me { background: rgba(230,120,30,.6); }
#killfeed .hs { color: #ff6b6b; }
#ping { position: absolute; top: 14px; left: 16px; font-size: 12px; opacity: .8; text-shadow: 0 1px 2px #000; }

#bottomleft { position: absolute; left: 24px; bottom: 24px; }
#hpnum { font-size: 40px; font-weight: 800; text-shadow: 0 2px 4px #000; }
#hpbar { width: 260px; height: 14px; background: rgba(0,0,0,.45); border-radius: 7px; overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); transition: width .1s; }
#hpfill.low { background: linear-gradient(90deg, #f87171, #dc2626); }

#bottomright { position: absolute; right: 24px; bottom: 24px; text-align: right; text-shadow: 0 2px 4px #000; }
#wname { font-size: 16px; opacity: .85; }
#ammo { font-size: 22px; }
#ammo b { font-size: 44px; }
#reloadmsg { font-size: 15px; color: #fde047; height: 20px; }

#death, #endscreen { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); text-align: center; display: none;
  background: rgba(0,0,0,.5); padding: 20px 40px; border-radius: 10px; }
#death h2 { color: #ff6b6b; font-size: 32px; }
#endscreen h2 { color: #fde047; font-size: 36px; }
#death p, #endscreen p { margin-top: 6px; font-size: 18px; }
#death.on, #endscreen.on { display: block; }

#scoreboard { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 440px; display: none;
  background: rgba(15,20,30,.85); padding: 18px 22px; border-radius: 10px; }
#scoreboard.on { display: block; }
#scoreboard h3 { margin-bottom: 10px; text-align: center; }
#scoreboard table { width: 100%; border-collapse: collapse; }
#scoreboard th, #scoreboard td { padding: 5px 10px; text-align: left; }
#scoreboard th:not(:first-child), #scoreboard td:not(:first-child) { text-align: center; }
#scoreboard tr.me td { color: #fdba74; font-weight: 700; }
#scoreboard tbody tr:nth-child(odd) { background: rgba(255,255,255,.05); }

#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,14,22,.55); backdrop-filter: blur(3px); }
#menu.off { display: none; }
.panel { width: 420px; background: rgba(20,26,38,.92); border-radius: 14px; padding: 30px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel h1 { font-size: 38px; letter-spacing: 2px; }
.panel h1 span { color: #fb923c; }
.sub { opacity: .7; margin-bottom: 18px; }
#nick { width: 100%; padding: 12px; font-size: 18px; border-radius: 8px; border: 2px solid #334155; background: #0f172a; color: #fff; outline: none; text-align: center; }
#nick:focus { border-color: #fb923c; }
.panel label { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 14px 0; font-size: 14px; }
#play { width: 100%; padding: 14px; font-size: 22px; font-weight: 800; border: 0; border-radius: 8px; background: #fb923c; color: #1a1a1a; cursor: pointer; }
#play:hover { background: #fdba74; }
#play:disabled { background: #555; cursor: default; }
#status { margin-top: 10px; font-size: 13px; opacity: .75; min-height: 18px; }
.controls { margin-top: 16px; font-size: 12.5px; line-height: 1.8; opacity: .75; }
.controls b { color: #fdba74; }
