/* ═══════════════════════════════════════════════════════════════════════════
   bman v2 — design system (MODERN.md "Modern UI", agent U)
   One dark-glass theme, one accent (bomb-orange ember), original pixel art
   as decoration. The arena canvas itself stays untouched original sprites.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* palette */
  --bg-0: #0b0e13;
  --bg-1: #10141b;
  --glass: rgba(17, 21, 29, 0.68);
  --glass-hi: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --txt: #e9edf3;
  --muted: #97a1b2;
  --dim: #5b6572;
  --accent: #ff7a1c;
  --accent-hi: #ffb01f;
  --accent-lo: #ff5a1f;
  --ember: linear-gradient(135deg, var(--accent-hi), var(--accent-lo));
  --good: #43cf72;
  --bad: #ff5148;
  /* shape */
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --glow: 0 6px 26px rgba(255, 122, 28, 0.32);
  /* type */
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  /* match layout (MODERN.md v3 §1 + v4 §3 "as narrow as possible"): width of
     the right-side HUD panel — the arena canvas (#screen) gets the REST of
     the viewport and must fill it.
     One source of truth: #screen and .hud-panel both derive from this. */
  --hud-w: clamp(96px, 12vw, 120px);
}
/* phones in landscape (match orientation): compact 84-100px column (v4 §3) */
@media (max-height: 520px) {
  :root { --hud-w: clamp(84px, 12vw, 100px); }
}
/* v5 §3: TOUCH devices (coarse pointer) get a wider column so the in-panel
   joystick is usable — desktop keeps the minimal v4 width above */
@media (pointer: coarse) {
  :root { --hud-w: clamp(132px, 18vw, 176px); }
}
/* phone landscape + touch: ~140-160px (v5 §3) */
@media (pointer: coarse) and (max-height: 520px) {
  :root { --hud-w: clamp(140px, 18vw, 160px); }
}

/* ── base ──────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
input, textarea { user-select: text; -webkit-user-select: text; }
::selection { background: rgba(255, 122, 28, 0.35); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* atmosphere: faint arena checkerboard + ember glow rising from below */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.016) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.016) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.016) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.016) 75%);
  background-position: 0 0, 26px 26px;
  background-size: 52px 52px;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(58% 42% at 50% 118%, rgba(255, 106, 26, 0.16), transparent 70%),
    radial-gradient(40% 30% at 85% -8%, rgba(255, 176, 31, 0.05), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.42) 100%);
}

[hidden] { display: none !important; }     /* author display rules must not resurrect hidden nodes */
.px, canvas.px, img.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

/* thin dark scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── layer stack ───────────────────────────────────────────────────────────── */
/* the ARENA AREA (MODERN.md v3 §1): viewport minus the right HUD panel. CSS
   owns this layout; render.js measures clientWidth/Height and sizes the
   backing store (dpr-aware) to match. Canvas is a replaced element, so the
   size must be explicit (width:auto would collapse to the attribute size). */
#screen {
  position: fixed; top: 0; left: 0; z-index: 1; display: none;
  width: calc(100vw - var(--hud-w));
  height: 100vh;
  height: 100dvh;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #000;
}
#app {
  position: fixed; inset: 0; z-index: 10;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#hud { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
/* direct children get their events back (.replaybar!) EXCEPT the full-viewport
   .hud-root shell: with a plain `#hud > *` the ID specificity beat
   .hud-root{pointer-events:none} and the shell swallowed every canvas
   wheel/click/tap during matches (integration fix 2026-07-09). The hud PANEL
   re-enables itself via its own pointer-events:auto (v3: it only covers the
   right column, never the arena). */
#hud > :not(.hud-root) { pointer-events: auto; }
#chrome { position: fixed; top: 12px; right: 12px; z-index: 40; display: flex; gap: 10px; align-items: center; }
#overlay-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#overlay-root > * { pointer-events: auto; }
#rotate { position: fixed; inset: 0; z-index: 80; display: none; }
#boot { position: fixed; inset: 0; z-index: 100; }

