:root {
  color-scheme: dark;
  --night: #060b14; --night-2: #0d1726; --ice: #e6f1f7; --ice-dim: rgba(230, 241, 247, .66); --ice-faint: rgba(230, 241, 247, .22);
  --aurora: #5ef2b0; --violet: #9d8cff; --warn: #ff5d73; --plate: rgba(6, 11, 20, .62);
  --font: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  --sl: max(16px, env(safe-area-inset-left, 0px)); --sr: max(16px, env(safe-area-inset-right, 0px));
  --st: max(12px, env(safe-area-inset-top, 0px)); --sb: max(12px, env(safe-area-inset-bottom, 0px));
}
html, body { height: 100%; margin: 0; }
body { background: var(--night); color: var(--ice); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
#app { position: fixed; inset: 0; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
#app * { box-sizing: border-box; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* ---- HUD ---- */
#hud { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
#hud.on { opacity: 1; }
.cross { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; transition: transform .12s; }
.cross::before, .cross::after { content: ''; position: absolute; background: var(--ice); opacity: .85; }
.cross::before { left: 12px; top: 0; width: 2px; height: 8px; box-shadow: 0 18px 0 var(--ice); }
.cross::after { top: 12px; left: 0; height: 2px; width: 8px; box-shadow: 18px 0 0 var(--ice); }
.cross.ads { transform: scale(.55); }
#hit { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; opacity: 0; transform: rotate(45deg); }
#hit::before, #hit::after { content: ''; position: absolute; background: var(--aurora); }
#hit::before { left: 14px; top: 0; width: 2px; height: 9px; box-shadow: 0 21px 0 var(--aurora); }
#hit::after { top: 14px; left: 0; height: 2px; width: 9px; box-shadow: 21px 0 0 var(--aurora); }
#hit.weak::before, #hit.weak::after { background: var(--warn); box-shadow: none; }
#hit.weak::before { box-shadow: 0 21px 0 var(--warn); } #hit.weak::after { box-shadow: 21px 0 0 var(--warn); }
#vig { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 60, 90, .55) 100%); }
.obj { position: absolute; left: var(--sl); top: var(--st); max-width: min(46vw, 340px); padding: 10px 14px; background: var(--plate); border-left: 3px solid var(--aurora); }
.obj-k { font-size: 11px; letter-spacing: .2em; color: var(--aurora); }
.obj-t { font-size: 15px; line-height: 1.5; margin-top: 2px; }
.pips { display: flex; gap: 6px; margin-top: 8px; }
.pips i { width: 26px; height: 5px; background: var(--ice-faint); }
.pips i.on { background: var(--aurora); box-shadow: 0 0 8px var(--aurora); }
.vital { position: absolute; left: var(--sl); bottom: var(--sb); width: min(34vw, 240px); }
.vital-k { font-size: 11px; letter-spacing: .2em; color: var(--ice-dim); display: flex; justify-content: space-between; }
.bar { height: 6px; margin-top: 6px; background: var(--ice-faint); }
.bar i { display: block; height: 100%; width: 100%; background: var(--ice); transition: width .15s, background .2s; }
.bar i.low { background: var(--warn); }
.ammo { position: absolute; right: var(--sr); bottom: var(--sb); text-align: right; }
.ammo-n { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ammo-n small { font-size: 16px; font-weight: 500; color: var(--ice-dim); }
.ammo-k { font-size: 11px; letter-spacing: .2em; color: var(--ice-dim); margin-top: 4px; }
#radio { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); width: min(86vw, 560px); padding: 10px 16px; background: var(--plate); border-top: 1px solid var(--ice-faint); font-size: 15px; line-height: 1.6; text-align: center; opacity: 0; transition: opacity .35s; }
#radio.on { opacity: 1; }
#radio b { display: block; font-size: 11px; letter-spacing: .2em; color: var(--violet); font-weight: 600; }
#prompt { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); text-align: center; font-size: 14px; letter-spacing: .08em; opacity: 0; transition: opacity .2s; }
#prompt.on { opacity: 1; }
#prompt .bar { width: 180px; margin: 8px auto 0; }
#prompt .bar i { background: var(--aurora); width: 0; transition: none; }
#mark { position: absolute; width: 0; height: 0; opacity: .95; }
#mark::before { content: ''; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border: 2px solid var(--aurora); transform: rotate(45deg); box-shadow: 0 0 8px rgba(94, 242, 176, .6); }
#mark span { position: absolute; top: 14px; left: -40px; width: 80px; text-align: center; font-size: 12px; color: var(--aurora); font-variant-numeric: tabular-nums; }

/* ---- touch controls ---- */
#touch { position: absolute; inset: 0; display: none; touch-action: none; }
#touch.on { display: block; }
#joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid var(--ice-faint); background: rgba(230, 241, 247, .06); display: none; pointer-events: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(230, 241, 247, .4); }
.tb { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--ice-faint); background: rgba(6, 11, 20, .42); color: var(--ice); font: 600 13px var(--font); letter-spacing: .06em; touch-action: none; }
.tb.down, .tb.act { background: rgba(94, 242, 176, .3); border-color: var(--aurora); }
#b-fire { width: 84px; height: 84px; right: calc(var(--sr) + 14px); bottom: calc(var(--sb) + 64px); font-size: 15px; }
#b-ads { width: 60px; height: 60px; right: calc(var(--sr) + 112px); bottom: calc(var(--sb) + 52px); }
#b-jump { width: 60px; height: 60px; right: calc(var(--sr) + 6px); bottom: calc(var(--sb) + 162px); }
#b-reload { width: 54px; height: 54px; right: calc(var(--sr) + 86px); bottom: calc(var(--sb) + 136px); }
#b-use { width: 72px; height: 72px; right: calc(var(--sr) + 170px); bottom: calc(var(--sb) + 120px); display: none; border-color: var(--aurora); color: var(--aurora); }
#b-use.show { display: flex; }
#b-pause { width: 44px; height: 44px; right: var(--sr); top: var(--st); font-size: 16px; }
body.touch .ammo { bottom: auto; top: calc(var(--st) + 54px); }
body.touch .ammo-n { font-size: 28px; }
body.touch #radio { top: auto; bottom: calc(var(--sb) + 34px); width: min(46vw, 420px); font-size: 13px; padding: 8px 12px; }
body.touch .vital { left: 50%; transform: translateX(-50%); bottom: var(--sb); }

/* ---- menus ---- */
.menu { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: center; padding: 24px var(--sr) 24px max(var(--sl), 6vw); background: linear-gradient(90deg, rgba(6, 11, 20, .92) 0%, rgba(6, 11, 20, .7) 55%, rgba(6, 11, 20, .25) 100%); overflow-y: auto; }
.menu.on { display: flex; }
.eyebrow { font-size: 12px; letter-spacing: .28em; color: var(--aurora); }
.title { font-size: clamp(44px, 10vw, 112px); font-weight: 900; letter-spacing: .1em; line-height: 1.1; margin: 8px 0 4px; background: linear-gradient(100deg, var(--ice) 30%, var(--aurora) 70%, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title.sm { font-size: clamp(32px, 6vw, 60px); }
.lede { max-width: 520px; font-size: 16px; line-height: 1.75; color: var(--ice-dim); margin: 8px 0 22px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { appearance: none; border: 1px solid var(--ice-faint); background: transparent; color: var(--ice); font: 600 16px var(--font); letter-spacing: .14em; padding: 14px 28px; min-height: 48px; cursor: pointer; }
.btn.pri { background: var(--aurora); border-color: var(--aurora); color: #04130d; }
.btn:hover { border-color: var(--ice); } .btn.pri:hover { filter: brightness(1.1); }
.keys { margin-top: 24px; font-size: 13px; line-height: 2; color: var(--ice-dim); max-width: 560px; }
.keys kbd { font: 600 12px var(--font); padding: 2px 7px; border: 1px solid var(--ice-faint); color: var(--ice); margin: 0 2px; }
.stats { display: grid; grid-template-columns: repeat(4, auto); gap: 6px 34px; justify-content: start; margin: 6px 0 24px; }
.stats dt { font-size: 11px; letter-spacing: .2em; color: var(--ice-dim); }
.stats dd { margin: 0; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; grid-row: 2; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, auto); } .stats dd { grid-row: auto; } }
@media (max-height: 420px) { .lede { margin-bottom: 14px; font-size: 14px; } .keys { margin-top: 12px; } .title { font-size: clamp(36px, 14vh, 72px); } }
#rotate { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; background: var(--night); font-size: 18px; line-height: 1.8; padding: 24px; z-index: 20; }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
#fatal { position: absolute; left: 16px; right: 16px; bottom: 16px; color: var(--warn); font-size: 13px; white-space: pre-wrap; z-index: 30; }
#fatal a { color: inherit; }

/* ---- co-op: teammates, downed overlay, lobby and join form ---- */
#team { margin-top: 8px; font-size: 13px; line-height: 1.7; color: var(--ice-dim); }
#team:empty { display: none; }
.tm.out { color: var(--warn); }
#down { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); font-size: 20px; font-weight: 700; letter-spacing: .1em; color: var(--warn); white-space: nowrap; opacity: 0; transition: opacity .2s; }
#down.on { opacity: 1; }
.menu input { -webkit-user-select: text; user-select: text; appearance: none; border: 1px solid var(--ice-faint); border-radius: 0; background: rgba(6, 11, 20, .6); color: var(--ice); font: 600 16px var(--font); letter-spacing: .1em; padding: 0 14px; min-height: 48px; outline: none; }
.menu input:focus { border-color: var(--aurora); }
.name-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; letter-spacing: .2em; color: var(--ice-dim); }
#name { width: 200px; }
.join { display: flex; }
#code { width: 112px; border-right: 0; }
.err { min-height: 1.6em; margin-top: 12px; font-size: 14px; color: var(--warn); }
#room-code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
