:root {
  color-scheme: dark;
  --bg: #111a2b;
  --panel: #1b2840;
  --ink: #fff9ec;
  --muted: #a7b8d0;
  --line: #ffffff16;
  --mint: #78dfcd;
  --me: #78dfcd;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 85% 0%, #28526b40, transparent 60%); pointer-events: none; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid var(--mint); outline-offset: 4px; }
.topbar { height: 76px; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 24px; font-weight: 850; letter-spacing: -.8px; line-height: 1.1; }
.wordmark small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .3px; margin-top: 4px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--mint); color: var(--bg); border-radius: 12px 12px 12px 2px; transform: rotate(-8deg); font-weight: 900; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.connection { color: var(--muted); font-size: 12px; }
.connection[data-state="open"] { color: var(--mint); }
.button { border: 1px solid var(--line); background: #ffffff09; color: var(--ink); border-radius: 10px; min-height: 40px; padding: 10px 15px; font-size: 12px; font-weight: 750; transition: background .15s, transform .15s; }
.button:hover:not(:disabled) { background: #ffffff18; }
.button:active:not(:disabled) { transform: translateY(2px); }
.button--primary { background: var(--mint); color: #12282d; border-color: transparent; }
.button--primary:hover:not(:disabled) { background: #a6f1e4; }
.button--quiet { background: transparent; }
.host-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; padding: 0 28px; height: calc(100vh - 124px); min-height: 530px; max-width: 1920px; margin: auto; }
.arena { background: #142039; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.scoreboard { display: flex; justify-content: space-around; padding: 16px 10px 12px; border-bottom: 1px solid var(--line); background: #ffffff03; gap: 10px; }
.scoreboard div { text-align: center; }
.scoreboard small { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.scoreboard strong { font-size: 25px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.scoreboard div:first-child strong { color: var(--mint); }
#stage { display: block; width: 100%; height: 100%; min-height: 0; flex: 1 1 0; object-fit: contain; touch-action: none; }
.arena-controls { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.arena-controls p { flex: 1; color: var(--muted); font-size: 11px; margin: 0; max-width: 450px; }
.join-panel { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 8px; }
.eyebrow { color: var(--mint); font-weight: 750; font-size: 9px; letter-spacing: 1.5px; }
h1 { margin: 0; font-size: 34px; letter-spacing: -1.5px; line-height: 1.07; }
.intro { font-size: 11px; line-height: 1.6; margin: 0; color: var(--muted); max-width: 260px; }
.qr-card { align-self: center; background: white; border-radius: 14px; padding: 7px; width: min(148px, 22vh); min-width: 100px; line-height: 0; box-shadow: 0 4px 24px #0003; }
.qr-card svg { width: 100%; height: auto; }
.room-label { margin: 0; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.room-label strong { color: var(--ink); font-size: 24px; letter-spacing: 5px; font-variant-numeric: tabular-nums; }
.join-link { text-align: center; color: var(--muted); font-size: 10px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.limb-roster { display: grid; gap: 5px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.seat .dot { flex: 0 0 8px; height: 8px; background: var(--limb); border-radius: 50%; box-shadow: 0 0 12px color-mix(in srgb, var(--limb), transparent 70%); }
.seat .seat-name { flex: 1; }
.seat .seat-owner { color: var(--muted); max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assist-note { text-align: center; color: var(--muted); font-size: 10px; line-height: 1.5; margin: 0; }
.button--practice { border-style: dashed; width: 100%; font-size: 10px; min-height: 34px; padding: 8px; color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 28px; font-size: 10px; color: #8d9eb7; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--mint); }
.error { color: #ff9aab; background: #ff697811; padding: 12px; font-size: 12px; margin: 0; }

.phone { max-width: 520px; margin: auto; }
.phone .topbar { padding: 16px 20px; height: 76px; }
.phone .wordmark { font-size: 22px; }
.join-form-card { padding: 36px 28px; }
.join-form-card .eyebrow { font-size: 8px; margin-bottom: 18px; }
.join-form-card h1 { font-size: 52px; }
.join-form-card p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 22px 0; }
#joinForm { display: grid; gap: 18px; margin-top: 28px; }
#joinForm label { font-size: 12px; font-weight: 700; display: grid; gap: 8px; }
#joinForm input { width: 100%; padding: 15px; border: 1px solid #ffffff25; background: var(--panel); color: var(--ink); border-radius: 12px; font-size: 18px; min-width: 0; }
#roomInput { text-transform: uppercase; letter-spacing: 5px; }
#joinForm .button { font-size: 15px; padding: 16px; margin-top: 6px; }
.phone-play { padding: 10px 20px 20px; }
.your-limb { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.your-limb h1 { font-size: 32px; color: var(--me); margin-top: 5px; }
.your-limb p { font-size: 11px; color: var(--muted); margin: 6px 0; }
.room-badge { border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.phone-status { margin: 12px 0; padding: 10px 12px; background: #ffffff07; border-radius: 8px; color: var(--muted); font-size: 12px; min-height: 36px; }
.phone-status.is-fit { color: var(--mint); background: #78dfcd12; }
.phone-pad { position: relative; max-width: 400px; margin: auto; }
#pad { display: block; width: 100%; height: auto; touch-action: none; border: 1px solid var(--line); border-radius: 24px; }
.offline { position: absolute; inset: 0; border-radius: 24px; background: #111a2bec; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; z-index: 1; }
.offline p { font-size: 15px; line-height: 1.6; }
.nudge { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 0; }
.nudge button { background: var(--panel); color: var(--me); border: 1px solid var(--line); border-radius: 9px; width: 42px; height: 42px; font-size: 22px; touch-action: manipulation; }
.nudge span { font-size: 9px; color: var(--muted); text-align: center; padding: 0 6px; }
.phone-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 12px; }
.phone-slots button { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 9px 3px; font-size: 9px; background: #ffffff04; border: 1px solid var(--line); border-top: 3px solid var(--limb); border-radius: 8px; color: var(--ink); min-height: 48px; }
.phone-slots button[aria-pressed="true"] { background: #ffffff12; border-color: var(--limb); }
.phone-slots small { color: var(--muted); font-size: 8px; }
.phone .site-footer { border-top: 1px solid var(--line); padding: 18px 20px; }

@media (min-width: 1600px) {
  .host-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
  .join-panel { padding: 10px 0; }
  .join-panel h1 { font-size: 44px; }
  .intro { font-size: 14px; }
  .seat { padding: 12px; font-size: 13px; }
  .qr-card { width: 180px; }
}
@media (max-width: 900px) {
  .host .topbar { padding: 12px 16px; }
  .host-layout { grid-template-columns: 1fr; height: auto; padding: 0 16px; }
  .arena { min-height: 490px; }
  #stage { flex: auto; height: auto; aspect-ratio: 5 / 3; }
  .join-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 10px; gap: 16px; }
  .join-panel h1 { font-size: 30px; }
  .qr-card { grid-column: 2; grid-row: 1 / 4; width: 140px; justify-self: center; }
  .intro { max-width: none; }
  .limb-roster { grid-column: 1 / -1; }
  .top-actions .connection { max-width: 110px; }
  .arena-controls { flex-wrap: wrap; }
  .arena-controls p { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
