:root {
  --space: #070B1E;
  --space2: #1B1140;
  --accent: #5CF2FF;
  --yellow: #FFD25A;
  --red: #FF5C7A;
  --ink: rgba(255, 255, 255, 0.72);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--space);
  color: #fff;
  font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.screen { position: fixed; inset: 0; }
.hidden { display: none !important; }
.c-page, .c-overlay {
  --c-accent: var(--accent); --c-on-accent: #0B1530; --c-panel: #141A3A;
  --c-page-bg: radial-gradient(ellipse at 50% 30%, #23185A 0%, var(--space2) 35%, var(--space) 80%);
}
.c-page .c-net.on::before { color: #6FD06A; }
.c-page .c-title, .c-page .c-h1 { color: #fff; }
.c-home .c-title { line-height: 1.05; }
.c-home .c-title span { color: var(--accent); font-size: 26px; letter-spacing: 10px; }
h2 { font-size: 18px; font-weight: 800; letter-spacing: 2px; color: var(--accent); margin: 16px 0 0; text-align: center; }
.hint { color: var(--ink); font-size: 13px; margin: 0; line-height: 1.4; }
.hint a { color: var(--accent); }
.center { text-align: center; }
.err { color: var(--red); }
.err:empty { display: none; }
.hint:empty { display: none; }
button { font: inherit; cursor: pointer; }
button.primary { background: var(--accent); color: #0B1530; font-weight: 800; font-size: 20px; border: 0; border-radius: 999px; padding: 16px; }
button.outline { background: rgba(0,0,0,0.3); color: #fff; border: 1px solid rgba(255,255,255,0.5); border-radius: 999px; padding: 6px 16px; font-size: 13px; }
button:disabled { opacity: 0.45; cursor: default; }
button.outline, .seg button { min-height: 44px; }
.hint a { display: inline-block; min-width: 44px; min-height: 44px; line-height: 44px; text-align: center; }
.seg { display: flex; align-self: center; border: 1px solid rgba(255,255,255,0.3); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 15px; padding: 9px 16px; }
.seg button.on { background: rgba(92,242,255,0.22); color: #fff; font-weight: 700; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud {
  position: absolute; inset: 0; pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
#hud button { pointer-events: auto; }
#hud.waiting #topleft, #hud.waiting #topright { display: none; }
#topleft { position: absolute; left: max(10px, env(safe-area-inset-left)); top: calc((var(--band-h, 52px) + 4px) / var(--ui, 1)); display: flex; flex-direction: column; gap: 3px; max-width: 58vw; }
.row { display: flex; align-items: center; gap: 8px; }
.ink { color: var(--ink); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
#reserves { width: 140px; height: 22px; display: block; }
.gauges { gap: 6px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 10px; height: 10px; border-radius: 2px; background: rgba(255,255,255,0.15); }
.pips.hull i.on { background: #6FD06A; }
.pips.flares i { border-radius: 50%; }
.pips.flares i.on { background: #FFB347; box-shadow: 0 0 6px #FF8A3D; }
.bar { width: 90px; height: 7px; border-radius: 4px; background: rgba(255,255,255,0.15); overflow: hidden; }
#boostBar { height: 100%; background: #9C7CFF; }
#boostBar.burning { background: #E0D0FF; box-shadow: 0 0 8px #9C7CFF; }
#squads { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.sq { font-size: 14px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.sq.me { color: #fff; font-weight: 700; }
.sq i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.sq span { color: var(--ink); }
.pill { background: rgba(0,0,0,0.45); border-radius: 8px; padding: 3px 8px; align-self: flex-start; color: var(--ink); }
.pill.bad { color: var(--red); }
#topright { position: absolute; right: max(10px, env(safe-area-inset-right)); top: calc((var(--band-h, 52px) + 4px) / var(--ui, 1)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#radar { width: 92px; height: 92px; }
.lock {
  position: absolute; top: 42%; left: 50%; transform: translateX(-50%); white-space: nowrap;
  color: #fff; background: rgba(255,40,60,0.75); font-weight: 900; letter-spacing: 3px; font-size: 16px; padding: 6px 14px; border-radius: 6px;
  animation: blink 0.3s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.45; } }
.notice { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: rgba(12,16,24,0.7); border: 1px solid rgba(255,255,255,0.18); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.notice[hidden] { display: none; }
.notice.good { border-color: var(--accent); color: var(--accent); }
.notice.warn { border-color: #ff7a59; color: #ffb39e; }
.flareBtn {
  flex: none; pointer-events: auto;
  width: 86px; height: 86px; border-radius: 50%; border: 2px solid #FFB347; background: rgba(255,138,61,0.25); color: #fff; font-weight: 800; font-size: 13px;
}
.flareBtn:active { background: rgba(255,200,120,0.6); }
.fireRow { display: flex; align-items: center; gap: 10px; }
.weaponBtn {
  flex: none; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 2px solid #8FD8FF; background: rgba(92,168,255,0.25); color: #fff;
}
.weaponBtn svg { width: 34px; height: 34px; display: block; }
.weaponBtn.missile svg { width: 28px; height: 28px; }
.weaponBtn .pips i { width: 7px; height: 7px; border-radius: 50%; }
.weaponBtn .pips i.on { background: #8FD8FF; box-shadow: 0 0 5px #5CA8FF; }
.weaponBtn:active { background: rgba(143,216,255,0.6); }
#c-corner .flareBtn, #c-corner .weaponBtn { zoom: calc(1 / var(--ui, 1)); }
.line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line.center { justify-content: center; }
.line .big { flex: 1; }
.who[data-id] { cursor: pointer; pointer-events: auto; text-decoration: underline dotted rgba(255,255,255,0.4); }
.lb { display: flex; flex-direction: column; gap: 4px; }
.lb .row { display: flex; align-items: center; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 8px 12px; gap: 10px; }
.lb .row.you { background: rgba(92,242,255,0.16); }
.lb .rank { width: 28px; color: var(--ink); }
.lb .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pts { font-weight: 800; color: var(--yellow); }
.lb .sub { color: var(--ink); font-size: 12px; }
.roomPanel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, 92vw); max-height: 86vh; overflow-y: auto;
  pointer-events: auto; touch-action: pan-y; background: rgba(8,12,34,0.88); border: 1px solid rgba(255,255,255,0.18); border-radius: 16px; padding: 14px;
}
#roomBody { display: flex; flex-direction: column; gap: 10px; }
#roomBot { margin-top: 2px; }
#roomBotHelp { margin-top: -4px; }
#hud #roomBody button { pointer-events: auto; }
.roomTitle { text-align: center; font-weight: 900; letter-spacing: 4px; color: var(--accent); font-size: 18px; }
.roomKind { text-align: center; color: var(--ink); font-size: 13px; margin-top: -6px; }
.roomSquads { display: flex; flex-direction: column; gap: 4px; }
.roomSquad { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.06); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.roomSquad.me { background: rgba(92,242,255,0.14); font-weight: 700; }
.roomSquad.empty { color: rgba(255,255,255,0.3); font-size: 12px; justify-content: center; }
.roomSquad i { width: 10px; height: 10px; border-radius: 50%; }
.roomSquad .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roomSquad .kind { color: var(--ink); font-size: 12px; }
.roomSquad .x { background: none; border: 0; color: var(--red); font-size: 20px; padding: 0 4px; min-width: 44px; min-height: 44px; margin: -6px -10px -6px 0; }
.roomBoard h3 { margin: 4px 0; font-size: 13px; color: var(--ink); font-weight: 600; text-align: center; }
.roomBoard .lb .row { padding: 4px 8px; font-size: 12px; }
#topleft, #topright, .lock, .waitNote { zoom: var(--ui, 1); }
.roomPanel { --z: var(--ui, 1); zoom: var(--z); width: min(420px, calc(92vw / var(--z))); max-height: calc(86vh / var(--z)); }
.scr-sideways .roomPanel { --z: min(var(--ui, 1), 1.3); }
#hud #roomPanel.c-stage { position: absolute; inset: 0; transform: none; width: auto; max-height: none; zoom: 1;
  background: rgba(7, 11, 30, .55); border: 0; border-radius: 0; padding: calc(var(--band-h, 52px) + 8px) 10px 12px; }
#roomPanel .c-stage-side { --c-panel: rgba(8, 12, 34, .92); }
#roomPanel .seg { align-self: stretch; }
#roomPanel .seg button { flex: 1; }
#roomPanel .dirPick { display: flex; flex-direction: column; gap: 4px; }
#roomPanel .c-seat .seg button { font-size: 20px; padding: 4px 0; }
body.tv #topleft .row.gauges, body.tv #apiStatus, body.tv #lock, body.tv #weaponBtn, body.tv #flareBtn,
body.tv #battleBot, body.tv #roomBot, body.tv #roomBotHelp, body.tv .fireRow { display: none !important; }
