/* Cryptosystems Meet own chrome — 002 inset-tray, on the UI foundation.
   Plus Jakarta / Fragment Mono. No Satoshi. No 10px elevated Join.
   Colours, shadows, motion: tokens.css (Day / Night / Matrix via [data-theme]).
   Button states (hover / pressed / focus / disabled): buttons.css.
   This file is layout + component geometry. Component aliases below
   keep the 002 names and point at tokens; a theme never changes layout. */

:root {
  --page: var(--color-bg);
  --fg: var(--color-fg);
  --muted: var(--color-fg-muted);
  --hair: var(--color-border);
  --card: var(--color-surface);
  --tile: var(--color-tile);
  --tile-on: var(--color-tile-on);
  --join-bg: var(--btn-primary-bg);
  --join-fg: var(--btn-primary-fg);
  --dock: var(--color-dock);
  --r: var(--radius-card);
  --r-tile: 999px;
  --r-field: var(--radius-field);
  --r-join: 999px;
  --font: var(--font-sans);
  --mono: var(--font-mono);
  --shadow-tray: var(--shadow-card);
}
* { box-sizing: border-box; }
html { color-scheme: var(--scheme, light); }
html.dark, html.matrix { color-scheme: dark; }
html[data-theme="day"] { color-scheme: light; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
button, input { font: inherit; color: inherit; }
svg { flex: none; }
.icon-sheet { position: absolute; width: 0; height: 0; overflow: hidden; }
.view { display: none; min-height: 100%; }
.view.on { display: flex; flex-direction: column; }
.mark {
  width: 28px; height: 28px; border-radius: 50%;
  background: #0c0c0c; display: grid; place-items: center; flex: none;
  box-shadow: 0 0 0 1px var(--hair);
  overflow: hidden;
}
.mark img, .mark svg { width: 28px; height: 28px; display: block; object-fit: cover; }
.word { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.themes {
  display: flex; gap: 0; padding: 2px; border-radius: 999px;
  background: var(--card); box-shadow: 0 0 0 1px var(--hair);
}
.themes button {
  appearance: none; border: 0;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 999px; font-size: 11px; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase;
}
.themes button svg { width: 14px; height: 14px; }
/* Narrow screens: the call topbar also carries clock + room, so the
   three-way switch drops to icons (the labels stay as accessible names)
   and the meta line truncates instead of widening the page. */
.themes { flex: none; }
.brand { min-width: 0; }
.meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  #call .themes button { padding: 0 9px; gap: 0; }
  #call .themes button span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
@media (max-width: 380px) {
  .themes button { padding: 0 9px; gap: 0; }
  .themes button span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
.tile {
  width: var(--size-control); height: var(--size-control); border: 0; border-radius: var(--r-tile);
  --btn-bg: var(--tile);
  display: grid; place-items: center; padding: 0;
}
.tile[hidden] { display: none !important; }
.tile svg { width: 18px; height: 18px; }
.tray-row {
  display: grid;
  grid-template-columns: repeat(3, 40px) minmax(16px, 1fr) repeat(2, 40px);
  align-items: center; column-gap: 8px;
}
.name {
  width: 100%; height: 40px; border-radius: var(--r-field);
  border: 1px solid var(--hair); background: transparent; padding: 0 14px;
  outline: none;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
.name:focus { box-shadow: inset 0 0 0 1px var(--fg); }
.name { transition: box-shadow var(--motion-base) var(--ease-standard), border-color var(--motion-base) var(--ease-standard); }
.name::placeholder { color: var(--color-fg-faint); }
.join {
  height: var(--size-control); width: 100%; border: 0; border-radius: var(--r-join);
  font-size: 14px; font-weight: 500;
  box-shadow: none;
}
.wait-copy {
  margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: center;
}
.hostish {
  display: block; margin: 8px auto 0; text-align: center;
  font-size: 12px; border: 0; border-radius: var(--radius-pill);
  padding: 6px 12px;
  text-decoration: underline; text-underline-offset: 3px;
  width: auto;
}
.hostish[aria-pressed="true"] { --btn-fg: var(--fg); }
#host-form {
  margin-top: 10px; width: 100%;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
#host-form[hidden] { display: none !important; }
#host-form .join { height: 36px; }
.jitsi-hold {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0; pointer-events: none;
}
.jitsi-hold.is-held { opacity: 0; pointer-events: none; z-index: 0; }
.jitsi-hold.is-auth {
  opacity: 1; pointer-events: auto; z-index: 6;
  background: rgba(8, 6, 12, .45);
  display: grid; place-items: center;
}
.jitsi-hold.is-auth .jitsi-root {
  position: relative; width: min(480px, calc(100% - 32px));
  height: min(560px, calc(100% - 96px));
  border-radius: var(--r); overflow: hidden; background: #fff;
  box-shadow: var(--shadow-tray);
}
html.dark .jitsi-hold.is-auth .jitsi-root { background: var(--color-surface); }
.jitsi-hold.is-live {
  opacity: 1; pointer-events: auto; z-index: 1;
  inset: 68px var(--stage-right) 88px 16px; border-radius: var(--r); overflow: hidden;
  background: var(--page);
}
.jitsi-hold .jitsi-root, .jitsi-hold iframe {
  width: 100%; height: 100%; border: 0; background: var(--page);
}
.auth-back {
  position: absolute; top: 18px; left: 18px; z-index: 7;
  border: 0; --btn-bg: var(--card);
  border-radius: var(--r-join); padding: 8px 14px; font-size: 12px;
  box-shadow: var(--shadow-tray);
}
.iframe-hole {
  position: relative; overflow: hidden; background: var(--color-preview-bg);
  border-radius: var(--r);
  display: grid; place-items: center;
  /* Lounge preview is not a control. Keep it off the hit list so a
     compositor layer cannot steal taps from Host Desk fields. */
  pointer-events: none;
}
.iframe-hole video,
.iframe-hole iframe,
.iframe-hole .jitsi-root {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; object-fit: cover; background: var(--color-preview-bg);
}
.iframe-tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255,255,255,.45);
  padding: 3px 7px; border: 1px dashed rgba(255,255,255,.22); border-radius: 2px;
  pointer-events: none;
}
.avatar {
  width: 88px; height: 88px; border-radius: 50%; background: var(--color-avatar-bg);
  color: var(--color-avatar-fg); display: grid; place-items: center; font-weight: 600; font-size: 28px;
  z-index: 1;
}
.avatar[hidden] { display: none; }
.dock {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px;
  border-radius: 999px;
  background: var(--dock);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: 0 0 0 1px var(--hair);
}
.dock .tile { --btn-bg: var(--color-dock-tile); }
.hang {
  width: 52px; height: var(--size-control); border: 0; border-radius: var(--r-join);
  display: grid; place-items: center; padding: 0;
}
.hang svg { width: 18px; height: 18px; }
.closed-main {
  flex: 1; display: grid; place-items: center; text-align: center; padding: 32px;
}
.closed-main h1 { font-size: 22px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.02em; }
.closed-main p { margin: 0; color: var(--muted); font-size: 14px; max-width: 36ch; }
.banner {
  font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.rel { position: relative; width: 40px; height: 40px; display: block; }
.settings-modal {
  border: 0; padding: 0; background: transparent; color: var(--fg);
  max-width: calc(100% - 32px);
}
.settings-modal::backdrop { background: var(--color-scrim); }
.settings-form {
  width: min(400px, 100%);
  background: var(--card);
  color: var(--fg);
  border-radius: var(--r);
  box-shadow: var(--shadow-tray);
  padding: 20px 20px 16px;
}
.settings-form h2 {
  margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.settings-lede { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.settings-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--muted); margin-bottom: 12px;
}
.settings-form [hidden] { display: none !important; }
.settings-picker-label { display: flex; flex-direction: column; gap: 6px; }
.settings-picker { position: relative; }
.settings-picker-btn,
.cs-picker-btn {
  width: 100%; height: var(--size-control); border-radius: var(--r-field);
  border: 1px solid var(--hair);
  padding: 0 32px 0 12px; text-align: left;
  font: inherit; font-size: 14px;
  background-image: var(--icon-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.settings-picker-btn[aria-expanded="true"],
.cs-picker-btn[aria-expanded="true"] { border-color: var(--color-border-strong); }
.settings-picker-list,
.cs-picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 8;
  margin: 0; padding: 4px;
  list-style: none;
  max-height: 220px; overflow: auto;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--hair); border-radius: var(--r-field);
  box-shadow: var(--shadow-tray);
}
.settings-picker-list, .cs-picker-list { background: var(--color-surface-raised); }
.settings-picker-option,
.cs-picker-option {
  display: block; width: 100%;
  margin: 0; padding: 10px 12px;
  border: 0; border-radius: calc(var(--r-field) - 2px);
  color: var(--fg);
  font: inherit; font-size: 14px; text-align: left;
}
.settings-cams-label {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}
.settings-cams {
  display: flex;
  flex-direction: column;
  margin: 0 0 12px;
  border: 1px solid var(--hair);
  border-radius: var(--r-field);
  overflow: hidden;
}
.settings-cams .cam-empty {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.settings-form .cam-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px solid var(--hair);
}
.settings-form .cam-row:last-child { border-bottom: 0; }
.settings-form .cam-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--fg);
  flex: none;
}
.settings-form .e2ee-row,
.settings-form .settings-switch {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  color: var(--fg);
  font-size: 13px;
  margin-bottom: 10px;
}
.settings-form .e2ee-row input,
.settings-form .settings-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--fg);
  flex: none;
}
.settings-form .settings-switch.is-disabled { opacity: .45; }
.settings-form .e2ee-row[hidden] { display: none !important; }
/* Host E2EE confirm: inline in Settings (a second modal cannot stack on the dialog). */
.settings-form .e2ee-confirm {
  margin: -4px 0 12px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken);
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--color-fg);
}
.settings-form .e2ee-confirm[hidden] { display: none !important; }
.settings-form .e2ee-confirm-title { margin: 0 0 var(--space-1); font-weight: var(--weight-semibold); }
.settings-form .e2ee-confirm-copy { margin: 0 0 var(--space-2); color: var(--color-fg-muted); }
.settings-form .e2ee-confirm-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
/* E2EE help (host / old browser) and the encrypted line. */
.settings-form .e2ee-help,
.settings-form .e2ee-status {
  margin: -6px 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.settings-lock-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.settings-lock-hint[hidden] { display: none !important; }
.settings-info {
  margin: 8px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
}
.settings-info h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.settings-invite-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}
.settings-invite-label button {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-field);
  border: 1px solid var(--hair);
  font-size: 12px;
}
.settings-info #set-invite {
  display: block;
  width: 100%;
  min-height: 44px;
  height: auto;
  margin: 0 0 12px;
  border-radius: var(--r-field);
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--fg);
  padding: 10px 12px;
  outline: none;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  resize: none;
  word-break: break-all;
}
.settings-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  font-size: 13px;
  color: var(--fg);
}
.settings-count strong { font-weight: 600; font-family: var(--mono); }
/* Audio A/B summary (docs/audio-ab.md): long, wraps instead of widening Settings. */
#set-ab-row, #set-e2ee-info-row { gap: 12px; align-items: flex-start; }
#set-ab, #set-e2ee-info { font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.settings-form menu { margin: 8px 0 0; padding: 0; }
.stage-cover {
  position: fixed; inset: 68px var(--stage-right) 88px 16px; z-index: 2;
  display: grid; place-items: center;
  background: var(--page);
  border-radius: var(--r);
  pointer-events: none;
}
.stage-cover[hidden] { display: none !important; }
/* <video> is a replaced element: with width/height auto, inset on all four
   sides does NOT stretch it (CSS 2.1 §10.3.8 / §10.6.5). It keeps the
   stream's intrinsic size at the top-left corner, e.g. ~224x126 when
   Jitsi still sends the filmstrip layer, and the Jitsi stage behind shows
   through. So the box gets explicit sizes from the same edges (the
   containing block of a fixed box is the viewport), and object-fit
   letterboxes the stream inside it. */
