/* Visual language: monochrome, hairline borders, colour only for meaning
   (speaking = green, muted / leave = red) and for telling people apart (avatars). */
:root {
  --bg: #fafafa; --card: #ffffff; --soft: #f2f2f2; --soft-2: #e8e8e8;
  --ink: #171717; --body: #4d4d4d; --mute: #8f8f8f;
  --line: #ebebeb; --line-strong: #d4d4d4;
  --primary: #171717; --primary-ink: #ffffff; --primary-hover: #383838;
  --danger: #e5484d; --danger-hover: #d13438; --danger-soft: #feecec;
  --speak: #16a34a; --focus: #0070f3; --warn: #f5a623; --link: #0062d1;
  --av-l: 92%; --av-s: 70%; --av-ink-l: 30%; --av-ink-s: 50%; --tile-l: 97%; --tile-s: 60%;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
/* Dark tokens: follow the system unless the user picked a theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --card: #141414; --soft: #1f1f1f; --soft-2: #2a2a2a;
    --ink: #ededed; --body: #a1a1a1; --mute: #7d7d7d;
    --line: #242424; --line-strong: #363636;
    --primary: #ededed; --primary-ink: #0a0a0a; --primary-hover: #cfcfcf;
    --danger: #e5484d; --danger-hover: #f06065; --danger-soft: #2b1314;
    --speak: #22c55e; --focus: #3291ff; --link: #6aaeff;
    --av-l: 22%; --av-s: 35%; --av-ink-l: 80%; --av-ink-s: 75%; --tile-l: 11%; --tile-s: 25%;
    --shadow-sm: none;
    --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
    --bg: #0a0a0a; --card: #141414; --soft: #1f1f1f; --soft-2: #2a2a2a;
    --ink: #ededed; --body: #a1a1a1; --mute: #7d7d7d;
    --line: #242424; --line-strong: #363636;
    --primary: #ededed; --primary-ink: #0a0a0a; --primary-hover: #cfcfcf;
    --danger: #e5484d; --danger-hover: #f06065; --danger-soft: #2b1314;
    --speak: #22c55e; --focus: #3291ff; --link: #6aaeff;
    --av-l: 22%; --av-s: 35%; --av-ink-l: 80%; --av-ink-s: 75%; --tile-l: 11%; --tile-s: 25%;
    --shadow-sm: none;
    --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); min-height: 100vh; min-height: 100dvh;
  font: 15px/1.5 Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- controls ---------- */
button, input, select { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; font-size: 14px; font-weight: 500; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
button svg.i { width: 16px; height: 16px; }
button:hover { background: var(--soft); }
button:active { transform: scale(.97); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button:disabled { opacity: .4; cursor: default; transform: none; }
input, select {
  height: 40px; padding: 0 12px; font-size: 15px; border-radius: 6px; min-width: 0; width: 100%;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; padding-right: 36px; font-size: 14px; cursor: pointer; text-overflow: ellipsis;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238f8f8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
}
input::placeholder { color: var(--mute); }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--body); }

/* Theme: an explicit segmented switch (auto / light / dark). Compact icons on the home page,
   labelled buttons in the call's settings popover. */
.theme-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--soft); flex: none; }
.theme-seg button {
  height: 28px; padding: 0 8px; gap: 5px; border: none; border-radius: 7px; background: transparent;
  color: var(--mute); font-size: 13px; font-weight: 500;
}
.theme-seg button svg.i { width: 14px; height: 14px; }
.theme-seg button:hover { background: transparent; color: var(--ink); }
.theme-seg button:active { transform: none; }
.theme-seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.theme-seg.wide { display: flex; margin: 2px 4px 4px; }
.theme-seg.wide button { flex: 1; height: 30px; color: var(--body); }
.home-top { display: flex; align-items: center; justify-content: space-between; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.3px; color: var(--ink); text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); }
.logo-mark svg.i { width: 19px; height: 19px; }
.home-left, .home-right { display: flex; align-items: center; gap: 8px; }
/* back, in the desktop app only (a browser has its own) */
.nav-back { width: 30px; height: 30px; margin-right: -2px; }
.nav-back svg.i { width: 18px; height: 18px; }
/* home: get the desktop app, offered for the visitor's system */
.get-app {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--body); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.get-app:hover { color: var(--ink); border-color: var(--line-strong); background: var(--soft); }
.get-app svg.i { width: 14px; height: 14px; }
@media (max-width: 420px) { .get-app .long { display: none; } }
/* desktop app: version pill on the home page, opens the updates dialog */
.ver {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 9999px;
  border: 1px solid var(--line); background: var(--card); color: var(--mute); font: 12px "Geist Mono", ui-monospace, Menlo, monospace;
  transition: color .15s, border-color .15s;
}
.ver:hover { color: var(--ink); border-color: var(--line-strong); background: var(--card); }
.ver .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--speak); display: none; }
.ver.upd { color: var(--ink); border-color: color-mix(in srgb, var(--speak) 45%, transparent); }
.ver.upd .dot { display: block; }
.upd-scrim { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.28); animation: fade-in .15s ease; }
:root[data-theme="dark"] .upd-scrim { background: rgba(0,0,0,.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .upd-scrim { background: rgba(0,0,0,.55); } }
@keyframes fade-in { from { opacity: 0; } }
.upd-dlg {
  position: relative; width: 340px; max-width: 100%; padding: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 16px 50px rgba(0,0,0,.18); -webkit-app-region: no-drag;
}
.upd-dlg .x { position: absolute; top: 12px; right: 12px; }
/* Settings (home page): sections on the left, the chosen one on the right. */
.prefs-btn { position: relative; width: 34px; height: 34px; padding: 0; border-radius: 10px; color: var(--ink); }
.prefs-btn svg.i { width: 17px; height: 17px; }
.prefs-btn .badge, .prefs-nav .badge { width: 8px; height: 8px; border-radius: 50%; background: var(--speak); }
.prefs-btn .badge { position: absolute; top: -3px; right: -3px; border: 2px solid var(--bg); box-sizing: content-box; }
.prefs-nav .badge { margin-left: auto; }
.prefs-dlg {
  position: relative; width: 720px; max-width: 100%; height: min(520px, calc(100dvh - 32px)); display: grid; grid-template-columns: 196px minmax(0, 1fr);
  border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0,0,0,.18); overflow: hidden; -webkit-app-region: no-drag;
}
.prefs-nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 8px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--soft) 45%, transparent); overflow-y: auto; }
.prefs-nav > b { margin: 0 10px 12px; font-size: 15px; font-weight: 600; }
.prefs-nav button { justify-content: flex-start; gap: 10px; height: 34px; padding: 0 10px; border: none; border-radius: 8px; background: none; color: var(--body); font-size: 13.5px; font-weight: 500; }
.prefs-nav button:hover { background: var(--soft); color: var(--ink); }
.prefs-nav button:active { transform: none; }
.prefs-nav button[aria-current="true"] { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.prefs-nav button svg.i { width: 16px; height: 16px; }
.prefs-pane { position: relative; overflow-y: auto; padding: 20px 22px 22px; }
.prefs-pane .x { position: absolute; top: 12px; right: 12px; }
.prefs-pane section:not(.on) { display: none; }
.prefs-pane h2 { margin: 0 40px 4px 0; font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.prefs-pane .lead { margin: 0 0 14px; font-size: 13px; color: var(--body); }
.prefs-pane .lead:empty { display: none; }
.prefs-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); text-align: left; }
section > .prefs-row:first-of-type, .prefs-box + .prefs-row { border-top: none; }
.prefs-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.prefs-row .t { font-size: 14px; color: var(--ink); font-weight: 400; }
.prefs-row .s { margin-top: 2px; font-size: 12px; color: var(--mute); line-height: 1.4; white-space: normal; }
.prefs-row.col { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.prefs-row input, .prefs-row select { height: 36px; font-size: 13.5px; }
.prefs-row > input, .prefs-row > select { width: 240px; }
.pref-model { display: block; width: 240px; }
.pref-model > * { width: 100%; }
.prefs-row button { height: 34px; padding: 0 12px; font-size: 13px; }
.prefs-row button svg.i { width: 15px; height: 15px; }
.prefs-row .theme-seg button { height: 30px; padding: 0 10px; gap: 6px; font-size: 12.5px; color: var(--body); border: none; }
.prefs-row .theme-seg button[aria-pressed="true"] { color: var(--ink); }
.prefs-line { display: flex; gap: 8px; } .prefs-line select { flex: 1; min-width: 0; }
.prefs-meter { display: flex; gap: 3px; height: 8px; }
.prefs-meter i { flex: 1; border-radius: 2px; background: var(--soft-2); transition: background .08s; }
.prefs-meter i.on { background: var(--speak); }
.prefs-row.tog { width: 100%; height: auto; border-radius: 0; border-left: none; border-right: none; border-bottom: none; background: none; padding: 12px 0; font-weight: 400; cursor: pointer; }
.prefs-row.tog:hover { background: none; } .prefs-row.tog:active { transform: none; }
.prefs-row .sw { position: relative; width: 34px; height: 20px; border-radius: 9999px; background: var(--line-strong); transition: background .15s; }
.prefs-row .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.prefs-row[aria-checked="true"] .sw { background: var(--speak); }
.prefs-row[aria-checked="true"] .sw::after { transform: translateX(14px); }
.prefs-box { padding: 14px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.prefs-box:empty { display: none; }
.prefs-ready { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; font-size: 12.5px; color: var(--body); }
.prefs-ready > .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--speak) 16%, transparent); color: var(--speak); }
.prefs-ready h4 { margin: 1px 0 2px; font-size: 14px; font-weight: 500; color: var(--ink); }
.prefs-ready .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.prefs-ready .tags span { padding: 2px 8px; border-radius: 9999px; background: var(--soft); font-size: 11.5px; }
.prefs-ready button { height: 32px; padding: 0 12px; font-size: 13px; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.prefs-ready button svg.i { width: 14px; height: 14px; }
#pref-dir-text { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 620px) {
  .prefs-dlg { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 32px); }
  .prefs-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 10px 8px; }
  .prefs-nav > b { display: none; }
  .prefs-nav button { flex: none; }
  .prefs-row { grid-template-columns: minmax(0, 1fr); }
  .prefs-row > input, .prefs-row > select { width: 100%; }
  .pref-model { width: 100%; }
}
.upd-app { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.upd-app .logo-mark { width: 44px; height: 44px; border-radius: 11px; }
.upd-app .logo-mark svg.i { width: 30px; height: 30px; }
.upd-app b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.upd-app span { font: 12px "Geist Mono", ui-monospace, Menlo, monospace; color: var(--mute); }
.upd-st { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 12px; background: var(--soft); font-size: 14px; line-height: 1.45; }
.upd-st > svg.i { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--mute); }
.upd-st.ok > svg.i { color: var(--speak); }
.upd-st.new > svg.i { color: var(--focus); }
.upd-st.err > svg.i { color: var(--danger); }
.upd-st.busy > svg.i { animation: spin 1s linear infinite; }
.upd-st > div { flex: 1; min-width: 0; }
.upd-st small { display: block; margin-top: 2px; color: var(--body); font-size: 13px; }
.upd-bar { height: 4px; margin-top: 8px; border-radius: 9999px; background: var(--soft-2); overflow: hidden; }
.upd-bar i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .3s; }
.upd-btns { display: flex; gap: 8px; margin-top: 16px; }
.upd-btns button { flex: 1; height: 40px; }
.upd-meta { margin-top: 14px; font-size: 12px; color: var(--mute); text-align: center; }

