:root {
  --hud: rgba(255, 178, 40, 0.92);
  --hud-dim: rgba(255, 178, 40, 0.5);
  --panel: rgba(58, 66, 52, 0.95);
  --panel-2: rgba(76, 88, 68, 0.98);
  --line: #8b9a7b;
  --text: #e1e7d8;
  --muted: #aab49e;
  --t: #f0b44c;
  --ct: #86b6ff;
  --red: #ff4b3a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text);
  font-family: Verdana, Tahoma, "Segoe UI", sans-serif; font-size: 14px; user-select: none;
}
#game canvas { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.muted a { color: var(--hud); }

/* ------------------------------------------------ панели */
.panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6); padding: 20px 24px; min-width: 360px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px); overflow: auto; z-index: 20;
}
.panel h1 { margin: 0 0 6px; font-size: 34px; letter-spacing: 3px; color: #f3f6ee; }
.panel h1 .v { color: var(--hud); }
.panel h2 { margin: 0 0 14px; font-size: 18px; color: #f3f6ee; letter-spacing: 1px; }
.panel h3 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.panel label { display: block; margin: 14px 0; color: var(--muted); font-size: 12px; }
.panel input[type=text], .panel input:not([type]) {
  display: block; width: 100%; margin-top: 6px; padding: 9px 10px; font: inherit; font-size: 15px;
  background: #262c22; color: var(--text); border: 1px solid var(--line); outline: none;
}
.panel input[type=range] { width: 100%; margin-top: 6px; accent-color: #c9d6b6; }
button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
button:hover:not(:disabled) { background: #8b9a7b; color: #11140f; }
button:disabled { opacity: 0.4; cursor: default; }
button.big { width: 100%; padding: 12px; font-size: 16px; text-align: center; letter-spacing: 2px; text-transform: uppercase; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > button { flex: 1; text-align: center; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.controls b { color: var(--text); }
.credits { margin: 14px 0 0; font-size: 11px; color: var(--muted); opacity: 0.8; }

#join { width: 560px; }
.avpick { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0 12px; }
#av-cur { width: 72px; height: 72px; border: 2px solid var(--hud); object-fit: cover; background: #222; flex: none; }
.av-side { flex: 1; min-width: 0; }
#av-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin: 5px 0 6px; }
#av-grid img { width: 100%; aspect-ratio: 1; cursor: pointer; border: 2px solid transparent; display: block; }
#av-grid img:hover { border-color: rgba(255, 178, 40, 0.6); }
#av-grid img.on { border-color: var(--hud); }
.av-btns { display: flex; gap: 8px; align-items: stretch; }
.av-btns > * { height: 28px; margin: 0; display: inline-flex; align-items: center; }
.av-btns button, .av-file { font-size: 12px; padding: 4px 10px; cursor: pointer; }
.av-file { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.av-file input { display: none; }

#teammenu { width: 520px; }
#teammenu .teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#teammenu .teams button { padding: 18px; font-size: 16px; text-align: center; }
#teammenu .teams button small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
#teammenu .teams .tbtn { border-color: #b98a3a; }
#teammenu .teams .ctbtn { border-color: #5b80b8; }

#buymenu { width: min(1180px, calc(100vw - 32px)); padding: 18px 20px 14px; }
#buymenu .bm-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
#buymenu .bm-head h2 { margin: 0; letter-spacing: 2px; text-transform: uppercase; }
#buymenu .money { color: #9fe39f; font-weight: bold; font-size: 20px; }
#buymenu .bm-body { display: flex; gap: 14px; align-items: stretch; }
#buymenu .bm-grid { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 8px; align-items: start; }
#buymenu .bm-col { display: flex; flex-direction: column; gap: 5px; }
#buymenu .bm-ch { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 2px 2px 4px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
#buymenu .bm-ch .k, #buymenu .bm-tile .k { color: var(--hud); font-weight: bold; margin-right: 6px; }
#buymenu .bm-col.sel .bm-ch { color: var(--hud); border-color: var(--hud); }
#buymenu .bm-tile { position: relative; display: grid; grid-template-rows: 34px auto; grid-template-columns: 1fr auto; gap: 2px 6px;
  padding: 6px 8px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(139, 154, 123, 0.45); }
#buymenu .bm-tile img, #buymenu .bm-tile i { grid-column: 1 / 3; width: 100%; height: 34px; object-fit: contain; opacity: 0.92; }
#buymenu .bm-tile .k { position: absolute; left: 6px; top: 4px; font-size: 12px; }
#buymenu .bm-tile .n { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#buymenu .bm-tile .p { font-size: 12px; color: #9fe39f; }
#buymenu .bm-tile:hover { background: rgba(255, 178, 40, 0.16); border-color: var(--hud); color: var(--text); }
#buymenu .bm-tile.no { opacity: 0.55; }
#buymenu .bm-tile.no .p, #buymenu .bm-name .no { color: #e07b6c; }
#buymenu .bm-tile.have { border-color: #9fe39f; }
#buymenu .bm-tile .rf { position: absolute; right: 4px; top: 2px; padding: 0 5px; border-radius: 4px; font-size: 13px; line-height: 18px;
  background: rgba(159, 227, 159, 0.2); color: #9fe39f; cursor: pointer; z-index: 2; }
#buymenu .bm-tile .rf:hover { background: #9fe39f; color: #1a1a1a; }
#buymenu .bm-rf { margin-top: 10px; font-size: 12px; color: #9fe39f; }
#buymenu .bm-side { width: 260px; flex: none; display: flex; flex-direction: column; gap: 8px; }
#buymenu .bm-view { height: 340px; background: radial-gradient(ellipse at 50% 85%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.3) 70%); border: 1px solid rgba(139, 154, 123, 0.45); }
#buymenu .bm-view canvas { display: block; width: 260px; height: 340px; cursor: grab; }
#buymenu .bm-info { min-height: 150px; font-size: 13px; }
#buymenu .bm-name { font-size: 16px; font-weight: bold; color: #f3f6ee; margin-bottom: 4px; display: flex; justify-content: space-between; }
#buymenu .bm-name span { color: #9fe39f; }
#buymenu .bm-desc { color: var(--muted); margin-bottom: 8px; line-height: 1.35; }
#buymenu .bm-stat { display: grid; grid-template-columns: 112px 1fr 58px; gap: 6px; align-items: center; font-size: 11px; margin: 3px 0; }
#buymenu .bm-stat b { height: 6px; background: rgba(0, 0, 0, 0.35); position: relative; }
#buymenu .bm-stat b::after { content: ''; position: absolute; inset: 0; width: calc(var(--k) * 100%); background: var(--hud); }
#buymenu .bm-stat em { font-style: normal; text-align: right; color: var(--text); }
#buymenu .bm-mag { font-size: 12px; margin-top: 6px; color: var(--muted); }
#buymenu .bm-hint { margin-top: 10px; font-size: 12px; }
@media (max-width: 900px) {
  #buymenu .bm-body { flex-direction: column; }
  #buymenu .bm-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  #buymenu .bm-side { width: 100%; flex-direction: row; }
}

#pausemenu { width: 480px; }
#pausemenu .share { padding: 8px 10px; background: #262c22; border: 1px dashed var(--line); font-family: monospace; font-size: 13px; user-select: text; word-break: break-all; }

#lost { text-align: center; }

/* ------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud b, #hud .ico { text-shadow: 0 0 6px rgba(0, 0, 0, 0.6); }

/* прицел настраивается игроком: цвет, длина, толщина, зазор, обводка, точка (см. applyCrosshair в client.js) */
.xh { position: absolute; left: 50%; top: 50%; --gap: 5px; --len: 7px; --th: 2px; --col: #50ff50; --out: 0 0 0 1px rgba(0,0,0,.7); }
.xh i { position: absolute; background: var(--col); box-shadow: var(--out); }
.xh .t, .xh .b { width: var(--th); height: var(--len); left: calc(var(--th) / -2); }
.xh .l, .xh .r { height: var(--th); width: var(--len); top: calc(var(--th) / -2); }
.xh .d { width: var(--th); height: var(--th); left: calc(var(--th) / -2); top: calc(var(--th) / -2); }
.xh .t { top: calc(-1 * (var(--gap) + var(--len))); }
.xh .b { top: var(--gap); }
.xh .l { left: calc(-1 * (var(--gap) + var(--len))); }
.xh .r { left: var(--gap); }
.xh-preview { position: relative; height: 110px; margin: 8px 0 4px; background: linear-gradient(135deg, #8b7a5a, #c9ad7c 55%, #6f8a9c); border: 1px solid var(--line); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 26px; height: 26px; padding: 0; border: 2px solid var(--line); }
.swatches button.on { border-color: #fff; }
.swatches input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--line); background: none; }
.checks label { display: inline-flex; gap: 6px; align-items: center; margin: 4px 14px 4px 0; color: var(--text); font-size: 13px; }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; opacity: 0; transition: opacity 0.15s; }
#hitmarker::before, #hitmarker::after { content: ""; position: absolute; left: 10px; top: 0; width: 2px; height: 22px; background: #fff; }
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.on { opacity: 1; transition: none; }
#hitmarker.hs::before, #hitmarker.hs::after { background: #ff5b4a; }

#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 38vh, #000 38.2vh); }
#scope .h { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #000; }
#scope .v { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #000; }

#blind { position: absolute; inset: 0; background: #fff; opacity: 0; }
#dmgflash { position: absolute; inset: 0; background: radial-gradient(circle, transparent 40%, rgba(200, 0, 0, 0.55)); opacity: 0; }
#dmgdirs { position: absolute; left: 50%; top: 50%; }
#dmgdirs .d { position: absolute; left: -60px; top: -150px; width: 120px; height: 18px; transform-origin: 60px 150px;
  background: radial-gradient(ellipse at center, rgba(255, 40, 30, 0.9), transparent 70%); }

#radar { position: absolute; left: 14px; top: 14px; width: 200px; height: 200px; }
#netinfo { position: absolute; left: 14px; top: 220px; font-size: 11px; color: rgba(255, 255, 255, 0.55); font-family: monospace; }

/* верхняя панель как в CS2: аватарки команд, счёт и время, сколько живых; мёртвым — снаряжение своих */
#top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: flex-start; font-weight: bold; }
#top .t { color: var(--t); }
#top .ct { color: var(--ct); }
.tb-mid { background: rgba(0, 0, 0, 0.45); padding: 3px 12px 4px; border-radius: 3px; text-align: center; }
.tb-sc { display: flex; gap: 12px; align-items: center; font-size: 20px; }
#tb-alive { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: #ddd; margin-top: 1px; }
#tb-alive .vs { color: var(--hud); }
.tb-team { display: flex; gap: 3px; }
.tb-team.t { flex-direction: row-reverse; }
.tp { width: 42px; display: flex; flex-direction: column; align-items: center; }
.tp > img { width: 42px; height: 42px; display: block; object-fit: cover; border: 2px solid var(--pc); border-bottom-width: 4px; background: #222; }
.tp.dead > img { filter: grayscale(1) brightness(0.35); border-color: rgba(120, 120, 120, 0.6); }
.tp.sel > img { outline: 2px solid #fff; outline-offset: 1px; }
.tp.c0 { --pc: #f2d54b; } .tp.c1 { --pc: #b65cf0; } .tp.c2 { --pc: #4ee07a; } .tp.c3 { --pc: #4aa3ff; } .tp.c4 { --pc: #ff9a3c; }
.tp .eq { width: 46px; margin-top: 2px; padding: 2px 0 3px; background: rgba(0, 0, 0, 0.5); font-size: 10px; font-weight: normal;
  color: #ddd; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tp .eq .m { color: #9fe39f; }
.tp .eq img { width: 40px; height: 13px; border: 0; background: none; object-fit: contain; filter: none; }
.tp .eq .g { letter-spacing: 1px; color: #ccc; min-height: 11px; }
.tp.dead .eq { opacity: 0.45; }
.tp.more { width: auto; padding: 0 4px; height: 46px; display: flex; justify-content: center; font-size: 13px; color: #ddd; background: rgba(0, 0, 0, 0.45); }
@media (max-width: 1200px) { .tp, .tp > img { width: 32px; } .tp > img { height: 32px; } .tp .eq { width: 36px; font-size: 9px; } .tp .eq img { width: 32px; } }
#timer { color: var(--hud); min-width: 70px; text-align: center; font-size: 24px; }
#timer.bomb { color: var(--red); animation: blink 0.8s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

#killfeed { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
#killfeed div { background: rgba(0, 0, 0, 0.45); padding: 3px 10px; font-size: 13px; white-space: nowrap; transition: opacity 0.5s; }
#killfeed div.mine { outline: 1px solid rgba(255, 80, 60, 0.8); }
#killfeed .T { color: var(--t); }
#killfeed .CT { color: var(--ct); }
#killfeed .w { color: #ddd; margin: 0 6px; font-size: 11px; }
#killfeed .hs { color: #ff6b5a; font-size: 11px; margin-right: 6px; }
#killfeed div { display: flex; align-items: center; }
#killfeed .wi { height: 22px; margin: 0 8px; filter: drop-shadow(0 0 1px rgba(0,0,0,.8)); transform: scaleX(-1); }   /* иконки нарисованы стволом влево — в ленте ствол на жертву, как в CS */
#killfeed .hsi { margin: 0 6px 0 -2px; }
#killfeed .kfi { margin: 0 3px; flex: none; }
#killfeed .plus { margin: 0 5px; color: #ddd; }
@media (max-width: 1400px) { #killfeed { top: 78px; } }   /* на узком экране — под верхней панелью */

/* плашка урона после убийства / смерти: сколько нанёс ты и сколько тебе */
#roundkills { display: flex; justify-content: flex-end; gap: 3px; min-height: 0; margin-bottom: 4px; }
#roundkills svg { filter: drop-shadow(0 0 2px rgba(0,0,0,.9)); }
.tp .eq .rk { color: #ff8a7a; }
#dmgcard { position: absolute; left: 50%; bottom: 210px; transform: translateX(-50%); min-width: 300px; padding: 10px 14px;
  background: rgba(0, 0, 0, 0.6); border-left: 3px solid var(--hud); font-size: 14px; color: #eee; transition: opacity 0.4s; }
#dmgcard.hidden { display: block; opacity: 0; pointer-events: none; }
#dmgcard.kill { border-left-color: #9fe39f; bottom: 240px; min-width: 260px; }
#dmgcard .dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 15px; }
#dmgcard .dc-head .wi { height: 20px; filter: drop-shadow(0 0 1px rgba(0,0,0,.8)); }
#dmgcard .T { color: var(--t); } #dmgcard .CT { color: var(--ct); }
#dmgcard .dc-row { display: grid; grid-template-columns: 1fr auto 96px; gap: 10px; align-items: baseline; padding: 2px 0; }
#dmgcard .dc-row b { font-size: 17px; text-align: right; }
#dmgcard .dc-row em { font-style: normal; font-size: 12px; color: var(--muted); }
#dmgcard .give b { color: #9fe39f; } #dmgcard .take b { color: #ff8a7a; } #dmgcard .left b { color: var(--hud); }

#center-msg { position: absolute; left: 0; right: 0; top: 24%; text-align: center; font-size: 32px; font-weight: bold;
  color: #fff; text-shadow: 0 2px 10px #000; transition: opacity 0.4s; }
#sub-msg { position: absolute; left: 0; right: 0; top: calc(24% + 48px); text-align: center; font-size: 17px; color: var(--hud); text-shadow: 0 1px 6px #000; }
#hint { position: absolute; left: 0; right: 0; bottom: 120px; text-align: center; font-size: 15px; color: #fff; text-shadow: 0 1px 5px #000; }

#progress { position: absolute; left: 50%; bottom: 170px; width: 320px; margin-left: -160px; height: 18px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--hud-dim); }
#progress-bar { height: 100%; width: 0; background: var(--hud); }
#progress-label { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 18px; color: #000; font-weight: bold; mix-blend-mode: difference; filter: invert(1); }

#bl { position: absolute; left: 20px; bottom: 16px; display: flex; gap: 34px; }
#br { position: absolute; right: 24px; bottom: 16px; text-align: right; }
#bl div, #ammo, #money { color: var(--hud); font-size: 34px; font-weight: bold; }
#bl .ico { font-size: 26px; margin-right: 8px; opacity: 0.85; }
#bl .low { color: var(--red); }
#money { font-size: 24px; color: #a6f06a; margin-bottom: 4px; }
#ammo span { font-size: 22px; opacity: 0.7; margin-left: 8px; }

#inventory { position: absolute; right: 24px; top: 32%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; transition: opacity 0.4s; }
#inventory div { font-size: 13px; color: var(--hud-dim); padding: 3px 8px; background: rgba(0, 0, 0, 0.3); }
#inventory div.on { color: var(--hud); border-right: 3px solid var(--hud); }
#c4icon { position: absolute; left: 20px; bottom: 70px; color: var(--red); font-weight: bold; font-size: 20px; animation: blink 1.6s infinite; }

#chat { position: absolute; left: 16px; bottom: 140px; width: 520px; display: flex; flex-direction: column; gap: 2px; }
#chat div { font-size: 13px; text-shadow: 0 1px 3px #000; transition: opacity 1s; }
#chat .T { color: var(--t); }
#chat .CT { color: var(--ct); }
#chat .S { color: #ccc; }
#chat .sys { color: #b8f08a; }
#chat-input { position: absolute; left: 16px; bottom: 112px; width: 520px; padding: 6px 8px; font: inherit; font-size: 13px;
  background: rgba(0, 0, 0, 0.65); color: #fff; border: 1px solid var(--hud-dim); outline: none; pointer-events: auto; }

#spec-info { position: absolute; left: 0; right: 0; bottom: 70px; text-align: center; font-size: 15px; color: #fff; text-shadow: 0 1px 4px #000; }

/* ------------------------------------------------ счёт */
#scoreboard { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 720px; max-width: calc(100vw - 32px);
  background: rgba(20, 24, 18, 0.88); border: 1px solid var(--line); padding: 14px 18px; z-index: 15; }
#scoreboard h2 { margin: 0 0 8px; font-size: 16px; display: flex; justify-content: space-between; }
#scoreboard table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
#scoreboard th { text-align: left; font-size: 11px; color: var(--muted); font-weight: normal; padding: 3px 6px; border-bottom: 1px solid #555; }
#scoreboard td { padding: 3px 6px; font-size: 13px; }
#scoreboard td.num, #scoreboard th.num { text-align: right; width: 70px; }
#scoreboard .T td { color: var(--t); }
#scoreboard .CT td { color: var(--ct); }
#scoreboard tr.dead td { opacity: 0.45; }
#scoreboard tr.me td { background: rgba(255, 255, 255, 0.08); }
#scoreboard .tag { font-size: 10px; color: var(--red); margin-left: 6px; }

/* экран «Управление» */
.binds { display: grid; grid-template-columns: 1fr; gap: 4px; }
.bind { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.bind span { flex: 1; }
.bind button { min-width: 86px; text-align: center; padding: 5px 6px; font-size: 12px; }
.bind button.wait { background: var(--hud); color: #000; }

/* метки для своих (как пинг в CS2) */
#marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#marks .mark { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; margin: -10px 0 0 -40px; width: 80px; }
#marks .mark i { width: 14px; height: 14px; transform: rotate(45deg); background: #ffd23a; border: 2px solid rgba(0,0,0,0.75); box-shadow: 0 0 8px rgba(255,210,58,0.7); }
#marks .mark.enemy i { background: #ff4b3a; box-shadow: 0 0 8px rgba(255,75,58,0.8); }
#marks .mark b { margin-top: 4px; font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000; white-space: nowrap; }
#marks .mark span { font-size: 11px; color: #ffd23a; text-shadow: 0 1px 3px #000; }