.stage-focus {
  position: fixed; inset: 68px var(--stage-right) 88px 16px; z-index: 2;
  box-sizing: border-box;
  width: calc(100% - 16px - var(--stage-right));
  height: calc(100% - 68px - 88px);
  max-width: none; max-height: none;
  object-position: center;
  background: var(--page);
  object-fit: contain;
  border-radius: var(--r);
  pointer-events: none;
  filter: none;
}
.stage-focus[hidden] { display: none !important; }
.stage-hit {
  position: fixed; inset: 68px var(--stage-right) 88px 16px; z-index: 2;
  background: transparent; cursor: pointer;
}
.stage-hit[hidden] { display: none !important; }
.stage-chip {
  position: fixed; left: 28px; bottom: 104px; z-index: 3;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: var(--color-preview-chip);
  color: #fff;
  font-size: 12px; font-weight: 500;
  display: grid; place-items: center;
  pointer-events: none;
  max-width: min(240px, calc(100% - 48px - var(--stage-right)));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-chip[hidden] { display: none !important; }
/* ---------- Docked side panel (chat, people) ----------
   One transition owner: the registered --side-open number on <body>
   (0 closed, 1 open). Every stage layer derives its right edge from
   --stage-right and each panel derives its slide from --side-open, so
   all of them move on the same frame with one curve. No layer has a
   transition of its own and no JS writes geometry. Without @property
   support --side-open simply flips 0 -> 1 (one step, still in sync).
   Phones: the panel is a full-height sheet over the call; the stage
   does not resize. Reduced motion: the motion tokens are ~0ms. */
@property --side-open {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
body {
  --side-open: 0;
  --side-w: 360px;
  --side-gap: 12px;
  --stage-right: calc(16px + var(--side-open) * (var(--side-w) + var(--side-gap)));
  transition: --side-open var(--motion-slow) var(--ease-standard);
}
body.chat-open, body.people-open { --side-open: 1; }
.side-panel {
  position: fixed; top: 68px; right: 16px; bottom: 88px; z-index: 3;
  width: var(--side-w);
  box-sizing: border-box;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--color-surface); color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--r);
  box-shadow: var(--shadow-tray);
  transform: translateX(calc((1 - var(--side-open)) * (100% + 24px)));
}
.side-panel[hidden] { display: none !important; }
@media (max-width: 720px) {
  body { --stage-right: 16px; }
  .side-panel {
    inset: 0; width: auto; z-index: 9;
    border: 0; border-radius: 0;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
    transform: translateY(calc((1 - var(--side-open)) * 100%));
  }
}

