:root {
  font-family: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif;
  font-synthesis: none;
  color-scheme: dark;
  background: #1d143b;
  color: #fff;
  --surface: #19132edb;
  --edge: #e4d6ff46;
  --lavender: #d2baff;
  --lime: #dbfc9f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, canvas:focus-visible { outline: 2px solid #c6a0ff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.game-card { position: fixed; inset: 0; isolation: isolate; overflow: hidden; width: 100%; height: 100%; height: 100dvh; }
.game-card:fullscreen, .game-card.is-expanded { position: fixed; inset: 0; width: 100%; height: 100%; }
.arena, #camera-video, #world { position: absolute; inset: 0; width: 100%; height: 100%; }
.arena { background: #1d143b; }
#camera-video { display: block; opacity: 0; object-fit: cover; transform: scaleX(-1); filter: saturate(1.12); }
.arena[data-live="true"] #camera-video, .arena[data-video="true"] #camera-video { opacity: 1; }
#world { display: block; touch-action: manipulation; }
#world:focus-visible { outline-offset: -3px; }
.topbar, .bottom-dock { position: fixed; z-index: 2; inset-inline: 0; pointer-events: none; }
.topbar > *, .bottom-dock > * { min-width: 0; }
.topbar {
  top: 0;
  padding: max(12px, env(safe-area-inset-top)) max(15px, env(safe-area-inset-right)) 0 max(15px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}
.top-start { display: flex; align-items: flex-start; flex-direction: column; gap: 6px; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-size: 22px; font-weight: 850; letter-spacing: -.075em; text-shadow: 0 1px 9px #000a; white-space: nowrap; }
.brand img { border-radius: 10px; box-shadow: 0 3px 14px #0005; }
.accent { color: var(--lavender); }
.camera-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px; border: 1px solid #ffffff32; background: #201833d9; font-size: 10px; font-weight: 700; white-space: nowrap; }
.camera-pill i { width: 6px; height: 6px; border-radius: 50%; background: #ad9fc6; flex: 0 0 auto; }
.camera-pill[data-camera="ready"] i { background: var(--lime); box-shadow: 0 0 7px #c6ff7e; }
.camera-pill[data-camera="loading"] i { background: #ffcf8e; }
.camera-pill[data-camera="error"] i { background: #ff9aba; }
.scoreboard { display: flex; border-radius: 14px; border: 1px solid var(--edge); background: var(--surface); backdrop-filter: blur(10px); }
.scoreboard div { padding: 5px 10px; min-width: 57px; text-align: center; }
.scoreboard div + div { border-left: 1px solid #e4d6ff25; }
.scoreboard span { display: block; color: #e4d8f8; font-size: 9px; font-weight: 750; letter-spacing: .065em; text-transform: uppercase; }
.scoreboard strong { display: block; font-size: 17px; line-height: 1.08; font-variant-numeric: tabular-nums; }
.top-actions { display: flex; justify-content: flex-end; gap: 5px; }
.icon-button, .secondary, .primary, .mode {
  border: 1px solid var(--edge);
  color: #fff;
  background: var(--surface);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 41px; height: 41px; flex: 0 0 auto; padding: 0; border-radius: 12px; }
.icon-button svg, .primary svg { width: 20px; height: 20px; flex: 0 0 auto; }
.icon-button:hover, .secondary:hover { background: #433366e9; }
.account-button span { display: none; }
#sound[aria-pressed="false"] .sound-off, #sound[aria-pressed="true"] .sound-on { display: none; }
.bottom-dock {
  bottom: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  padding: 0 max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.arena-overlay, .round-actions, .active-controls { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.arena-overlay { flex-direction: column; text-align: center; max-width: min(100%, 465px); }
.active-controls:not(:has(button:not([hidden]))) { display: none; }
.round-summary { display: none; padding: 5px 10px; border-radius: 13px; border: 1px solid var(--edge); background: var(--surface); }
.arena-overlay:is([data-screen="paused"], [data-screen="results"]) .round-summary { display: block; }
.round-summary h2 { margin: 0; font-size: 15px; line-height: 1.1; }
.round-summary p, .overlay-note { margin: 2px 0 0; color: #eee4ff; font-size: 11px; font-weight: 550; }
.overlay-note:not(:empty) { border-radius: 12px; background: var(--surface); padding: 5px 8px; }
.overlay-note:empty { display: none; }
.primary, .secondary { min-height: 39px; padding: 6px 12px; border-radius: 12px; font-size: 13px; font-weight: 780; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #272135; background: var(--lime); border-color: #eeffd4; box-shadow: 0 3px 16px #adff8880; }
.primary:hover { background: #efffca; }
.primary:disabled { opacity: .88; }
.game-card:has(.arena[data-live="true"]) .video-symbol, .game-card:not(:has(.arena[data-live="true"])) .play-symbol { display: none; }
.modes { display: flex; gap: 5px; justify-content: center; max-width: 100%; }
.mode { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 13px; font-size: 13px; font-weight: 750; min-height: 39px; padding: 5px 10px; white-space: nowrap; }
.mode svg { width: 20px; height: 20px; }
.mode.blitz { --mode-color: #cfb1ff; }
.mode.rush { --mode-color: #ff9abf; }
.mode.orbit { --mode-color: #dafb96; }
.mode.sweep { --mode-color: #8df0fb; }
.mode svg { color: var(--mode-color); }
.mode[aria-pressed="true"] { background: #2d204ae9; border-color: var(--mode-color); color: var(--mode-color); }
.mode:not(:disabled):hover { border-color: var(--mode-color); background: #49366aeb; }
.mode:disabled:not([aria-pressed="true"]) { opacity: .73; }

@media (max-width: 650px) {
  .topbar { gap: 4px; grid-template-columns: minmax(0, 1fr) auto auto; padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .top-start { gap: 4px; }
  .brand span { display: none; }
  .brand img { width: 33px; height: 33px; }
  .scoreboard div { padding: 4px 5px; min-width: 44px; }
  .scoreboard strong { font-size: 15px; }
  .icon-button, .account-button { height: 37px; width: 37px; }
  .top-actions { gap: 3px; }
  .icon-button.expand { display: none; }
  .camera-pill { font-size: 9px; padding-inline: 5px; }
  .mode { padding-inline: 7px; min-height: 37px; }
  .mode svg { width: 17px; height: 17px; }
}
@media (max-width: 360px) {
  .mode { padding-inline: 5px; gap: 3px; }
  .icon-button, .account-button { height: 33px; width: 33px; }
  .scoreboard div { min-width: 39px; }
  .camera-pill span { max-width: 67px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .bottom-dock { gap: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .mode, .primary, .secondary { min-height: 34px; }
}