/* scene-driven visibility */
body[data-scene="match"] #screen { display: block; }
body[data-scene="match"] #app { display: none; }
body[data-scene="match"] #chrome { display: none; }

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid var(--line-2);
  background: var(--glass-hi);
  color: var(--txt);
  font: 600 15px/1 var(--font);
  min-height: 44px; padding: 0 18px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 200ms ease, filter 160ms ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary {
  background: var(--ember);
  border-color: rgba(255, 255, 255, 0.28);
  color: #241102;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  box-shadow: var(--glow);
  position: relative; overflow: hidden;
}
.btn.primary::after {                          /* burning-fuse shimmer */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  background-size: 200% 100%;
  opacity: 0; transition: opacity 160ms ease;
}
.btn.primary:hover::after { opacity: 1; animation: fuseSlide 1.1s linear infinite; }
@keyframes fuseSlide { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { box-shadow: none; filter: saturate(0.4); }
.btn.danger { border-color: rgba(255, 81, 72, 0.5); color: #ffb1ac; }
.btn.danger:hover { background: rgba(255, 81, 72, 0.14); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--glass-hi); }
.btn.big { min-height: 50px; font-size: 16px; width: 100%; }
.btn.xl { min-height: 58px; font-size: 17px; letter-spacing: 0.06em; width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.back { padding-left: 12px; }
.btn.back::before { content: "←"; font-size: 17px; line-height: 1; }
.btn-cnt { opacity: 0.75; font-weight: 500; }

/* ── inputs ────────────────────────────────────────────────────────────────── */
.field {
  width: 100%; min-height: 44px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--txt);
  font: 500 15px/1.2 var(--font);
  padding: 0 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field::placeholder { color: var(--dim); }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 28, 0.18); }
.field.code {
  font-family: var(--mono); font-size: 20px; letter-spacing: 0.35em;
  text-align: center; text-transform: uppercase; max-width: 170px;
}
.lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 0 0 6px 2px; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex: none; }

input[type="range"] { appearance: none; -webkit-appearance: none; height: 30px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin-top: -7.5px; border-radius: 50%;
  background: var(--ember); border: 2px solid #1a0d02;
  box-shadow: 0 0 10px rgba(255, 122, 28, 0.5);
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ember); border: 2px solid #1a0d02;
}

/* ── surfaces ──────────────────────────────────────────────────────────────── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.panel { padding: clamp(16px, 2.4vw, 24px); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-title {
  margin: 6px 0 2px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted);
}
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spacer { height: 8px; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); color: var(--muted);
  border: 1px solid var(--line);
}
.badge.pub { color: var(--good); border-color: rgba(67, 207, 114, 0.4); }
.badge.priv { color: var(--accent-hi); border-color: rgba(255, 176, 31, 0.4); }
.badge.dim { opacity: 0.6; }
.empty { color: var(--muted); padding: 22px 8px; text-align: center; }
.empty strong { color: var(--txt); }
.err-note { color: var(--bad); font-size: 12px; margin-top: 8px; }

/* ── scene scaffolding ─────────────────────────────────────────────────────── */
.scene {
  position: relative; z-index: 1;
  max-width: 1220px; margin: 0 auto;
  min-height: 100%;
  padding: clamp(14px, 3vw, 36px);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: clamp(14px, 2vw, 22px);
  animation: sceneIn 260ms ease backwards;
}
@keyframes sceneIn { from { opacity: 0; transform: translateY(10px); } }
.scene-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.scene-title {
  margin: 0; font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; letter-spacing: -0.02em;
}
.head-note { color: var(--dim); font-size: 12.5px; letter-spacing: 0.04em; }