/* ---------- Chat ---------- */
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 10px 8px 10px 16px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}
.chat-title { margin: 0; font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; }
.chat-head-actions { display: flex; align-items: center; gap: 2px; }
.chat-head-btn, .chat-x {
  width: 36px; height: 36px; border: 0; padding: 0;
  border-radius: var(--r-tile);
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
}
.chat-head-btn svg { width: var(--size-icon); height: var(--size-icon); }
.chat-export { position: relative; }
.chat-export-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 6;
  min-width: 200px; padding: 6px;
  display: grid; gap: 2px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-tray);
}
.chat-export-menu[hidden] { display: none !important; }
.chat-export-menu button {
  --btn-fg: var(--color-fg);
  height: 36px; border: 0; padding: 0 12px;
  border-radius: 8px; text-align: left;
  font: 500 13px/1 var(--font);
}
.chat-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px 16px;
  scrollbar-width: thin;
}
.chat-empty {
  margin: 8px 0 0; padding: 12px 14px;
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken);
  color: var(--color-muted);
  font-size: var(--text-sm); line-height: 1.5;
}
.chat-empty[hidden] { display: none; }
.chat-log { margin: 0; padding: 0; list-style: none; }
.chat-group { margin-top: 16px; }
.chat-group:first-child { margin-top: 8px; }
.chat-meta {
  display: flex; align-items: baseline; gap: var(--space-2);
  margin-bottom: 2px; min-width: 0;
}
.chat-nick {
  font-size: 13px; font-weight: 600; color: var(--color-fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-time {
  flex: none;
  font-size: var(--text-xs); color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}
.chat-msg + .chat-msg { margin-top: 3px; }
.chat-text {
  margin: 0;
  font-size: var(--text-md); line-height: 1.45;
  color: var(--color-fg);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-link {
  color: var(--color-accent);
  text-decoration: underline; text-underline-offset: 2px;
  border-radius: 3px;
}
.chat-link:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring); outline-offset: 1px; }
.chat-img {
  display: block; max-width: 100%; max-height: 200px; margin: 4px 0 2px;
  border-radius: var(--radius-field); object-fit: contain;
  background: var(--color-surface-sunken);
  cursor: zoom-in;
}
.chat-img:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring); outline-offset: 2px; }
.chat-pill {
  position: absolute; left: 0; right: 0; bottom: 76px; z-index: 4;
  width: max-content; margin: 0 auto;
  height: 32px; padding: 0 14px; border: 0;
  border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 var(--text-sm)/1 var(--font);
  box-shadow: var(--shadow-tray);
}
.chat-pill[hidden] { display: none !important; }
.chat-pill svg { width: 14px; height: 14px; }
.chat-compose {
  position: relative; flex: none;
  display: flex; align-items: flex-end; gap: var(--space-2);
  padding: 10px 12px 12px;
  border-top: 1px solid var(--color-border);
}
.chat-compose textarea {
  flex: 1; min-width: 0;
  height: var(--size-control); min-height: var(--size-control); max-height: 120px;
  box-sizing: border-box; resize: none;
  padding: 10px 12px;
  border-radius: var(--radius-field);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-sunken); color: var(--color-fg);
  font: 400 var(--text-md)/1.4 var(--font);
  outline: none;
}
.chat-compose textarea::placeholder { color: var(--color-muted); }
.chat-compose [type="submit"], .chat-emoji, .chat-clip {
  flex: none;
  width: var(--size-control); height: var(--size-control); padding: 0;
  border-radius: var(--r-tile);
  display: grid; place-items: center;
}
.chat-compose [type="submit"] { border: 0; }
.chat-emoji, .chat-clip { border: 1px solid var(--color-border-strong); --btn-bg: transparent; }
.chat-clip svg { width: var(--size-icon); height: var(--size-icon); }
.chat-clip[hidden] { display: none !important; }
.chat-compose [type="submit"]:disabled { opacity: 0.45; cursor: not-allowed; }
/* Attachment tray above the composer. */
.chat-attach {
  flex: none; list-style: none; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 12px 0; max-height: 40vh; overflow: auto;
  border-top: 1px solid var(--color-border);
}
.chat-attach[hidden] { display: none !important; }
.chat-attach-item, .chat-file {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px 8px; border-radius: var(--radius-field);
  background: var(--color-surface-sunken); color: var(--color-fg);
  border: 1px solid var(--color-border);
}
.chat-attach-item[data-state="error"] { border-color: var(--color-danger); }
.chat-attach-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 6px; background: var(--color-surface); }
.chat-attach-icon, .chat-file-icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--color-accent-soft); color: var(--color-fg);
  font: 600 11px/1 var(--font); letter-spacing: 0.04em;
}
.chat-attach-meta, .chat-file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-attach-name, .chat-file-name { font: 600 var(--text-sm)/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach-size, .chat-file-size { font: 400 12px/1.3 var(--font); color: var(--color-fg-muted); font-variant-numeric: tabular-nums; }
.chat-attach-bar, .chat-file-bar { display: block; height: 4px; border-radius: 2px; background: var(--color-meter-track); overflow: hidden; }
.chat-attach-bar[hidden] { display: none; }
.chat-attach-bar > span { display: block; height: 100%; background: var(--color-meter-fill); transition: width var(--motion-fast, 120ms) linear; }
progress.chat-file-bar { -webkit-appearance: none; appearance: none; width: 100%; border: 0; color: var(--color-meter-fill); }
progress.chat-file-bar::-webkit-progress-bar { background: var(--color-meter-track); }
progress.chat-file-bar::-webkit-progress-value { background: var(--color-meter-fill); }
progress.chat-file-bar::-moz-progress-bar { background: var(--color-meter-fill); }
.chat-attach-x {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: var(--r-tile);
  --btn-bg: transparent; color: var(--color-fg); font-size: 20px; line-height: 1;
}
.chat-attach-x:focus-visible, .chat-file-dl:focus-visible, .chat-file-cancel:focus-visible, .chat-clip:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring); outline-offset: 2px; }
.chat-file { margin: 4px 0 2px; flex-wrap: wrap; }
.chat-file .chat-img { flex: 1 1 100%; margin: 0; }
.chat-file-dl, .chat-file-cancel { flex: none; height: 32px; padding: 0 12px; border-radius: var(--r-tile); font: 600 12px/1 var(--font); }
.chat-file[data-state="failed"] .chat-file-size, .chat-file[data-state="cancelled"] .chat-file-size { color: var(--color-danger-text); }
.chat-drop {
  position: absolute; inset: 8px; z-index: 6;
  display: grid; place-items: center;
  border: 2px dashed var(--color-accent); border-radius: var(--r);
  background: var(--color-surface-glass); color: var(--color-fg);
  font: 600 var(--text-md)/1 var(--font);
  pointer-events: none;
}
.chat-drop[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .chat-attach-bar > span { transition: none; }
}
.chat-compose [type="submit"] svg, .chat-emoji svg { width: var(--size-icon); height: var(--size-icon); }
.chat-emoji-wrap { position: relative; flex: none; }
.chat-emoji-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 5;
  width: 312px; max-width: calc(100vw - 24px);
  box-sizing: border-box; padding: 8px;
  display: grid; gap: 6px;
  background: var(--color-surface-raised); color: var(--color-fg);
  border: 1px solid var(--color-border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-tray);
}
.chat-emoji-pop[hidden] { display: none !important; }
.chat-emoji-search {
  height: 34px; box-sizing: border-box; width: 100%;
  padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-sunken); color: var(--color-fg);
  font: 400 13px/1 var(--font); outline: none;
}
.chat-emoji-search::placeholder { color: var(--color-muted); }
.chat-emoji-tabs { display: flex; gap: 2px; }
.chat-emoji-pop .chat-emoji-tab {
  flex: 1; height: 30px; padding: 0; border: 0;
  border-radius: 8px; font-size: 16px; line-height: 1;
}
.chat-emoji-grid {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px;
  max-height: 212px; overflow-y: auto; overscroll-behavior: contain;
}
.chat-emoji-pop .chat-emoji-cell {
  height: 34px; padding: 0; border: 0;
  border-radius: 8px; font-size: 20px; line-height: 1;
}
.chat-emoji-none { grid-column: 1 / -1; margin: 0; padding: 16px 8px; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
.tile[data-chat] { position: relative; }
.chat-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: var(--radius-pill);
  background: var(--color-accent); color: var(--color-accent-fg);
  box-shadow: 0 0 0 2px var(--color-surface);
  font: 600 11px/18px var(--font); text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.chat-badge[hidden] { display: none; }
/* Unread chat while the panel is not in view: soft accent glow around the
   dock icon (stays while unread) plus one small bounce per new message.
   Reduced motion: the global rule below removes the bounce. */
.tile[data-chat]::before {
  content: ""; position: absolute; inset: -3px;
  border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--color-accent), 0 0 14px 3px var(--color-accent-glow);
  opacity: 0;
  transition: opacity var(--motion-base) var(--ease-standard);
}
.tile[data-chat].has-unread::before { opacity: 1; }
.tile[data-chat].chat-ping { animation: chat-ping 520ms var(--ease-standard) 1; }
@keyframes chat-ping {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
  55% { transform: translateY(0); }
  75% { transform: translateY(-1.5px); }
}
@media (prefers-reduced-motion: reduce) {
  .tile[data-chat].chat-ping { animation: none; }
}
@media (max-width: 720px) {
  .chat-head { padding-top: 12px; padding-bottom: 12px; }
  .chat-compose { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .chat-compose textarea { font-size: 16px; } /* no iOS zoom on focus */
  .chat-emoji-pop { width: calc(100vw - 24px); }
}

/* ---------- People ---------- */
.img-lightbox {
  position: fixed; inset: 0; z-index: 12;
  display: flex; flex-direction: column;
  background: var(--color-scrim);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.img-lightbox[hidden] { display: none !important; }
.img-lightbox-bar {
  flex: none; display: flex; align-items: center; gap: var(--space-2);
  padding: 10px 12px;
  background: var(--color-surface-glass); color: var(--color-fg);
  border-bottom: 1px solid var(--color-border);
}
.img-lightbox-name { flex: 1; min-width: 0; font: 600 var(--text-sm)/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-lightbox-dims { flex: none; font: 400 var(--text-sm)/1 var(--font); color: var(--color-fg-muted); }
.img-lightbox-fit, .img-lightbox-dl { flex: none; height: 36px; padding: 0 14px; border-radius: var(--r-tile); font: 600 var(--text-sm)/1 var(--font); }
.img-lightbox-view {
  flex: 1; min-height: 0; overflow: auto;
  display: grid; place-items: safe center;
  padding: 16px;
}
/* Native resolution by default: one image pixel per CSS pixel, scroll if larger. */
.img-lightbox-view img {
  display: block; max-width: none; max-height: none;
  width: auto; height: auto;
  image-rendering: auto;
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-tray);
  background: var(--color-surface-sunken);
}
.img-lightbox.is-fit .img-lightbox-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-lightbox-x {
  flex: none;
  width: 36px; height: 36px; border: 0;
  border-radius: var(--r-tile);
  --btn-bg: var(--card);
  font-size: 22px;
}
@media (max-width: 640px) {
  .img-lightbox-dims { display: none; }
  .img-lightbox-fit { padding: 0 10px; }
}
.cs-confirm {
  position: fixed; inset: 0; z-index: 14;
  display: flex; align-items: center; justify-content: center;
}
.cs-confirm[hidden] { display: none !important; }
.cs-confirm-backdrop {
  position: absolute; inset: 0;
  background: var(--color-scrim);
}
.cs-confirm-dialog {
  position: relative;
  width: calc(100vw - 40px); max-width: 380px;
  padding: 24px 22px 20px;
  display: grid; gap: 14px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  box-shadow: var(--shadow-tray);
}
.cs-confirm-title {
  margin: 0;
  font-size: 20px; font-weight: 500; letter-spacing: -0.01em;
}
.cs-confirm-copy {
  margin: 0;
  font-size: 15px; line-height: 1.45; color: var(--muted);
}
.cs-confirm-row { display: grid; gap: 8px; }
.cs-confirm-go,
.cs-confirm-cancel {
  appearance: none;
  min-height: 44px;
  font: 500 15px/1 var(--font);
  border-radius: var(--r-join);
}
.cs-confirm-go {
  border: 0;
}
.cs-confirm-cancel {
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  .cs-confirm-dialog { animation: none; }
}
.people-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 10px 16px; font-size: var(--text-lg); font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}
.people-x {
  width: 36px; height: 36px; border: 0; padding: 0;
  font-size: 20px; line-height: 1; border-radius: var(--r-tile);
}
.people-list {
  flex: 1; margin: 0; padding: 8px 0; list-style: none; overflow: auto;
}
.people-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 14px;
}
.people-list .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-avatar-bg); color: var(--color-avatar-fg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: none;
}
.people-list .you { color: var(--muted); font-size: 11px; }
/* ---------- Lobby (pre-join) ----------
   Desktop: preview | panel. Phone: preview over panel.
   The preview never hides while waiting for the host. */
