* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; color: #e8e8e8;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
.hidden { display: none !important; }

/* ---------- overlays / menus ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(20,24,28,.75), rgba(0,0,0,.92)); z-index: 20; padding: 16px; }
#click-start, #pause { background: rgba(0,0,0,.55); cursor: pointer; }
.panel { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: rgba(14,16,18,.92);
  border: 1px solid #2c3136; border-top: 3px solid #d9a21b; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.small-panel { width: min(440px, 100%); text-align: center; }
h1 { font-family: "Black Ops One", "Segoe UI", sans-serif; font-size: 36px; letter-spacing: 3px; font-weight: 400; }
h1 span { color: #d9a21b; }
h2 { font-size: 14px; letter-spacing: 2px; color: #d9a21b; margin: 18px 0 8px; text-transform: uppercase; }
.small-panel h2 { font-size: 22px; margin: 0 0 10px; }
.tag { color: #8a9299; font-size: 13px; margin: 4px 0 18px; letter-spacing: 1px; }
label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #b9c0c6; margin: 8px 0; }
label input[type=range] { flex: 1; accent-color: #d9a21b; }
label span { width: 38px; text-align: right; color: #fff; }
input, textarea, select { background: #0a0b0c; color: #fff; border: 1px solid #3a4046; padding: 9px 10px; font: inherit; font-size: 14px; }
#name { flex: 1; }
textarea { width: 100%; height: 86px; resize: none; font-family: Consolas, monospace; font-size: 11px; word-break: break-all; }
button { background: #23282d; color: #fff; border: 1px solid #3a4046; padding: 11px 18px; font: inherit; font-weight: 700;
  letter-spacing: 1.5px; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover { background: #2f363c; border-color: #d9a21b; }
button.primary { background: #d9a21b; color: #111; border-color: #d9a21b; }
button.primary:hover { background: #f0b52a; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.small-panel .btns { justify-content: center; }
.btns button { flex: 1; min-width: 120px; }
.settings { margin-top: 22px; border-top: 1px solid #2c3136; padding-top: 12px; }
#status { margin-top: 14px; font-size: 13px; color: #9fb3c4; min-height: 18px; }
#status.err { color: #ff6b5b; }
.small { font-size: 12px; color: #8a9299; margin-top: 10px; }
.controls { margin-top: 18px; font-size: 12px; color: #9aa2a8; line-height: 1.9; }
.controls b { color: #fff; background: #23282d; padding: 1px 6px; border-radius: 2px; }
#end-title { margin-bottom: 8px; }
.credit { margin-top: 16px; padding-top: 12px; border-top: 1px solid #2c3136; font-size: 12px; color: #8a9299; letter-spacing: .5px; }
.credit a { color: #d9a21b; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
#end-score { font-size: 20px; margin-bottom: 8px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
#vignette { position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(120,0,0,0) 35%, rgba(150,0,0,.55) 80%, rgba(90,0,0,.9) 100%); }
#dmgdir { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; opacity: 0; }
#dmgdir::before { content: ""; position: absolute; left: 50%; top: 0; width: 90px; height: 26px; margin-left: -45px;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,40,30,.9), rgba(255,0,0,0) 70%); border-radius: 50% 50% 0 0; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transition: opacity .1s; }
#crosshair .ch { position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { width: 9px; height: 2px; top: -1px; }
#crosshair .dot { position: absolute; width: 2px; height: 2px; left: -1px; top: -1px; background: #fff; opacity: .7; }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
#hitmarker i { position: absolute; width: 2px; height: 9px; background: #fff; box-shadow: 0 0 2px #000; left: -1px; top: -4.5px; }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateY(-11px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateY(-11px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateY(-11px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateY(-11px); }
#hitmarker.kill i { background: #ff3b30; }

#score { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.08); }
#score .side { display: flex; align-items: center; gap: 10px; padding: 6px 14px; font-size: 28px; font-weight: 800; min-width: 120px; }
#score .side .lbl { font-size: 12px; letter-spacing: 2px; font-weight: 700; opacity: .85; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#score .you { background: linear-gradient(90deg, rgba(40,120,220,.0), rgba(40,120,220,.45)); justify-content: flex-end; color: #9fd0ff; }
#score .enemy { background: linear-gradient(90deg, rgba(220,50,40,.45), rgba(220,50,40,0)); color: #ffaaa2; }
#score .mid { padding: 6px 14px; text-align: center; }
#timer { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
#limit { font-size: 10px; letter-spacing: 2px; opacity: .7; }

#minimap { position: absolute; top: 16px; left: 16px; width: 180px; height: 180px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); }
#killfeed { position: absolute; top: 16px; right: 16px; text-align: right; font-size: 14px; }
#killfeed div { background: rgba(0,0,0,.45); padding: 4px 10px; margin-bottom: 4px; animation: kf 5s forwards; }
#killfeed .y { color: #8fc6ff; } #killfeed .e { color: #ff8b80; } #killfeed .w { color: #ccc; margin: 0 8px; font-size: 12px; }
@keyframes kf { 0%, 85% { opacity: 1 } 100% { opacity: 0 } }
#netinfo { position: absolute; top: 205px; left: 16px; font-size: 11px; color: #aab; opacity: .8; font-family: Consolas, monospace; }

#ammo { position: absolute; right: 28px; bottom: 26px; text-align: right; }
#wname { font-size: 13px; letter-spacing: 2px; opacity: .85; }
#mag { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
#mag.low { color: #ff5d4d; }
#ammo .sep { font-size: 26px; opacity: .5; margin: 0 4px; }
#reserve { font-size: 22px; opacity: .8; font-variant-numeric: tabular-nums; }
#hint { font-size: 13px; color: #ffd86b; height: 18px; letter-spacing: 1px; }
#hpbar { position: absolute; left: 28px; bottom: 30px; width: 220px; height: 6px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.15); }
#hpfill { height: 100%; width: 100%; background: #e8e8e8; transition: width .15s; }
#hpfill.low { background: #ff4a3a; }

#center-msg { position: absolute; top: 34%; width: 100%; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 3px; }
#sub-msg { position: absolute; top: calc(34% + 44px); width: 100%; text-align: center; font-size: 16px; letter-spacing: 1px; color: #ffd86b; }
#enemy-tag { position: absolute; top: calc(50% - 46px); width: 100%; text-align: center; font-size: 14px; font-weight: 700; color: #ff5040; opacity: 0; letter-spacing: 1px; }
#hud.dead #crosshair, #hud.dead #ammo { opacity: 0; }

@media (max-width: 700px) {
  #minimap { width: 110px; height: 110px; }
  #netinfo { top: 132px; }
  #score .side { min-width: 70px; font-size: 20px; padding: 4px 8px; }
}

/* ---------------- grenades */
#nades { position: absolute; right: 30px; bottom: 112px; display: flex; gap: 14px; align-items: center; font-weight: 700; }
#nades .nade { display: flex; align-items: center; gap: 5px; font-size: 18px; transition: opacity .2s; }
#nades .nade.empty { opacity: .28; }
#nades .nade.held b { color: #ffd34d; }
#nades .key { font-size: 10px; padding: 1px 4px; border: 1px solid rgba(255,255,255,.45); border-radius: 3px; opacity: .75; }
#nades .ico { display: inline-block; width: 13px; height: 17px; }
#nades .ico.frag { background: #6d7a52; border-radius: 50% 50% 46% 46%; box-shadow: inset -3px -3px 0 rgba(0,0,0,.35); position: relative; }
#nades .ico.frag::after { content: ''; position: absolute; left: 4px; top: -4px; width: 5px; height: 5px; background: #aaa; }
#nades .ico.flash { width: 9px; background: #a7aca4; border-radius: 2px; box-shadow: inset 0 -5px 0 rgba(0,0,0,.3); }
#cook { position: absolute; right: 0; bottom: 30px; font-size: 13px; color: #ffd34d; letter-spacing: 1px; white-space: nowrap; }
#cook.danger { color: #ff4a3a; }