/* ---------- home ---------- */
#home { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 24px 16px; }
#home .hero { width: 100%; max-width: 520px; margin: auto; padding-bottom: 10vh; }
#home, #room { position: relative; z-index: 1; }
/* Dot field behind the home and pre-join screens: drifting light clouds, blooming around the cursor. */
#backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; transition: opacity .5s ease;
  -webkit-mask-image: radial-gradient(ellipse 44% 40% at 50% 46%, rgba(0,0,0,.18), #000 82%);
  mask-image: radial-gradient(ellipse 44% 40% at 50% 46%, rgba(0,0,0,.18), #000 82%);
}
#backdrop.off { opacity: 0; }
/* Calm the dots under the content: the pre-join card sits higher and is taller than the home hero. */
body.on-room #backdrop {
  -webkit-mask-image: radial-gradient(ellipse 34% 54% at 50% 47%, rgba(0,0,0,.1), #000 88%);
  mask-image: radial-gradient(ellipse 34% 54% at 50% 47%, rgba(0,0,0,.1), #000 88%);
}
@media (max-width: 520px) {
  #backdrop {
    -webkit-mask-image: radial-gradient(ellipse 100% 32% at 50% 46%, rgba(0,0,0,.1), #000 92%);
    mask-image: radial-gradient(ellipse 100% 32% at 50% 46%, rgba(0,0,0,.1), #000 92%);
  }
  body.on-room #backdrop {
    -webkit-mask-image: radial-gradient(ellipse 110% 42% at 50% 47%, rgba(0,0,0,.08), #000 95%);
    mask-image: radial-gradient(ellipse 110% 42% at 50% 47%, rgba(0,0,0,.08), #000 95%);
  }
}
/* The topbar sits over the dots on the pre-join screen. */
.topbar { background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* ---------- entrance & screen transitions ----------
   Only opacity/transform are animated (no layout properties), and nothing starts
   until web fonts are ready, so text never re-flows mid-animation. */
.enter > * { opacity: 0; }
body.ready .enter > * { opacity: 1; animation: rise .5s cubic-bezier(.2, .8, .2, 1) backwards; }
.enter > :nth-child(2) { animation-delay: 50ms !important; }
.enter > :nth-child(3) { animation-delay: 100ms !important; }
.enter > :nth-child(4) { animation-delay: 150ms !important; }
.enter > :nth-child(5) { animation-delay: 200ms !important; }
.enter > :nth-child(n+6) { animation-delay: 250ms !important; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.prejoin.leaving { opacity: 0; transform: translateY(-8px); transition: opacity .22s ease, transform .22s ease; }
/* Call view stays invisible until the server has told us who is here, so the grid appears in its final layout. */
.stage.in-call > #people, .stage.in-call > #invite { opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1); }
.stage.in-call.shown > #people, .stage.in-call.shown > #invite { opacity: 1; transform: none; }
.bar.in { animation: bar-in .4s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: .1s; }
@keyframes bar-in { from { opacity: 0; transform: translate(-50%, 16px); } }

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-group(root) { animation-duration: .28s; }
#home h1 { font-size: 48px; font-weight: 600; letter-spacing: -2.4px; line-height: 1.08; margin: 0 0 12px; }
.sub { color: var(--body); font-size: 16px; margin: 0 0 28px; }
.alt { margin-top: 16px; font-size: 14px; color: var(--body); }
.alt button {
  height: auto; padding: 0; border: none; background: none; font-weight: 400; font-size: inherit; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.alt button:hover { background: none; text-decoration-color: var(--ink); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm); }
form { display: flex; gap: 8px; }
form input { flex: 1; height: 44px; }
form button { height: 44px; }

/* ---------- room ---------- */
#room { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 61px; /* = .chat-head, so their lines meet */
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.crumb { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.crumb .sep { color: var(--line-strong); font-size: 20px; font-weight: 300; }
#room-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 9999px; background: var(--soft); color: var(--body); font-size: 13px; white-space: nowrap;
}
.chip svg.i { width: 14px; height: 14px; }
.stage { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 16px 128px; display: flex; flex-direction: column; gap: 16px; }

/* pre-join */
.prejoin { width: 100%; max-width: 440px; margin: auto; padding-bottom: 6vh; display: flex; flex-direction: column; gap: 16px; }
.stage:not(.in-call) { padding-bottom: 32px; }
/* Soft pool of the page colour behind the text, so the dots fall away under it (no visible edge). */
#home .hero, .prejoin { position: relative; isolation: isolate; }
#home .hero::before, .prejoin::before {
  content: ""; position: absolute; inset: -80px -110px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--bg) 94%, transparent) 45%,
    color-mix(in srgb, var(--bg) 70%, transparent) 72%,
    transparent);
}
/* One centred column: room name, who's inside, your future tile, name, devices, join. */
.prejoin { max-width: 400px; gap: 12px; }
.prejoin h1 {
  font-size: 30px; font-weight: 600; letter-spacing: -1.1px; line-height: 1.15; margin: 8px 0 0; text-align: center;
  overflow-wrap: anywhere;
}
.door-card { width: 100%; max-width: 340px; margin: auto; padding-bottom: 8vh; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.door-card h1 { font-size: 26px; font-weight: 600; letter-spacing: -.8px; line-height: 1.15; margin: 0; }
.door-card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--body); }
.dc-badge { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--soft); color: var(--body); margin-bottom: 6px; }
.dc-badge svg.i { width: 28px; height: 28px; }
.dc-room { font: 13px "Geist Mono", ui-monospace, Menlo, monospace; color: var(--mute); overflow-wrap: anywhere; }
.dc-watch { display: inline-flex; align-items: center; gap: 7px; margin-top: 2px; font-size: 12.5px; color: var(--mute); }
.dc-watch i { width: 7px; height: 7px; border-radius: 50%; background: var(--mute); animation: dc-blink 1.6s ease-in-out infinite; }
@keyframes dc-blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .dc-watch i { animation: none; } }
.dc-btns { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 10px; }
.pj-who { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -4px 0 4px; min-height: 22px; text-align: center; }
#room-info { color: var(--body); font-size: 14px; }
.stack { display: flex; flex: none; }
.stack:empty { display: none; }
.stack .av { width: 22px; height: 22px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--bg); display: grid; place-items: center; font-size: 10px; font-weight: 600; background: var(--soft); color: var(--mute); }
.stack .av:first-child { margin-left: 0; }
.pj-tile {
  position: relative; isolation: isolate; aspect-ratio: 4 / 3; border-radius: 14px; padding-bottom: 30px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; transition: background .3s;
}
.pj-tile.tinted { background: radial-gradient(120% 90% at 50% 38%, hsl(var(--h) var(--tile-s) var(--tile-l)) 0%, var(--card) 75%); }
.pj-tile .avatar { --av: 96px; margin: 0; box-shadow: 0 0 0 6px color-mix(in srgb, var(--card) 60%, transparent); }
.pj-tile .avatar::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; background: var(--speak);
  opacity: calc(var(--lvl, 0) * .3); transform: scale(calc(1 + var(--lvl, 0) * .45));
}
.pj-tile.muted .avatar::before, .pj-tile.muted .avatar.tinted::before { opacity: 0; }
.pj-tile .name.ph { color: var(--mute); font-weight: 400; }
.pj-tile.paused { cursor: pointer; }
.pj-tile.paused .state { color: var(--ink); }
.pj-mic {
  position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 82%, transparent);
}
.pj-mic svg.i { width: 16px; height: 16px; }
.pj-mic.off, .pj-mic.off:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
#pj-name { height: 44px; font-size: 15px; }
.pj-devs { display: flex; gap: 8px; }
.pj-devs .csel { flex: 1; min-width: 0; }
.pj-devs .csel-menu { min-width: min(300px, calc(100vw - 32px)); }
.pj-devs .csel + .csel .csel-menu { left: auto; right: 0; }

/* recent rooms on the home page (kept in this browser only) */
.recent { margin-top: 32px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--mute); margin-bottom: 6px; }
.recent-head button { height: auto; padding: 0; border: none; background: none; font-size: 13px; font-weight: 400; color: var(--mute); }
.recent-head button:hover { background: none; color: var(--ink); }
#recent-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
#recent-list li { position: relative; display: flex; align-items: center; }
#recent-list li + li { border-top: 1px solid var(--line); }
#recent-list a {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
#recent-list li:hover a { background: var(--soft); }
#recent-list a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.recent .rn { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .when { font-size: 12px; color: var(--mute); white-space: nowrap; }
.recent .live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--speak); white-space: nowrap; }
.recent .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--speak); box-shadow: 0 0 0 3px color-mix(in srgb, var(--speak) 20%, transparent); }
.recent .stack .av { border-color: var(--card); }
#recent-list li:hover .stack .av { border-color: var(--soft); }
.recent .rm {
  position: absolute; right: 10px; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; background: none; color: var(--mute); opacity: 0; transition: opacity .15s, background .15s;
}
.recent .rm svg.i { width: 14px; height: 14px; }
#recent-list li:hover .rm, #recent-list li:focus-within .rm { opacity: 1; }
.recent .rm:hover { background: var(--soft-2); color: var(--ink); }
/* Symmetric padding; on hover the time / live label slides left and the cross takes its place. */
#recent-list a { transition: padding-right .18s cubic-bezier(.2, .8, .2, 1); }
#recent-list li:hover a, #recent-list li:focus-within a { padding-right: 44px; }
/* no hover on touch screens: the cross stays visible and keeps its room */
@media (hover: none) { .recent .rm { opacity: 1; } #recent-list a { padding-right: 44px; } }
/* custom device picker: icon | label (ellipsis) | chevron, chevron always at the same spot */
.csel { position: relative; }
.csel-btn {
  width: 100%; height: 40px; display: grid; grid-template-columns: 16px minmax(0, 1fr) 16px; gap: 10px;
  justify-items: start; padding: 0 12px; border-radius: 8px; font-weight: 400; font-size: 14px;
}
.csel-btn svg.i { width: 16px; height: 16px; color: var(--mute); }
.csel-btn .chev { transition: transform .18s; }
.csel-btn .val { width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel.open .csel-btn { border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft-2); }
.csel.open .chev { transform: rotate(180deg); }
.csel-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  max-height: 240px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s;
}
.csel.open .csel-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .14s ease, transform .14s ease; }
.opt {
  display: grid; grid-template-columns: minmax(0, 1fr) 16px; align-items: center; gap: 8px; min-height: 36px;
  padding: 0 10px; border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--ink);
}
.opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt:hover, .opt.hl { background: var(--soft); }
.opt svg.i { width: 16px; height: 16px; visibility: hidden; }
.opt[aria-selected="true"] svg.i { visibility: visible; }
#join-btn { height: 48px; font-size: 15px; }

/* tiles */
/* Layout adapts to the number of people: big tiles for 1-2, a 3x2 grid for 5-6. */
.stage.in-call { justify-content: center; }
#people {
  --cols: 3; --tile: 240px; --av: 76px;
  list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; justify-content: center;
  grid-template-columns: repeat(var(--cols), minmax(0, var(--tile)));
}
#people[data-n="1"] { --cols: 1; --tile: 300px; --av: 112px; }
#people[data-n="2"] { --cols: 2; --tile: 300px; --av: 104px; }
#people[data-n="3"] { --cols: 3; --tile: 250px; --av: 88px; }
#people[data-n="4"] { --cols: 2; --tile: 260px; --av: 84px; }
/* A tile is a 4:3 card softly tinted with the person's colour; name, mic and status sit on a plate
   in the bottom-left corner, like in video calls. */
#people li {
  position: relative; isolation: isolate; aspect-ratio: 4 / 3; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 30px;
  animation: pop .25s ease-out; transition: opacity .2s, border-color .45s ease, box-shadow .45s ease;
}
#people li.tinted { background: radial-gradient(120% 90% at 50% 38%, hsl(var(--h) var(--tile-s) var(--tile-l)) 0%, var(--card) 75%); }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
/* Speaking: the whole tile gets a green ring and a soft outer glow. */
#people li::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--speak); opacity: 0; transition: opacity .45s ease;
}
/* Lights up quickly, fades out slowly. */
#people li.speaking {
  border-color: transparent; box-shadow: 0 0 0 4px color-mix(in srgb, var(--speak) 18%, transparent);
  transition: opacity .2s, border-color .12s, box-shadow .12s;
}
#people li.speaking::after { opacity: 1; transition: opacity .12s; }
/* Connecting: a shimmer runs across the tile, the avatar is greyed out. */
#people li.connecting .avatar { filter: grayscale(1); opacity: .55; }
#people li.connecting::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, color-mix(in srgb, var(--ink) 5%, transparent) 50%, transparent 65%) 0 0 / 300% 100%;
  animation: shimmer 2s ease-in-out infinite;
}
/* With a 300% wide gradient the band is fully outside the tile at both ends, so the loop restarts unseen. */
@keyframes shimmer { from { background-position: 110% 0; } to { background-position: -10% 0; } }
.avatar {
  --av: 72px;
  position: relative; width: var(--av); height: var(--av); border-radius: 9999px; margin-bottom: 14px;
  display: grid; place-items: center; font-weight: 500; font-size: calc(var(--av) * .36); letter-spacing: -.5px;
  background: var(--soft); color: var(--mute);
  transition: background .3s, color .3s, filter .3s, opacity .3s, width .3s ease, height .3s ease, font-size .3s ease;
}
#people .avatar { --av: inherit; margin: 0; box-shadow: 0 0 0 6px color-mix(in srgb, var(--card) 60%, transparent); }
/* Live voice level: a soft halo around the avatar that breathes with the volume. */
#people .avatar::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: var(--speak);
  opacity: calc(var(--lvl, 0) * .3);
  transform: scale(calc(1 + var(--lvl, 0) * .45));
}
.avatar.tinted {
  background: hsl(var(--h) var(--av-s) var(--av-l));
  color: hsl(var(--h) var(--av-ink-s) var(--av-ink-l));
}
/* For a named person the halo is a soft blurred glow in their own colour, the tile's tint. */
#people .avatar.tinted::before, .pj-tile .avatar.tinted::before {
  background: hsl(var(--h) 75% 60%); filter: blur(calc(var(--av) * .1));
  opacity: calc(var(--lvl, 0) * .6); transform: scale(calc(1 + var(--lvl, 0) * .4));
}
.plate {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); z-index: 1;
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px 0 7px; border-radius: 8px;
  background: color-mix(in srgb, var(--card) 82%, transparent); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