.lounge-stage {
  flex: 1; display: grid; place-items: center;
  padding: 4px 28px 28px;
}
.stage-frame {
  width: min(1120px, 100%);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: stretch;
}
.lobby-preview {
  position: relative;
  min-width: 0;
  min-height: clamp(460px, calc(100vh - 140px), 660px);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--color-preview-bg);
  box-shadow: var(--shadow-raised);
}
.stage-frame .iframe-hole { position: absolute; inset: 0; border-radius: inherit; }
#lounge-video { transform: scaleX(-1); }
.lounge-still {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1); z-index: 1;
}
.lounge-still[hidden] { display: none; }
.preview-chip {
  position: absolute; top: var(--space-4); left: var(--space-4); z-index: 2;
  margin: 0; max-width: calc(100% - 32px);
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 30px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-preview-chip);
  color: var(--color-preview-fg);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-chip[hidden] { display: none; }
.preview-chip.is-waiting::before,
.preview-chip.is-error::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--color-success);
}
.preview-chip.is-error::before { background: var(--color-danger); }
.preview-chip.is-waiting::before { animation: cs-breathe 2.4s var(--ease-standard) infinite; }
@keyframes cs-breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}
@media (prefers-reduced-motion: reduce) {
  .preview-chip.is-waiting::before { animation: none; }
}
/* Tray: the 002 row (mic, camera, settings | gap | flip, speaker) as a
   glass strip on the preview. Centered without transform (mobile input
   trap, see .inset). */