/* flashbang: white-out plus a burned-in afterimage of what you were looking at */
#flashout { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 12; }
#afterimage { position: fixed; inset: 0; width: 100vw; height: 100vh; opacity: 0; pointer-events: none; z-index: 11; filter: grayscale(.6) brightness(1.6) contrast(.8); }
#hud.dead #nades { opacity: 0; }
#pause-settings { text-align: left; cursor: default; }

/* ---------------- loading screen */
#loader { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(60,56,46,.35), rgba(0,0,0,0) 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 2px, rgba(0,0,0,0) 2px 4px),
    #101113;
  transition: opacity .6s ease; }
#loader.out { opacity: 0; pointer-events: none; }
.ld-inner { width: min(820px, 100%); }
#ld-logo { display: block; width: 100%; height: auto; }
.ld-bar { margin: 26px auto 0; width: min(560px, 100%); height: 12px; border: 1px solid #3a4046; background: rgba(0,0,0,.5); padding: 2px; }
#ld-fill { height: 100%; width: 0; background: repeating-linear-gradient(-45deg, #d9a21b 0 10px, #b07f10 10px 20px);
  background-size: 28px 28px; animation: ld-stripes .8s linear infinite; }
@keyframes ld-stripes { to { background-position: 28px 0; } }
.ld-meta { width: min(560px, 100%); margin: 8px auto 0; display: flex; justify-content: space-between;
  font-family: "Black Ops One", Impact, sans-serif; font-size: 14px; letter-spacing: 2px; color: #cfc7ae; }
#ld-pct { color: #d9a21b; font-variant-numeric: tabular-nums; }
#ld-tip { width: min(560px, 100%); margin: 18px auto 0; text-align: center; font-size: 13px; color: #8a9299; min-height: 36px; line-height: 1.4; }
#loader.failed #ld-label { color: #ff5d4d; }
#loader.failed #ld-fill { background: #7a2b20; animation: none; }
#loader.failed #ld-tip { color: #ff8b80; }
