/* The room. Every phone is a speaker: cream body, dark grille, one live color.
   Two type voices (a tight grotesk, a small caps mono) plus the dot-matrix for codes and counters. */
body.room-mode {
  --cream:#E7E1D4; --warm:#D9D2C6; --warm-2:#CFC7B8; --ink:#141414; --ink-2:#3A3732; --muted:#6F6A60;
  --live:#ED3F1C; --orange:#ED8008; --olive:#736B1E; --panel:#1C1A17; --panel-dot:#4B463E; --field:#F6F2EA;
  --level:0;
  /* Motion. Productive curves (Carbon) for controls; expressive arrivals and exits (Material emphasized) for the moments. */
  --ease-std:cubic-bezier(.2,0,.38,.9); --ease-in:cubic-bezier(0,0,.38,.9); --ease-out:cubic-bezier(.2,0,1,.9);
  --ease-x:cubic-bezier(.4,.14,.3,1); --ease-in-x:cubic-bezier(.05,.7,.1,1); --ease-out-x:cubic-bezier(.3,0,.8,.15);
  --t-fast:70ms; --t-quick:110ms; --t-mod:150ms; --t-mod2:240ms; --t-slow:400ms; --t-slow2:700ms;
  background:var(--cream); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Helvetica Neue",Inter,Roboto,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
@media(prefers-color-scheme:dark) {
  body.room-mode {--cream:#1C1A17; --warm:#2B2824; --warm-2:#3A3631; --ink:#EFE9DD; --ink-2:#D9D2C6; --muted:#A39C8E; --panel:#282521; --panel-dot:#5C554B; --field:#26231F}
  body.room-mode .grille {border:1px solid rgba(255,255,255,.07)}
}
.mono {font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace; font-weight:500; font-size:10px; line-height:1.5; letter-spacing:.12em; text-transform:uppercase}
.code {font:400 1em/1 "Loud Matrix",ui-monospace,Menlo,monospace; letter-spacing:.02em}
.visually-hidden {position:absolute; width:1px; height:1px; min-height:0; padding:0; border:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap}
@keyframes spin {to {transform:rotate(360deg)}}

/* Chrome */
body.room-mode .masthead {background:transparent; border:0; color:var(--ink); padding:16px 20px 0; height:auto; max-width:1200px; margin:0 auto}
body.room-mode .masthead .edition,body.room-mode .welcome-nav,body.room-mode footer,body.room-mode .broadcast-stage {display:none!important}
body.room-mode .brand {color:var(--ink); font-size:20px; letter-spacing:-.04em; gap:9px; white-space:nowrap; flex:none}
body.room-mode .brand-dot {color:var(--live)}
body.room-mode .brand .brand-icon {width:22px}
body.room-mode .brand .brand-icon i {--dot:var(--ink)}
body.room-mode .masthead {display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0}
.room-actions {display:flex; align-items:center; gap:2px; margin-left:auto; flex:none}
.room-actions .pill {min-height:36px; padding:6px 8px; border-color:transparent; background:transparent; font-size:13px; color:var(--ink-2)}
.room-actions .account-pill {gap:7px; padding-left:8px}
.room-actions .account-avatar {width:18px; height:18px; font-size:9px}
.room-actions .account-avatar:empty::before {font-size:6px}
.room-actions .account-pill[data-signed-in=true] {border-color:transparent}
@media(hover:hover) {.room-actions .pill:not(:disabled):hover {background:var(--warm); color:var(--ink)}}
body.room-mode :focus-visible {outline:2px solid var(--live); outline-offset:3px}
body.room-mode .notice {background:var(--ink); color:var(--cream); border:0; border-radius:14px; box-shadow:0 20px 50px -20px #000a; font-size:13px; padding:14px 18px; cursor:pointer; animation:notice-in var(--t-mod2) var(--ease-in-x) both}
@keyframes notice-in {from {opacity:0; transform:translate(-50%,14px)} to {opacity:1; transform:translate(-50%,0)}}
body.room-mode .notice.error {background:var(--live); color:#fff}

/* Controls */
.room button {font-family:inherit}
.pill {display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:40px; padding:9px 16px; border-radius:40px; border:1px solid var(--ink); background:transparent; color:var(--ink); font-size:13px; font-weight:500; line-height:1.2; white-space:nowrap; cursor:pointer; transition:background var(--t-quick) var(--ease-std),color var(--t-quick) var(--ease-std),border-color var(--t-quick) var(--ease-std),transform var(--t-fast) var(--ease-std)}
.pill-ink {background:var(--ink); color:var(--cream)}
.pill span[aria-hidden] {font-size:15px; line-height:1}
body.room-mode .room button:disabled,body.room-mode .room .pill:disabled {background:transparent!important; color:var(--muted)!important; border-color:var(--warm-2)!important; cursor:not-allowed!important}
.link {display:inline; min-height:0; padding:0; border:0; background:none; color:var(--live); font:inherit; text-decoration:underline; text-underline-offset:3px; cursor:pointer}
.round {position:relative; display:grid; place-items:center; width:54px; height:54px; min-height:54px; padding:0; border-radius:50%; border:1px solid var(--ink); background:transparent; color:var(--ink); cursor:pointer; transition:transform var(--t-fast) var(--ease-std),background var(--t-mod2) var(--ease-x),color var(--t-mod2) var(--ease-x),border-color var(--t-mod2) var(--ease-x)}
.round svg {width:20px; height:20px; fill:currentColor}
.round-xl {width:88px; height:88px; min-height:88px; background:var(--ink); color:var(--cream); border-color:var(--ink)}
.round-xl svg {width:34px; height:34px}
.round-xl .icon-pause {display:none}
#play::before {content:""; position:absolute; inset:-7px; border-radius:50%; border:3px solid rgba(237,63,28,.28); opacity:0; transform:scale(.9); transition:opacity var(--t-mod2) var(--ease-x),transform var(--t-mod2) var(--ease-x); pointer-events:none}
#play[data-state=playing] {background:var(--live); border-color:var(--live); color:#fff}
#play[data-state=playing]::before {opacity:1; transform:scale(calc(1 + var(--level) * .16))}
#play::after {content:""; position:absolute; inset:-4px; border-radius:50%; border:2px solid var(--orange); opacity:0; pointer-events:none}
#play[data-state=starting]::after {animation:ring-out 1000ms var(--ease-out) var(--charge-delay,0ms) both}
@keyframes ring-out {0% {opacity:.9; transform:scale(1)} 100% {opacity:0; transform:scale(1.9)}}
#play[data-state=playing] .icon-play,#play[data-state=starting] .icon-play {display:none}
#play[data-state=playing] .icon-pause,#play[data-state=starting] .icon-pause {display:block}
#play[data-state=starting] {background:var(--orange); border-color:var(--orange); color:#fff}
#lock svg {width:20px; height:20px}
#lock[data-locked=true] {background:var(--live); border-color:var(--live); color:#fff}
#lock[data-locked=false] .shackle {transform:translate(-2.5px,-2px); transform-origin:12px 10px}
body.room-mode .room #play:disabled {background:var(--warm)!important; color:var(--muted)!important}
.room button:not(:disabled):active {transform:scale(.96)}
@media(hover:hover) {
  .pill:not(:disabled):hover {background:var(--ink); color:var(--cream)}
  .pill-ink:not(:disabled):hover {background:var(--live); border-color:var(--live); color:#fff}
  .round:not(:disabled):hover {transform:translateY(-1px)}
  .round-xl:not(:disabled):hover {background:var(--live); border-color:var(--live); color:#fff}
}

/* Layout */
.room {max-width:1200px; margin:0 auto; padding:22px 20px 44px}
.room-top {display:flex; flex-direction:column; gap:14px; margin-bottom:26px}
.room-id {min-width:0}
.eyebrow.mono {color:var(--muted); margin:0}

.room-top h1 {margin:0; font-size:clamp(24px,6.6vw,30px); line-height:1; letter-spacing:-.04em; font-weight:600; text-wrap:balance; overflow-wrap:anywhere; max-width:18ch}
#party[data-role=guest] .room-top h1 {font-size:clamp(26px,7vw,34px)}
.room-top h1:focus {outline:none}
.room-status {display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; margin:10px 0 0; font-size:12px; color:var(--muted)}
.connection-state {display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px}
.connection-state[data-state=connected] {display:none}
.room-status:not(:has(.connection-state:not([data-state=connected]),.lock-state:not([hidden]))) {display:none}
.connection-state::before {content:""; width:7px; height:7px; border-radius:50%; background:var(--orange); flex:none}
.connection-state[data-state=connected]::before {background:var(--live)}
.lock-state {color:var(--live); border:1px solid currentColor; border-radius:20px; padding:3px 9px; font-size:9px}
.room-top {margin-bottom:18px}
.room-grid {display:grid; grid-template-columns:minmax(0,1fr); gap:36px}

/* The stage: this phone, as a speaker */
.stage {display:flex; flex-direction:column; min-width:0}
.pass {display:flex; flex-direction:column; gap:10px; padding-bottom:22px; margin-bottom:26px; border-bottom:1px solid var(--ink)}
.pass-row {display:flex; align-items:center; justify-content:space-between; gap:14px}
#room-code {font-size:clamp(44px,13vw,64px); color:var(--ink); white-space:nowrap}
#party[data-role=guest] .pass {display:none}
.stage-row {display:flex; flex-direction:column; min-width:0}
/* Stage order: code, chat, track, progress, controls. The host without a track picks audio first; the chat follows. */
.stage>.pass {order:0} .stage>.hero {order:1} .stage>.stage-row {order:2} .stage>.progress {order:3} .stage>.times {order:4} .stage>#retry-room {order:5} .stage>.deck {order:6} .stage>.guest-note {order:7}
.hero {width:100%; margin:4px 0 22px}
#party[data-role=host][data-has-track=false] .hero {order:10; margin:26px 0 0}
.pager {display:block; outline:none}
.pane {display:block}
.pane>* {width:100%}
.grille-hidden {display:none}
/* Guests who have not tapped yet: one unmissable pill above the chat. */
.join-sound {display:flex; width:100%; align-items:center; justify-content:center; min-height:52px; margin:0 0 12px; padding:14px 20px; border:0; border-radius:40px; background:var(--live); color:#fff; font-size:15px; font-weight:600; cursor:pointer; box-shadow:0 14px 30px -12px rgba(237,63,28,.7); animation:join-in var(--t-slow) var(--ease-in-x) both}
@keyframes join-in {from {opacity:0; transform:translateY(10px)} to {opacity:1; transform:translateY(0)}}
.join-sound[hidden] {display:none}
@media(hover:hover) {.join-sound:hover {background:var(--ink)}}
.unread {position:absolute; top:-4px; right:-6px; min-width:16px; height:16px; padding:0 4px; border-radius:8px; background:var(--live); color:#fff; font:600 9px/16px ui-monospace,Menlo,monospace; text-align:center; animation:pop-in var(--t-mod2) var(--ease-in-x) both}
#chat-unread {display:none}
@keyframes pop-in {from {transform:scale(.4); opacity:0} to {transform:scale(1); opacity:1}}
#party[data-role=host] .now {min-width:0; flex:1}
.grille {position:absolute; inset:0; border-radius:14%; background:var(--panel); box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 24px 40px -28px rgba(0,0,0,.55); transform:scale(calc(1 + var(--level) * .035)); transition:transform 70ms linear; will-change:transform}
.grille svg {display:block; width:100%; height:100%}
.grille .g-base {fill:var(--panel-dot)}
/* The live layer breathes with the level; each ring decides on its own whether it is lit, so power-on sweeps outward. */
.grille .g-live {fill:var(--live); opacity:calc(.55 + var(--level) * .45)}
.grille .g-live .ring {opacity:var(--lit,0); transition:opacity var(--t-slow) var(--ease-in-x) calc(var(--i) * 60ms)}
.grille .g-flash {fill:var(--live); opacity:0}
/* Each live dot lights when its column's level reaches its row. Idle, the columns spell the logo (3, 7, 5, 1). */
.grille {--l4:.3; --l5:1; --l6:.6; --l7:.1}
.grille .g-live .px {opacity:clamp(0, calc(var(--l, 0) * 6 - var(--d, 0)), 1); transition:opacity 50ms linear}
.grille .g-live .px[data-c="0"] {--l:var(--l0)} .grille .g-live .px[data-c="1"] {--l:var(--l1)} .grille .g-live .px[data-c="2"] {--l:var(--l2)} .grille .g-live .px[data-c="3"] {--l:var(--l3)}
.grille .g-live .px[data-c="4"] {--l:var(--l4)} .grille .g-live .px[data-c="5"] {--l:var(--l5)} .grille .g-live .px[data-c="6"] {--l:var(--l6)} .grille .g-live .px[data-c="7"] {--l:var(--l7)}
.grille .g-live .px[data-c="8"] {--l:var(--l8)} .grille .g-live .px[data-c="9"] {--l:var(--l9)} .grille .g-live .px[data-c="10"] {--l:var(--l10)} .grille .g-live .px[data-c="11"] {--l:var(--l11)}
#party[data-audio-enabled=true] .grille {--lit:1; animation:power-on var(--t-slow2) var(--ease-x) 1}
#party[data-audio-enabled=true][data-has-track=false] .grille {--lit:.35}
@keyframes power-on {0% {transform:scale(1)} 35% {transform:scale(1.04)} 100% {transform:scale(1)}}
/* Invitation: a ring that leaves the disc, over and over, until the phone is tapped. Transform and opacity only. */
.speaker::after {content:""; position:absolute; inset:-2px; border-radius:15%; border:2px solid var(--live); opacity:0; pointer-events:none}
.speaker:has(.grille-tap:not([hidden]))::after {animation:ripple 2.2s var(--ease-out) infinite}
@keyframes ripple {0% {opacity:.55; transform:scale(1)} 100% {opacity:0; transform:scale(1.16)}}
/* Countdown to the downbeat: every lit phone goes dark and refills from the centre, timed to land on the same server instant. */
#party[data-audio-enabled=true][data-charging=true] .g-live .ring {opacity:0; transition:none; animation:ring-on 300ms var(--ease-in-x) calc(var(--charge-delay,0ms) + 400ms + var(--i) * 30ms) both}
@keyframes ring-on {from {opacity:0} to {opacity:1}}
#party[data-audio-enabled=true][data-charging=true] .grille {animation:none}
.grille-tap {position:absolute; inset:0; border-radius:14%; border:0; background:transparent; padding:0; cursor:pointer}
.grille-tap span {position:absolute; left:50%; bottom:-12px; transform:translateX(-50%); display:inline-block; padding:13px 20px; border-radius:40px; background:var(--live); color:#fff; font-size:14px; font-weight:600; white-space:nowrap; box-shadow:0 14px 30px -12px rgba(237,63,28,.7)}
#party[data-role=host] .grille-tap span {font-size:0; padding:0; width:14px; height:14px; bottom:4px; left:auto; right:4px; transform:none; box-shadow:0 0 0 3px var(--cream)}
.grille-tap:focus-visible {outline-offset:6px}
.grille-tap:not([hidden]) span {animation:rise-in var(--t-slow) var(--ease-in-x) both}
@keyframes rise-in {from {opacity:0; transform:translateX(-50%) translateY(10px)} to {opacity:1; transform:translateX(-50%) translateY(0)}}
.now {min-width:0; text-align:center}
#party[data-role=host] .now {text-align:left}
.status {display:inline-flex; align-items:center; gap:8px; color:var(--muted); margin-bottom:10px}
#party[data-role=host][data-has-track=false] .status {display:none}
.status::before {content:""; width:6px; height:6px; border-radius:50%; background:var(--ink); flex:none; transition:background var(--t-mod2) var(--ease-x)}
.stage[data-loading=true] .status::before {width:9px; height:9px; background:none; border:1.5px solid currentColor; border-right-color:transparent; animation:spin .8s linear infinite}
body[data-playing=true] .status::before {background:var(--live)}
.now h2 {margin:0; font-size:clamp(24px,6.6vw,32px); line-height:1.08; letter-spacing:-.035em; font-weight:600; overflow-wrap:anywhere; text-wrap:balance}
.now p {margin:10px 0 0; font-size:14px; line-height:1.55; color:var(--muted); max-width:36ch}
.now p:empty {display:none}
#me-line {display:none}
#party[data-role=guest] .now p {margin-inline:auto}
.me-line {display:flex; flex-wrap:wrap; justify-content:center; align-items:baseline; gap:4px 8px; margin-top:14px!important; font-size:13px; color:var(--muted); max-width:none!important}
#party[data-role=host] .me-line {justify-content:flex-start}
.me-line strong {color:var(--ink); font-weight:600; overflow-wrap:anywhere}
.progress {position:relative; height:2px; margin-top:24px; background:var(--warm-2); overflow:hidden}
.progress span {display:block; width:0; height:100%; background:var(--ink); transition:width 200ms linear}
.progress .progress-buffer {position:absolute; inset:0 auto 0 0; background:var(--warm-2); transition:width 300ms var(--ease-std)}
.progress #progress-fill {position:relative}
.times {display:flex; justify-content:space-between; margin-top:8px; color:var(--muted); font-size:10px}
#party[data-has-track=false] .progress,#party[data-has-track=false] .times {display:none}
#retry-room {align-self:flex-start; margin-top:18px}

/* The host's deck */
.deck {margin-top:24px}
.transport {display:flex; align-items:center; gap:18px}
.transport-label {display:none}
.picks {display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; margin-top:22px}
.link-quiet {color:var(--muted); text-decoration-color:var(--warm-2)}
.link-quiet:disabled {opacity:.5; cursor:not-allowed}
@media(hover:hover) {.link-quiet:not(:disabled):hover {color:var(--live)}}
.upload-label {cursor:pointer}
.upload-label:has(+ input:disabled) {opacity:.5; pointer-events:none}
.upload-label:has(+ input:focus-visible) {outline:2px solid var(--live); outline-offset:3px}
#party[data-has-track=false] .upload-label {background:var(--ink); color:var(--cream)}
.file-note {margin:12px 0 0; color:var(--muted); font-size:9px; letter-spacing:.08em; line-height:1.7}
#party[data-has-track=true] .file-note,#party[data-has-track=true] #demo {display:none}
#party[data-has-track=false] .transport,#party[data-has-track=false] .transport-label {display:none}
#party[data-has-track=false] .picks {margin-top:0}
#party[data-has-track=false] .deck {margin-top:22px}
#party[data-role=host][data-has-track=false] .stage-row {gap:20px}
#party[data-role=host][data-has-track=false] .speaker {width:96px}
#party[data-role=host][data-has-track=false] .grille {border-radius:22%}
.guest-note {margin:26px 0 0; padding:0; border:0; text-align:center; color:var(--muted); font-size:9px}
#party[data-role=guest] .deck {display:none}

/* The roster: one card per phone, stacked like a wallet */
.roster {min-width:0}
.roster-head {display:flex; align-items:baseline; gap:10px; padding-bottom:12px; border-bottom:1px solid var(--warm-2)}
.roster-title {margin:0 auto 0 0; font-size:17px; line-height:1.1; letter-spacing:-.02em; font-weight:600}
.roster-number {font-size:22px; line-height:1; color:var(--ink)}
.roster-unit {color:var(--muted); font-size:9px}
.stack {list-style:none; margin:18px 0 0; padding:0}
.card {position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:6px 12px; min-height:88px; padding:14px 18px 18px; margin-top:-16px; border-radius:20px; background:var(--card,var(--warm)); color:var(--card-text,#141414); border:1px solid rgba(0,0,0,.08); box-shadow:0 -10px 24px -18px rgba(0,0,0,.45); touch-action:pan-y; user-select:none; -webkit-user-select:none}
.card:first-child {margin-top:0}
.card[data-enter=true] {animation:card-in var(--t-slow) var(--ease-in-x) both}
.card[data-exit=true] {animation:card-out var(--t-mod2) var(--ease-out-x) both; pointer-events:none}
@keyframes card-in {from {opacity:0; transform:translateY(22px) scale(.97)} to {opacity:1; transform:translateY(0) scale(1)}}
@keyframes card-out {from {opacity:1; transform:translateX(0)} to {opacity:0; transform:translateX(48px)}}
.card[data-host=true] {--card:var(--panel); --card-text:#EFE9DD; border-color:rgba(255,255,255,.06)}
.card-top {grid-column:1 / -1; display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:9px; opacity:.75}
.card-rename {min-height:28px; padding:0; border:0; background:none; color:inherit; font:500 12px/1 inherit; font-family:inherit; text-decoration:underline; text-underline-offset:3px; cursor:pointer}
.card[data-open=true] .card-rename {visibility:hidden}
.card-name {font-size:22px; line-height:1.1; letter-spacing:-.025em; font-weight:600; overflow-wrap:anywhere; min-width:0}
.card-status {display:inline-flex; align-items:center; gap:7px; font-size:9px; white-space:nowrap}
.card-status::before {content:""; width:8px; height:8px; border-radius:50%; background:currentColor; opacity:.3; flex:none}
.card[data-ready=true] .card-status::before {background:var(--live); opacity:1; box-shadow:0 0 0 3px rgba(237,63,28,.25); transform:scale(calc(1 + var(--level) * .5)); transition:transform 70ms linear}
.card-status::before {transition:background var(--t-mod2) var(--ease-x),opacity var(--t-mod2) var(--ease-x)}
.card[data-local=true] .card-name::after {content:" · you"; font-size:12px; font-weight:500; opacity:.7; letter-spacing:0}
.card-remove {position:absolute; right:12px; top:50%; transform:translateY(-50%) translateX(8px); min-height:38px; padding:9px 14px; border-radius:30px; border:0; background:#141414; color:#EFE9DD; font-size:12px; font-weight:600; cursor:pointer; opacity:0; pointer-events:none; transition:opacity var(--t-mod) var(--ease-in),transform var(--t-mod) var(--ease-in)}
.card[data-host=true] .card-remove {background:var(--live); color:#fff}
.card[data-open=true] .card-remove,.card:focus-within .card-remove {opacity:1; pointer-events:auto; transform:translateY(-50%) translateX(0)}
.card[data-open=true] .card-status {visibility:hidden}
@media(hover:hover) {.card:hover .card-remove {opacity:1; pointer-events:auto; transform:translateY(-50%) translateX(0)} .card:hover .card-status {visibility:hidden} .card-remove:hover {background:var(--live); color:#fff}}
.roster[data-connected=false] .card {opacity:.55}
.roster-note {display:flex; gap:10px; align-items:flex-start; margin:18px 0 0; padding-top:14px; border-top:1px solid var(--warm-2); color:var(--muted); font-size:10px; line-height:1.65; letter-spacing:.06em}
.roster-note::before {content:""; width:7px; height:7px; margin-top:5px; border-radius:50%; background:var(--warm-2); flex:none}
.roster[data-playing=true] .roster-note::before {background:var(--live)}
.roster[data-solo=true][data-connected=true] .roster-note {display:none}
.room:has(.roster[data-connected=true]) .caption {display:none}
.roster-empty {margin:18px 0 0; padding:22px 18px; border:1px dashed var(--warm-2); border-radius:20px; text-align:center; color:var(--muted); font-size:13px; line-height:1.55}

/* The cover: a small tile beside the track title, only when the track has one. */
.now {display:flex; align-items:flex-start; gap:14px}
#party[data-role=guest] .now {flex-direction:column; align-items:center}
.now-text {min-width:0; flex:1}
.art {position:relative; flex:none; width:64px; height:64px; border-radius:14px; overflow:hidden; background:var(--panel); color:#EFE9DD; display:none}
.art[data-has-art=true] {display:block; animation:card-in var(--t-slow) var(--ease-in-x) both}
.art img {position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block}
.art-fallback {display:none}
#party[data-role=guest] .art {width:88px; height:88px; border-radius:18px}
body[data-playing=true] .art {transform:scale(calc(1 + var(--level) * .02)); transition:transform 70ms linear}
/* Chat pane: the room talking. Each phone is a blob in its card color with two dot eyes. */
.chat {position:relative; display:flex; flex-direction:column; height:clamp(300px,74vw,380px); border-radius:28px; overflow:hidden; background:var(--panel); color:#EFE9DD; box-shadow:0 24px 40px -28px rgba(0,0,0,.55)}
.chat-list {flex:1; min-height:0; margin:0; padding:20px 16px 8px; list-style:none; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; display:flex; flex-direction:column; gap:10px; mask-image:linear-gradient(to bottom, transparent 0, #000 8%, #000 100%)}
.chat-list::-webkit-scrollbar {display:none}
.chat-msg {display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-areas:"blob who" "blob text"; column-gap:9px; row-gap:3px; max-width:88%; align-self:flex-start; align-items:end}
.chat-msg[data-mine=true] {grid-template-columns:minmax(0,1fr); grid-template-areas:"who" "text"; align-self:flex-end; justify-items:end}
.chat-msg[data-chain=true] {margin-top:-5px}
.chat-msg[data-chain=true] .chat-who {display:none}
.chat-msg[data-chain=true] .blob {visibility:hidden}
.chat-who {grid-area:who; font-size:8px; opacity:.6; padding:0 4px}
.chat-text {grid-area:text; display:inline-block; padding:9px 13px; border-radius:18px 18px 18px 6px; background:var(--card,#3A3631); color:#141414; font-size:14px; line-height:1.4; overflow-wrap:anywhere}
.chat-msg:not([style*="--card"]) .chat-text {background:#3A3631; color:#EFE9DD}
.chat-msg[data-host=true] .chat-text {background:#EFE9DD; color:#141414}
.chat-msg[data-mine=true] .chat-text {border-radius:18px 18px 6px 18px}
.chat-msg[data-emoji=true] .chat-text {background:none!important; padding:0 2px; font-size:34px; line-height:1.1}
/* The blob: a soft shape with two eyes that blink now and then. */
.blob {grid-area:blob; position:relative; display:inline-block; width:28px; height:28px; border-radius:var(--shape,50%); background:var(--card,#3A3631); flex:none; transform-origin:50% 100%}
.blob[data-host=true] {background:#EFE9DD}
.blob::before,.blob::after {content:""; position:absolute; top:38%; width:14%; height:14%; min-width:3px; min-height:3px; border-radius:50%; background:#141414; animation:blink var(--blink,4s) infinite}
.blob::before {left:30%} .blob::after {left:56%; animation-delay:.04s}
.blob[data-host=false]:not([style*="--card"]) {background:#3A3631}
.blob[data-host=false]:not([style*="--card"])::before,.blob[data-host=false]:not([style*="--card"])::after {background:#EFE9DD}
@keyframes blink {0%,92%,100% {transform:scaleY(1)} 95% {transform:scaleY(.1)}}
.blob-lg {width:64px; height:64px; margin:0 -6px}
/* Empty room: the cast waits under an empty speech bubble. */
.chat-stage {position:absolute; inset:0 0 108px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:18px; padding:18px 18px 6px; pointer-events:none}
.chat-stage[hidden] {display:none}
.chat-stage-bubble {position:relative; width:min(78%,250px); padding:26px 22px; border-radius:22px; background:#EFE9DD; color:#141414; font-size:15px; font-weight:500; text-align:center; letter-spacing:-.01em; animation:bubble-in var(--t-slow2) var(--ease-in-x) both}
.chat-stage-bubble::after {content:""; position:absolute; left:48%; bottom:-14px; border:10px solid transparent; border-top:16px solid #EFE9DD; border-bottom:0; transform:skewX(18deg)}
@keyframes bubble-in {from {opacity:0; transform:translateY(10px) scale(.94)} to {opacity:1; transform:translateY(0) scale(1)}}
.chat-cast {display:flex; align-items:flex-end; justify-content:center; height:76px}
.chat-cast .blob {animation:blob-idle 3.2s var(--ease-x) calc(var(--i,0) * -.7s) infinite alternate}
.chat-cast .blob[data-me=true] {width:72px; height:72px}
@keyframes blob-idle {from {transform:translateY(0) scale(1,1)} to {transform:translateY(-5px) scale(.98,1.03)}}
/* Quick reactions and the composer. */
.chat-quick {display:flex; justify-content:center; gap:4px; padding:4px 12px 0}
.chat-react {min-height:36px; width:40px; padding:0; border:0; border-radius:20px; background:transparent; font-size:20px; line-height:1; cursor:pointer; transition:background var(--t-quick) var(--ease-std)}
@media(hover:hover) {.chat-react:hover {background:rgba(255,255,255,.08)}}
.chat-form {display:flex; align-items:center; gap:10px; padding:6px 16px 16px}
body.room-mode .chat-form input:not([type=range]) {flex:1; width:auto; min-width:0; height:46px; padding:0 18px; border-radius:30px; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.06); color:#EFE9DD; font:inherit; font-size:15px; outline:none; -webkit-appearance:none; appearance:none; transition:border-color var(--t-quick) var(--ease-std),background var(--t-quick) var(--ease-std)}
.chat-form input::placeholder {color:rgba(239,233,221,.5)}
body.room-mode .chat-form input:not([type=range]):focus {border-color:rgba(255,255,255,.4); background:rgba(255,255,255,.1); outline:none; box-shadow:none}
.chat-send {flex:none; width:46px; height:46px; min-height:46px; padding:0; border-radius:50%; border:0; background:var(--live); color:#fff; display:grid; place-items:center; cursor:pointer; transition:transform var(--t-fast) var(--ease-std)}
.chat-send svg {width:20px; height:20px}
.chat-send[aria-busy=true] {opacity:.6}
@media(prefers-reduced-motion:reduce) {.blob::before,.blob::after,.chat-cast .blob,.chat-stage-bubble {animation:none}}

/* Sound settings */
.settings {border:1px solid var(--ink); border-radius:18px; color:var(--ink)}
.settings>summary {display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:54px; padding:14px 18px; list-style:none; cursor:pointer; font-size:13px; font-weight:600}
.settings>summary::-webkit-details-marker,.settings .room-details>summary::-webkit-details-marker,.settings .manual-timing>summary::-webkit-details-marker {display:none}
.settings>summary span {font-size:22px; font-weight:300; line-height:1; transition:transform .2s}
.settings[open]>summary span {transform:rotate(45deg)}
.settings-body {padding:0 18px 14px; font-size:13px; color:var(--ink-2)}
.settings .small-copy,.settings .lab-note,.settings .phone-settings label,.settings .roster-heading>span,.settings .member-state,.settings output {color:var(--muted); font-size:12px; line-height:1.65}
.settings .lab-note strong,.settings .phone-settings label {color:var(--ink)}
.settings .lab-note {margin:16px 0 0; padding-top:14px; border-top:1px solid var(--warm-2)}
.settings h2 {margin:6px 0 8px; font-size:18px; font-weight:600; letter-spacing:-.02em}
.calibration-tag {color:var(--live); margin:12px 0 0}
.speaker-calibration .pill {margin:6px 8px 6px 0}
.settings .room-details,.settings .manual-timing {border-top:1px solid var(--warm-2); margin-top:6px}
.settings .room-details>summary,.settings .manual-timing>summary {display:flex; align-items:center; justify-content:space-between; min-height:46px; padding:10px 0; font-size:12px; font-weight:600; list-style:none; cursor:pointer}
.settings .room-details>summary::after,.settings .manual-timing>summary::after {content:"+"; font-size:18px; font-weight:300}
.settings .room-details[open]>summary::after,.settings .manual-timing[open]>summary::after {content:"−"}
.settings .manual-timing {border-top:0; margin-top:0}
.settings .timing-control {padding:6px 0 10px}
.settings .dial-label {color:var(--muted)}
.settings .timing-dial output {color:var(--ink); font:300 22px/1 inherit; letter-spacing:-.03em}
.settings .timing-dial:focus-within {outline-color:var(--live)}
.settings .dial-rotor span::after,.settings .dial-ticks {background-color:var(--ink)}
.settings .timing-control .range-labels,.settings .timing-control .small-copy {color:var(--muted)}
.settings .phone-settings {border:0; margin:0; padding:10px 0 4px}
.settings .phone-settings input {accent-color:var(--live)}
.settings .roster-heading {display:flex; align-items:baseline; justify-content:space-between; margin:16px 0 6px}
.settings .roster-heading h2 {margin:0; font-size:14px}
.settings .members li {display:flex; align-items:center; gap:10px; padding:11px 0; border-top:1px solid var(--warm-2)}
.settings .avatar {width:30px; height:30px; display:grid; place-items:center; border-radius:50%; background:var(--warm); border:1px solid var(--warm-2); color:var(--ink); font-size:11px; font-weight:600; flex:none}
.settings .member-name {flex:1; min-width:0; font-size:13px; font-weight:500; color:var(--ink); overflow-wrap:anywhere}
.settings .member-state {font-size:10px; text-align:right}
.settings .member-state.ready {color:var(--live)}
.settings .member-remove {flex:none; width:32px; height:32px; min-height:32px; padding:0; border-radius:50%; border:1px solid var(--warm-2); background:transparent; color:var(--ink); font-size:12px; line-height:1; cursor:pointer}
.settings .pill {margin-top:8px}
.settings #resync {margin:8px 0}
.room-guide-link {display:block; margin-top:14px; padding:12px 0 2px; color:var(--muted); font-size:12px; text-decoration:underline; text-underline-offset:3px}
.caption {margin:28px 0 0; text-align:center; color:var(--muted); font-size:9px}

/* Name sheet */
.name-modal {background:var(--cream); color:var(--ink); border:1px solid var(--ink); border-radius:22px; width:min(440px,calc(100% - 40px)); padding:30px 28px 24px; text-align:left}
.name-modal::backdrop {background:rgba(20,20,20,.55); backdrop-filter:none; animation:fade-in var(--t-mod2) linear both}
.name-modal[open] {animation:sheet-in var(--t-slow) var(--ease-in-x) both}
@keyframes sheet-in {from {opacity:0; transform:translateY(18px) scale(.98)} to {opacity:1; transform:translateY(0) scale(1)}}
@keyframes fade-in {from {opacity:0} to {opacity:1}}
.name-form {display:flex; flex-direction:column}
.name-form .entry-invitation {display:block; margin:0 0 14px; color:var(--muted); font:500 10px/1.5 ui-monospace,"SF Mono",Menlo,monospace; letter-spacing:.12em}
.name-form h2 {margin:0 0 10px; font:600 clamp(30px,5vw,40px)/1.02 inherit; letter-spacing:-.04em; color:var(--ink)}
.name-room {margin:0 0 22px; font-size:14px; line-height:1.6; color:var(--muted); overflow-wrap:anywhere}
.name-modal #guest-name {width:100%; min-height:60px; padding:16px 18px; border-radius:14px; border:1px solid var(--ink); background:var(--field); color:var(--ink); font-size:22px; font-weight:500; letter-spacing:-.02em}
.name-modal #guest-name::placeholder {color:var(--muted)}
.name-modal #guest-name:focus {outline:none; box-shadow:0 0 0 3px rgba(237,63,28,.25); border-color:var(--live)}
.name-submit {display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; min-height:58px; padding:16px 22px; border:0; border-radius:40px; background:var(--live); color:#fff; font-size:16px; font-weight:600; cursor:pointer}
.name-submit .launch-button-arrow {font-size:26px; line-height:.8}
.name-skip {align-self:center; margin-top:8px; min-height:40px; padding:8px 12px; border:0; background:none; color:var(--muted); font-size:13px; font-weight:500; cursor:pointer; text-decoration:underline; text-underline-offset:3px}
@media(hover:hover) {.name-submit:hover {background:var(--ink)} .name-skip:hover {color:var(--ink)}}
@media(max-width:620px) {
  .name-modal {width:calc(100% - 32px); max-width:calc(100% - 32px); height:fit-content; max-height:calc(100dvh - 32px); margin:auto; border:1px solid var(--ink); border-radius:22px; padding:26px 22px 20px}
  .name-form h2 {font-size:30px}
}

/* Wide screens: the stage on the left, the room on the right */
@media(min-width:900px) {
  .room {padding:22px 40px 60px}
  body.room-mode .masthead {padding:24px 40px 0}
  .room-top {flex-direction:row; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:34px}
  .room-top h1 {font-size:44px}
  .room-grid {grid-template-columns:minmax(380px,460px) minmax(0,1fr); gap:40px 72px; align-items:start}
  .stage {grid-column:1; grid-row:1 / span 2}
  .roster {grid-column:2; grid-row:1}
  .settings {grid-column:2; grid-row:2; max-width:540px}
  #party[data-role=host] .stage-row {flex-direction:column; align-items:flex-start; gap:0}
  .hero {width:100%; max-width:none}
  .chat {height:420px}
  #party[data-role=guest] .room-grid {grid-template-columns:minmax(0,560px); justify-content:center}
  #party[data-role=guest] .stage,#party[data-role=guest] .roster,#party[data-role=guest] .settings {grid-column:1; grid-row:auto}
  #party[data-role=guest] .room-top {flex-direction:column; align-items:center; text-align:center}
  #party[data-role=guest] .room-top h1 {max-width:none}
  #party[data-role=guest] .room-status {justify-content:center}
  #party[data-role=guest] .hero {max-width:560px; margin-inline:auto}
  .card {min-height:96px; padding:16px 20px 20px}
  .card-name {font-size:24px}
  .roster-number {font-size:24px}
}
@media(max-width:380px) {
  .room {padding-inline:16px}
  .room-top h1 {font-size:38px}
  .pill {padding:8px 13px; font-size:12px}
  .round-xl {width:78px; height:78px; min-height:78px}
  .card {padding:12px 14px 16px; min-height:80px}
  .card-name {font-size:20px}
}
@media(prefers-reduced-motion:reduce) {
  .grille,.grille .g-live .ring,.card,.speaker::after,.grille-tap span,.notice,.name-modal[open],.name-modal::backdrop,#play::after,#play::before {animation:none!important; transition:none!important}
  .grille {transform:none}
  .grille .g-live {opacity:var(--lit,0)}
  .card[data-ready=true] .card-status::before {transform:none}
  #play[data-state=playing]::before {opacity:1; transform:none}
  #party[data-audio-enabled=true][data-charging=true] .g-live .ring {opacity:1}
}
@media(forced-colors:active) {
  .grille {border:1px solid CanvasText}
  .card {border:1px solid CanvasText}
  .pill,.round {border:1px solid CanvasText}
}

/* Switch-room dialog, in the same system as the room */
body.room-mode .entry-modal {background:var(--cream); color:var(--ink); border:1px solid var(--ink); box-shadow:0 30px 80px -30px rgba(0,0,0,.6)}
body.room-mode .entry-modal::backdrop {background:rgba(20,20,20,.55); backdrop-filter:none}
body.room-mode .entry-modal-head h2 {color:var(--ink); font-family:inherit; font-weight:600; letter-spacing:-.04em}
body.room-mode .entry-modal-head .outline {color:var(--ink); border:1px solid var(--ink); border-radius:50%; width:44px; padding:0; background:transparent}
body.room-mode .entry-modal .entry-face,body.room-mode .entry-modal .entry-face.entry-join {background:var(--field); border:1px solid var(--warm-2); box-shadow:none}
body.room-mode .entry-face .transmitter-label,body.room-mode .entry-face .transmitter-label>span {color:var(--muted)}
body.room-mode .entry-face .digital-field {border-bottom:1px solid var(--warm-2); background:none}
body.room-mode .entry-face .digital-field::after {background:var(--live)}
body.room-mode .entry-face .digital-field:focus-within {border-color:var(--live); background:none}
body.room-mode .entry-face .digital-display {color:var(--ink)}
body.room-mode .entry-face .digital-field[data-empty=true] .digital-display {opacity:.4}
body.room-mode .entry-face #code,body.room-mode .entry-face #room-name {color:var(--ink); -webkit-text-fill-color:var(--ink); caret-color:var(--live)}
body.room-mode .entry-face .digital-field[data-mirrored=true] input {color:transparent!important; -webkit-text-fill-color:transparent}
body.room-mode .entry-face input::placeholder {color:var(--muted); -webkit-text-fill-color:var(--muted)}
body.room-mode .entry-face input::selection {background:rgba(237,63,28,.25)}
body.room-mode .entry-action p {color:var(--ink)}
body.room-mode .entry-action p span {color:var(--muted)}
body.room-mode .entry-action .launch-button {background:var(--live); color:#fff; border:0}
body.room-mode .entry-action .launch-button>span:first-child {color:#fff}
body.room-mode .entry-meta .identity-control {color:var(--ink); border-bottom:1px solid var(--warm-2)}
body.room-mode .identity-control summary>span {color:var(--muted)}
body.room-mode .identity-control input {background:var(--field); color:var(--ink); border:1px solid var(--ink); border-radius:12px}
body.room-mode .entry-error {color:var(--live); border-color:var(--live); background:transparent}
body.room-mode #join-switch-hint {color:var(--muted); font-size:12px}
@media(hover:hover) {body.room-mode .entry-action .launch-button:hover {background:var(--ink)}}

/* Accounts: a chip in the header, a sheet with the sign-in options */
.account-pill {gap:9px; padding-left:9px}
.account-avatar {display:inline-grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--warm-2); color:var(--ink); font-size:11px; font-weight:600; overflow:hidden; flex:none}
.account-avatar img {width:100%; height:100%; object-fit:cover; display:block}
.account-avatar:empty {background:var(--ink); color:var(--cream)}
.account-avatar:empty::before {content:"●"; font-size:8px}
.account-pill[data-signed-in=true] {border-color:var(--warm-2)}
.account-avatar-lg {width:52px; height:52px; font-size:20px}
.account-modal {width:min(460px,calc(100% - 40px))}
.providers {display:grid; gap:8px; margin:4px 0 14px}
.provider {display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:52px; padding:12px 18px; border-radius:40px; border:1px solid var(--ink); color:var(--ink); background:transparent; font-size:14px; font-weight:500; text-decoration:none; transition:background var(--t-quick) var(--ease-std),color var(--t-quick) var(--ease-std)}
.provider span:last-child {font-size:18px}
.provider[data-provider=google] {background:var(--field)}
.email-row {display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding-top:14px; border-top:1px solid var(--warm-2)}
.name-modal #account-email {min-height:46px; padding:10px 14px; font-size:15px; border:1px solid var(--ink); border-radius:40px; background:var(--field); color:var(--ink); width:100%}
.name-modal #account-email:focus {outline:none; box-shadow:0 0 0 3px rgba(237,63,28,.25); border-color:var(--live)}
#account-email-send {min-height:46px}
.account-status {min-height:20px; margin:10px 0 0; font-size:13px; line-height:1.5; color:var(--muted)}
.account-status[data-tone=error] {color:var(--live)}
.account-status a {color:var(--live)}
.account-card {display:flex; align-items:center; gap:14px; padding:4px 0 16px; border-bottom:1px solid var(--warm-2)}
.account-who {display:grid; gap:4px; min-width:0}
.account-who strong {font-size:22px; letter-spacing:-.03em; overflow-wrap:anywhere}
.account-who .mono {color:var(--muted); text-transform:none; letter-spacing:0; font-size:12px; overflow-wrap:anywhere}
#account-logins {margin:12px 0 0; color:var(--muted)}
.account-h3 {margin:18px 0 6px; font-size:12px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted)}
.account-rooms {list-style:none; margin:0; padding:0; max-height:180px; overflow:auto}
.account-rooms li {display:flex; justify-content:space-between; gap:12px; padding:10px 0; border-top:1px solid var(--warm-2); font-size:13px}
.account-rooms li:first-child {border-top:0}
.account-rooms .code {font-size:16px}
.account-rooms .mono {color:var(--muted)}
.account-rooms li.empty {color:var(--muted); justify-content:flex-start}
.account-actions {display:flex; flex-wrap:wrap; gap:8px; margin-top:16px}
.card-avatar {position:absolute; right:16px; top:12px; width:26px; height:26px; border-radius:50%; object-fit:cover; border:1px solid rgba(0,0,0,.1)}
.card:hover .card-avatar,.card[data-open=true] .card-avatar {visibility:hidden}
@media(hover:hover) {.provider:hover {background:var(--ink); color:var(--cream)}}