.preview-dock {
  position: absolute; left: 0; right: 0; bottom: var(--space-4); z-index: 3;
  margin-inline: auto;
  width: min(312px, calc(100% - 32px));
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-dock);
  -webkit-backdrop-filter: saturate(1.2) blur(18px);
  backdrop-filter: saturate(1.2) blur(18px);
  box-shadow: 0 0 0 1px var(--hair), var(--shadow-raised);
  pointer-events: auto;
}
.preview-dock .tile { --btn-bg: var(--color-dock-tile); }

/* Panel. Kept the .inset name: 002 guards and the mobile keyboard trap
   notes refer to it. Never transform this ancestor. */
.inset {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0;
  border-radius: var(--r);
  box-shadow: var(--shadow-tray);
  padding: var(--space-6) var(--space-5) var(--space-5);
  z-index: 3;
  isolation: isolate;
  pointer-events: auto;
}
.inset, html.dark .inset { background: var(--card); }
.inset::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}
.inset > * {
  position: relative;
  z-index: 1;
}
.lobby-head { margin: 0 0 var(--space-5); }
.lobby-title {
  margin: 0; font-size: var(--text-xl); font-weight: var(--weight-semibold);
  letter-spacing: -0.02em; line-height: 1.2;
}
.lobby-room {
  margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lobby-room-label {
  font-family: var(--mono); font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--color-fg-faint);
}
.field-label {
  display: block; margin: 0 0 6px;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted);
}
.inset .name { margin: 0; }
.lobby-devices { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }
.field { min-width: 0; }
.field-row { display: flex; gap: var(--space-2); align-items: center; }
.field-row .cs-picker { flex: 1; min-width: 0; }
.field-row .cs-picker[hidden] { display: none; }
.cs-picker { position: relative; }
.cs-picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 8;
  margin: 0; padding: 4px; list-style: none;
  max-height: 240px; overflow: auto;
  color: var(--fg);
  border: 1px solid var(--hair); border-radius: var(--r-field);
  box-shadow: var(--shadow-raised);
}
.cs-picker-list[hidden] { display: none; }
.lobby-test {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--size-control); min-width: 84px; padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: var(--weight-medium);
}
.lobby-test svg { width: 12px; height: 12px; }
.lobby-test[data-playing] { --btn-state-bg: var(--btn-selected-bg); }
.field-note { margin: 6px 0 0; font-size: var(--text-sm); color: var(--muted); }
.field-note[hidden] { display: none; }
/* Mic level: segmented bar, calm accent, peak tint when hot. */
.meter {
  --level: 0;
  position: relative; margin-top: var(--space-2);
  height: var(--meter-height); border-radius: var(--radius-pill);
  background: var(--color-meter-track); overflow: hidden;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
  mask-image: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
}
.meter-fill {
  position: absolute; inset: 0;
  background: var(--color-meter-fill);
  transform-origin: left center;
  transform: scaleX(var(--level));
}
.meter.is-hot .meter-fill { background: var(--color-meter-peak); }
.meter[data-state="muted"], .meter[data-state="idle"], .meter[data-state="error"] { opacity: .5; }
.lobby-notice {
  margin: var(--space-4) 0 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-chip);
  background: var(--color-accent-soft); color: var(--fg);
  font-size: var(--text-sm); line-height: 1.4;
}
.lobby-notice[hidden] { display: none; }
.inset > .join { margin-top: var(--space-6); height: var(--size-control-lg); font-size: 15px; }
/* Waiting for the host: Cancel takes the place of "Host this room". */
.lobby-cancel {
  display: block; width: 100%; margin-top: var(--space-2);
  height: var(--size-control); border: 0; border-radius: var(--r-join);
  font-size: var(--text-sm); font-weight: 500;
  --btn-fg: var(--color-fg);
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
}
.lobby-cancel[hidden], body.is-waiting .inset > .hostish { display: none; }
@media (min-width: 900px) {
  /* Actions settle at the bottom of the panel, level with the tray. */
  .inset > .join { margin-top: auto; }
  .lobby-devices { margin-bottom: var(--space-6); }
}