/* Mic icon (red when muted); while the person speaks it turns into level bars. */
.mic { display: grid; place-items: center; width: 16px; height: 16px; flex: none; color: var(--mute); }
.mic svg.i { width: 14px; height: 14px; }
.mic > span { display: grid; place-items: center; } /* not inline: an inline svg sits on the text baseline, off centre */
.mic .off, .muted .mic .on { display: none; }
.muted .mic .off { display: grid; }
.muted .mic { color: var(--danger); }
.eq { display: none; align-items: center; justify-content: center; gap: 2px; width: 16px; height: 16px; flex: none; }
.eq i { width: 3px; border-radius: 2px; background: var(--speak); height: calc(4px + var(--lvl, 0) * 9px); transition: height .08s; }
.eq i:nth-child(2) { height: calc(4px + var(--lvl, 0) * 12px); }
.speaking:not(.muted) .eq { display: flex; }
.speaking:not(.muted) .mic { display: none; }
.name-row { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; }
.name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font-size: 11px; color: var(--mute); white-space: nowrap; }
/* Your own name is the rename button. At rest it looks like everyone else's plate; hovering the tile
   slides a pencil in, hovering the name gives it a soft chip. The pencil stays put on touch screens,
   for keyboard focus and while you have no name yet. */
.name-btn {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; height: 22px; padding: 0 5px; margin: 0 -5px;
  border: none; border-radius: 6px; background: none; font-size: inherit; font-weight: inherit; cursor: text;
}
.name-btn:hover, .name-btn:focus-visible { background: var(--soft); }
.name-btn:active { transform: none; }
.edit { display: grid; place-items: center; width: 0; overflow: hidden; opacity: 0; flex: none; color: var(--mute); transition: width .15s ease, opacity .15s ease; }
.edit svg.i { width: 13px; height: 13px; }
#people li:hover .edit, .name-btn:focus-visible .edit, .name-btn.empty .edit { width: 13px; opacity: 1; }
.name-btn:hover .edit { color: var(--ink); }
.name-btn.empty { background: var(--soft); }
@media (hover: none) { .edit { width: 13px; opacity: 1; } }
/* When the plate runs out of room the status gives way first, then the name. */
.state { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; }
.state:empty { display: none; }
.state::before { content: "· "; }
li.connecting .name { color: var(--mute); }
/* 4. connection quality: nothing while it's good, a small pill when it's weak or bad */
.q {
  position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 9999px; font-size: 11px; cursor: help; color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--card));
}
.q[data-q="3"], .q:not([data-q]) { display: none; }
.q[data-q="1"] { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--card)); }
.q::after { content: "слабая сеть"; }
.q[data-q="1"]::after { content: "плохая связь"; }
:root[lang="en"] .q::after { content: "weak network"; }
:root[lang="en"] .q[data-q="1"]::after { content: "poor connection"; }
#people.am-host .q { right: 42px; }
.q b { display: flex; align-items: flex-end; gap: 1.5px; height: 9px; }
.q i { width: 2.5px; border-radius: 1px; background: var(--soft-2); }
.q i:nth-child(1) { height: 4px; } .q i:nth-child(2) { height: 6.5px; } .q i:nth-child(3) { height: 9px; }
.q[data-q="2"] i:nth-child(-n+2), .q[data-q="1"] i:nth-child(1) { background: currentColor; }
.name-input { height: 22px; width: 150px; min-width: 0; flex: 0 1 auto; padding: 0 6px; font-size: 13px; border-radius: 5px; }

.invite {
  width: 100%; max-width: 560px; align-self: center;
  background: var(--card); border: 1px dashed var(--line-strong); border-radius: 12px;
  padding: 20px; display: flex; flex-direction: column; gap: 4px;
}
.invite h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.invite p { margin: 0 0 12px; color: var(--body); font-size: 14px; }
.invite .row { display: flex; gap: 8px; }
.invite input { flex: 1; font-size: 13px; color: var(--body); background: var(--soft); border-color: var(--line); }

.notice {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
  padding: 12px 12px 12px 16px; display: flex; gap: 12px; align-items: center; min-height: 58px;
  font-size: 14px; color: var(--ink);
}
.notice .ic { display: grid; color: var(--danger); }
.notice.busy .ic { color: var(--mute); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice span.text { flex: 1; }

/* The agent in the call: a tile next to the people. Its owner's avatar is pinned to the bot,
   the status says what it is doing. */
#people li.agent-tile {
  --ag: color-mix(in srgb, var(--focus) 14%, var(--card));
  background: radial-gradient(120% 90% at 50% 20%, var(--ag) 0%, var(--card) 70%);
  border-color: color-mix(in srgb, var(--focus) 28%, var(--line));
}
.ag-bot {
  position: relative; width: calc(var(--av) * .8); height: calc(var(--av) * .8); border-radius: 28%;
  display: grid; place-items: center; color: var(--focus);
  background: color-mix(in srgb, var(--focus) 16%, var(--card)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--focus) 30%, transparent);
}
.ag-bot > svg.i { width: 50%; height: 50%; }
.ag-bot > svg.logo { width: 46%; height: 46%; }
.ag-bot.claude, .ag-bot.codex, .ag-bot.opencode { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-sm); }
#people li.agent-tile:has(.ag-bot.claude) { --ag: color-mix(in srgb, #D97757 16%, var(--card)); border-color: color-mix(in srgb, #D97757 30%, var(--line)); }
#people li.agent-tile:has(.ag-bot.codex), #people li.agent-tile:has(.ag-bot.opencode) { --ag: var(--soft); border-color: var(--line-strong); }
.ag-bot .av { position: absolute; right: -9px; bottom: -7px; width: 26px; height: 26px; font-size: 11px; box-shadow: 0 0 0 3px var(--card); }
.ag-state {
  position: absolute; top: 8px; left: 8px; max-width: calc(100% - 52px); z-index: 1;
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border: none; border-radius: 9999px;
  font-size: 12px; font-weight: 500; background: var(--soft); color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default;
}
.ag-state.busy { background: color-mix(in srgb, var(--focus) 15%, transparent); color: var(--link); }
.ag-state.wait { background: color-mix(in srgb, var(--warn) 15%, transparent); color: color-mix(in srgb, var(--warn) 75%, var(--ink)); }
.ag-state.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--speak); flex: none; }
.ag-state.deaf::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; flex: none; }
button.ag-state.deaf { cursor: pointer; }
button.ag-state.deaf:hover { background: var(--line); color: var(--ink); }
button.ag-state.wait { cursor: pointer; }
button.ag-state.wait:hover { background: color-mix(in srgb, var(--warn) 25%, transparent); }
.ag-state .dots { display: inline-flex; gap: 2px; }
.ag-state .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: ag-dot 1.2s infinite; }
.ag-state .dots i:nth-child(2) { animation-delay: .15s; }
.ag-state .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ag-dot { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
/* While the agent works, a comet in its brand colour runs around the tile, the tile glows,
   the mark breathes and the status shimmers. */
@property --ag-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
#people li.agent-tile { --ag-c: var(--focus); }
#people li.agent-tile:has(.ag-bot.claude) { --ag-c: #D97757; }
#people li.agent-tile:has(.ag-bot.codex), #people li.agent-tile:has(.ag-bot.opencode) { --ag-c: var(--ink); }
#people li.agent-tile.thinking, #people li.agent-tile.thinking:has(.ag-bot) { border-color: transparent; box-shadow: 0 0 28px -6px color-mix(in srgb, var(--ag-c) 55%, transparent); }
#people li.agent-tile.thinking::before {
  content: ""; position: absolute; inset: -1px; z-index: 0; padding: 2px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--ag-a), var(--ag-c), color-mix(in srgb, var(--ag-c) 35%, transparent) 22%, transparent 40%, transparent 72%, var(--ag-c));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ag-orbit 2.4s linear infinite;
}
@keyframes ag-orbit { to { --ag-a: 360deg; } }
#people li.agent-tile.thinking .ag-bot { animation: ag-breathe 1.8s ease-in-out infinite; }
@keyframes ag-breathe { 50% { transform: scale(1.06); box-shadow: 0 0 0 1px var(--line-strong), 0 0 22px color-mix(in srgb, var(--ag-c) 35%, transparent); } }
.ag-state .shim {
  background: linear-gradient(90deg, var(--link) 0%, color-mix(in srgb, var(--link) 30%, transparent) 50%, var(--link) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: ag-shim 1.6s linear infinite;
}
@keyframes ag-shim { from { background-position: 200% 0; } to { background-position: 0 0; } }
/* The agent's answer is written out top to bottom, as if it were streaming. */
.msg.ag-reveal .bubble {
  -webkit-mask-image: linear-gradient(#000 40%, transparent 60%); mask-image: linear-gradient(#000 40%, transparent 60%);
  -webkit-mask-size: 100% 250%; mask-size: 100% 250%; -webkit-mask-position: 0 0; mask-position: 0 0;
  animation: ag-reveal var(--rev, 900ms) cubic-bezier(.35, .1, .35, 1) both;
}
@keyframes ag-reveal { from { -webkit-mask-position: 0 100%; mask-position: 0 100%; } }
.ag-more { position: absolute; top: 6px; right: 6px; z-index: 2; width: 30px; height: 30px; padding: 0; border: none; border-radius: 8px; background: transparent; color: var(--body); }
.ag-more:hover, .ag-more[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.ag-menu {
  position: absolute; top: 40px; right: 6px; z-index: 3; width: min(230px, calc(100% - 12px)); padding: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); text-align: left;
}
.ag-menu .ag-info { padding: 6px 10px 6px; font-size: 12px; line-height: 1.45; color: var(--mute); white-space: normal; }
.ag-menu button { width: 100%; height: 32px; padding: 0 10px; justify-content: flex-start; border: none; border-radius: 6px; background: none; font-size: 13px; }
.ag-menu button:hover { background: var(--soft); }
.ag-menu button.danger { color: var(--danger); }
.stage.has-screen:not(.rail) #people li.agent-tile .ag-bot { --av: 28px; border-radius: 50%; }
.stage.has-screen:not(.rail) .ag-bot .av, .stage.has-screen:not(.rail) .ag-state, .stage.has-screen.rail .ag-state { display: none; }
.stage.has-screen .ag-more { top: 4px; right: 4px; width: 26px; height: 26px; }
.stage.has-screen:not(.rail) .ag-more { position: static; flex: none; margin-left: auto; }
/* a task for the agent from someone other than its owner: waits for the owner under the message */
.task { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--soft); font-size: 12px; color: var(--body); max-width: 100%; }
.task-h { display: flex; align-items: center; gap: 7px; }
.task-h svg.i { width: 14px; height: 14px; flex: none; }
.task.wait .task-h svg.i { color: var(--warn); }
.task.ok .task-h svg.i { color: var(--speak); }
.task.no .task-h svg.i, .task.gone .task-h svg.i { color: var(--mute); }
.task.ask { padding: 10px 12px; }
.task-acts { display: flex; gap: 6px; }
.task-acts button { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.peek-task { padding: 0 12px 8px 50px; }
.peek-task .task { margin: 0; }
/* the agent's own messages: the bot with its owner's avatar */
.av.bot-av { position: relative; border-radius: 9px; background: color-mix(in srgb, var(--focus) 16%, var(--card)); color: var(--focus); }
.av.bot-av > svg.i { width: 16px; height: 16px; }
.av.bot-av > svg.logo { width: 15px; height: 15px; }
.av.bot-av.claude, .av.bot-av.codex, .av.bot-av.opencode { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.av.bot-av .av { position: absolute; right: -5px; bottom: -4px; width: 15px; height: 15px; font-size: 8px; box-shadow: 0 0 0 2px var(--card); }
.msg-head .tag { font-size: 11px; color: var(--mute); white-space: nowrap; }
/* asking the agent by voice: the hold button on its tile and the hint above the bar */
.ag-talk {
  position: absolute; right: 8px; bottom: 8px; z-index: 2; height: 28px; padding: 0 6px 0 8px; gap: 5px;
  border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--body); user-select: none; -webkit-user-select: none; touch-action: none;
  background: color-mix(in srgb, var(--card) 82%, transparent); border: 1px solid var(--line);
}
.ag-talk svg.i { width: 14px; height: 14px; }
#people li.agent-tile .plate { max-width: calc(100% - 78px); }
#people li.agent-tile .you { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stage.has-screen #people li.agent-tile .plate { max-width: calc(100% - 16px); }
.ag-talk:hover { color: var(--ink); }
.ag-talk.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.ag-talk kbd { font: inherit; font-size: 11px; padding: 0 4px; border-radius: 4px; background: var(--soft); color: var(--mute); }
.ag-talk.on kbd { background: rgba(255,255,255,.2); color: #fff; }
.stage.has-screen .ag-talk { display: none; }
.voice-pill {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 16; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 8px 14px; border-radius: 9999px;
  background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); font-size: 13px; color: var(--ink);
  animation: hint-in-r .18s ease-out;
}
.vp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.voice-pill.listening .vp-dot { background: var(--danger); animation: vp-pulse 1s ease-in-out infinite; }
@keyframes vp-pulse { 50% { opacity: .35; } }
.pop-toggle:disabled { opacity: .55; cursor: default; }
.pop-toggle:disabled:hover { background: none; }
.agent-dlg [hidden] { display: none !important; } /* the rules below set display; the script hides with the attribute */
.agent-dlg { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.agent-dlg h2 { margin: 0 32px 16px 0; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.agent-dlg .label { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-size: 12px; color: var(--mute); }
.agent-dlg .label a { color: var(--body); }
.agent-err { margin-top: 8px; font-size: 12px; color: var(--danger); }
.agent-cmd { display: flex; align-items: flex-start; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); }
.agent-cmd code { flex: 1; min-width: 0; padding: 4px 0; font-size: 12px; line-height: 1.5; color: var(--ink); word-break: break-all; user-select: all; }
.agent-cmd button { width: 28px; height: 28px; padding: 0; flex: none; border: none; background: transparent; color: var(--mute); border-radius: 6px; }
.agent-cmd button:hover { background: var(--soft-2); color: var(--ink); }
.agent-cmd button svg.i { width: 15px; height: 15px; }
/* which agent: three cards; in the app they say whether it is installed */
.agent-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.agent-cards button {
  height: auto; flex-direction: column; gap: 4px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; font-weight: 500; white-space: normal; text-align: center;
}
.agent-cards button:hover { background: var(--soft); }
.agent-cards button[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--card); }
.agent-cards .ag-logo { display: grid; place-items: center; width: 28px; height: 28px; color: var(--ink); }
.agent-cards .ag-logo svg { width: 24px; height: 24px; }
.agent-cards small { font-size: 11px; font-weight: 400; color: var(--mute); min-height: 15px; }
.agent-cards small:empty { display: none; } /* a browser shows no install status: nothing to hold room for */
.agent-cards small.ok { color: var(--speak); }
.agent-cards button.missing:not([aria-checked="true"]) { opacity: .6; }
.agent-what { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--body); }
.agent-what b { font-weight: 500; color: var(--ink); }
.agent-dlg .agent-sw { margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.agent-dlg .agent-sw > svg.i { align-self: flex-start; margin-top: 2px; }
.agent-dlg .agent-sw:disabled { opacity: .55; }
.agent-dlg .agent-sw .lbl { font-weight: 500; font-size: 13.5px; }
.agent-dlg .agent-sw small { font-weight: 400; }
.agent-proj { display: flex; align-items: center; gap: 10px; margin: 14px 0 16px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.agent-proj.set { border-style: solid; }
.agent-proj.web { cursor: pointer; }
.agent-proj > svg.i { width: 16px; height: 16px; color: var(--body); flex: none; align-self: flex-start; margin-top: 2px; }
.agent-proj .lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.agent-proj .lbl b { font-size: 13.5px; font-weight: 500; }
.agent-proj .lbl small { font-size: 12px; color: var(--mute); }
.agent-proj.set .lbl small { font-family: "Geist Mono", ui-monospace, monospace; color: var(--ink); white-space: nowrap; overflow: hidden; }
.agent-proj #agent-pick { height: 30px; padding: 0 12px; font-size: 13px; flex: none; }
.agent-proj .icon-btn { width: 28px; height: 28px; }
.agent-proj .sw { position: relative; width: 32px; height: 18px; border-radius: 9999px; background: var(--line-strong); flex: none; transition: background .15s; }
.agent-proj .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.agent-proj.set .sw { background: var(--speak); }
.agent-proj.set .sw::after { transform: translateX(14px); }
.agent-check { margin-bottom: 10px; font-size: 13px; color: var(--body); }
.agent-check::before { content: "! "; color: var(--warn); font-weight: 600; }
.agent-check a { color: var(--ink); }
#agent-start { width: 100%; height: 42px; gap: 8px; border-radius: 10px; }
#agent-start svg.i { width: 15px; height: 15px; }
.agent-live { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; font-size: 13px;
  background: color-mix(in srgb, var(--speak) 9%, var(--card)); border: 1px solid color-mix(in srgb, var(--speak) 30%, var(--line)); }
.agent-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--speak); flex: none; }
.agent-live.starting .dot { background: var(--mute); animation: min-pulse 1.2s infinite; }
.agent-live .g { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.agent-live .g b { font-weight: 500; color: var(--ink); }
.agent-live .g small { font-size: 12px; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-live button { height: 30px; padding: 0 12px; font-size: 13px; flex: none; }
#agent-web .label { margin-top: 2px; }
.agent-dlg details { margin-top: 10px; font-size: 12px; color: var(--mute); }
.agent-dlg details summary { cursor: pointer; width: fit-content; }
.agent-dlg details .label { margin-top: 10px; }
.agent-dlg details .label a { color: var(--body); }
.agent-dlg .agent-foot { display: flex; justify-content: space-between; gap: 12px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--mute); }
.agent-dlg .agent-foot .links { display: flex; gap: 12px; flex: none; }
.agent-dlg .agent-foot a { color: var(--body); }

/* call bar */
.bar {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 9999px; box-shadow: var(--shadow-lg);
}
.bar button { width: 48px; height: 48px; padding: 0; border-radius: 9999px; border: none; background: var(--soft); }
.bar button:hover { background: var(--soft-2); }
.bar button svg.i { width: 20px; height: 20px; }
.bar button.off { background: var(--danger); color: #fff; }
.bar button.off:hover { background: var(--danger-hover); }
.bar button[aria-expanded="true"] { background: var(--primary); color: var(--primary-ink); }
.bar .leave { width: auto; padding: 0 20px; background: var(--danger); color: #fff; }
.bar .leave:hover { background: var(--danger-hover); }
.bar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.popover {
  --tail-x: 50%;
  position: fixed; left: 16px; bottom: calc(98px + env(safe-area-inset-bottom)); z-index: 11;
  width: min(320px, calc(100vw - 32px)); padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  transform-origin: var(--tail-x) 100%;
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.97);
  transition: opacity .16s ease, transform .22s cubic-bezier(.2, .9, .3, 1.2), visibility 0s linear .22s;
}
.popover.open { opacity: 1; visibility: visible; transform: none; transition: opacity .16s ease, transform .22s cubic-bezier(.2, .9, .3, 1.2); }
.pop-sec {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px;
  font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em;
}
.pop-sec svg.i { width: 12px; height: 12px; }
.pop-div { height: 1px; background: var(--line); margin: 6px 4px; }
.pop-tail {
  position: absolute; bottom: -6px; left: var(--tail-x); width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg);
  background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* per-participant volume */
/* Volume: a small button in the top-left corner; on hover (or click) it unrolls into a slider along
   the top edge, so the name plate at the bottom stays visible and the tile never resizes. */
.vol-btn {
  position: absolute; top: 8px; left: 8px; z-index: 3; height: 28px; padding: 0 8px; gap: 4px; border: none; border-radius: 8px;
  background: transparent; color: var(--mute); font-size: 11px; font-weight: 500; opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.vol-btn svg.i { width: 14px; height: 14px; }
.vol-btn span:empty, li.vol-open .vol-btn span { display: none; }
#people li.remote:hover .vol-btn, .vol-btn:focus-visible, li.vol-open .vol-btn, li.vol-changed .vol-btn { opacity: 1; }
.vol-btn:hover { background: var(--soft); color: var(--ink); }
li.vol-open .vol-btn { background: transparent; color: var(--ink); }
@media (hover: none) { .vol-btn { opacity: 1; } }
.vol {
  position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 28px; overflow: hidden;
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 34px; color: var(--mute);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transition: width .22s cubic-bezier(.2, .9, .3, 1), opacity .12s ease, visibility 0s linear .22s;
}
.vol > svg.i { display: none; }
li.vol-open .vol {
  width: min(220px, calc(100% - 16px)); opacity: 1; visibility: visible;
  transition: width .22s cubic-bezier(.2, .9, .3, 1), opacity .12s ease;
}
.stage.has-screen.rail .vol { top: 6px; left: 6px; padding-right: 8px; }
.stage.has-screen.rail li.vol-open .vol { width: calc(100% - 12px); }
.vol .pct { font-size: 11px; width: 34px; text-align: right; color: var(--body); }
.vol input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 4px; padding: 0; border: none; border-radius: 9999px;
  background: linear-gradient(var(--ink), var(--ink)) 0 / var(--v, 100%) 100% no-repeat, var(--soft-2); cursor: pointer;
}
.vol input[type=range]:focus { box-shadow: none; }
.vol input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }
.vol input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }

/* reactions */
/* Two rows: the warm ones on top, the sad / negative ones under them. */
.react-pop { width: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.react-row { display: flex; gap: 2px; }
.react-row button { width: 44px; height: 44px; padding: 0; border: none; background: none; border-radius: 10px; font-size: 24px; line-height: 1; }
.react-row button:hover { background: var(--soft); transform: translateY(-2px) scale(1.08); }
.float-emoji {
  --dx: 0px; position: absolute; left: 50%; bottom: 45%; z-index: 3; font-size: 34px; line-height: 1; pointer-events: none;
  animation: float-up 2.4s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(.5); }
  12% { opacity: 1; transform: translate(calc(-50% + var(--dx) * .3), 0) scale(1.15); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -130px) scale(1); }
}

