/* tabtango app: the midnight ballroom. Ink navy and black surfaces, hairline borders, a faint
   floor grid, muted silver and dusty teal, two slow spotlights. Built on Monsoon tokens. */

:root {
  --seed: #5f8f8b;
  --font: 'Inter Tight', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', ui-serif, Georgia, serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 14px;
  --bar-h: 56px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html[data-theme='dark'] {
  --background: #05070b;
  --foreground: #e6ebf1;
  --surface: #0a0d14;
  --surface-2: #0e121b;
  --surface-3: #131824;
  --muted: #10141d;
  --muted-foreground: #8d97a5;
  --border: rgba(200, 214, 230, 0.1);
  --line-strong: rgba(200, 214, 230, 0.18);
  --silver: #c4cbd4;
  --teal: #86b5b0;
  --teal-soft: rgba(134, 181, 176, 0.14);
  --grid: rgba(200, 214, 230, 0.035);
  --spot: rgba(190, 210, 225, 0.07);
  --glass: rgba(10, 13, 20, 0.72);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
}

html[data-theme='light'] {
  --background: #f3f4f6;
  --foreground: #10151d;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f3;
  --muted: #eef0f3;
  --muted-foreground: #5a6472;
  --border: rgba(16, 24, 36, 0.1);
  --line-strong: rgba(16, 24, 36, 0.18);
  --silver: #4f5865;
  --teal: #3f6d69;
  --teal-soft: rgba(63, 109, 105, 0.1);
  --grid: rgba(16, 24, 36, 0.04);
  --spot: rgba(120, 150, 170, 0.08);
  --glass: rgba(255, 255, 255, 0.78);
  --shadow: 0 24px 50px -28px rgba(16, 24, 36, 0.35);
}

* { box-sizing: border-box; }
html { background: var(--background); }
body.tt {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--foreground);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 56px 56px,
    var(--background);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Two slow spotlights crossing over the floor. */
body.tt::before, body.tt::after {
  content: '';
  position: fixed;
  top: -30vh;
  width: 70vmax;
  height: 140vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(closest-side, var(--spot), transparent 70%);
  filter: blur(8px);
  animation: sweep 26s ease-in-out infinite alternate;
}
body.tt::before { left: -20vmax; transform-origin: 50% 0; transform: rotate(-18deg); }
body.tt::after { right: -20vmax; transform-origin: 50% 0; transform: rotate(18deg); animation-delay: -13s; animation-direction: alternate-reverse; }
@keyframes sweep {
  from { translate: 0 0; rotate: 0deg; }
  to { translate: 12vmax 0; rotate: 10deg; }
}
@media (prefers-reduced-motion: reduce) {
  body.tt::before, body.tt::after { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.sprite { position: absolute; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted-foreground); }
.small { font-size: 13px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.hint { font-size: 13px; color: var(--muted-foreground); margin: 6px 0 0; }
.warn, .warn-text { color: oklch(0.8 0.09 70); }
html[data-theme='light'] .warn, html[data-theme='light'] .warn-text { color: oklch(0.5 0.11 60); }
.ok-text { color: var(--teal); }
.link { color: var(--teal); text-underline-offset: 3px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.skip-link:focus { top: 8px; }
.noscript { padding: 24px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.bar-room { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-foreground); }
.bar-count { color: var(--foreground); font-variant-numeric: tabular-nums; }
.bar-gap { flex: 1; }
.icon-btn .ic { width: 18px; height: 18px; }
.theme-btn .ic-sun { display: none; }
html[data-theme='light'] .theme-btn .ic-sun { display: block; }
html[data-theme='light'] .theme-btn .ic-moon { display: none; }
.lang { --seg-h: 28px; }

.notices { position: relative; z-index: 2; }
.notice { margin: 0; padding: 10px 16px; font-size: 13px; text-align: center; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--silver); }

main { position: relative; z-index: 1; outline: none; }

/* ---------- home ---------- */
.home { max-width: 1120px; margin: 0 auto; padding: clamp(28px, 6vw, 72px) 16px 56px; }
.home-head { max-width: 760px; }
.home-art { display: block; width: 118px; height: auto; margin-bottom: 18px; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35)); }
.display { font-size: clamp(34px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 640; margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--muted-foreground); margin: 0 0 26px; max-width: 46ch; }
.name-field { max-width: 360px; margin-bottom: 28px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 28px; }
.choice {
  position: relative;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: calc(var(--r) + 4px);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice::before { content: ''; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.choice h2 { font-size: 22px; letter-spacing: -0.02em; margin: 6px 0 0; }
.choice p { margin: 0 0 8px; }
.choice-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); color: var(--teal); background: var(--teal-soft); }
.choice-icon .ic { width: 22px; height: 22px; }
.choice .btn-block { margin-top: auto; }
.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.word { position: relative; display: block; }
.word span { position: absolute; left: 10px; top: 50%; translate: 0 -50%; font: 600 11px var(--mono); color: var(--muted-foreground); pointer-events: none; }
.word input {
  width: 100%;
  height: 46px;
  padding: 0 10px 0 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font: 500 15px var(--mono);
  letter-spacing: 0.01em;
}
.word input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.word.ok input { border-color: color-mix(in oklab, var(--teal) 55%, transparent); }
.word.bad input { border-color: oklch(0.7 0.1 50 / 0.6); }
.ext-line { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; max-width: 760px; font-size: 14.5px; color: var(--silver); }
.ext-line + .ext-line { margin-top: 10px; }
.ext-line .ic { margin-top: 2px; color: var(--teal); }
.ways { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--silver); }
.ways li { display: flex; gap: 10px; align-items: flex-start; }
.ways .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--teal); }
/* Wide screens: the welcome on the left, both choices on the right, all in the first screen. */
@media (min-width: 1024px) {
  .home { max-width: 1240px; min-height: calc(100dvh - var(--bar-h)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 520px); gap: clamp(40px, 6vw, 96px); align-items: center; padding-block: 28px; }
  .home-head { max-width: 560px; }
  .home .display { font-size: clamp(40px, 4vw, 58px); }
  .home-cards { grid-template-columns: 1fr; gap: 14px; margin-top: 0; }
  .home .choice { padding: 22px 24px; gap: 8px; }
  .home .choice { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
  .home .choice h2 { margin: 0; }
  .home .choice > :not(.choice-icon):not(h2) { grid-column: 1 / -1; }
  .home .choice > p.muted { margin: 2px 0 6px; }
}
@media (min-width: 1024px) and (max-height: 820px) {
  .home-art { width: 88px; margin-bottom: 10px; }
  .home .lead { margin-bottom: 16px; }
  .name-field { margin-bottom: 14px; }
}

/* scroll and load reveals */
.reveal { animation: rise 0.7s var(--ease) both; }
.home-cards .reveal:nth-child(2) { animation-delay: 0.08s; }
@keyframes rise { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

/* ---------- joining and ended ---------- */
.joining, .ended { min-height: calc(100dvh - var(--bar-h)); display: grid; place-items: center; padding: 24px 16px; }
.join-card { width: min(560px, 100%); text-align: center; padding: 32px 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 14px; justify-items: center; }
.join-card h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0; display: flex; gap: 10px; align-items: center; justify-content: center; }
.join-art { width: 120px; height: auto; }
.confirm-words, .invite-words { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.confirm-words li, .invite-words li { display: flex; gap: 8px; align-items: baseline; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font: 600 17px var(--mono); }
.confirm-words li span, .invite-words li span { font-size: 11px; color: var(--muted-foreground); }
.small-words li { padding: 8px; font-size: 14px; }
.waiting { display: flex; gap: 8px; align-items: center; color: var(--teal); margin: 0; }

/* ---------- room ---------- */
.room { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 16px; max-width: 2200px; margin: 0 auto; min-height: calc(100dvh - var(--bar-h)); }
.stage-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stage-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-frame { position: relative; border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden; background: #020305; box-shadow: var(--shadow); }
.frame-chrome { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-bottom: 1px solid rgba(200, 214, 230, 0.1); background: #0a0d14; color: #8d97a5; font-size: 12px; }
.frame-chrome i { width: 9px; height: 9px; border-radius: 50%; background: rgba(200, 214, 230, 0.16); }
.frame-chrome span { margin-left: 10px; padding: 3px 12px; border-radius: 999px; background: rgba(200, 214, 230, 0.06); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.stage { position: relative; aspect-ratio: 16 / 9; width: 100%; max-height: calc(100dvh - var(--bar-h) - 190px); min-height: 220px; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #020305; }
.stage .trails, .stage .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .layer { touch-action: none; cursor: crosshair; overflow: hidden; }
.stage .layer[data-tool='hidden'] { touch-action: auto; cursor: default; }
.stage .trails { pointer-events: none; }
.stage-empty { position: absolute; inset: 34px 0 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 20px; background: radial-gradient(ellipse at 50% 30%, rgba(134, 181, 176, 0.08), transparent 60%), #05070b; color: #e6ebf1; }
.stage-empty img { width: clamp(120px, 22vw, 220px); height: auto; }
.stage-empty h2 { margin: 0; font-size: clamp(20px, 2.4vw, 28px); letter-spacing: -0.02em; }
.stage-empty p { margin: 0; max-width: 46ch; color: #8d97a5; }

.cursor { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; color: var(--c); transition: opacity 0.2s; }
.cursor svg { position: absolute; left: -3px; top: -2px; width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); transition: scale 0.12s; }
.cursor path { fill: var(--c); stroke: #05070b; }
.cursor-name { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 12px/1 var(--font); padding: 5px 9px; border-radius: 999px; background: var(--c); color: #05070b; }
.cursor.is-hidden { opacity: 0; }
.cursor.is-pressed svg { scale: 0.86; }
.cursor.is-laser svg { filter: drop-shadow(0 0 6px var(--c)); }
.ripple { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 2px solid var(--c); pointer-events: none; animation: ripple 0.7s var(--ease) forwards; }
@keyframes ripple { from { scale: 0.2; opacity: 1; } to { scale: 1.7; opacity: 0; } }

.stage-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-tools .segmented-item { gap: 6px; }
.ext-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 13.5px; }
.ext-card .ic { color: var(--teal); margin-top: 2px; }
.ext-card p { margin: 0; }
.ext-title { font-weight: 650; margin-bottom: 2px !important; }

.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.invite-btn { gap: 10px; }
.tabs-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tab-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted-foreground); font: 600 13px var(--font); cursor: pointer; }
.tab-btn[aria-selected='true'] { background: var(--surface-3); color: var(--foreground); box-shadow: inset 0 0 0 1px var(--border); }
.tab-btn .count { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--surface-3); }
.tab-btn .count.dot { background: var(--teal); color: #05070b; }
.panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-height: 260px; }
.panel-title { margin: 0; font-size: 15px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.seat { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c) 22%, transparent); flex: none; display: inline-block; }
.leave { align-self: flex-start; margin-top: auto; }
.chat-panel { height: min(60dvh, 520px); }
.chat-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border-left: 2px solid var(--c); max-width: 92%; }
.msg.me { align-self: flex-end; background: var(--teal-soft); }
.msg-head { font-size: 12px; color: var(--muted-foreground); display: flex; gap: 8px; }
.msg-head b { color: var(--foreground); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form .textarea { min-height: 40px; max-height: 120px; resize: none; }
.page-form { display: flex; gap: 8px; }
.page-form .input { flex: 1; min-width: 0; }
.pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pages li { display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.pages li .grow { display: grid; }
.pages small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- dialogs ---------- */
.modal-box { background: var(--surface); border: 1px solid var(--line-strong); }
.invite-box { --modal-w: 640px; }
.door-status { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--teal); margin: 8px 0; }
.door-status[data-status='closed'], .door-status[data-status='error'] { color: var(--muted-foreground); }
.invite-body { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 16px; align-items: center; }
.invite-words li { font-size: 18px; padding: 14px 12px; }
.qr-card { padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--border); }
.qr-card svg { display: block; width: 100%; height: auto; }
/* ---------- the context menu: dark in both themes ---------- */
.ctx-menu { position: fixed; z-index: 80; min-width: 210px; max-width: min(300px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow: auto; padding: 6px; border-radius: 12px; background: #0d1119; color: #dfe5ec; border: 1px solid rgba(200, 214, 230, 0.14); box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 0, 0, 0.4); font: 500 13.5px/1.2 var(--font); animation: ctx-in 0.12s ease-out; }
@keyframes ctx-in { from { opacity: 0; translate: 0 -4px; } }
.ctx-menu button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.ctx-menu button:hover, .ctx-menu button:focus-visible, .ctx-menu button:focus { background: rgba(134, 181, 176, 0.16); color: #fff; outline: none; }
.ctx-menu button:focus-visible { box-shadow: inset 0 0 0 1px #86b5b0; }
.ctx-menu button[aria-disabled='true'] { opacity: 0.42; cursor: default; }
.ctx-menu button[aria-expanded='true'] { background: rgba(134, 181, 176, 0.12); }
.ctx-menu button.is-checked .ctx-mark, .ctx-menu button[aria-checked='true'] .ctx-mark { color: #86b5b0; }
.ctx-menu button.is-checked { background: rgba(134, 181, 176, 0.08); }
.ctx-mark { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: #9aa6b4; }
.ctx-mark .ic { width: 16px; height: 16px; }
.ctx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-more { flex: none; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor; rotate: 45deg; opacity: 0.6; margin-right: 2px; }
.ctx-sep { height: 1px; margin: 5px 6px; background: rgba(200, 214, 230, 0.12); }
@media (prefers-reduced-motion: reduce) { .ctx-menu { animation: none; } }
#people li:focus-visible, .msg:focus-visible, .stage .layer:focus-visible { outline: 2px solid var(--accent, #86b5b0); outline-offset: 2px; }
.stage .layer, #people li, .msg { -webkit-touch-callout: none; }
.stage { overflow: hidden; }
.stage.is-following > video, .stage.is-following > canvas, .stage.is-following > .layer { transform: var(--follow); transform-origin: 0 0; }
.cursor.is-driver svg { width: 30px; height: 30px; }
.cursor.is-driver::before { content: ''; position: absolute; left: -16px; top: -16px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--c); opacity: 0.7; animation: drive 1.6s ease-out infinite; }
@keyframes drive { from { scale: 0.6; opacity: 0.8; } to { scale: 1.4; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor.is-driver::before { animation: none; } }
.follow-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 4px 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.driver-badge { background: rgba(134, 181, 176, 0.18); }
#device-settings select { width: 100%; margin-bottom: 8px; }
.invite-link { grid-column: 1 / -1; width: 100%; display: grid; gap: 6px; }
.invite-link .row { flex-wrap: nowrap; }
.invite-link input { font: 500 13px var(--mono); min-width: 0; }
.invite-link p { margin: 0; }
.door { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.door h3 { margin: 0; font-size: 15px; }
.door-guest { padding: 12px; border-radius: 12px; border: 1px solid color-mix(in oklab, var(--c) 40%, var(--border)); background: var(--surface-2); }
.door-guest p { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.settings-box { --modal-w: 560px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-block { padding: 14px 0; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.set-block h3 { margin: 0; font-size: 15px; }
.set-block p { margin: 0; }
.set-block summary { cursor: pointer; font-weight: 600; }
[data-voodoo-theme-mode] { cursor: pointer; }
.segmented-item[aria-pressed='true'] { background: var(--surface-3); color: var(--foreground); }
.scan-video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); translate: -50% 0; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast-item { margin: 0; padding: 11px 14px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 14px; animation: rise 0.35s var(--ease) both; }

/* ---------- small screens: the guest view on phones ---------- */
@media (max-width: 1023px) {
  .room { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .stage { max-height: none; }
  .chat-panel { height: 52dvh; }
}
@media (max-width: 640px) {
  :root { --bar-h: 52px; }
  .bar { gap: 6px; padding: 0 12px; }
  .brand span { display: none; }
  .bar-room { padding: 4px 8px; }
  .home { padding-top: 24px; }
  .choice { padding: 18px; }
  .room { padding: 0 0 12px; gap: 8px; }
  .stage-col { gap: 8px; }
  .stage-frame { border-radius: 0; border-left: 0; border-right: 0; }
  .frame-chrome { display: none; }
  .stage-empty { inset: 0; }
  .stage { min-height: 200px; }
  .stage-bar, .stage-tools, .ext-card, .side, .tiles, .stage-col > .hint { margin: 0 10px; }
  .stage-tools .label-text { display: none; }
  .invite-body { grid-template-columns: 1fr; justify-items: center; }
  .qr-card { width: 200px; }
  .confirm-words, .invite-words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .lang { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .room { grid-template-columns: minmax(0, 1fr) 300px; }
  .stage { max-height: calc(100dvh - var(--bar-h) - 70px); }
  .stage-col > .hint, .ext-card { display: none; }
}

/* ---------- camera tiles ---------- */
.tiles { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.tiles[hidden] { display: none; }
.tile { position: relative; margin: 0; flex: 0 0 auto; width: clamp(120px, 16vw, 200px); aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #020305; border: 1px solid var(--border); box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--c) 45%, transparent); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.mirror video { transform: scaleX(-1); }
.tile figcaption { position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(5, 7, 11, 0.7); color: #e6ebf1; font-size: 11.5px; font-weight: 600; border-left: 3px solid var(--c); }

/* ---------- point at this ---------- */
.flash { position: absolute; width: 0; height: 0; pointer-events: none; color: var(--c); z-index: 2; }
.flash i { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--c); animation: flash-ring 1.2s var(--ease) 3 both; }
.flash i + i { animation-delay: 0.35s; }
.flash span { position: absolute; left: 24px; top: -14px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; padding: 5px 10px; border-radius: 999px; background: var(--c); color: #05070b; font: 600 12px/1.2 var(--font); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.flash.flip span { left: auto; right: 24px; }
@keyframes flash-ring { from { scale: 0.3; opacity: 1; } to { scale: 1.6; opacity: 0; } }
.stage .layer.is-pointing { cursor: copy; outline: 2px dashed var(--teal); outline-offset: -4px; }
.point-hint { margin: 0; font-size: 12.5px; color: var(--teal); }

/* ---------- chat extras ---------- */
.msg { position: relative; }
.msg.spot { border-left-style: double; border-left-width: 4px; }
.msg-reply { display: flex; gap: 6px; align-items: center; border: 0; background: transparent; padding: 0; color: var(--muted-foreground); font: 12px var(--font); text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg-reply .ic { width: 14px; height: 14px; }
.msg-reply b { color: var(--foreground); }
.msg-spot { justify-self: start; display: inline-flex; gap: 6px; align-items: center; margin-top: 2px; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in oklab, var(--c) 50%, var(--border)); background: transparent; color: var(--foreground); font: 600 12px var(--font); cursor: pointer; }
.msg-spot .ic { width: 14px; height: 14px; color: var(--c); }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.reaction { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--foreground); font: 600 12px var(--font); cursor: pointer; }
.reaction .ic { width: 14px; height: 14px; }
.reaction.mine { border-color: var(--teal); background: var(--teal-soft); }
.msg-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 0.8; } }
.msg-act { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--muted-foreground); cursor: pointer; }
.msg-act .ic { width: 15px; height: 15px; }
.picker { display: flex; gap: 4px; padding: 4px; margin-top: 4px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-3); width: max-content; }
.pick { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--foreground); cursor: pointer; }
.pick:hover { background: var(--teal-soft); color: var(--teal); }
.reply-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border-left: 2px solid var(--teal); font-size: 13px; }
.reply-bar small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- voice ---------- */
.noise-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground); }
.noise-chip .ic { width: 15px; height: 15px; color: var(--teal); }
.noise-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: background 0.15s; }
.noise-chip i.on { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.meter-bar { flex: 1 1 120px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.meter-bar i { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width 0.08s linear; }