/* ═══ HOME ═════════════════════════════════════════════════════════════════ */
.scene-home { justify-content: center; gap: clamp(20px, 3.5vh, 40px); max-width: 1080px; }
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 4vh; text-align: center; }
.home-logo {
  width: clamp(270px, 44vw, 540px); height: auto; aspect-ratio: 298 / 139;
  filter: drop-shadow(0 14px 34px rgba(255, 122, 28, 0.28)) drop-shadow(0 4px 0 rgba(0, 0, 0, 0.45));
  animation: logoIn 700ms cubic-bezier(0.2, 0.9, 0.25, 1.2) backwards;
}
@keyframes logoIn { from { opacity: 0; transform: translateY(-18px) scale(0.94); } }
.home-tag {
  color: var(--muted); font-size: clamp(13px, 1.6vw, 15px);
  letter-spacing: 0.22em; text-transform: uppercase;
  animation: sceneIn 400ms 150ms ease backwards;
}
.home-heads { display: flex; gap: 10px; margin-top: 6px; }
.home-head { display: inline-flex; animation: bob 2.6s ease-in-out infinite; }
.home-head canvas { border-radius: 8px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.home-nav {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.nav-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 108px; padding: 18px 20px;
  text-align: left; cursor: pointer;
  color: var(--txt);
  border-radius: var(--r-lg);
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 220ms ease, background 180ms ease;
  animation: rise 460ms ease backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.nav-card:hover { transform: translateY(-3px); border-color: rgba(255, 176, 31, 0.45); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 4px 30px rgba(255, 122, 28, 0.14); }
.nav-card:active { transform: translateY(-1px) scale(0.99); }
.nav-card .card-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.nav-card .card-sub { font-size: 13px; color: var(--muted); }
.nav-card .card-arrow { position: absolute; right: 16px; top: 16px; opacity: 0.5; transition: transform 180ms ease, opacity 180ms ease; }
.nav-card .card-arrow::before { content: "→"; font-size: 18px; }
.nav-card:hover .card-arrow { transform: translateX(4px); opacity: 1; }
.nav-card.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(255, 176, 31, 0.16), rgba(255, 90, 31, 0.13)), var(--glass);
  border-color: rgba(255, 140, 40, 0.45);
}
.nav-card.primary .card-title { font-size: 22px; }
.nav-card.primary .card-title::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--ember); margin-right: 10px; box-shadow: 0 0 12px rgba(255, 122, 28, 0.8); animation: pulseDot 1.6s ease-in-out infinite; }
@keyframes pulseDot { 50% { box-shadow: 0 0 20px rgba(255, 122, 28, 1); } }
.nav-card.busy { pointer-events: none; opacity: 0.75; }

/* quick-play controls on the primary card (MODERN.md v3 §3): bots stepper
   1..15 + auto map size readout; the card itself is a div (nested buttons) */
.quick-card { cursor: pointer; }
.quick-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; width: 100%; flex-wrap: wrap; }
.quick-row .step-btn { width: 44px; height: 44px; flex: none; }
.quick-bots {
  min-width: 62px; text-align: center; flex: none;
  font: 700 15px var(--mono);
}
.quick-go { flex: 1 1 130px; max-width: 240px; min-height: 44px; letter-spacing: 0.06em; }
.quick-card .card-sub { min-height: 1.4em; }
.home-foot { margin-top: auto; text-align: center; color: var(--dim); font-size: 12.5px; padding-top: 10px; }