/* Screen sharing. A wide call area (.rail, set from JS by the area's real width, so an open chat
   counts) puts the tiles in a column beside the frame and gives the frame the full height.
   A narrow one keeps the frame on top and turns the tiles into a row of "avatar + name" chips. */
.stage.in-call > #screen { animation: pop .25s ease-out; }
.stage.has-screen { max-width: 1280px; }
.stage.has-screen .q::after, .stage.has-screen .state, .stage.has-screen .edit { display: none; }
.screen-box {
  position: relative; overflow: hidden; width: 100%; height: clamp(220px, calc(100dvh - 280px), 56vw);
  background: #000; border-radius: 12px; border: 1px solid var(--line); touch-action: none;
}

.stage.has-screen.rail {
  --screen-h: max(320px, calc(100dvh - 210px));
  max-width: 1720px; display: grid; grid-template-columns: minmax(0, 1fr) 176px; column-gap: 12px; align-items: start; align-content: start;
}
.stage.has-screen.rail > * { grid-column: 1; }
.stage.has-screen.rail .screen-box { height: var(--screen-h); }
/* the column scrolls when the tiles don't fit; the padding leaves room for the speaking glow */
.stage.has-screen.rail > #people[data-n] {
  grid-column: 2; grid-row: 1 / span 4; --av: 52px; grid-template-columns: minmax(0, 1fr); gap: 8px;
  max-height: calc(var(--screen-h) + 8px); overflow-y: auto; padding: 4px; margin: -4px; scrollbar-width: thin;
}
.stage.has-screen.rail #people li { padding-bottom: 26px; border-radius: 12px; }
.stage.has-screen.rail .plate { left: 6px; bottom: 6px; max-width: calc(100% - 12px); height: 24px; padding: 0 7px 0 5px; gap: 4px; }
.stage.has-screen.rail .name { font-size: 12px; }
.stage.has-screen.rail .q { top: 6px; right: 6px; padding: 0 6px; }

.stage.has-screen:not(.rail) #people[data-n] { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage.has-screen:not(.rail) #people li {
  --av: 28px; aspect-ratio: auto; height: 40px; max-width: 240px; padding: 0 12px 0 6px; gap: 8px;
  flex-direction: row; justify-content: flex-start; border-radius: 9999px;
}
.stage.has-screen:not(.rail) #people .avatar { box-shadow: none; font-size: 12px; }
.stage.has-screen:not(.rail) .plate {
  position: static; min-width: 0; max-width: none; height: auto; padding: 0; gap: 5px;
  background: none; border: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.stage.has-screen:not(.rail) .q { position: static; flex: none; height: auto; padding: 0; background: none; }
/* volume: the button appears over the avatar on hover, the slider opens above the chip */
.stage.has-screen:not(.rail) .vol-btn {
  top: 6px; left: 6px; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--card) 88%, transparent);
}
.stage.has-screen:not(.rail) .vol-btn span { display: none; }
.stage.has-screen:not(.rail) li.vol-changed:not(:hover):not(.vol-open) .vol-btn { opacity: 0; }
.stage.has-screen:not(.rail) .vol { top: auto; bottom: calc(100% + 6px); left: 0; padding: 0 10px; border-radius: 10px; height: 32px; }
.stage.has-screen:not(.rail) li.vol-open .vol { width: 210px; }
.screen-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.screen-box:fullscreen, body.pip .screen-box { height: 100%; border: none; border-radius: 0; }
body.pip { background: #000; height: 100vh; overflow: hidden; }
.pip-ph { display: grid; place-items: center; height: 120px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--body); font-size: 14px; }
.screen-bar { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 3; display: flex; align-items: flex-start; gap: 6px; pointer-events: none; }
.screen-tag, .screen-stat, .screen-bar button {
  pointer-events: auto; height: 32px; padding: 0 10px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.62); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