@media (max-width: 899px) {
  .lounge-stage { place-items: start center; padding: 0 var(--space-4) var(--space-6); }
  .stage-frame { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .lobby-preview { min-height: 0; aspect-ratio: 4 / 3; max-height: 56vh; }
  .inset { padding: var(--space-5) var(--space-4) var(--space-4); }
  .lobby-head { margin-bottom: var(--space-4); }
}
.call-fill { flex: 1; position: relative; }
.call-fill .iframe-hole { position: absolute; inset: 12px var(--stage-right) 88px 16px; }
.call-dock-wrap {
  position: fixed; left: 0; right: 0; bottom: 18px;
  display: flex; flex-direction: column-reverse; align-items: center;
  justify-content: flex-end; gap: 10px; z-index: 4;
  padding: 0 8px; box-sizing: border-box;
}
.dock { max-width: 100%; flex: none; }
body:not([data-view="call"]) .call-dock-wrap { display: none; }
body[data-view="call"] #lounge { display: none !important; }
@media (max-width: 430px) {
  .call-dock-wrap {
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  .dock { gap: 6px; padding: 8px; }
}
@media (max-width: 360px) {
  .dock { gap: 4px; padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Visually hidden (live regions) ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ---------- Lobby admission notice (moderators) ----------
   Stage corner, follows the docked side panel through --stage-right.
   Tokens only (Day / Night / Matrix), buttons from buttons.css. */
.admit {
  position: fixed; top: 80px; right: calc(var(--stage-right) + 12px); z-index: 10;
  width: min(340px, calc(100vw - var(--stage-right) - 44px));
  display: flex; flex-direction: column; gap: var(--space-2);
  font-family: var(--font);
}
.admit[hidden] { display: none; }
.admit-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.admit-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-3);
  background: var(--color-surface-glass); color: var(--color-fg);
  border: 1px solid var(--color-border); border-radius: var(--radius-field);
  box-shadow: var(--shadow-raised);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  animation: admit-in var(--motion-base) var(--ease-standard) both;
}
.admit-card.is-settled { animation: none; }
@keyframes admit-in {
  from { opacity: 0; transform: translateY(-6px); }
}
.admit-av {
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  display: grid; place-items: center;
  background: var(--color-avatar-bg); color: var(--color-avatar-fg);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
}
.admit-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.admit-name {
  font-size: var(--text-md); font-weight: var(--weight-semibold);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admit-what { font-size: var(--text-sm); color: var(--color-fg-muted); }
.admit-actions { display: flex; gap: var(--space-1); }
.admit-actions .cs-btn, .admit-all {
  appearance: none; border: 0;
  height: 34px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font: var(--weight-medium) var(--text-sm)/1 var(--font);
}
.admit-deny { --btn-fg: var(--color-fg-muted); }
.admit-more {
  margin: 0; padding: 0 var(--space-2);
  font-size: var(--text-sm); color: var(--color-fg-muted);
}
.admit-all {
  align-self: flex-end;
  box-shadow: var(--shadow-raised);
}
.admit-more[hidden], .admit-all[hidden] { display: none; }
@media (max-width: 720px) {
  /* Above the full-screen side sheet so a host in chat still sees it. */
  .admit { top: calc(env(safe-area-inset-top, 0px) + 64px); left: 12px; right: 12px; width: auto; }
  .admit-actions .cs-btn, .admit-all { height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .admit-card { animation: none; }
}

/* ---------- People: who speaks now + talk time (dominantSpeakerChanged) ---------- */
.people-list .talk {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font: var(--weight-regular) var(--text-xs)/1 var(--mono); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.people-list .av { transition: box-shadow var(--motion-base) var(--ease-standard); }
.people-list li.is-speaking .av { box-shadow: 0 0 0 2px var(--color-success); }
.people-list li.is-speaking .talk { color: var(--color-fg); }
.speak-bars { display: none; align-items: flex-end; gap: 2px; height: 10px; }
.speak-bars i { display: block; width: 2px; height: 100%; border-radius: 1px; background: var(--color-success); transform-origin: bottom; }
.people-list li.is-speaking .speak-bars { display: inline-flex; }
.people-list li.is-speaking .speak-bars i { animation: speak-bar 900ms var(--ease-standard) infinite alternate; }
.people-list li.is-speaking .speak-bars i:nth-child(2) { animation-delay: -300ms; }
.people-list li.is-speaking .speak-bars i:nth-child(3) { animation-delay: -600ms; }
@keyframes speak-bar { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .people-list li.is-speaking .speak-bars i { animation: none; transform: none; }
  .speak-bars i:nth-child(2) { transform: scaleY(0.6); }
  .speak-bars i:nth-child(3) { transform: scaleY(0.8); }
}

/* ---------- Room lock (Jitsi lobby) ----------
   Topbar badge for everyone, host switch hint, guest knocking / declined
   states in the lobby panel. Tokens only (Day / Night / Matrix). */
.lock-badge {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px 0 8px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft); color: var(--color-fg);
  box-shadow: inset 0 0 0 1px var(--color-border);
  font: var(--weight-medium) var(--text-xs)/1 var(--font);
  letter-spacing: .02em;
  animation: lock-in var(--motion-base) var(--ease-standard) both;
}
.lock-badge[hidden] { display: none; }
.lock-badge svg { width: 13px; height: 13px; flex: none; }
@keyframes lock-in { from { opacity: 0; transform: scale(.92); } }
@media (max-width: 560px) {
  .lock-badge { width: 26px; height: 26px; padding: 0; justify-content: center; }
  .lock-badge-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
.settings-form .settings-switch.is-fixed { opacity: 1; }
.settings-form .settings-switch.is-fixed input { cursor: not-allowed; }
.settings-lock-hint { line-height: 1.4; }
.settings-switch.is-fixed + .settings-lock-hint { color: var(--color-fg); }

/* Guest: knocking on a locked room. Same calm chip, a short note. */
.lobby-lock-note {
  margin: var(--space-3) 0 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-chip);
  background: var(--color-accent-soft); color: var(--color-fg);
  font-size: var(--text-sm); line-height: 1.45;
}
.lobby-lock-note[hidden] { display: none; }

/* Guest: declined. The panel takes the place of name, devices and Join;
   all of them come back untouched with "Back to lobby". */
.lobby-declined {
  margin-top: 0;
  padding: var(--space-5);
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken); color: var(--color-fg);
  box-shadow: inset 0 0 0 1px var(--color-border);
  animation: lock-in var(--motion-base) var(--ease-standard) both;
}
.lobby-declined[hidden] { display: none; }
/* The panel heading reads out with the status; the page title shows it. */
.lobby-declined-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; margin: 0;
}
.lobby-declined-text { margin: 0; font-size: var(--text-md); line-height: 1.5; color: var(--color-fg-muted); }
.lobby-declined-back {
  appearance: none; border: 0; display: block; width: 100%;
  margin-top: var(--space-4);
  height: var(--size-control-lg); border-radius: var(--r-join);
  font: var(--weight-semibold) 15px/1 var(--font);
}
body.is-declined .inset > :not(.lobby-head):not(.lobby-declined) { display: none; }
@media (min-width: 900px) {
  body.is-declined .lobby-declined { margin-block: auto; }
}

/* Admitted: the call fades in instead of jumping. */
#call.is-admitted { animation: lock-admit var(--motion-slow) var(--ease-standard) both; }
@keyframes lock-admit { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .lock-badge, .lobby-declined, #call.is-admitted { animation: none; }
}

/* ---------- Booked meeting not open (early / late / cancelled) ----------
   docs/booking-guest-screen.md. Tokens only (Day / Night / Matrix).
   early: name, devices and preview stay (check your camera while you wait),
   Join is disabled. late / cancelled: only the explanation and Host. */
.booking-gate {
  margin: var(--space-3) 0 var(--space-4); padding: var(--space-4);
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken); color: var(--color-fg);
  box-shadow: inset 0 0 0 1px var(--color-border);
  animation: lock-in var(--motion-base) var(--ease-standard) both;
}
.booking-gate[hidden] { display: none; }
.booking-text { margin: 0; font-size: var(--text-md); line-height: 1.5; color: var(--color-fg); }
.booking-countdown {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xl); font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums; color: var(--color-accent);
}
.booking-countdown[hidden] { display: none; }
.booking-hint { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--color-fg-muted); }
body[data-booking="late"] .inset > :not(.lobby-head):not(.booking-gate):not(.hostish):not(#host-form):not(.sr-only),
body[data-booking="cancelled"] .inset > :not(.lobby-head):not(.booking-gate):not(.hostish):not(#host-form):not(.sr-only) { display: none; }
body[data-booking="late"] .lobby-preview,
body[data-booking="cancelled"] .lobby-preview { opacity: .5; }
body[data-booking="late"] .preview-dock,
body[data-booking="cancelled"] .preview-dock { display: none; }
body[data-booking="early"] .inset > .join { opacity: .6; }
@media (max-width: 720px) {
  .booking-gate { padding: var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  .booking-gate { animation: none; }
}

/* Encryption line: only "End-to-end encrypted" with a lock, else nothing. */
.settings-form .e2ee-status[hidden],
.settings-form .e2ee-help[hidden],
.settings-count[hidden] { display: none !important; }
.settings-form .e2ee-status { display: flex; align-items: center; gap: var(--space-1); margin-top: 0; font-size: 13px; color: var(--color-fg); font-weight: var(--weight-medium); }
.e2ee-lock { flex: none; vertical-align: -2px; margin-right: 4px; color: var(--color-success); }
.settings-form .e2ee-status .e2ee-lock { margin-right: 0; }