/* ═══ ROOMS ════════════════════════════════════════════════════════════════ */
.rooms-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.join-row { display: flex; gap: 10px; align-items: center; }
.room-list { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.room-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; min-height: 54px;
  cursor: pointer; color: var(--txt);
  border-radius: var(--r-md);
  transition: transform 160ms ease, border-color 160ms ease;
  text-align: left;
}
.room-row:hover { transform: translateX(4px); border-color: rgba(255, 176, 31, 0.4); }
.room-name { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-count { color: var(--muted); }
.room-join { color: var(--accent-hi); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ═══ LOBBY ════════════════════════════════════════════════════════════════ */
.code-box { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-left: auto; border-radius: var(--r-md); flex-wrap: wrap; }
.code-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim); }
.room-code { font-size: 22px; font-weight: 800; letter-spacing: 0.3em; color: var(--accent-hi); }
.lobby-grid {
  display: grid; gap: 16px;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr) minmax(230px, 300px);
  align-items: start;
}
.lobby-count { color: var(--muted); font-size: 13px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 8px; }
.slot {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 84px; padding: 10px 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--txt); cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.slot:hover { transform: translateY(-2px); border-color: var(--line-2); }
.slot.human, .slot.ai { border-color: color-mix(in srgb, var(--pc) 55%, transparent); background: color-mix(in srgb, var(--pc) 7%, transparent); }
.slot.open { border-style: dashed; color: var(--muted); }
.slot.closed { opacity: 0.38; }
.slot.me { box-shadow: 0 0 0 2px var(--accent), 0 6px 18px rgba(255, 122, 28, 0.2); }
.slot-avatar { height: 40px; display: flex; align-items: center; }
.slot-avatar canvas { border-radius: 6px; }
.slot-hole { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line-2); }
.slot-name { font-size: 12.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-tag {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 1px 7px; color: var(--muted);
}
.slot-tag.you { color: #241102; background: var(--ember); border-color: transparent; left: auto; right: -4px; transform: none; }
.slot-tag.off { left: auto; right: -4px; transform: none; color: var(--bad); }
.slot-hint { color: var(--dim); font-size: 12px; }
.host-note { color: var(--accent-hi); font-size: 12.5px; }

.arena-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.arena-pick { flex: 1 1 260px; min-width: 0; }
.lvl-group-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim); margin: 8px 0 5px; }
.lvl-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lvl-chip {
  min-height: 38px; padding: 0 13px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--txt); font: 600 13px var(--font);
  cursor: pointer; transition: border-color 140ms ease, background 140ms ease;
}
.lvl-chip:hover:not(:disabled) { border-color: var(--line-2); }
.lvl-chip:disabled { cursor: default; opacity: 0.65; }
.lvl-chip.sel { background: var(--ember); color: #241102; border-color: transparent; font-weight: 800; box-shadow: var(--glow); opacity: 1; }
.mini-box {
  flex: 0 1 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px;
}
.minimap { border-radius: 4px; max-width: 100%; }
.mini-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mini-cap { font-size: 12px; color: var(--dim); }
.mini-none { color: var(--dim); font-size: 13px; padding: 30px 20px; }

.rules-row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.stepper { display: flex; flex-direction: column; gap: 5px; }
.step-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.step-ctl { display: flex; align-items: center; gap: 8px; }
.step-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2);
  color: var(--txt); font-size: 19px; cursor: pointer;
  transition: background 140ms ease;
}
.step-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.step-btn:disabled { opacity: 0.35; cursor: default; }
.step-val { min-width: 54px; text-align: center; font: 700 16px var(--mono); }
.stepper.ro .step-btn { display: none; }
.toggle-line { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; font-size: 14px; }

.mods-list { display: flex; flex-direction: column; gap: 4px; }
.mod-line { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; padding: 2px 6px; border-radius: var(--r-sm); }
.mod-line:hover { background: var(--glass-hi); }
.mod-line.on .mod-name { color: var(--accent-hi); }
.mod-name { font-weight: 600; }
.mod-extra { color: var(--dim); font-size: 12px; }
.mods-none { color: var(--dim); font-size: 13px; }
.start-btn { margin-top: 8px; }

.lobby-chat { max-height: calc(100dvh - 220px); }
.chat-log { flex: 1; min-height: 160px; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 4px; }
.chat-line { font-size: 13.5px; overflow-wrap: anywhere; }
.chat-from { font-weight: 700; margin-right: 7px; }
.chat-line.server .chat-from { color: var(--accent-hi); }
.chat-line.server .chat-text { color: var(--muted); font-style: italic; }

/* ═══ RESULTS (winner / draw / victory) ════════════════════════════════════ */
.scene-result { justify-content: center; align-items: center; }
.result-card {
  width: min(94vw, 560px);
  padding: clamp(20px, 4vw, 34px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
  animation: cardPop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards;
  /* v3 verifier fix: auto margins beat justify-content, so the card centers
     when it fits but stays TOP-REACHABLE (scrollable in #app) when taller
     than a landscape-phone viewport — plain flex centering made the top
     overflow (winner art) unscrollable/cut on 412px-tall phones. */
  margin: auto 0;
}
@keyframes cardPop { from { opacity: 0; transform: translateY(22px) scale(0.94); } }
.result-art { width: min(70%, 300px); height: auto; filter: drop-shadow(0 6px 18px rgba(255, 122, 28, 0.35)); }
.result-art.small { width: min(55%, 240px); }
.result-hero { display: flex; justify-content: center; align-items: flex-end; gap: 8px; min-height: 70px; }
.result-hero canvas { filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--pc, #ff7a1c) 55%, transparent)); animation: heroBounce 1.4s ease-in-out infinite; }
@keyframes heroBounce { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-10px); } }
.draw-hero .draw-head { display: inline-flex; opacity: 0.8; }
.result-title { margin: 0; font-size: clamp(21px, 4vw, 28px); font-weight: 800; letter-spacing: -0.02em; }
.result-sub { color: var(--muted); font-size: 13.5px; }
.score-list { width: 100%; display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow-y: auto; }
.score-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid transparent;
}
.score-row.win { border-color: color-mix(in srgb, var(--pc) 60%, transparent); background: color-mix(in srgb, var(--pc) 9%, transparent); }
.score-avatar { display: flex; }
.score-avatar canvas { border-radius: 6px; }
.score-name { flex: 1; text-align: left; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pips { display: flex; gap: 4px; }
.spip { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.spip.on { background: var(--ember); box-shadow: 0 0 7px rgba(255, 122, 28, 0.6); }
.score-n { font-weight: 800; min-width: 22px; text-align: right; }
.result-actions { width: 100%; display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.victory-note { color: var(--muted); font-size: 14px; padding: 6px; }

/* fuse countdown */
.fuse { position: relative; width: 100%; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); margin: 8px 0 2px; }
.fuse-burn { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ember); }
.fuse-spark {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff8e0 0%, var(--accent-hi) 45%, transparent 75%);
  box-shadow: 0 0 12px 3px rgba(255, 176, 31, 0.75);
  animation: sparkle 300ms linear infinite alternate;
}
@keyframes sparkle { from { filter: brightness(1); } to { filter: brightness(1.5); } }
.fuse.out .fuse-spark { display: none; }

