* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0b0e12;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #dfe5ea;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas-holder, #canvas-holder canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: none; }

#topbar {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
#scoreboard-mini { display: flex; align-items: center; gap: 10px; background: rgba(8,12,16,0.72); padding: 4px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); }
.score { font-size: 24px; font-weight: 800; min-width: 34px; text-align: center; }
.score.ct { color: #6fa8dc; } .score.t { color: #e09a4a; }
#timer-box { text-align: center; }
#timer { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
#phase-label { font-size: 10px; letter-spacing: 2px; color: #e0b13c; height: 12px; }
#compass { opacity: 0.9; }
#round-label { font-size: 10px; letter-spacing: 3px; color: rgba(223,229,234,0.5); }
#conn-status { position: absolute; right: -170px; top: 6px; font-size: 11px; letter-spacing: 1px; }

#radar {
  position: absolute; top: 14px; left: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.14);
  background: rgba(8,12,16,0.4);
}

#loot-feed { position: absolute; top: 200px; left: 14px; display: flex; flex-direction: column; gap: 4px; }
.loot-line {
  background: rgba(20,30,20,0.8); border-left: 3px solid #ffb020;
  border-radius: 4px; padding: 5px 10px; font-size: 12.5px; max-width: 260px;
  animation: kfin 0.2s ease-out;
}
.loot-line b { color: #ffd24a; letter-spacing: 0.5px; }
.loot-line span { display: block; color: #cfd6dd; font-size: 11px; margin-top: 1px; }

#killfeed { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf-row {
  background: rgba(8,12,16,0.72); border-radius: 4px; padding: 3px 9px;
  font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,0.07);
  animation: kfin 0.15s ease-out;
}
.kf-wep { color: #cfd6dd; margin: 0 8px; font-weight: 500; opacity: 0.85; font-size: 11px; letter-spacing: 1px; }
@keyframes kfin { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

#crosshair { --gap: 5px; position: absolute; top: 50%; left: 50%; width: 0; height: 0; display: none; }
#crosshair span { position: absolute; background: #58f08a; box-shadow: 0 0 2px rgba(0,0,0,0.9); }
.ch-t { width: 2px; height: 7px; left: -1px; top: calc(-7px - var(--gap)); }
.ch-b { width: 2px; height: 7px; left: -1px; top: var(--gap); }
.ch-l { width: 7px; height: 2px; top: -1px; left: calc(-7px - var(--gap)); }
.ch-r { width: 7px; height: 2px; top: -1px; left: var(--gap); }
.ch-dot { width: 2px; height: 2px; left: -1px; top: -1px; }

#hitmarker { position: absolute; top: 50%; left: 50%; width: 0; height: 0; opacity: 0; border-color: rgba(255,255,255,0.95); }
#hitmarker span { position: absolute; width: 0; height: 0; border-left: 2px solid; border-color: inherit; }
@keyframes hm { 0% { opacity: 1; transform: scale(1.25); } 100% { opacity: 0; transform: scale(1); } }
#hitmarker.show { animation: hm 0.18s ease-out; }

#dmg-vignette {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(190, 20, 20, 0.55) 100%);
}
#dmg-dir { position: absolute; top: 50%; left: 50%; opacity: 0; transition: opacity 0.5s; }
#dmg-dir .arc {
  position: absolute; left: -40px; top: -110px; width: 80px; height: 26px;
  background: radial-gradient(ellipse at bottom, rgba(255,40,40,0.85), transparent 70%);
  clip-path: polygon(15% 100%, 50% 0%, 85% 100%);
}

#banner {
  display: none; position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  font-size: 42px; font-weight: 900; letter-spacing: 6px;
  color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,0.8); white-space: nowrap;
}
#subbanner {
  display: none; position: absolute; top: calc(22% + 54px); left: 50%; transform: translateX(-50%);
  font-size: 17px; letter-spacing: 3px; color: #e0b13c; font-weight: 700; white-space: nowrap;
}
#streak-banner {
  position: absolute; top: 32%; left: 50%; transform: translateX(-50%) scale(0.6);
  font-size: 30px; font-weight: 900; letter-spacing: 5px; color: #ffd24a;
  text-shadow: 0 0 18px rgba(255,180,30,0.7), 0 2px 8px #000;
  opacity: 0; pointer-events: none;
}
#streak-banner.show { animation: streak 2.2s ease-out forwards; }
@keyframes streak {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  22% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1) translateY(-16px); }
}