/* Left: who is presenting + the frame rate (always visible). Right: actions that show on hover, and Stop. */
.screen-info { display: flex; gap: 6px; margin-right: auto; min-width: 0; }
.screen-tag { min-width: 34px; overflow: hidden; white-space: nowrap; } /* at least the icon stays */
.screen-tag span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.screen-stat { flex: none; }
.screen-tag svg.i { width: 14px; height: 14px; }
.screen-stat { font-size: 12px; cursor: help; }
.screen-stat i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none; }
.screen-stat[data-level="warn"] i { background: var(--warn); }
.screen-stat[data-level="bad"] i { background: var(--danger); }
.screen-bar button:hover { background: rgba(0,0,0,.8); }
.screen-bar button.stop { background: var(--danger); }
/* Desktop app: viewers' pointers over the presenter's real screen, on or off. */
.ovl-btn .sw { position: relative; width: 26px; height: 15px; border-radius: 999px; background: rgba(255,255,255,.3); transition: background .15s; }
.ovl-btn .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ovl-btn[aria-pressed="true"] .sw { background: #22c55e; }
.ovl-btn[aria-pressed="true"] .sw::after { transform: translateX(11px); }
.screen-bar button.ovl-btn[aria-disabled="true"] { cursor: default; color: rgba(255,255,255,.6); }
.screen-bar button.stop:hover { background: var(--danger-hover); }
.screen-box:not(:hover) .screen-bar button:not(.stop) { opacity: 0; visibility: hidden; }
.screen-bar button { transition: opacity .15s, background .15s, visibility 0s; }
.screen-box:not(:hover) .screen-bar button:not(.stop) { transition: opacity .15s, background .15s, visibility 0s linear .15s; }
@media (hover: none) { .screen-box .screen-bar button { opacity: 1 !important; } }
/* ink over the shared screen: one canvas under the pointers, in frame coordinates */
.ink-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen-box.drawing { cursor: crosshair !important; touch-action: none; }
.screen-bar button#draw-btn[aria-pressed="true"] { background: #fff; color: #0a0a0a; }
/* other people's pointers, in frame coordinates */
.ptr-layer { position: absolute; z-index: 2; pointer-events: none; }
.ptr, .ptr-ring { --c: hsl(var(--h, 210) 85% 52%); position: absolute; }
.ptr { left: 0; top: 0; transition: left .09s linear, top .09s linear, opacity .4s; }
.ptr.gone { opacity: 0; }
.ptr svg { display: block; width: 22px; height: 22px; margin: -2px 0 0 -3px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.ptr svg path { fill: var(--c); stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; }
.ptr span {
  position: absolute; left: 14px; top: 18px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 7px; border-radius: 6px; background: var(--c); color: #fff; font-size: 12px; font-weight: 500; line-height: 18px;
}
.ptr-ring { width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid var(--c); animation: ring .8s ease-out forwards; }
@keyframes ring { from { transform: scale(.15); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.share-pop { width: min(300px, calc(100vw - 32px)); padding: 14px; }
.share-pop p { margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.share-row { display: flex; gap: 8px; justify-content: flex-end; }
.share-row button { height: 34px; padding: 0 12px; }
.bar button.on { background: var(--primary); color: var(--primary-ink); }
.bar button.on:hover { background: var(--primary-hover); }

#mute-hint {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 12;
  display: flex; align-items: center; gap: 12px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 9999px; box-shadow: var(--shadow-lg);
  padding: 6px 6px 6px 16px; font-size: 14px; animation: hint-in .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 8px) scale(.97); } }
#mute-hint svg.i { color: var(--danger); width: 16px; height: 16px; }
#mute-hint button { height: 32px; border-radius: 9999px; padding: 0 14px; }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: 8px; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- chat ----------
   A side panel: on wide screens the call makes room for it, on narrow ones it covers the call,
   on phones it takes the screen with a strip of the call on top. */
.chat {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 15; width: 380px; max-width: 100%;
  display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--line);
  transform: translateX(100%); visibility: hidden;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .25s;
}
.chat.open { transform: none; visibility: visible; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 1100px) {
  /* the call moves aside in step with the panel */
  #room { transition: padding-right .25s cubic-bezier(.2, .8, .2, 1); }
  .bar, #mute-hint { transition: left .25s cubic-bezier(.2, .8, .2, 1); }
  #toast { transition: opacity .2s, transform .2s, left .25s cubic-bezier(.2, .8, .2, 1); }
  body.chat-open #room { padding-right: 380px; }
  body.chat-open .bar, body.chat-open #mute-hint, body.chat-open #toast, body.chat-open #voice-pill, body.chat-open #missed { left: calc(50% - 190px); }
}
@media (max-width: 1099px) { .chat { box-shadow: var(--shadow-lg); } }
.m-only { display: none !important; }
.icon-btn { width: 32px; height: 32px; padding: 0; border: none; background: none; color: var(--body); border-radius: 8px; flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn svg.i { width: 18px; height: 18px; }
.chat-head { display: flex; align-items: center; gap: 10px; min-height: 61px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.chat-title b { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.chat-title > span { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .live { display: flex; align-items: center; gap: 6px; }
.chat-title .live i { width: 6px; height: 6px; border-radius: 50%; background: var(--speak); }
.chat-avs { display: flex; }
.chat-avs .av { width: 30px; height: 30px; font-size: 12px; box-shadow: 0 0 0 2px var(--bg); }
.chat-avs .av + .av { margin-left: -6px; }
.chat-avs .av.speaking { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--speak); position: relative; z-index: 1; }
.chat-avs .more { background: var(--soft); color: var(--body); font: 11px "Geist Mono", monospace; }
#chat-mic { width: 44px; height: 44px; padding: 0; border: none; border-radius: 50%; background: var(--soft); }
#chat-mic.off { background: var(--danger); color: #fff; }

.chat-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#chat-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 12px; display: flex; flex-direction: column; }
#chat-list > :first-child { margin-top: auto; }
.chat-empty { margin: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.chat-empty .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); color: var(--body); display: grid; place-items: center; }
.chat-empty .ic svg.i { width: 22px; height: 22px; stroke-width: 1.8; }
.chat-empty b { font-weight: 500; }
.chat-empty p { margin: -6px 0 4px; color: var(--body); font-size: 13px; max-width: 280px; }
.chat-empty button { height: 32px; padding: 0 12px; font-size: 13px; }
.sys { align-self: center; margin: 12px 0 2px; font-size: 12px; color: var(--mute); text-align: center; }
.new-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--link); font-size: 12px; font-weight: 500; }
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--link) 40%, transparent); }