/* victory confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cf {
  position: absolute; top: -6vh; width: 9px; height: 14px; border-radius: 2px;
  animation: cfFall 3s linear infinite;
  opacity: 0.9;
}
@keyframes cfFall {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(118vh) rotate(560deg); }
}

/* ═══ REPLAYS ══════════════════════════════════════════════════════════════ */
.replay-body { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.replay-list { display: flex; flex-direction: column; gap: 8px; }
.scene-replays.viewing .replay-list { display: none; }
.replay-stage {
  display: none; position: relative;
  flex: 1; min-height: 0;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; padding-bottom: 74px;      /* room for the transport bar */
}
.scene-replays.viewing .replay-stage { display: flex; }
.replay-canvas {
  width: auto; height: auto;
  max-width: 100%; max-height: calc(100dvh - 240px);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.stage-close { position: absolute; top: 12px; right: 12px; }
.replay-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; min-height: 52px;
  color: var(--txt); cursor: pointer; text-align: left;
  border-radius: var(--r-md);
  transition: transform 160ms ease, border-color 160ms ease;
}
.replay-row:hover { transform: translateX(4px); border-color: rgba(255, 176, 31, 0.4); }
.rr-when { color: var(--muted); font-size: 13px; min-width: 110px; }
.rr-level { font-weight: 700; flex: 1; }
.rr-len, .rr-players { color: var(--dim); font-size: 13px; }
.rr-status { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-hi); }
.rr-status.live { color: var(--bad); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* the viewer core's transport bar (replay_viewer.js), restyled modern */
.replaybar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(94vw, 720px);
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font: 500 13px var(--mono);
  color: var(--txt);
  z-index: 45;
}
.replaybar button {
  appearance: none; min-width: 44px; min-height: 36px;
  background: rgba(255, 255, 255, 0.06); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 999px;
  font: 600 13px var(--font); cursor: pointer; padding: 0 12px;
  transition: background 140ms ease;
}
.replaybar button:hover { background: rgba(255, 255, 255, 0.12); }
.replaybar button:first-child { background: var(--ember); color: #241102; border-color: transparent; font-size: 15px; }
.replaybar input[type="range"] { flex: 1; min-width: 60px; }
.replaybar .tick { cursor: copy; min-width: 9ch; text-align: right; color: var(--muted); }
.replaybar .warn { color: var(--accent-hi); font-weight: 700; }

/* ═══ MODS ═════════════════════════════════════════════════════════════════ */
.mods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; align-content: start; }
.mod-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.mod-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mod-title { font-size: 17px; font-weight: 800; }
.mod-id { color: var(--dim); font-size: 12px; }
.mod-desc { margin: 0; color: var(--muted); font-size: 13.5px; }
.mod-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.mods-foot { grid-column: 1 / -1; color: var(--dim); font-size: 13px; text-align: center; padding: 8px; }