#death-screen {
  display: none; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(60,0,0,0.35), rgba(0,0,0,0.65));
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
#death-title { font-size: 46px; font-weight: 900; letter-spacing: 10px; color: #ff5a4e; }
#death-killer { font-size: 18px; color: #dfe5ea; }
#death-hint { font-size: 12px; color: rgba(223,229,234,0.55); letter-spacing: 1px; }

#spectate-label {
  display: none; position: absolute; bottom: 22%; left: 50%; transform: translateX(-50%);
  background: rgba(8,12,16,0.7); padding: 6px 16px; border-radius: 4px;
  font-size: 13px; letter-spacing: 1.5px; color: #cfd6dd;
}

#bottom-left { position: absolute; left: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: 240px; }
.vital { display: flex; align-items: center; gap: 10px; background: rgba(8,12,16,0.62); padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.07); }
.vlabel { font-size: 12px; font-weight: 800; width: 24px; color: #9aa5ae; }
.vbar { flex: 1; height: 9px; background: rgba(255,255,255,0.09); border-radius: 2px; overflow: hidden; }
.vbar div { height: 100%; width: 100%; background: #7ec96b; transition: width 0.15s; }
.vbar div.armor { background: #5a9bd4; }
.vital > span:last-child { width: 36px; text-align: right; font-weight: 800; font-size: 16px; }

#bottom-right { position: absolute; right: 20px; bottom: 20px; text-align: right; }
#slots { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.slot { width: 26px; height: 26px; line-height: 26px; text-align: center; background: rgba(8,12,16,0.62); border: 1px solid rgba(255,255,255,0.12); border-radius: 4px; font-size: 12px; font-weight: 700; color: #88929b; }
.slot.active { color: #fff; border-color: #58f08a; background: rgba(88,240,138,0.12); }
#weapon-name { font-size: 14px; letter-spacing: 1.5px; color: #cfd6dd; font-weight: 700; }
#ammo-line { font-variant-numeric: tabular-nums; }
#ammo-mag { font-size: 38px; font-weight: 900; }
#ammo-res { font-size: 19px; font-weight: 600; color: #9aa5ae; margin-left: 5px; }

#fps-counter { position: absolute; bottom: 8px; left: 10px; font-size: 10px; color: rgba(223,229,234,0.4); }

#chat-log { position: absolute; left: 20px; bottom: 90px; display: flex; flex-direction: column; gap: 3px; max-width: 420px; transition: opacity 0.6s; }
.chat-line { background: rgba(8,12,16,0.55); padding: 3px 8px; border-radius: 3px; font-size: 13px; }
#chat-input-wrap { position: absolute; left: 20px; bottom: 58px; display: none; align-items: center; gap: 8px; background: rgba(8,12,16,0.8); padding: 6px 10px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.15); pointer-events: all !important; }
#chat-input-wrap span { font-size: 11px; letter-spacing: 2px; color: #e0b13c; font-weight: 800; }
#chat-input { background: transparent; border: none; outline: none; color: #fff; font-size: 14px; width: 320px; pointer-events: all; }

#scope-overlay { display: none; position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 34vmin, rgba(0,0,0,0.985) 35vmin); }
.scope-cross-h { position: absolute; top: 50%; left: 0; width: 100%; height: 1px; background: rgba(0,0,0,0.85); }
.scope-cross-v { position: absolute; left: 50%; top: 0; height: 100%; width: 1px; background: rgba(0,0,0,0.85); }

#fullmap-wrap {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  flex-direction: column; align-items: center; gap: 8px; z-index: 8;
}
#fullmap-head { background: rgba(8,12,16,0.85); padding: 6px 14px; border-radius: 5px; font-size: 12px; letter-spacing: 2px; font-weight: 700; }
#fullmap-head span { color: #88929b; font-weight: 400; }
#fullmap { border: 2px solid rgba(255,255,255,0.18); border-radius: 6px; }

#scoreboard { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); min-width: 500px; background: rgba(8,12,16,0.88); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; overflow: hidden; }
#sb-head { padding: 8px 14px; font-weight: 800; letter-spacing: 3px; font-size: 13px; background: rgba(255,255,255,0.06); }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 14px; }
#scoreboard th { text-align: left; padding: 6px 14px; font-size: 11px; color: #88929b; letter-spacing: 1px; }
#scoreboard td { padding: 5px 14px; border-top: 1px solid rgba(255,255,255,0.05); }
#scoreboard tr.me td { background: rgba(88,240,138,0.08); }
.tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 3px; background: #3a424a; color: #fff; margin-right: 6px; }
.tag.CT { background: #3d6a96; } .tag.T { background: #a06a2c; }

#touch-ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#touch-ui > * { pointer-events: auto; }
#t-stick {
  position: absolute; left: 26px; bottom: 90px; width: 128px; height: 128px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(8,12,16,0.3);
}
#t-knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; background: rgba(255,255,255,0.35); border: 2px solid rgba(255,255,255,0.5);
}
#t-buttons { position: absolute; right: 18px; bottom: 80px; display: grid; grid-template-columns: 74px 60px; gap: 10px; justify-items: end; }
#t-side { position: absolute; right: 18px; top: 200px; display: flex; flex-direction: column; gap: 8px; }
.tbtn {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(8,12,16,0.5); border: 2px solid rgba(255,255,255,0.3);
  color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 1px;
}
.tbtn.big { width: 84px; height: 84px; font-size: 15px; background: rgba(180,40,30,0.45); border-color: rgba(255,120,100,0.6); }
.tbtn.mini { width: 44px; height: 44px; font-size: 11px; border-radius: 10px; }
.tbtn.on { background: rgba(88,240,138,0.35); border-color: #58f08a; }

#menu { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.menu-bg { position: absolute; inset: 0; background: linear-gradient(160deg, #10161d 0%, #1a2129 45%, #26221a 100%); }
.menu-bg::after { content: ''; position: absolute; inset: 0; background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 3px); }
#menu > * { position: relative; }
.logo { font-size: 62px; font-weight: 900; letter-spacing: 10px; }
.logo span { color: #58f08a; }
.studio-tag { font-size: 11px; letter-spacing: 6px; color: #88929b; }
.tagline { color: #88929b; font-size: 14px; letter-spacing: 1px; margin-bottom: 10px; }
.screen { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 380px; }
.screen h2 { letter-spacing: 4px; font-size: 22px; margin-bottom: 6px; }
.mbtn {
  pointer-events: all; cursor: pointer;
  background: rgba(255,255,255,0.06); color: #dfe5ea;
  border: 1px solid rgba(255,255,255,0.16); border-radius: 6px;
  letter-spacing: 3px; font-weight: 700;
  transition: background 0.12s, border-color 0.12s;
}
.mbtn.big { width: 340px; padding: 14px 0; font-size: 16px; }
.mbtn.small { width: 165px; padding: 10px 0; font-size: 13px; }
.mbtn:hover { background: rgba(88,240,138,0.12); border-color: #58f08a; }
.mbtn.accent { border-color: #58f08a; color: #58f08a; }
.mbtn.accent:hover { background: #58f08a; color: #0b0e12; }
.mbtn:disabled { opacity: 0.5; cursor: default; }
.row-pair { display: flex; gap: 10px; }
.backbtn { pointer-events: all; cursor: pointer; background: none; border: none; color: #88929b; font-size: 13px; letter-spacing: 2px; padding: 6px 10px; }
.backbtn:hover { color: #fff; }
.opt { display: flex; align-items: center; gap: 14px; pointer-events: all; background: rgba(255,255,255,0.05); padding: 10px 16px; border-radius: 6px; width: 360px; justify-content: space-between; }
.opt span { font-size: 12px; letter-spacing: 1.5px; color: #9aa5ae; font-weight: 700; }
select, input[type=text], .code-input {
  pointer-events: all; background: #141a21; color: #dfe5ea; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px; padding: 7px 10px; font-size: 14px; outline: none;
}
.code-input { width: 220px; text-align: center; font-size: 24px; letter-spacing: 8px; font-weight: 800; text-transform: uppercase; }
.hint { font-size: 12px; color: #88929b; max-width: 360px; text-align: center; line-height: 1.6; }
.name-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.name-row label { font-size: 11px; letter-spacing: 2px; color: #88929b; }
.name-row input { width: 180px; }
#create-status, #join-error { color: #e0b13c; font-size: 13px; min-height: 18px; }

#lobby-code-row { font-size: 15px; letter-spacing: 2px; display: flex; align-items: center; gap: 10px; }
#lobby-code-row b { color: #58f08a; font-size: 22px; letter-spacing: 6px; }
#lobby-code-row button { pointer-events: all; cursor: pointer; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); color: #dfe5ea; border-radius: 4px; padding: 4px 12px; font-size: 12px; }
#copy-hint { font-size: 11px; color: #58f08a; }
#lobby-count { font-size: 12px; color: #88929b; letter-spacing: 1px; }
#lobby-players { display: flex; flex-direction: column; gap: 5px; min-height: 40px; max-height: 200px; overflow-y: auto; }
.lobby-player { background: rgba(255,255,255,0.05); padding: 6px 14px; border-radius: 4px; font-size: 14px; min-width: 260px; }
#lobby-options { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#lobby-options .opt { width: auto; }
#opt-bots-note { font-size: 11px; color: #58f08a; width: 100%; text-align: center; }
#lobby-waiting { color: #e0b13c; font-size: 13px; letter-spacing: 1px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.help-cols { display: flex; gap: 40px; }
.help-cols h3 { font-size: 13px; letter-spacing: 3px; color: #58f08a; margin: 12px 0 6px; }
.help-cols p { font-size: 13px; line-height: 1.75; color: #b8c0c8; }

#boot {
  position: absolute; inset: 0; z-index: 100; cursor: pointer;
  background: #05070a; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.7s;
}
#boot.boot-out { opacity: 0; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.boot-studio { font-size: 22px; letter-spacing: 10px; font-weight: 300; color: #cfd6dd; animation: fadein 1.4s ease-out; }
.boot-studio span { color: #58f08a; font-weight: 700; }
.boot-presents { font-size: 10px; letter-spacing: 8px; color: #5a646e; animation: fadein 2s ease-out; }
.boot-logo {
  font-size: 84px; font-weight: 900; letter-spacing: 14px; margin: 8px 0;
  background: linear-gradient(100deg, #dfe5ea 20%, #58f08a 40%, #dfe5ea 60%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 3.2s linear infinite, fadein 1.2s ease-out;
}
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes fadein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.boot-bar { width: 340px; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
#boot-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #58f08a, #b8ffce); transition: width 0.12s; }
#boot-step { font-size: 10px; letter-spacing: 3px; color: #5a646e; }
#boot-enter { display: none; font-size: 15px; letter-spacing: 5px; color: #58f08a; font-weight: 800; animation: pulse 1.3s infinite; margin-top: 10px; }

#match-loading {
  position: absolute; inset: 0; z-index: 90;
  background: radial-gradient(ellipse at center, #131a22 0%, #07090d 100%);
  display: none; align-items: center; justify-content: center;
}
.ml-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ml-studio { font-size: 11px; letter-spacing: 6px; color: #5a646e; animation: fadein 0.8s ease-out; }
#ml-title { font-size: 44px; letter-spacing: 10px; font-weight: 900; color: #dfe5ea; animation: fadein 1s ease-out; }
.ml-bar { width: 380px; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
#ml-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #58f08a, #b8ffce); }
#ml-tip { max-width: 460px; text-align: center; font-size: 13px; color: #9aa5ae; line-height: 1.6; }

#overlay-lock {
  display: none; position: absolute; inset: 0; z-index: 15;
  background: rgba(5,8,11,0.55); cursor: pointer;
  align-items: center; justify-content: center; text-align: center;
}
.lock-big { font-size: 40px; font-weight: 900; letter-spacing: 8px; text-shadow: 0 2px 12px #000; }
.lock-sub { margin-top: 10px; color: #9aa5ae; font-size: 13px; letter-spacing: 2px; }

#pause-menu {
  display: none; position: absolute; inset: 0; z-index: 16;
  background: rgba(5,8,11,0.78);
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
#pause-menu h2 { letter-spacing: 8px; margin-bottom: 10px; }

#match-end {
  display: none; position: absolute; inset: 0; z-index: 18;
  background: rgba(5,8,11,0.88);
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
#match-end-title { font-size: 60px; font-weight: 900; letter-spacing: 14px; }
#match-end-score { font-size: 17px; color: #b8c0c8; letter-spacing: 1px; }
#match-end-table { min-width: 520px; background: rgba(255,255,255,0.04); border-radius: 8px; overflow: hidden; }
#match-end-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
#match-end-table th { text-align: left; padding: 8px 16px; font-size: 11px; color: #88929b; letter-spacing: 1px; }
#match-end-table td { padding: 6px 16px; border-top: 1px solid rgba(255,255,255,0.05); }
#match-end-table tr.me td { background: rgba(88,240,138,0.08); }

@media (max-width: 760px) {
  .logo { font-size: 40px; }
  .boot-logo { font-size: 52px; }
  .mbtn.big { width: 280px; }
  #radar { width: 110px; height: 110px; }
  #compass { width: 240px; }
  .help-cols { flex-direction: column; gap: 8px; }
  #match-end-table { min-width: 90vw; }
  #scoreboard { min-width: 90vw; }
  .opt { width: 90vw; max-width: 360px; }
}