.av {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 500; background: var(--soft); color: var(--mute);
}
.av.tinted { background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) var(--av-ink-s) var(--av-ink-l)); }
/* A chosen avatar: a ready-made one is larger than an initial; a photo fills the circle. */
.avatar.av-emoji { font-size: calc(var(--av) * .55); letter-spacing: 0; }
.av.av-emoji { font-size: 1.35em; }
.stack .av.av-emoji { font-size: 13px; }
.avatar.av-photo, .av.av-photo { background-size: cover !important; background-position: center !important; background-repeat: no-repeat !important; }
#people li[data-id="me"] .avatar, .pj-tile .avatar { cursor: pointer; }
.pj-tile .avatar .av-edit {
  position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 0;
}
.pj-tile .avatar .av-edit svg.i { width: 13px; height: 13px; }
/* Avatar dialog */
.av-dlg { width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.av-dlg h2 { margin: 0 0 12px; font-size: 17px; }
.av-now { display: flex; justify-content: center; margin: 4px 0 6px; }
.av-now .avatar { --av: 80px; margin: 0; }
.av-lbl { margin: 12px 0 6px; font-size: 12px; color: var(--body); }
.av-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.av-grid .av { width: 100%; height: auto; aspect-ratio: 1; font-size: 15px; cursor: pointer; padding: 0; border: 2px solid transparent; }
.av-grid .av.av-emoji { font-size: 22px; }
.av-grid .av[aria-pressed="true"] { border-color: var(--ink); }
.av-grid .av:hover { filter: brightness(.96); }
.av-photo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-photo-row label { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; }
.av-photo-row label:hover { background: var(--soft); }
.av-photo-row small { color: var(--mute); font-size: 12px; }
.av-crop { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.av-crop canvas { width: 160px; height: 160px; border-radius: 12px; touch-action: none; cursor: grab; background: #111; flex: none; }
.av-crop canvas:active { cursor: grabbing; }
.av-crop div { font-size: 12px; color: var(--body); display: flex; flex-direction: column; gap: 8px; }
.av-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.av-foot .r { display: flex; gap: 8px; margin-left: auto; }
/* Microphone at joining: on or off, remembered */
.pj-microw { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 6px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; }
.pj-microw .theme-seg button.off[aria-pressed="true"] { color: var(--danger); }
.pj-hint { margin: -4px 0 0; font-size: 12px; color: var(--body); text-align: center; }
.pop-toggle .sw { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--line-strong); flex: none; margin-left: auto; transition: background .15s; }
.pop-toggle .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; }
.pop-toggle[aria-pressed="true"] .sw { background: var(--ink); }
.pop-toggle[aria-pressed="true"] .sw::after { transform: translateX(12px); }
.msg {
  position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px;
  margin: 2px -8px 0; padding: 1px 8px; border-radius: 10px; transition: background .15s;
}
.msg.first { margin-top: 12px; }
.msg > .av { grid-row: 1 / span 9; margin-top: 2px; }
.msg-body { grid-column: 2; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.msg.mine { grid-template-columns: minmax(0, 1fr); }
.msg.mine .msg-body { grid-column: 1; align-items: flex-end; padding-left: 40px; }
.msg:not(.mine) .msg-body { padding-right: 32px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 2px; font-size: 13px; max-width: 100%; }
.msg-head .who { font-weight: 500; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .who.tinted { color: hsl(var(--h) var(--av-ink-s) var(--av-ink-l)); }
.msg-head time, .status { font-size: 11px; color: var(--mute); flex: none; }
.bubble {
  max-width: 100%; padding: 7px 12px; border-radius: 6px 14px 14px 14px; background: var(--soft); color: var(--ink);
  font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { border-radius: 14px 6px 14px 14px; background: var(--primary); color: var(--primary-ink); }
.msg.mention .bubble { background: color-mix(in srgb, var(--focus) 16%, var(--card)); }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.mention-tag { color: var(--link); font-weight: 500; }
.msg.mine .mention-tag { color: inherit; font-weight: 600; }
.bubble .txt.clamp { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.bubble .more { display: block; height: auto; padding: 4px 0 0; border: none; background: none; color: var(--link); font-size: 13px; font-weight: 500; }
.msg.mine .bubble .more { color: inherit; text-decoration: underline; }
.quote {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; height: auto; margin: 0 0 5px; padding: 5px 10px; border: none; border-radius: 9px;
  background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; text-align: left; font-size: 12px; font-weight: 400; line-height: 1.4;
  white-space: nowrap; max-width: 100%; overflow: hidden;
}
.quote:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
.quote b { font-weight: 500; }
.quote b, .quote span { max-width: min(260px, 100%); overflow: hidden; text-overflow: ellipsis; }
.quote span { opacity: .75; }
.msg.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--focus) 18%, transparent); } }
.msg.pending .bubble, .msg.pending .media { opacity: .6; }
.msg.failed .bubble { background: var(--danger-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--danger); }
.status { display: flex; align-items: center; gap: 4px; margin: 0 2px; }
.status svg.i { width: 13px; height: 13px; }
.status .ok { color: var(--focus); }
.msg.mine.sent:not(.latest) .status { display: none; }
.status.fail { color: var(--danger); font-size: 12px; gap: 8px; }
.status.fail button { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; }

/* attachments in a message */
.media { display: grid; gap: 4px; grid-template-columns: repeat(2, minmax(0, 124px)); }
.media.one { grid-template-columns: minmax(0, auto); }
.media .img {
  position: relative; display: block; width: 100%; height: 124px; padding: 0; border: none; border-radius: 12px; overflow: hidden;
  background: var(--soft); cursor: zoom-in;
}
.media .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.one .img { height: auto; max-width: 260px; }
.media.one .img img { height: auto; max-height: 300px; object-fit: contain; }
.prog { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 9999px; background: rgba(0,0,0,.35); overflow: hidden; }
.prog::after { content: ""; display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: #fff; transition: width .15s; }
.file {
  display: flex; align-items: center; gap: 10px; width: 260px; max-width: 100%; padding: 8px 10px 8px 8px; position: relative;
  border-radius: 12px; background: var(--soft); color: var(--ink); text-decoration: none; overflow: hidden;
}
a.file:hover { background: var(--soft-2); }
.file .fic { width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--card); color: var(--body); display: grid; place-items: center; }
.file .fic svg.i { width: 18px; height: 18px; }
.file .fname { min-width: 0; flex: 1; display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; }
.file .fname b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fname span { color: var(--body); font-size: 12px; }
.file .dl { color: var(--mute); }
.file .prog { left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }
.file .prog::after { background: var(--ink); }
.link-card {
  display: flex; flex-direction: column; gap: 2px; width: 280px; max-width: 100%; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 13px; line-height: 1.4;
}
.link-card:hover { border-color: var(--line-strong); }
.link-card .site { font-size: 12px; color: var(--mute); }
.link-card b { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card span:last-child { color: var(--body); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* reactions under a message */
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rchip {
  height: 26px; padding: 0 8px; gap: 4px; border-radius: 9999px; font-size: 13px; font-weight: 400;
  background: var(--soft); border: 1px solid var(--line);
}
.rchip span { font: 12px "Geist Mono", monospace; color: var(--body); }
.rchip.mine { background: color-mix(in srgb, var(--focus) 14%, var(--card)); border-color: color-mix(in srgb, var(--focus) 55%, transparent); }
.rchip.mine span { color: var(--link); }

/* actions on hover (tap on touch screens) */
.tools {
  position: absolute; top: 50%; right: 8px; z-index: 2; display: none; gap: 2px; padding: 3px; transform: translateY(-50%);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.msg.mine .tools { right: auto; left: 8px; }
.tools button { width: 30px; height: 30px; padding: 0; border: none; border-radius: 7px; background: none; color: var(--body); }
.tools button:hover { background: var(--soft); color: var(--ink); }
.tools button svg.i { width: 15px; height: 15px; }
@media (hover: hover) {
  .msg.sent:hover { background: color-mix(in srgb, var(--soft) 55%, transparent); }
  .msg.sent:hover .tools, .msg.sent:focus-within .tools { display: flex; }
}
.msg.tools-open .tools { display: flex; }
.react-pick {
  position: fixed; z-index: 25; display: grid; grid-template-columns: repeat(6, 38px); gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.react-pick button { width: 38px; height: 38px; padding: 0; border: none; border-radius: 8px; background: none; font-size: 20px; }
.react-pick button:hover { background: var(--soft); transform: translateY(-1px) scale(1.08); }

#chat-new {
  position: absolute; left: 50%; bottom: 10px; z-index: 3; transform: translateX(-50%); height: 30px; padding: 0 12px;
  border-radius: 9999px; font-size: 13px; box-shadow: var(--shadow-lg);
}
.typing { display: flex; align-items: center; gap: 8px; padding: 0 16px 8px; font-size: 12px; color: var(--mute); }
.dots { display: inline-flex; gap: 3px; padding: 7px 9px; border-radius: 9999px; background: var(--soft); }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--mute); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.chat-drop {
  position: absolute; inset: 8px; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed var(--line-strong); border-radius: 14px; background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--body); font-size: 14px; pointer-events: none;
}
.chat-drop svg.i { width: 28px; height: 28px; }

/* composer */
.chat-form { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer {
  display: flex; align-items: flex-end; gap: 2px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft-2); }
.composer .icon-btn { width: 36px; height: 36px; }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; overflow-y: hidden; padding: 8px 4px; border: none; background: none; outline: none;
  font: inherit; font-size: 14px; line-height: 20px; color: var(--ink);
}
.composer textarea::placeholder { color: var(--mute); }
.composer .send { width: 36px; height: 36px; padding: 0; border-radius: 8px; flex: none; }
.chat-hint { font-size: 11px; color: var(--mute); margin: -2px 0 0 4px; }
@media (hover: none) { .chat-hint { display: none; } }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--soft); color: var(--body); }
.reply-bar > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; line-height: 1.4; }
.reply-bar b { color: var(--ink); font-weight: 500; }
.reply-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atts { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; }
.att {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  background: var(--soft); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.att img { width: 100%; height: 100%; object-fit: cover; }
.att svg.i { width: 18px; height: 18px; color: var(--body); }
.att small { max-width: 56px; font-size: 10px; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att.err { border-color: var(--danger); }
.att .x {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; border: none; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff;
}
.att .x svg.i { width: 12px; height: 12px; color: #fff; }
.att .prog { left: 6px; right: 6px; bottom: 6px; }
.mention-list, .emoji-pop {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 5; padding: 4px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.mention-list .opt { grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.mention-list .av { width: 22px; height: 22px; font-size: 11px; }
/* Emoji picker: category tabs on top, one scrolling list of sections below; the tab follows the scroll. */
.emoji-pop { left: auto; width: 316px; max-width: calc(100% - 24px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ep-tabs { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ep-tabs button {
  flex: 1 1 0; height: 30px; padding: 0; border: none; border-radius: 7px; background: none; font-size: 16px;
  opacity: .5; transition: background .15s, opacity .15s;
}
.ep-tabs button:hover { background: var(--soft); opacity: .9; }
.ep-tabs button[aria-selected="true"] { opacity: 1; background: var(--soft); }
.ep-body { height: 248px; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 6px; scrollbar-width: thin; }
.ep-h {
  position: sticky; top: 0; z-index: 1; padding: 8px 4px 4px; font-size: 12px; font-weight: 500; color: var(--mute);
  background: var(--card);
}
.ep-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.ep-grid button {
  width: 100%; height: 34px; padding: 0; border: none; background: none; border-radius: 8px; font-size: 20px; line-height: 1;
  transition: background .12s, transform .12s;
}
.ep-grid button:hover, .ep-grid button:focus-visible { background: var(--soft); transform: scale(1.12); outline-offset: -2px; }
.ep-grid button:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) { .ep-grid button:hover, .ep-grid button:focus-visible { transform: none; } }

/* bar badge + notification card while the chat is closed */
.bar #chat-btn { position: relative; }
.count-badge {
  position: absolute; top: -2px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 9999px;
  background: var(--danger); color: #fff; border: 2px solid var(--card); font-size: 11px; font-weight: 600; line-height: 16px;
}
.count-badge.at { background: var(--focus); }
.peek {
  position: fixed; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 12; width: min(340px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: hint-in-r .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes hint-in-r { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.peek-head { display: flex; align-items: center; padding: 6px 6px 0 12px; font-size: 12px; color: var(--mute); }
.peek-head span { flex: 1; }
.peek-head .icon-btn { width: 28px; height: 28px; }
.peek-item {
  display: flex; gap: 10px; align-items: flex-start; justify-content: flex-start; width: calc(100% - 12px); height: auto; margin: 2px 6px; padding: 6px;
  border: none; border-radius: 10px; background: none; text-align: left; font-weight: 400; white-space: normal;
}
.peek-item:hover { background: var(--soft); }
.peek-item.mention { background: color-mix(in srgb, var(--focus) 14%, var(--card)); }
.peek-item > span:last-child { min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.4; }
.peek-item b { font-size: 13px; font-weight: 500; }
.peek-item b em { font-style: normal; font-size: 11px; color: var(--link); margin-left: 6px; }
.peek-item .t { color: var(--body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.peek-reply { display: flex; gap: 6px; padding: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.peek-reply input { height: 36px; font-size: 14px; border-radius: 9px; }
.peek-reply button { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }

/* full-size picture */
/* a page an agent made: a card in the chat, opened in a sandboxed frame */
.file.page { cursor: pointer; }
.file.page .fic { color: var(--focus); }
.file.page .fname span { color: var(--mute); }
.page-view { position: fixed; inset: 16px; z-index: 30; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 16px 50px rgba(0,0,0,.35); }
.page-view-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.5); }
.pv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.pv-bar .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-bar .t small { margin-left: 8px; font-weight: 400; color: var(--mute); font-size: 12px; }
.pv-bar a { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); font-size: 13px; text-decoration: none; }
.pv-bar a:hover { background: var(--soft); }
.pv-bar a svg.i { width: 15px; height: 15px; }
.page-view iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 640px) { .page-view { inset: 0; border-radius: 0; } .pv-bar a span { display: none; } }
.lightbox { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.88); padding: 64px 16px 24px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-bar { position: absolute; top: 12px; left: 16px; right: 12px; display: flex; align-items: center; gap: 8px; color: #fff; }
.lb-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.lb-btn {
  height: 36px; padding: 0 12px; border: none; border-radius: 8px; background: rgba(255,255,255,.14); color: #fff;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; text-decoration: none;
}
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-btn svg.i { width: 16px; height: 16px; }

.msg.new-in { animation: msg-in .2s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 520px) {
  #home h1 { font-size: 36px; letter-spacing: -1.6px; }
  .stage { padding-top: 20px; }
  .prejoin h1 { font-size: 26px; letter-spacing: -.9px; }
  #people { gap: 8px; --av: 64px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #people[data-n="1"] { --av: 104px; grid-template-columns: minmax(0, 280px); }
  #people[data-n="2"] { --av: 88px; }
  #people li { aspect-ratio: 1; }
  #people[data-n="1"] li { aspect-ratio: 4 / 3; }
  .screen-box { height: auto; aspect-ratio: 16 / 10; }
  #count svg.i, #timer svg.i { display: none; }
  .topbar { gap: 8px; }
  .invite .row { flex-direction: column; }
  .chat { width: 100%; border-left: none; }
  .chat-head .m-only { display: inline-flex !important; }
  .chat-title .m-only { display: flex !important; }
  .chat .d-only { display: none !important; }
  .chat-head { background: var(--bg); padding: 10px 12px; }
  #chat-back { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); color: var(--ink); justify-content: center; align-items: center; }
  #chat-mic { align-items: center; justify-content: center; }
  .bubble { font-size: 15px; }
  .composer .icon-btn, .composer .send { width: 40px; height: 40px; }
  .composer textarea { font-size: 16px; padding: 10px 4px; }
  .peek { right: 12px; left: 12px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .media .img { height: 110px; }
}
/* small phones: the bar must fit next to the edges */
@media (max-width: 420px) {
  .bar { gap: 4px; padding: 6px; }
  .bar button { width: 44px; height: 44px; }
  .bar .leave { width: 44px; padding: 0; }
  .bar .leave span { display: none; }
  .bar .sep { margin: 0 2px; }
}
/* ---------- transcript: a tab of the chat panel ---------- */
.chat-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.chat-tabs button {
  height: 38px; padding: 0 10px; gap: 6px; margin-bottom: -1px; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--body); font-size: 13px; font-weight: 500;
}
.chat-tabs button:hover { background: none; color: var(--ink); }
.chat-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--speak); flex: none; }
.bar #chat-live { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border: 2px solid var(--card); box-sizing: content-box; }
.bar #chat-badge:not(.hidden) ~ #chat-live { display: none; } /* the unread count says more */
.tr-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tr-status { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--body); }
.tr-status b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.tr-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tr-acts > * { height: 30px; padding: 0 12px; gap: 6px; font-size: 13px; border-radius: 8px; }
.tr-acts a { display: inline-flex; align-items: center; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tr-acts a:hover { background: var(--soft); }
/* The speech model's download (desktop app): an offer, progress, pause, error, done.
   In the transcript tab and, while it downloads, on the home page. */
.dl { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; padding: 4px 0 2px; font-size: 12.5px; color: var(--body); text-align: left; }
.dl > .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--ink); }
.dl > .ic svg { width: 18px; height: 18px; }
.dl.ok > .ic { background: color-mix(in srgb, var(--speak) 16%, transparent); color: var(--speak); }
.dl.err > .ic { background: var(--danger-soft); color: var(--danger); }
.dl h4 { margin: 1px 0 2px; font-size: 14px; font-weight: 500; color: var(--ink); }
.dl p { margin: 0; line-height: 1.45; }
.dl p + p { margin-top: 4px; }
.dl-feat { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dl-feat li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.dl-feat svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--mute); }
.dl-bar { position: relative; height: 6px; border-radius: 9999px; background: var(--soft-2); overflow: hidden; margin: 10px 0 8px; }
.dl-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--ink); transition: width .4s ease-out; overflow: hidden; }
.dl-bar.live i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--card) 55%, transparent), transparent); animation: dl-sweep 1.6s linear infinite; }
.dl-bar.still i { background: var(--mute); }
@keyframes dl-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .dl-bar.live i::after { animation: none; } }
.dl-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.dl-meta b { font-weight: 500; color: var(--ink); }
.dl-meta b, .dl-meta .eta { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.dl-chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; min-height: 22px; padding: 2px 8px; border-radius: 11px; background: var(--soft); font-size: 11.5px; line-height: 1.35; }
.dl-chip svg { width: 12px; height: 12px; flex: none; }
.dl-note { margin-top: 6px !important; font-size: 12px; color: var(--mute); }
.dl .tr-acts { margin-top: 12px; }
.dl .tr-acts button.ghost { border-color: transparent; background: none; color: var(--body); }
.dl .tr-acts button.ghost:hover { color: var(--ink); background: var(--soft); }
.dl .tr-acts .dl-size { font-weight: 400; opacity: .6; }
.home-model { margin-top: 28px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(8px); }
#tr-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 12px; display: flex; flex-direction: column; }
#tr-list > :first-child { margin-top: auto; }
.tr-blk { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; margin-top: 14px; }
.tr-blk > .av { margin-top: 2px; }
.tr-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 2px; font-size: 13px; }
.tr-head .who { font-weight: 500; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-head .who.tinted { color: hsl(var(--h) var(--av-ink-s) var(--av-ink-l)); }
.tr-head time { font-size: 11px; color: var(--mute); flex: none; }
.tr-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
#tr-new {
  position: absolute; left: 50%; bottom: 10px; z-index: 3; transform: translateX(-50%); height: 30px; padding: 0 12px;
  border-radius: 9999px; font-size: 13px; box-shadow: var(--shadow-lg);
}
.tr-foot { display: flex; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.tr-foot button { flex: 1; height: 40px; gap: 8px; }
.chat.tab-tr #chat-list, .chat.tab-tr #chat-new, .chat.tab-tr #chat-typing, .chat.tab-tr #chat-drop, .chat.tab-tr .chat-form,
.chat:not(.tab-tr) .tr-pane, .chat:not(.tab-tr) .tr-foot { display: none !important; }
.chat.tab-min #chat-list, .chat.tab-min #chat-new, .chat.tab-min #chat-typing, .chat.tab-min #chat-drop, .chat.tab-min .chat-form,
.chat:not(.tab-min) .min-pane { display: none !important; }

/* ---------- minutes: the agent's live record of the call (minutes.go, cmd/meetji-agent/minutes.go) ---------- */
.tab-n.min { background: var(--focus); }
.min-pane { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.min-status { display: flex; align-items: center; gap: 8px; min-height: 41px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--body); }
.min-status .g { flex: 1; min-width: 0; line-height: 1.35; }
.min-status .g b { font-weight: 500; color: var(--ink); }
.min-status .live-dot.on { animation: min-pulse 1.6s infinite; }
@keyframes min-pulse { 50% { opacity: .3; } }
.min-status .icon-btn { width: 28px; height: 28px; border-radius: 7px; }
.min-status .min-orig { height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: none; color: var(--body); font-size: 11.5px; font-weight: 500; flex: none; }
.min-status .min-orig:hover { background: var(--soft); color: var(--ink); }
.min-status .icon-btn svg.i { width: 15px; height: 15px; }
#min-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 22px; }
.min-sec { display: flex; flex-direction: column; gap: 6px; }
.min-sum { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 13.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.min-sum small { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.min-sum.new { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--focus) 45%, transparent); }
.min-sec h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; font-size: 11.5px; font-weight: 600; color: var(--body); text-transform: uppercase; letter-spacing: .04em; }
.min-sec h4 svg.i { width: 14px; height: 14px; }
.min-sec h4 .c { font-weight: 500; color: var(--mute); }
.min-it { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; margin: 0 -10px; padding: 9px 12px 10px 10px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.min-it > svg.i { width: 15px; height: 15px; margin-top: 2px; color: var(--mute); }
.min-it.new { background: color-mix(in srgb, var(--focus) 9%, transparent); animation: min-in 2.4s ease-out; }
.min-it.new::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--focus); }
@keyframes min-in { from { box-shadow: 0 0 0 2px var(--focus); } }
.min-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--body); }
.min-meta > .min-ref:first-child { margin-left: -6px; }
.min-who { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 2px; border-radius: 11px; background: var(--soft); font-weight: 500; max-width: 100%; }
.min-who .av { width: 18px; height: 18px; font-size: 10px; }
.min-who.none { padding: 0 8px; border: 1px dashed var(--line-strong); background: none; color: var(--mute); font-weight: 400; }
.min-due { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid var(--line); }
.min-due svg.i { width: 12px; height: 12px; }
.min-ref { height: 22px; padding: 0 6px; gap: 4px; border: none; border-radius: 6px; background: none; color: var(--link); font: 500 11.5px "Geist Mono", ui-monospace, monospace; }
.min-ref:hover { background: var(--soft); color: var(--link); }
.min-chg { font-size: 11px; font-weight: 500; color: var(--focus); }
.min-topics .tp { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.min-topics .tp:first-of-type { border-top: 0; }
.min-topics .tp time { font: 11.5px "Geist Mono", ui-monospace, monospace; color: var(--mute); }
.min-topics .tp b { font-weight: 500; }
.min-topics .tp.now b::after { content: var(--now-word, "сейчас"); margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--speak) 14%, transparent); color: var(--speak); font-size: 11px; font-weight: 500; }
.min-tip { position: absolute; z-index: 4; left: 16px; right: 16px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--body); pointer-events: none; }
.min-tip q { display: block; margin: 3px 0 6px; color: var(--ink); quotes: "«" "»"; overflow-wrap: anywhere; }
.min-tip q:last-child { margin-bottom: 0; }
.min-tip small { color: var(--mute); }
.tr-back { flex: none; justify-content: flex-start; height: 34px; padding: 0 16px; gap: 6px; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--soft); color: var(--link); font-size: 12.5px; font-weight: 500; }
.tr-back svg.i { width: 14px; height: 14px; }
.tr-text .ph.hl { border-radius: 4px; background: color-mix(in srgb, var(--warn) 30%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 30%, transparent); transition: background 1s, box-shadow 1s; }