/* ═══ SETTINGS ═════════════════════════════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.set-block { display: flex; flex-direction: column; gap: 10px; }
.set-note { color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.vol-line { display: grid; grid-template-columns: 78px 1fr 48px; align-items: center; gap: 10px; min-height: 44px; }
.vol-lbl { font-size: 13px; color: var(--muted); }
.vol-val { text-align: right; color: var(--muted); font-size: 13px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; }
.key-lbl { font-size: 14px; }
.key-btn {
  min-width: 130px; min-height: 40px;
  background: rgba(0, 0, 0, 0.32); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font: 700 13px var(--mono); letter-spacing: 0.06em;
  cursor: pointer; transition: border-color 140ms ease;
}
.key-btn:hover { border-color: var(--accent); }
.key-btn.capturing { border-color: var(--accent); color: var(--accent-hi); animation: blink 0.9s steps(2) infinite; }
.set-block.keys.compact .key-row { min-height: 38px; }

/* ═══ MATCH HUD — right-side vertical panel (MODERN.md v3 §1) ══════════════ */
/* .hud-root stays the full-viewport pointer-transparent shell; the PANEL is
   the only persistent HUD surface and it lives entirely in the --hud-w column
   to the right of the arena canvas — no HUD element overlaps the arena. */
.hud-root { position: fixed; inset: 0; pointer-events: none; }
.hud-panel {
  pointer-events: auto;
  position: absolute; top: 0; right: 0; bottom: 0;
  width: var(--hud-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 6px;
  background: linear-gradient(180deg, rgba(15, 19, 26, 0.97), rgba(10, 13, 18, 0.97));
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 34px rgba(0, 0, 0, 0.4);
}

.hud-clock {
  flex: none; text-align: center;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.4);
}
.hc-time { font: 800 18px/1.1 var(--mono); letter-spacing: 0.03em; }
.hud-clock.low { border-color: var(--accent); }
.hud-clock.low .hc-time { color: var(--accent-hi); animation: clockPulse 1s ease-in-out infinite; }
.hud-root.closing .hud-clock { border-color: var(--accent); box-shadow: 0 0 16px rgba(255, 122, 28, 0.35); }
@keyframes clockPulse { 50% { opacity: 0.55; } }
.hud-root.over .hud-panel { opacity: 0.72; }

/* player chips: stacked top-to-bottom (own chip FIRST — v4 §1), scrollable
   when 16 don't fit. Two rows per chip: avatar+name+score, then the
   power-up strip. */
