/* Strike 2D: page, HUD, touch controls, menus. Phone portrait and landscape, tablet, desktop. */
:root {
  --ct: #3f7fe0; --t: #e28b35; --ink: #e8edf2; --dim: #9aa6b2; --panel: rgba(10, 14, 19, 0.78); --line: rgba(160, 180, 200, 0.22);
  --ok: #9ff0a8; --bad: #ff6b5e; --gold: #ffd166;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #0b0f14; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; background: #0b0f14; z-index: 50; }
.boot b { font-size: 34px; letter-spacing: 0.08em; text-transform: uppercase; }
.boot span { color: var(--dim); }

/* ------------------------------------------------------------------ HUD */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; display: none; font-variant-numeric: tabular-nums; }
.hud.on { display: block; }
.hud > * { position: absolute; }
.h-top { top: calc(6px + var(--st)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; }
.h-score { min-width: 34px; padding: 4px 8px; border-radius: 6px; font-weight: 800; font-size: 20px; text-align: center; background: var(--panel); }
.h-ct { color: #cfe0ff; border-bottom: 3px solid var(--ct); }
.h-t { color: #ffe0c4; border-bottom: 3px solid var(--t); }
.h-clock { text-align: center; padding: 3px 12px; border-radius: 6px; background: var(--panel); }
.h-time { font-size: 22px; font-weight: 800; }
.h-time.bomb { color: var(--bad); }
.h-phase { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.h-radar { top: calc(8px + var(--st)); left: calc(8px + var(--sl)); width: 150px; height: 150px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.h-radar canvas { width: 100%; height: 100%; display: block; }
.h-feed { top: calc(8px + var(--st)); right: calc(8px + var(--sr)); display: flex; flex-direction: column; gap: 3px; align-items: flex-end; max-width: 46vw; }
.f-row { display: flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 5px; background: var(--panel); font-size: 13px; white-space: nowrap; }
.f-row.me { outline: 1px solid rgba(255, 255, 255, 0.55); }
.f-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 15ch; }
.f-name.ct { color: #9cc2ff; } .f-name.t { color: #ffc58f; }
.f-weapon { color: var(--dim); font-size: 11px; text-transform: uppercase; }
.h-vitals { bottom: calc(10px + var(--sb)); left: calc(10px + var(--sl)); display: flex; gap: 8px; align-items: flex-end; }
.h-vitals > div { padding: 5px 10px; border-radius: 6px; background: var(--panel); font-weight: 800; font-size: 20px; }
.h-hp.low { color: var(--bad); }
.h-money { color: var(--ok); }
.h-weapon { bottom: calc(10px + var(--sb)); right: calc(10px + var(--sr)); text-align: right; padding: 6px 12px; border-radius: 6px; background: var(--panel); }
.h-wname { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.h-ammo { font-size: 24px; font-weight: 800; }
.h-ammo.empty { color: var(--bad); } .h-ammo.reload { opacity: 0.5; }
.h-nades { font-size: 11px; color: var(--gold); min-height: 13px; }
.off { opacity: 0.25; }
.h-msg { top: 22%; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 6px; background: var(--panel); font-weight: 700; opacity: 0; transition: opacity 0.2s; text-align: center; max-width: 80vw; }
.h-msg.on { opacity: 1; }
.h-banner { top: 32%; left: 50%; transform: translate(-50%, -50%); padding: 12px 26px; border-radius: 10px; background: rgba(10, 14, 19, 0.86); text-align: center; opacity: 0; transition: opacity 0.25s; border-top: 4px solid #888; }
.h-banner.on { opacity: 1; }
.h-banner.ct { border-color: var(--ct); } .h-banner.t { border-color: var(--t); }
.h-banner b { display: block; font-size: 26px; }
.h-banner span { color: var(--dim); }
.h-bar { bottom: 26%; left: 50%; transform: translateX(-50%); width: min(300px, 70vw); height: 18px; border-radius: 9px; background: rgba(0, 0, 0, 0.6); overflow: hidden; display: none; border: 1px solid var(--line); }
.h-bar.on { display: block; }
.h-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #d9a83a, var(--gold)); }
.h-bar span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 800; line-height: 18px; color: #111; }
.h-hint, .h-spec, .h-status { left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 6px; background: var(--panel); font-size: 13px; display: none; white-space: nowrap; }
.h-hint { bottom: 31%; color: var(--gold); }
.h-spec { bottom: calc(64px + var(--sb)); }
.h-status { top: calc(64px + var(--st)); color: var(--gold); }
.h-hint.on, .h-spec.on, .h-status.on { display: block; }
.h-flash { inset: 0; background: #fff; opacity: 0; }
.h-dmg { left: 50%; top: 50%; width: 0; height: 0; }
.h-dmg i { position: absolute; left: -26px; top: -6px; width: 52px; height: 12px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(255, 50, 40, 0.9), rgba(255, 50, 40, 0)); transform-origin: 26px 6px; }
.h-fps { bottom: calc(96px + var(--sb)); right: calc(10px + var(--sr)); font-size: 11px; color: var(--dim); }
.hud.hitmark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border: 2px solid #fff; border-radius: 50%; animation: hit 0.2s ease-out forwards; }
@keyframes hit { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* Buy menu */
.h-buy { display: none; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 92vw); max-height: 86vh; overflow: auto; padding: 12px; border-radius: 12px; background: rgba(10, 14, 19, 0.94); border: 1px solid var(--line); pointer-events: auto; z-index: 30; }
.h-buy.on { display: block; }
.h-buy.closed { opacity: 0.6; }
.b-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.b-head b { font-size: 20px; flex: 1; }
.b-money { color: var(--ok); font-weight: 800; font-size: 18px; }
.b-close { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 20px; cursor: pointer; }
.b-group { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; color: var(--dim); letter-spacing: 0.06em; }
.b-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.b-item { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--ink); text-align: left; cursor: pointer; font: inherit; min-height: 48px; }
.b-item:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.b-item kbd { grid-row: span 2; font: 700 12px system-ui; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.b-name { font-weight: 700; }
.b-price { color: var(--ok); font-size: 13px; }
.b-item.poor .b-price { color: var(--bad); }
.b-item.owned { opacity: 0.45; }
.b-item:disabled { cursor: default; }
.b-hint { margin-top: 8px; font-size: 11px; color: var(--dim); text-align: center; }

/* Scoreboard */
.h-scoreboard { display: none; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 94vw); max-height: 80vh; overflow: auto; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(10, 14, 19, 0.92); border: 1px solid var(--line); z-index: 25; }
.h-scoreboard.on { display: grid; grid-template-columns: 1fr 1fr; }
.s-team { min-width: 0; }
.s-head { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; padding: 4px 6px; border-bottom: 3px solid; }
.s-team.ct .s-head { border-color: var(--ct); } .s-team.t .s-head { border-color: var(--t); }
.s-row { display: grid; grid-template-columns: 1fr 2.2em 2.2em 2.2em 4.2em; gap: 4px; padding: 3px 6px; font-size: 13px; }
.s-row span:not(.s-name) { text-align: right; }
.s-hdr { color: var(--dim); font-size: 11px; }
.s-row.dead { opacity: 0.5; } .s-row.me { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
.s-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ touch */
.touch { display: none; position: absolute; inset: 0; pointer-events: none; }
.touch.on { display: block; }
.t-zone { position: absolute; top: 18%; bottom: 0; pointer-events: auto; touch-action: none; }
.t-left { left: 0; width: 50%; } .t-right { right: 0; width: 50%; }
.t-stick { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.06); display: none; pointer-events: none; }
.t-stick.on { display: block; }
.t-stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transform: translate(-50%, -50%); }
.t-stick-aim.on { border-color: rgba(255, 120, 100, 0.45); }
.t-buttons { position: absolute; display: grid; gap: 8px; pointer-events: none; }
.t-buttons-right { right: calc(10px + var(--sr)); bottom: calc(76px + var(--sb)); grid-template-columns: repeat(3, 58px); }
.t-buttons-left { left: calc(10px + var(--sl)); bottom: calc(76px + var(--sb)); grid-template-columns: repeat(2, 58px); }
.t-btn { pointer-events: auto; touch-action: none; height: 46px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(12, 16, 22, 0.55); color: var(--ink); font: 800 11px system-ui; letter-spacing: 0.04em; }
.t-btn.down { background: rgba(255, 255, 255, 0.28); }
.t-use { border-color: rgba(255, 209, 102, 0.6); }
.t-menu { position: absolute; left: calc(10px + var(--sl)); bottom: calc(14px + var(--sb)); width: 58px; height: 34px; font-size: 10px; }
.hud:has(.touch.on) .h-vitals { z-index: 1; }
.hud:has(.touch.on) .h-fps { bottom: auto; top: calc(92px + var(--st)); right: 50%; transform: translateX(50%); }
.hud:has(.touch.on) .h-weapon { bottom: auto; top: calc(62px + var(--st)); right: 50%; transform: translateX(50%); padding: 2px 10px; display: flex; gap: 10px; align-items: baseline; }
.hud:has(.touch.on) .h-ammo { font-size: 17px; }
.hud:has(.touch.on) .h-vitals { bottom: auto; top: calc(116px + var(--st)); left: calc(8px + var(--sl)); flex-direction: column; align-items: flex-start; gap: 3px; }
.hud:has(.touch.on) .h-vitals > div { font-size: 14px; padding: 2px 7px; }
.hud:has(.touch.on) .h-radar { width: 104px; height: 104px; }
.hud:has(.touch.on) .h-top { top: calc(4px + var(--st)); }
.hud:has(.touch.on) .h-feed { top: calc(4px + var(--st)); max-width: 34vw; }
.hud:has(.touch.on) .f-row { font-size: 11px; padding: 2px 5px; }
.hud:has(.touch.on) .h-spec { bottom: calc(190px + var(--sb)); }

/* ------------------------------------------------------------------ menus */
.menu { position: fixed; inset: 0; z-index: 40; display: none; overflow: auto; background: radial-gradient(ellipse at 50% 30%, rgba(30, 44, 58, 0.92), rgba(8, 11, 15, 0.97)); padding: calc(16px + var(--st)) calc(12px + var(--sr)) calc(16px + var(--sb)) calc(12px + var(--sl)); box-sizing: border-box; }
.menu.on { display: block; }
.m-card { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.m-title h1 { margin: 0; font-size: clamp(32px, 8vw, 56px); letter-spacing: 0.08em; text-transform: uppercase; }
.m-title p { margin: 0; color: var(--dim); }
.m-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-label { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.m-input { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--ink); font: 600 16px system-ui; user-select: text; -webkit-user-select: text; }
.m-tag { color: var(--dim); font-weight: 700; }
.m-stack { display: grid; gap: 8px; }
.m-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.m-row > .m-btn { flex: 1; }
.m-btn { min-height: 46px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--ink); font: 700 15px system-ui; cursor: pointer; }
.m-btn:hover, .m-btn:focus-visible { background: rgba(255, 255, 255, 0.12); outline: none; }
.m-btn.primary { background: linear-gradient(180deg, #4b8cf0, #2f6bd0); border-color: #6aa0f5; }
.m-btn.on { background: rgba(159, 240, 168, 0.18); border-color: var(--ok); }
.m-dice { flex: 0 0 auto; min-width: 46px; }
.m-help { color: var(--dim); font-size: 13px; }
.m-help p { margin: 6px 0; }
.m-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.m-map { min-height: 70px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; text-shadow: 0 1px 3px #000; }
.m-map b { font-size: 15px; } .m-map span { font-size: 11px; opacity: 0.85; }
.m-map.on { outline: 3px solid var(--ok); outline-offset: 1px; }
.m-choice { display: flex; flex-direction: column; gap: 4px; }
.m-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.m-opt { flex: 1; min-width: 90px; }
.m-section { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); }
.m-section h2 { margin: 0; font-size: 16px; flex: 1; }
.m-code { text-transform: uppercase; letter-spacing: 0.12em; }
.m-rooms { display: grid; gap: 6px; color: var(--dim); }
.m-room { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.m-room span { font-size: 12px; color: var(--dim); font-weight: 500; }
.m-status { min-height: 18px; color: var(--gold); }
.m-bigcode { font-size: 26px; letter-spacing: 0.14em; }
.m-teams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-teamcol { padding: 8px; border-radius: 10px; border: 1px solid var(--line); min-height: 80px; display: flex; flex-direction: column; gap: 4px; }
.m-teamcol.ct { border-top: 4px solid var(--ct); } .m-teamcol.t { border-top: 4px solid var(--t); }
.m-teamcol h3 { margin: 0 0 4px; font-size: 14px; }
.m-member { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-member.me { font-weight: 800; }
.m-join { margin-top: auto; min-height: 36px; }
.m-range { width: 100%; }
.m-sub, .m-wait { color: var(--dim); margin: 0; }

@media (orientation: portrait) {
  .hud:has(.touch.on) .h-feed { top: calc(98px + var(--st)); max-width: 60vw; }
}
@media (max-width: 520px) {
  .h-radar { width: 104px; height: 104px; }
  .h-score { font-size: 16px; min-width: 26px; padding: 2px 6px; }
  .h-time { font-size: 18px; }
  .m-teams { grid-template-columns: 1fr; }
  .h-scoreboard.on { grid-template-columns: 1fr; }
}
@media (max-height: 440px) {
  .h-banner b { font-size: 20px; }
  .h-buy { max-height: 92vh; padding: 8px; }
  .b-item { min-height: 40px; padding: 5px 8px; }
}