/* Room access (access.go): the host's badge and menu on tiles, who may enter, who waits at the door. */
:root[lang="en"] { --now-word: "now"; }
.hostb { display: none; flex: none; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 9999px; white-space: nowrap;
  color: color-mix(in srgb, var(--warn) 75%, var(--ink)); background: color-mix(in srgb, var(--warn) 15%, transparent); }
#people li.host .hostb { display: inline-block; }
.peer-more { position: absolute; top: 6px; right: 6px; z-index: 3; width: 30px; height: 30px; padding: 0; border: none; border-radius: 8px;
  background: transparent; color: var(--body); display: none; opacity: 0; transition: opacity .15s, background .15s; }
#people.am-host li.remote .peer-more { display: grid; place-items: center; }
#people.am-host li.remote:hover .peer-more, .peer-more:focus-visible, .peer-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .peer-more { opacity: 1; } }
.peer-more:hover, .peer-more[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.stage.has-screen .peer-more { top: 3px; right: 3px; width: 24px; height: 24px; }
.peer-menu { position: fixed; top: 0; left: 0; right: auto; width: 210px; z-index: 40; }
/* The lock in the call's header: the host's way to the door rules, a warning while anyone may walk in. */
.access-wrap { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.access-chip { border: none; cursor: pointer; }
.access-chip:hover { background: var(--soft-2); color: var(--ink); }
.access-chip.warn { color: color-mix(in srgb, var(--warn) 80%, var(--ink)); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.access-chip.ok { color: var(--speak); background: color-mix(in srgb, var(--speak) 14%, transparent); }
.access-fix { height: 28px; padding: 0 11px; border: none; border-radius: 9999px; font-size: 13px; font-weight: 600; background: var(--warn); color: #111; }
.access-fix:hover { background: color-mix(in srgb, var(--warn) 85%, #fff); }
.access-pop { position: fixed; z-index: 25; width: min(300px, calc(100vw - 32px)); padding: 6px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: fade-in .12s ease; }
.access-pop .pop-toggle:disabled { opacity: 1; cursor: default; }
.access-pop .pop-toggle:disabled:hover { background: none; }
.access-pop .acc-note { margin: 0; padding: 6px 10px 6px; font-size: 12px; color: var(--mute); }
@media (max-width: 520px) { .access-chip.warn span:not(:first-child) { display: none; } }
.pj-door { width: 100%; height: auto; min-height: 48px; padding: 6px 10px 6px 8px; justify-content: flex-start; gap: 10px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); white-space: normal; font-weight: 400; font-size: 14px; }
.pj-door:hover { background: var(--card); border-color: var(--line-strong); }
.pj-door .ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--soft); color: var(--body); }
.pj-door .ic svg.i { width: 15px; height: 15px; }
.pj-door .ic .on, .pj-door[aria-checked="true"] .ic .off { display: none; }
.pj-door[aria-checked="true"] .ic .on { display: grid; }
.pj-door[aria-checked="true"] .ic { color: var(--speak); background: color-mix(in srgb, var(--speak) 15%, transparent); }
.pj-door .lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pj-door small { font-size: 12px; color: var(--mute); }
.pj-door .sw, .access-pop .sw { position: relative; width: 32px; height: 18px; border-radius: 9999px; background: var(--line-strong); flex: none; transition: background .15s; }
.pj-door .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pj-door[aria-checked="true"] .sw { background: var(--speak); }
.pj-door[aria-checked="true"] .sw::after { transform: translateX(14px); }
#settings .pop-devs { display: flex; flex-direction: column; gap: 6px; padding: 4px; }
#settings .csel-menu { min-width: 100%; }
.pop-link { display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--ink); font-size: 14px; font-weight: 400; justify-content: flex-start; }
.pop-link:hover { background: var(--soft); }
.pop-link svg.i { width: 16px; height: 16px; color: var(--body); }
.pop-link small { margin-left: auto; font-size: 12px; color: var(--mute); }
.acc-h { display: block; font-size: 16px; font-weight: 600; margin: 0 32px 6px 0; letter-spacing: -.2px; }
.acc-note { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: var(--body); }
.kick-ban { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.kick-ban input { width: 16px; height: 16px; flex: none; margin: 0; padding: 0; accent-color: var(--ink); }
.kick-acts { display: flex; justify-content: flex-end; gap: 8px; }
.kick-acts .danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.kick-acts .danger:hover { background: var(--danger-hover); }
.lobby {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 15; transform: translateX(-50%); width: min(380px, calc(100vw - 32px));
  padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: hint-in .25s ease-out;
}
.lobby h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.lobby ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.lobby li { display: flex; align-items: center; gap: 10px; }
.lobby .av { width: 28px; height: 28px; font-size: 12px; flex: none; }
.lobby .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; }
.lobby li button { height: 28px; padding: 0 10px; font-size: 12.5px; }
.lobby .no { color: var(--danger); }
.lobby .all { margin-top: 10px; width: 100%; height: 32px; font-size: 13px; }
#home-alt { position: relative; height: 24px; }
#home-alt > span { position: absolute; inset: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; transition: opacity .18s, transform .18s; }
#home-alt .alt-warn, #home-alt.warn .alt-plain { opacity: 0; transform: translateY(3px); pointer-events: none; visibility: hidden; }
#home-alt.warn .alt-warn { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
#home-alt .alt-plain { gap: 0.3em; }
.alt-warn { font-size: 13px; }
.alt-warn svg.i { width: 14px; height: 14px; flex: none; }
.aw-easy, .aw-safe { display: inline-flex; align-items: center; gap: 5px; color: var(--mute); }
.aw-easy svg.i { color: var(--warn); }
.aw-safe { display: none; color: var(--speak); }
#home-alt.safe .aw-easy { display: none; }
#home-alt.safe .aw-safe { display: inline-flex; }
.aw-sep { color: var(--line-strong); }
.alt .room-pill { height: 24px; padding: 0 9px 0 7px; gap: 4px; border: none; border-radius: 9999px; background: var(--soft);
  color: var(--body); font-size: 12px; font-weight: 500; text-decoration: none; }
.alt .room-pill svg.i { width: 13px; height: 13px; }
.alt .room-pill:hover { background: var(--soft-2); color: var(--ink); }
.room-pill .lk-open, .room-pill .lk { display: inline-flex; }
.room-pill .lk, .room-pill[aria-pressed="true"] .lk-open { display: none; }
.room-pill[aria-pressed="true"] .lk { display: inline-flex; }
@media (max-width: 520px) { .aw-easy .t, .aw-safe .t { display: none; } }
.alt .room-pill[aria-pressed="true"] { background: color-mix(in srgb, var(--speak) 16%, transparent); color: var(--speak); }
.alt .aw-rand { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.alt .aw-rand .lnk { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.alt .aw-rand:hover .lnk { text-decoration-color: var(--ink); }

/* "what you missed": over the call for someone who comes in late or comes back */
.missed {
  position: fixed; left: 50%; top: calc(72px + env(safe-area-inset-top)); z-index: 14; transform: translateX(-50%); width: min(400px, calc(100vw - 32px));
  padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: hint-in .25s ease-out;
}
.missed .top { display: flex; align-items: center; gap: 8px; margin: -4px -6px 0 0; font-size: 12px; color: var(--mute); }
.missed .top svg.i { width: 14px; height: 14px; }
.missed .top .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.missed h3 { margin: 4px 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.missed p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--body); }
.missed ul { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.missed li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
.missed li svg.i { width: 15px; height: 15px; margin-top: 2px; color: var(--mute); }
.missed .acts { display: flex; gap: 8px; }
.missed .acts button { height: 34px; font-size: 13px; }
body.call-ended .missed { display: none; }

/* switch in the settings popover */
.pop-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--ink); font-size: 14px; font-weight: 400; text-align: left;
}
.pop-toggle:hover { background: var(--soft); }
.pop-toggle > svg.i { width: 16px; height: 16px; color: var(--body); flex: none; }
.pop-toggle .lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; white-space: normal; }
.pop-toggle small { font-size: 12px; color: var(--mute); }
.pop-toggle .sw { position: relative; width: 32px; height: 18px; border-radius: 9999px; background: var(--line-strong); flex: none; transition: background .15s; }
.pop-toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pop-toggle[aria-checked="true"] .sw { background: var(--speak); }
.pop-toggle[aria-checked="true"] .sw::after { transform: translateX(14px); }

/* after leaving a call that has a transcript or minutes: what the call was, who talked how much,
   the minutes in short, and one main button */
.ended { width: 100%; max-width: 420px; margin: auto; padding-bottom: 6vh; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.end-ok { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--soft); color: var(--body); }
.end-ok svg.i { width: 20px; height: 20px; }
.ended h1 { font-size: 28px; font-weight: 600; letter-spacing: -1px; line-height: 1.15; margin: 2px 0 0; }
.ended .meta { margin: -6px 0 4px; color: var(--body); font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.end-share { width: 100%; margin-bottom: 4px; }
.end-bar { display: flex; gap: 2px; height: 6px; border-radius: 9999px; overflow: hidden; background: var(--soft); }
.end-bar i { width: 0; background: var(--mute); transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.end-bar i.tinted, .end-leg i.tinted { background: hsl(var(--h) 75% 58%); }
.end-leg { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; margin-top: 8px; font-size: 12px; color: var(--body); }
.end-leg span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.end-leg i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--mute); }
.min-card { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; animation: pop .3s ease-out; }
.min-card .hd { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.min-card .hd > svg.i { width: 16px; height: 16px; color: var(--body); }
.min-card .hd small { margin-right: auto; font-size: 12px; font-weight: 400; color: var(--mute); }
.min-card .bd { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 14px; }
.min-card .bd p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.min-card h4 { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--body); text-transform: uppercase; letter-spacing: .04em; }
.min-card .l { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; padding: 3px 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.min-card .l svg.i { width: 15px; height: 15px; margin-top: 2px; color: var(--mute); }
.min-card .l small { font-size: 12px; color: var(--mute); white-space: nowrap; }
.min-card .more { width: 100%; height: auto; padding: 10px 16px; border: none; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--body); font-size: 13px; font-weight: 400; }
.min-card .more:hover { background: var(--soft); color: var(--ink); }
.min-card .more:active { transform: none; }
.end-file { margin: 0; width: 100%; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: 16px; font-size: 13.5px; color: var(--body); text-align: left; }
.end-acts { display: flex; gap: 8px; width: 100%; }
.end-acts button { flex: 1; height: 44px; padding: 0 12px; }
.end-links { display: flex; justify-content: center; gap: 8px; }
.end-links button { height: 32px; padding: 0 8px; border: none; background: none; color: var(--body); font-weight: 400; }
.end-links button:hover { background: none; color: var(--ink); }
body.call-ended #bar, body.call-ended #chat, body.call-ended #chat-peek, body.call-ended #mute-hint, body.call-ended #timer,
body.call-ended #count, body.call-ended .stage > :not(#ended) { display: none !important; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- translator: the agent translates the call (translate.go, translator.go in the bot) ----------
   The tiles shrink to a row of chips on top, the stage is given to live subtitles: the translation
   into my language large, the original small under it. Over a shared screen they are a band. */
.stage.tr-mode:not(.has-screen) { justify-content: flex-start; max-width: 960px; }
.stage.has-screen .ylg { display: none; }
.stage.tr-mode:not(.has-screen) #people[data-n] { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage.tr-mode:not(.has-screen) #people li {
  --av: 28px; aspect-ratio: auto; height: 40px; max-width: 260px; padding: 0 12px 0 6px; gap: 8px;
  flex-direction: row; justify-content: flex-start; border-radius: 9999px;
}
.stage.tr-mode:not(.has-screen) #people .avatar { box-shadow: none; font-size: 12px; }
.stage.tr-mode:not(.has-screen) .plate {
  position: static; min-width: 0; max-width: none; height: auto; padding: 0; gap: 5px;
  background: none; border: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.stage.tr-mode:not(.has-screen) .q { position: static; flex: none; height: auto; padding: 0; background: none; }
.stage.tr-mode:not(.has-screen) .q::after, .stage.tr-mode:not(.has-screen) .state, .stage.tr-mode:not(.has-screen) .edit,
.stage.tr-mode:not(.has-screen) .vol-btn, .stage.tr-mode:not(.has-screen) .vol, .stage.tr-mode:not(.has-screen) .ag-talk,
.stage.tr-mode:not(.has-screen) .ag-state, .stage.tr-mode:not(.has-screen) .ag-bot .av { display: none; }
.stage.tr-mode:not(.has-screen) #people li.agent-tile .ag-bot { --av: 28px; border-radius: 50%; }
.stage.tr-mode:not(.has-screen) #people li.agent-tile .plate { max-width: none; }
.stage.tr-mode:not(.has-screen) .ag-more { position: static; order: 1; flex: none; margin: 0 -6px 0 auto; width: 26px; height: 26px; }
.stage.tr-mode #people { position: relative; z-index: 4; } /* its menus open over the subtitles */
.stage.tr-mode:not(.has-screen) .ag-menu { top: 44px; right: 0; width: 250px; }
.stage.tr-mode .lg { display: inline-block; }
.lg {
  display: none; flex: none; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line);
  font: 500 10.5px/16px "Geist Mono", ui-monospace, Menlo, monospace; color: var(--body); background: color-mix(in srgb, var(--card) 70%, transparent);
}
.lg:empty { display: none !important; }
#people li.agent-tile .you.lag { color: color-mix(in srgb, var(--warn) 75%, var(--ink)); }