.hud-chips {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 5px;
  overflow-y: auto; overflow-x: hidden;
  padding-right: 2px;
}
.hud-chips .chip {
  flex: none; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 3px 5px 4px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid color-mix(in srgb, var(--pc, #888) 45%, transparent);
  transition: opacity 300ms ease, filter 300ms ease;
}
.chip.me { box-shadow: 0 0 0 1.5px var(--accent); }
.chip.dead { filter: grayscale(1); opacity: 0.42; }
.chip.sick .chip-avatar { animation: sickFlash 0.36s steps(2) infinite; }
@keyframes sickFlash { 50% { filter: hue-rotate(120deg) saturate(2); } }
.chip-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.chip-avatar { display: flex; flex: none; }
.chip-avatar canvas { width: 22px !important; height: 22px !important; border-radius: 5px; display: block; }
.chip-name { flex: 1 1 auto; min-width: 0; font-size: 10.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.chip-score {
  flex: none; min-width: 16px; text-align: center;
  font: 800 10.5px var(--mono);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px; padding: 1px 4px;
  color: var(--accent-hi);
}
/* v4 §1 power-up strip: tiny pixelated arena_item sprites + counts; wraps */
.chip-pu { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; min-width: 0; }
.pu { display: inline-flex; align-items: center; gap: 2px; }
.pu-ico { width: 13px; height: 13px; border-radius: 3px; display: block; }
.pu-n { font: 700 9.5px var(--mono); color: var(--muted); line-height: 1; }
/* dense mode: 11+ players → tighter stack (the strip stays — v4 §1) */
.hud-panel.dense .hud-chips { gap: 3px; }
.hud-panel.dense .hud-chips .chip { padding: 2px 4px 3px; gap: 2px; }
.hud-panel.dense .chip-avatar canvas { width: 16px !important; height: 16px !important; }

/* bottom action row: pause menu + fullscreen (v3: they live IN the panel) */
.hud-actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hud-act {
  min-height: 44px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 140ms ease;
}
.hud-act:hover { background: rgba(255, 255, 255, 0.11); }
.hud-act.act-menu:hover .gear-ico { transform: rotate(40deg); }
.gear-ico {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px dotted var(--txt);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  transition: transform 300ms ease;
}

/* phone-landscape compact column (v4 §3: 84-100px, no dead padding) */
@media (max-height: 520px) {
  .hud-panel { gap: 5px; padding: 5px max(5px, env(safe-area-inset-right)) 5px 5px; }
  .hc-time { font-size: 15px; }
  .hud-clock { padding: 3px 4px; }
  .hud-chips { gap: 4px; }
  .hud-chips .chip { gap: 2px; padding: 2px 4px 3px; }
  .hud-chips .chip-avatar canvas { width: 20px !important; height: 20px !important; }
  .chip-name { font-size: 10px; }
  .pu-ico { width: 12px; height: 12px; }
  .pu-n { font-size: 9px; }
  .chip-score { font-size: 10px; min-width: 15px; }
  .hud-actions { gap: 5px; }
  .hud-act { min-height: 38px; }
}

/* hurry banner: original art streaks across the ARENA AREA (transient event
   flash, pointer-transparent — the persistent panel never covers the arena) */
.hud-hurry {
  position: absolute; top: 38%; left: 0; right: var(--hud-w);
  display: none; justify-content: center; overflow: hidden;
  padding: 10px 0;
  pointer-events: none;
}
.hud-hurry::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 122, 28, 0.7), transparent);
}
.hud-hurry .hurry-art { height: 54px; width: auto; filter: drop-shadow(0 4px 14px rgba(255, 122, 28, 0.5)); }
.hud-root.hurry-on .hud-hurry { display: flex; }
.hud-root.hurry-on .hud-hurry .hurry-art { animation: hurryRun 2.4s cubic-bezier(0.25, 0.6, 0.45, 1) both; }
.hud-root.hurry-on .hud-clock { border-color: var(--accent); }
@keyframes hurryRun {
  0% { transform: translateX(-62vw); opacity: 0; }
  12% { opacity: 1; }
  46% { transform: translateX(0); }
  60% { transform: translateX(0); }
  88% { opacity: 1; }
  100% { transform: translateX(62vw); opacity: 0; }
}

/* ═══ v5 touch controls — INSIDE the panel, never over the map ═════════════ */
/* hud.js renders .hud-stick + .hud-ab only on coarse-pointer devices;
   input.js wires them by delegation. The joystick never shrinks (flex: none,
   fixed aspect square) — with 16 players the CHIPS scroll instead (v5 §3). */
.hud-stick {
  flex: none; position: relative;
  width: min(100%, 124px); aspect-ratio: 1 / 1;
  margin: 2px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.42) 74%);
  border: 1.5px solid var(--line-2);
  touch-action: none;
  cursor: pointer;
}
.hud-stick::before {                       /* subtle center mark */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 46%; aspect-ratio: 1 / 1;
  margin: -23% 0 0 -23%;                   /* centered; JS moves it via transform */
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)), rgba(44, 52, 66, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;                    /* the BASE owns the pointer */
}
.hud-stick.on { border-color: var(--accent); }
.hud-stick.on .stick-knob { border-color: var(--accent-hi); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 14px rgba(255, 122, 28, 0.35); }
.hud-ab { flex: none; display: flex; gap: 10px; justify-content: center; padding: 2px 0; }
.tbtn {
  width: 50px; height: 50px; flex: none;
  border-radius: 50%;
  background: rgba(16, 20, 27, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.82);
  font: 800 18px var(--font);
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: none;
  cursor: pointer;
}
.tbtn.on, .tbtn:active { background: rgba(255, 122, 28, 0.4); border-color: var(--accent); }
/* touch panel: keep at least a sliver of chips visible; they scroll (v5 §3) */
.hud-panel.touch .hud-chips { min-height: 52px; }

