:root {
  color-scheme: light dark;
  --bg: #f4f2ee;
  --fg: #1d1b19;
  --panel: #ffffff;
  --muted: #6b6560;
  --accent: #3d5a80;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --fg: #ece8e2;
    --panel: #22201e;
    --muted: #9b948c;
    --accent: #7ea6d8;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.4 system-ui, sans-serif; background: var(--bg); color: var(--fg); }
header { display: flex; align-items: baseline; gap: 1rem; padding: 0.75rem 1rem; }
header h1 { margin: 0; font-size: 1.25rem; }
#who { color: var(--muted); }
main { padding: 0 1rem 1rem; }
#join { max-width: 26rem; margin: 3rem auto; background: var(--panel); padding: 1.5rem; border-radius: 12px; }
#join label { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
#join { max-width: 36rem; }
#join h2 { margin: 0 0 1rem; }
.lobby-preview { position: relative; background: #111; border-radius: 12px; aspect-ratio: 16 / 9; overflow: hidden; display: grid; place-items: center; }
.lobby-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.avatar { width: 6rem; height: 6rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 2.2rem; font-weight: 600; }
.avatar:empty::before { content: ""; width: 2.6rem; height: 2.6rem; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-4 0-9 2-9 5v3h18v-3c0-3-5-5-9-5z'/%3E%3C/svg%3E") center / contain no-repeat; }
.lobby-note { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; margin: 0; padding: 0.5rem 0.75rem; border-radius: 8px; background: rgb(0 0 0 / 70%); color: #fff; font-size: 0.9rem; }
.lobby-note:empty { display: none; }
.lobby-controls { display: flex; justify-content: center; gap: 1.25rem; margin: 0.9rem 0 1.25rem; }
.device { position: relative; display: flex; align-items: center; }
.round { width: 3.25rem; height: 3.25rem; border-radius: 50%; padding: 0; display: grid; place-items: center; position: relative; overflow: hidden; background: var(--panel); border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.round svg { width: 1.5rem; height: 1.5rem; fill: currentColor; position: relative; z-index: 1; }
.round[aria-pressed="true"] { outline: none; }
.round[aria-pressed="false"] { background: #d33; border-color: #d33; color: #fff; }
.round .slash { display: none; }
.round[aria-pressed="false"] .slash { display: inline; }
.round .meter { position: absolute; inset: auto 0 0 0; height: 100%; pointer-events: none; }
#level { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: color-mix(in srgb, #3fdc6a 45%, transparent); transition: height 60ms linear; }
.caret { width: 1.6rem; height: 1.6rem; border-radius: 50%; padding: 0; margin-left: -0.6rem; align-self: flex-end; display: grid; place-items: center; background: var(--panel); border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); z-index: 2; }
.caret svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.dropup { position: absolute; bottom: calc(100% + 0.5rem); left: 50%; transform: translateX(-50%); min-width: 16rem; max-width: 22rem; background: var(--panel); border-radius: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / 30%); padding: 0.35rem; z-index: 10; }
.dropup h4 { margin: 0.35rem 0.6rem; font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.dropup button { display: flex; width: 100%; gap: 0.5rem; text-align: left; border: none; background: none; padding: 0.5rem 0.6rem; border-radius: 6px; }
.dropup button:hover, .dropup button:focus-visible { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.dropup button[aria-checked="true"]::before { content: "✓"; }
.dropup button[aria-checked="false"]::before { content: ""; width: 0.75em; }
.dropup p { margin: 0.4rem 0.6rem; color: var(--muted); font-size: 0.9rem; }
#join-form { display: grid; gap: 0.5rem; }
#join-form label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 0.75rem; font-size: 1.05rem; }
input, select, button { font: inherit; }
input, select { padding: 0.5rem; border-radius: 8px; border: 1px solid var(--muted); background: transparent; color: inherit; }
button { padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--muted); background: var(--panel); color: inherit; cursor: pointer; }
button[aria-pressed="true"] { outline: 3px solid #ffd166; }
.note { color: var(--muted); font-size: 0.9rem; }
#stage { display: grid; grid-template-columns: minmax(0, 3fr) minmax(16rem, 1fr); gap: 1rem; }
@media (max-width: 800px) { #stage { grid-template-columns: 1fr; } }
.program { position: relative; background: #000; border-radius: 12px; aspect-ratio: 16 / 9; overflow: hidden; }
.program video { width: 100%; height: 100%; object-fit: contain; }
#play { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 0.9rem 1.4rem; font-size: 1.15rem; font-weight: 600; background: #ffd166; color: #222; border: none; box-shadow: 0 4px 18px rgb(0 0 0 / 50%); }
#program-note { position: absolute; inset: auto 0 45% 0; text-align: center; color: #bbb; margin: 0; }
aside { display: grid; gap: 1rem; align-content: start; }
.self video { width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 10px; object-fit: cover; }
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.status { background: var(--panel); padding: 0.75rem; border-radius: 10px; }
.roles { display: grid; gap: 0.5rem; }
.role { display: flex; justify-content: space-between; align-items: center; background: var(--panel); padding: 0.5rem 0.75rem; border-radius: 8px; }
.role .taken { color: var(--muted); }
.cues { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.cue { min-height: 3.5rem; border: none; font-weight: 600; touch-action: none; }
.cue[aria-pressed="true"] { outline: 3px solid #ffd166; }
.pad { width: 100%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--panel) 0 20%, var(--accent) 100%); position: relative; touch-action: none; cursor: crosshair; }
.pad .dot { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #ffd166; transform: translate(-50%, -50%); left: 50%; top: 50%; pointer-events: none; }
.expressions { display: grid; gap: 0.5rem; }
.expressions label { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
h3 { margin: 0.25rem 0; font-size: 1rem; }
.error { color: #d33; }
.held { cursor: pointer; }
.held::after { content: "▶ Click to see yourself"; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 0.6rem 1rem; border-radius: 8px; background: #ffd166; color: #222; font-weight: 600; white-space: nowrap; }
.self { position: relative; }