.subs { position: relative; flex: 1 1 0; min-height: 260px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 90px); mask-image: linear-gradient(transparent, #000 90px); }
.stage:not(.in-call) > #subs, .stage.has-screen > #subs, body.call-ended #subs { display: none; }
.subs-list { display: flex; flex-direction: column; gap: 2px; }
.srow { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 14px; padding: 10px 14px; border-radius: 14px; border: 1px solid transparent; transition: opacity .4s, background .3s; }
.srow.in { animation: msg-in .25s ease-out; }
.srow > .av { width: 36px; height: 36px; margin-top: 3px; font-size: 14px; }
.srow.cont > .av { visibility: hidden; height: 0; }
.srow.cont .sub-meta { display: none; }
.sub-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--mute); }
.sub-meta b { font-size: 13px; font-weight: 500; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-meta .lg { display: inline-block; }
.sub-meta .done { display: inline-flex; align-items: center; gap: 4px; }
.sub-meta .done svg.i { width: 12px; height: 12px; }
.sub-meta .dots { display: inline-flex; gap: 3px; }
.sub-meta .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: ag-dot 1.2s infinite; }
.sub-meta .dots i:nth-child(2) { animation-delay: .15s; } .sub-meta .dots i:nth-child(3) { animation-delay: .3s; }
.sub-t { margin: 0; font-size: 22px; line-height: 1.35; letter-spacing: -.2px; color: var(--ink); overflow-wrap: anywhere; text-wrap: pretty; }
.sub-o { margin: 2px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--mute); overflow-wrap: anywhere; }
.srow.old { opacity: .7; }
.srow.old .sub-t, .srow.mine .sub-t { font-size: 17px; color: var(--body); }
.srow.cur { background: var(--card); border-color: var(--line); box-shadow: var(--shadow-sm); }
.srow.pending .sub-t { font-size: 19px; color: var(--body); }
.srow .shim { display: block; height: 10px; width: 60%; margin-top: 8px; border-radius: 5px;
  background: linear-gradient(100deg, var(--soft) 30%, var(--soft-2) 50%, var(--soft) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s ease-in-out infinite; }
.subs-empty { margin: auto; max-width: 420px; padding: 24px; text-align: center; color: var(--body); font-size: 14px; line-height: 1.5; }
.subs-empty .ic { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 12px; background: var(--soft); color: var(--ink); }
.subs-empty b { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 500; }
.subs-empty a { color: var(--link); }
.subs-empty.warn { padding: 14px 16px; margin: 0 auto 12px; border-radius: 12px; text-align: left; font-size: 13px;
  background: color-mix(in srgb, var(--warn) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); }
.subs-empty.warn .ic { display: none; }

/* over a shared screen: a band at the bottom of the video, can go up or away */
.sub-band {
  position: absolute; left: 50%; bottom: 16px; z-index: 3; transform: translateX(-50%); width: min(78%, 720px);
  padding: 10px 16px 12px; border-radius: 12px; background: rgba(10,10,10,.78); color: #f4f4f5;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 4px;
}
.sub-band.up { bottom: auto; top: 56px; }
.sub-band .l { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.sub-band .w { flex: none; width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #a1a1aa; }
.sub-band .t { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.sub-band .l.prev .t { font-size: 14px; color: #a1a1aa; }
.sub-band .l.wait .t { color: #d4d4d8; }
.sb-ctl { position: absolute; right: 6px; top: -32px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.sub-band:hover .sb-ctl, .sb-ctl:focus-within { opacity: 1; }
.sub-band.up .sb-ctl { top: auto; bottom: -32px; }
.sb-ctl button, .sb-show { height: 26px; padding: 0 9px; border: none; border-radius: 7px; font-size: 12px; background: rgba(10,10,10,.7); color: #f4f4f5; }
.sb-ctl button:hover, .sb-show:hover { background: rgba(10,10,10,.9); }
.sb-show { position: absolute; right: 10px; bottom: 10px; z-index: 3; gap: 5px; }
.sb-show svg.i { width: 14px; height: 14px; }

/* the language button in the bar and its popover */
.bar button.lang-btn { width: auto; padding: 0 14px 0 12px; gap: 6px; font-size: 13px; }
.lang-btn .lc { font-size: 12px; color: var(--mute); }
.bar button.lang-btn[aria-expanded="true"] .lc { color: inherit; opacity: .7; }
.lang-pop { width: min(280px, calc(100vw - 32px)); }
.lang-q { display: flex; align-items: center; gap: 6px; margin: 2px 2px 4px; padding: 0 8px; height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--mute); }
.lang-q svg.i { width: 14px; height: 14px; }
.lang-q input { height: 30px; border: none; padding: 0; font-size: 13px; background: none; box-shadow: none !important; }
.lang-list { max-height: min(300px, 46dvh); overflow-y: auto; }
.lang-list .pop-sec { padding-top: 6px; }
.lang-list button, .lang-orig { width: 100%; height: 32px; padding: 0 10px; justify-content: flex-start; gap: 8px; border: none; border-radius: 7px; background: none; font-size: 13px; font-weight: 400; }
.lang-list button:hover, .lang-orig:hover { background: var(--soft); }
.lang-list button.sel { background: var(--soft); font-weight: 500; }
.lang-list button .k { margin-left: auto; font-size: 11px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-list button.sel .k::after { content: " ✓"; color: var(--ink); }
.lang-orig { justify-content: space-between; }
.sw { position: relative; width: 28px; height: 16px; flex: none; border-radius: 9px; background: var(--soft-2); transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.sw.on { background: var(--primary); }
.sw.on::after { transform: translateX(12px); background: var(--primary-ink); }
.lang-note { padding: 4px 10px 6px; font-size: 11.5px; line-height: 1.4; color: var(--mute); }

/* the transcript tab becomes "Перевод": each phrase on its own line, the original under it */
.chat.tr-mode .tr-text .ph { display: block; }
.chat.tr-mode .tr-text .ph + .ph { margin-top: 4px; }
.tr-text .ph .o { display: block; font-size: 12.5px; color: var(--mute); }
.tr-text .ph.wait .m { color: var(--mute); }

/* a chat message in another language: shown translated, the original a click away */
.bubble .trl { display: flex; gap: 8px; margin-top: 6px; padding-top: 5px; border-top: 1px dashed color-mix(in srgb, currentColor 25%, transparent); font-size: 11.5px; opacity: .7; }
.bubble .trl button { height: auto; padding: 0; border: none; background: none; color: inherit; font-size: inherit; font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.bubble .orig { display: block; margin-top: 4px; font-size: 12.5px; opacity: .7; white-space: pre-wrap; }

.ag-menu .ag-sec { padding: 6px 10px 2px; font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.ag-menu button .rd { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.ag-menu button[aria-checked="true"] .rd { border: 4px solid var(--ink); }
.ag-menu button .sw { margin-left: auto; }
.ag-menu button .k { margin-left: auto; font: 11px "Geist Mono", ui-monospace, Menlo, monospace; color: var(--mute); }
.ag-menu .ag-div { height: 1px; margin: 4px 0; background: var(--line); }

@media (max-width: 520px) {
  .stage.tr-mode:not(.has-screen) #people li { padding-right: 10px; }
  .stage.tr-mode:not(.has-screen) #people li .plate .name { max-width: 90px; }
  .srow { grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; padding: 8px 10px; }
  .srow > .av { width: 26px; height: 26px; font-size: 11px; }
  .sub-t { font-size: 18px; } .srow.old .sub-t, .srow.mine .sub-t { font-size: 15px; } .srow.pending .sub-t { font-size: 16px; }
  .bar button.lang-btn .ln { display: none; }
  .bar:has(#lang-btn:not(.hidden)) #bar-copy { display: none; } /* room for the language: the link is in the chat too */
  .sub-band { width: calc(100% - 20px); bottom: 10px; padding: 8px 12px; }
  .sub-band .t { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .srow.in, .srow .shim, .sub-meta .dots i { animation: none; } }