/* ═══ chrome (net dot + fullscreen) ════════════════════════════════════════ */
.net-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bad); box-shadow: 0 0 8px rgba(255, 81, 72, 0.7);
  transition: background 300ms ease, box-shadow 300ms ease;
}
.net-dot.on { background: var(--good); box-shadow: 0 0 8px rgba(67, 207, 114, 0.7); }
.chrome-btn {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 140ms ease;
}
.chrome-btn:hover { border-color: var(--line-2); }
.fs-ico { width: 14px; height: 14px; border: 2px solid var(--txt); border-radius: 3px; position: relative; }
.fs-ico::before, .fs-ico::after { content: ""; position: absolute; width: 6px; height: 6px; }
.fs-ico::before { top: -5px; left: -5px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.fs-ico::after { bottom: -5px; right: -5px; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); }

/* ═══ overlays: toasts, modals, pause ══════════════════════════════════════ */
.toasts {
  position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; z-index: 70; width: min(94vw, 480px);
}
.toast {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  color: var(--txt);
  font-size: 14px; padding: 11px 16px;
  box-shadow: var(--shadow);
  animation: toastIn 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
  max-width: 100%;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.toast.gone { opacity: 0; transition: opacity 400ms ease; }

.modal-veil {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: veilIn 180ms ease backwards;
}
@keyframes veilIn { from { opacity: 0; } }
.modal, .pause-panel {
  width: min(94vw, 400px);
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  animation: cardPop 300ms cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
  max-height: calc(100dvh - 40px); overflow-y: auto;
}
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.modal-body { color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.modal-actions .btn { min-width: 96px; }
.pause-panel { width: min(94vw, 440px); }
.pause-note { color: var(--dim); font-size: 12.5px; }
.pause-settings { display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }

/* ═══ rotate gate (portrait phones during a match, MODERN.md #7) ═══════════ */
#rotate {
  background: rgba(5, 7, 11, 0.96);
  align-items: center; justify-content: center;
}
.rotate-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.rotate-phone {
  width: 46px; height: 78px;
  border: 3px solid var(--txt); border-radius: 9px;
  position: relative;
  animation: rotHint 1.8s ease-in-out infinite;
}
.rotate-phone::after { content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 14px; height: 3px; border-radius: 2px; background: var(--accent); }
@keyframes rotHint { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.rotate-text { font-size: 20px; font-weight: 800; }
.rotate-sub { color: var(--muted); font-size: 13.5px; }
@media (orientation: portrait) and (pointer: coarse) {
  body[data-scene="match"] #rotate { display: flex; }
}

/* ═══ boot splash / error surface ══════════════════════════════════════════ */
#boot {
  background: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 350ms ease;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(88vw, 340px); }
.boot-logo { font-size: 30px; font-weight: 900; letter-spacing: 0.14em; }
.boot-logo span { background: var(--ember); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot-bar { width: 100%; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.boot-fill { height: 100%; width: 0%; background: var(--ember); border-radius: 4px; transition: width 200ms ease; }
.boot-line { color: var(--muted); font-size: 13px; font-family: var(--mono); }
#boot.err { opacity: 1; pointer-events: auto; align-items: flex-start; overflow: auto; padding: 20px; }
#boot.err .boot-line, .boot-err-line {
  color: #ff8a84; white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px;
  text-align: left; max-width: 100%; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}

/* legacy inline chat prompt (kept for any remaining call site) */
.chatbox {
  position: absolute; left: 50%; bottom: 12%;
  transform: translateX(-50%);
  width: min(70vw, 420px);
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px; display: flex; gap: 8px; align-items: center;
}
.chatbox input {
  flex: 1; background: rgba(0, 0, 0, 0.35); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font: 500 14px var(--font); padding: 8px 10px; outline: none;
}

/* ═══ responsive ═══════════════════════════════════════════════════════════ */
@media (max-width: 1020px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .lobby-slots { grid-column: 1 / -1; }
  .lobby-chat { max-height: none; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .rooms-grid, .lobby-grid, .settings-grid { grid-template-columns: 1fr; }
  .code-box { margin-left: 0; width: 100%; }
  .scene-head { gap: 10px; }
  .arena-row { flex-direction: column; }
  .mini-box { align-self: center; }
  .rr-when { min-width: 84px; }
  .rr-players { display: none; }
  .replay-canvas { max-height: calc(100dvh - 300px); }
  .home-heads { flex-wrap: wrap; justify-content: center; }
}

/* reduced motion: kill the theatrics, keep the states */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .home-head, .result-hero canvas { animation: none !important; }
}
