:root {
  --ground-dark: #1A2014;
  --accent: #8CE85C;
  --yellow: #FFD25A;
  --red: #FF5C5C;
  --ink: rgba(255, 255, 255, 0.72);
  --c-accent: #8CE85C;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--ground-dark);
  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-on-accent: #2C1A6B; --c-page-bg: linear-gradient(#26301B, #121810); --c-panel: #1f2818; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { color: var(--ink); font-size: 13px; }
.field .pickBtn { min-height: 48px; font-size: 17px; border-radius: 6px; border-color: rgba(255,255,255,0.35); }
.field .pickOpt { font-size: 16px; }
.field input {
  font-size: 18px; padding: 12px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25); color: #fff; user-select: text; -webkit-user-select: text;
}
.hint { color: var(--ink); font-size: 13px; margin: 0; line-height: 1.4; }
.hint a { color: var(--accent); }
.center { text-align: center; }
button { font: inherit; cursor: pointer; }
button.primary {
  background: var(--accent); color: #2C1A6B; font-weight: 800; font-size: 20px; border: 0; border-radius: 999px; padding: 16px;
}
button.outline {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); border-radius: 999px; padding: 6px 18px; font-size: 13px;
}
button.round {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.35); color: #fff; font-size: 20px;
}
h2 { font-size: 20px; font-weight: 800; letter-spacing: 2px; color: var(--accent); margin: 18px 0 0; text-align: center; }
button.outline.big { font-size: 16px; padding: 10px 18px; }
button:disabled { opacity: 0.5; cursor: default; }
.line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.line .big { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
input.code {
  width: 150px; font-size: 20px; letter-spacing: 3px; text-transform: uppercase; text-align: center; padding: 9px 8px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.35); background: rgba(0,0,0,0.25); color: #fff; user-select: text; -webkit-user-select: text;
}
.rooms { display: flex; flex-direction: column; gap: 6px; }
.room { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.3); border-radius: 10px; padding: 8px 12px; }
.room .who { flex: 1; min-width: 0; }
.room .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .who span { color: var(--ink); font-size: 12px; }
.err { color: var(--red); }
.err:empty { display: none; }
.hint:empty { display: none; }
.who[data-id] { cursor: pointer; }
#players .who { pointer-events: auto; }
.lb .name.tap { cursor: pointer; text-decoration: underline dotted rgba(255,255,255,0.4); }
.people { display: flex; flex-wrap: wrap; gap: 4px; }
.people:empty { display: none; }
.people button { background: rgba(255,255,255,0.08); color: #fff; border: 0; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.lb { display: flex; flex-direction: column; gap: 4px; }
.seg { display: flex; align-self: center; border: 1px solid rgba(255,255,255,0.3); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 14px; padding: 7px 14px; }
.seg button.on { background: rgba(140,232,92,0.25); color: #fff; font-weight: 700; }
#roomBoard .lb .row { padding: 3px 8px; font-size: 12px; }
#roomBoard .lb .sub { display: none; }
#roomBoard h3 { margin: 4px 0 2px; font-size: 12px; color: var(--ink); font-weight: 600; }
.lb .row { background: rgba(0,0,0,0.3); border-radius: 8px; padding: 8px 12px; gap: 10px; }
.lb .row.you { background: rgba(140,232,92,0.18); }
.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; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
#hud button, #hud canvas#minimap, #squad .cell, #card button, #hud select, #hud input { pointer-events: auto; }
.pickChoice { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pickBtn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; width: 100%;
  border-radius: 7px; border: 1px solid rgba(255,255,255,0.3); background: #1b2215; color: #fff; font-size: 14px; text-align: left;
}
.pickBtnText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickArrow { display: inline-flex; width: 16px; height: 16px; flex: none; transition: transform .12s; }
.pickArrow svg { width: 100%; height: 100%; }
.pickChoice.open .pickArrow { transform: rotate(180deg); }
.pickList {
  display: flex; flex-direction: column; margin-top: 6px; padding: 6px;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 14px; background: rgba(12,16,12,0.96);
}
.pickOpt {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: #fff;
  font-size: 14px; font-weight: 600; text-align: left; white-space: nowrap;
}
.pickOpt:hover { background: rgba(255,255,255,0.1); }
.pickOpt.on { background: var(--accent); color: #10200a; }
#roarBtn { --charge: 0%; min-width: 96px; letter-spacing: 1.5px; background: linear-gradient(to right, rgba(255,150,40,0.5) var(--charge), var(--c-glass, rgba(0,0,0,0.45)) var(--charge)); opacity: 0.8; }
#roarBtn.ready { background: #ff9a2e; border-color: #ff9a2e; color: #201000; opacity: 1; }
#topleft { position: absolute; top: calc(var(--band-h) / var(--ui, 1) + 2px); left: max(12px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; gap: 4px; }
.row.bottom { align-items: flex-end; }
.ink { color: var(--ink); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
#topleft { max-width: 272px; }
#topleft .row { flex-wrap: wrap; }
#apiStatus, #where, #notice { max-width: 100%; }
#tour { font-weight: 700; color: #fff; }
.bar { width: 90px; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.15); overflow: hidden; }
#baseBar { height: 100%; border-radius: 4px; background: var(--yellow); }
.pill { align-self: flex-start; background: rgba(0,0,0,0.35); border-radius: 8px; padding: 3px 8px; margin-top: 2px; }
.accent { color: var(--accent); }
#squad { display: grid; grid-template-columns: repeat(2, 84px); gap: 2px 3px; margin-top: 2px; }
#squad .cell {
  display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.35); border-radius: 7px; padding: 2px 6px; font-size: 11px; height: 22px;
}
#squad .cell.watched { background: rgba(0,0,0,0.7); }
#squad .n { width: 15px; font-weight: 700; font-size: 12px; }
#squad .watched .n { color: var(--yellow); }
#squad .hp { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.15); overflow: hidden; }
#squad .hp div { height: 100%; border-radius: 3px; }
#players { margin-top: 4px; font-size: 12px; }
#players .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
#minimap { position: absolute; top: calc(var(--band-h) / var(--ui, 1) + 2px); right: max(12px, env(safe-area-inset-right)); touch-action: none; }
#pilot { gap: 6px; }
#pilotName { font-size: 14px; font-weight: 700; white-space: nowrap; }
#pilotName .sub { font-weight: 400; color: var(--ink); font-size: 12px; }
.lockBtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.4); background: rgba(0,0,0,0.3); color: #fff; font-size: 18px; padding: 0; }
.lockBtn.on { background: var(--yellow); border-color: var(--yellow); }
.card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.55); border-radius: 16px;
  padding: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 80vw;
}
.card.bottom { top: auto; bottom: 16px; transform: translateX(-50%); }
.card .title { font-size: 30px; font-weight: 900; letter-spacing: 3px; }
.card .sub { font-size: 15px; }
.card button { margin-top: 10px; background: var(--accent); color: #2C1A6B; border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 700; }
.scr-compact #hud { padding: 6px; }
.scr-compact #topleft { max-width: none; left: max(6px, env(safe-area-inset-left)); gap: 1px; }
.scr-compact #topleft .row { flex-wrap: nowrap; }
.scr-compact .small { font-size: 12px; }
.scr-compact .tiny { font-size: 12px; }
.scr-compact .bar { width: 60px; height: 6px; }
.scr-compact #squad { grid-template-columns: repeat(2, 64px); gap: 1px 2px; }
.scr-compact #squad .cell { height: 20px; padding: 1px 4px; gap: 3px; border-radius: 5px; }
.scr-compact #squad .n { width: 16px; font-size: 14px; }
.scr-compact #squad .hp { height: 4px; }
.scr-compact #players { margin-top: 2px; line-height: 1.3; font-size: 14px; }
.scr-compact #players .dot { width: 7px; height: 7px; margin-right: 4px; }
.scr-compact #minimap { right: max(6px, env(safe-area-inset-right)); opacity: 0.85; }
.scr-compact #pilotName { font-size: 13px; }
.scr-compact .card { padding: 12px 16px; }
.scr-compact .card .title { font-size: 22px; letter-spacing: 2px; }
.scr-compact .card .sub { font-size: 12px; }
.scr-compact .card button { margin-top: 6px; padding: 7px 16px; font-size: 13px; min-height: 44px; }
#room { background: var(--ground-dark); }
#roomField { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#roomPanel {
  position: absolute; top: calc(var(--band-h) / var(--ui, 1) + 6px); left: max(12px, env(safe-area-inset-left));
  width: 250px; display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.4); border-radius: 14px; padding: 14px;
}
.roomTitle { display: flex; flex-direction: column; gap: 2px; }
.roomTitle b { font-size: 24px; letter-spacing: 3px; color: var(--accent); }
.roomTitle.private { flex-direction: row; align-items: center; gap: 10px; }
.roomTitle.private #roomInvite .c-code { font-size: 18px; color: var(--accent); }
#roomStatus { line-height: 1.35; }
.countdown { font-size: 44px; font-weight: 900; color: var(--yellow); line-height: 1; }
.countdown:empty { display: none; }
.roomButtons { display: flex; flex-direction: column; gap: 8px; }
.roomButtons button.outline { font-size: 15px; padding: 9px 16px; }
.roomButtons button.primary { font-size: 18px; padding: 12px; }
#roomPanel p { margin: 0; line-height: 1.35; }
#roomPanel p:empty { display: none; }
#botCards { position: absolute; inset: 0; pointer-events: none; }
.botCard {
  position: absolute; display: flex; align-items: center; gap: 0; pointer-events: auto;
  background: rgba(8,12,8,0.82); border: 1px solid rgba(255,255,255,0.18); border-radius: 999px; padding: 0; font-size: 13px;
}
.botCard:has(.pickChoice.open) { z-index: 5; }
.typePick { display: flex; gap: 8px; }
.typeBtn { width: 54px; height: 54px; min-height: 0; padding: 0; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,0.16); border-radius: 12px; background: rgba(0,0,0,0.35); cursor: pointer; opacity: 0.6; }
.typeBtn.on { opacity: 1; background: rgba(255,255,255,0.1); cursor: default; }
.typeBtn:not(.on):hover { opacity: 0.9; }
.typePick.fixed .typeBtn:not(.on) { display: none; }
.typeCycle { flex: none; width: 40px; height: 40px; min-height: 0; margin: 2px 0 2px 3px; padding: 0; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; background: rgba(255,255,255,0.08); cursor: pointer; }
.typeCycle:disabled { cursor: default; opacity: 1; }
.botCard.withType .pickBtn { padding-left: 6px; }
.botCard .pickBtn { min-height: 40px; padding: 0 10px 0 12px; border: 0; background: none; font-size: 13px; font-weight: 600; gap: 4px; }
.botX { position: absolute; pointer-events: auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 10px; background: rgba(0,0,0,0.6); color: var(--red); font-size: 24px; line-height: 1; cursor: pointer; }
.botCard .pickArrow { width: 14px; height: 14px; }
.botCard .pickList { position: absolute; left: 0; top: calc(100% + 6px); margin: 0; min-width: 100%; width: max-content; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,0.6); }
.botCard .pickChoice.up .pickList { top: auto; bottom: calc(100% + 6px); }
.botCard .kind { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pickAct { margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.16); border-radius: 0 0 9px 9px; color: var(--red); }
.pickAct:hover { background: rgba(255,92,92,0.16); }
.center-check { justify-content: center; }
.mineCard .c-pick { flex: 1; min-width: 0; }
.mineCard .c-pick-label { display: none; }
.scr-upright #roomPanel { width: auto; right: max(12px, env(safe-area-inset-right)); padding: 10px 12px; gap: 6px; }
.scr-upright .roomButtons { flex-direction: row; }
.scr-upright .roomButtons button { flex: 1; }
.scr-upright .countdown { font-size: 32px; }
#hud > *, #roomPanel { zoom: var(--ui, 1); }
button.outline, button.primary, button.danger, button.link, .options button, .people button, .seg button { min-height: 44px; }
.field input, input.code { min-height: 44px; }
.lb.rooms .row.join { min-height: 44px; }
.radios input { width: 24px; height: 24px; }
.radios label { min-height: 44px; }
#roomPanel { max-height: calc((100dvh - var(--band-h)) / var(--ui, 1) - 12px); overflow-y: auto; touch-action: pan-y; }
.scr-compact #roomPanel { padding: 8px 10px; gap: 4px; }
.scr-compact .roomTitle b { font-size: 18px; letter-spacing: 2px; }
.scr-compact .roomButtons { flex-direction: row; }
.scr-compact .roomButtons button { flex: 1; }
.scr-compact .roomButtons button.primary { font-size: 16px; padding: 8px; }
body.tv #addBot, body.tv #startNow, body.tv #roomBot, body.tv #roomType, body.tv #roomInvite, body.tv #roomHint, body.tv #roomDocs,
body.tv #battleBot, body.tv #card { display: none !important; }
body.tv #pilot, body.tv #topleft .row:has(#tour), body.tv #topleft .row:has(#queue), body.tv #baseRow,
body.tv #kills, body.tv #squad, body.tv #apiStatus, body.tv #where { display: none !important; }
#roomPeople .who.me { border: 1px solid var(--accent); color: var(--accent); }
