/* In-app meeting room («اتاق جلسه راه») in the app brand (Nov 2026): the same light blue
   glass ground, royal-blue gradient actions and dark ink as the rest of Rah, deep navy behind
   video, the official seal red for leaving. (The variable names --room-gold and friends are
   kept from the earlier ivory design; they now hold the brand blues.) Works LTR and RTL. */
body.app-room-open { overflow: hidden; }
body.app-room-open .app-confirm-dialog { z-index: 10010; }

/* Component display rules below must never beat the hidden attribute. */
.app-room [hidden] { display: none !important; }

.app-room-host { position: fixed; inset: 0; z-index: 10000; }

.app-room {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--room-ground);
  color: var(--room-ink);
  font: inherit;
}
.app-room button { font: inherit; }
.app-room svg { flex: none; }

/* ---------- header ---------- */
.app-room-header {
  display: flex;
  align-items: center;
  min-width: 0;
}
.app-room-seal {
  flex: none;
  display: grid;
  place-items: center;
  letter-spacing: 1px;
  font-weight: 700;
}
.app-room-title { display: grid; gap: 1px; min-width: 0; flex: 1; }
.app-room-title strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-room-title span { color: var(--room-gold-ink); font-size: 0.75rem; letter-spacing: 0.04em; }
.app-room-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.app-room-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.app-room-chip svg { width: 15px; height: 15px; }
.app-room-chip.is-button { cursor: pointer; }

.app-room-banner {
  justify-self: center;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  max-width: min(720px, 100%);
  overflow-wrap: anywhere;
}

/* ---------- pre-join ---------- */
.app-room-prejoin {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  max-width: 1000px;
  width: 100%;
  margin: auto;
}
.app-room-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 26px;
  background: var(--room-navy);
  border: 4px solid var(--room-paper);
  outline: 1px solid var(--room-line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
/* contain, never cover: the whole camera picture, no zoom */
.app-room-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.app-room-preview video.is-mirrored, .app-settings-preview video.is-mirrored { transform: scaleX(-1); }
.app-room-preview > .app-room-avatar { position: relative; z-index: 1; }
.app-room-prejoin-copy h2 { margin: 0 0 8px; font-size: 1.7rem; font-weight: 300; color: var(--room-ink); }
.app-room-prejoin-copy p { margin: 0 0 18px; color: var(--room-sub); line-height: 1.8; }
.app-room-toggles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.app-room-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 16px;
  border: 1px solid var(--room-line);
  background: var(--room-soft);
  color: var(--room-sub);
  cursor: pointer;
}
.app-room-toggle.is-on { color: var(--room-gold); background: var(--room-navy); border-color: var(--room-navy); }
.app-room-toggle svg, .app-room-control svg { width: 22px; height: 22px; }
.app-room-prejoin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.app-room-prejoin-actions button { min-height: 46px; padding: 0 22px; border-radius: 14px; font-weight: 500; cursor: pointer; }
.app-room-prejoin-actions .primary-button { background: var(--room-navy); border: 1px solid var(--room-navy); color: #fff; }
.app-room-prejoin-actions .secondary-button { background: transparent; border: 1px solid var(--room-line); color: var(--room-ink); }
.app-room-error { margin: 0 0 12px; }

/* ---------- stage ---------- */
.app-room-stage {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}
.app-room-grid {
  grid-column: 1;
  display: grid;
  gap: 10px;
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  grid-auto-rows: minmax(120px, 1fr);
}
.app-room-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.app-room-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Conversation: the speaker large, everyone else in a strip below. */
.app-room-grid[data-layout="speaker"] {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) clamp(96px, 16vh, 140px);
  grid-auto-rows: 0;
}
.app-room-grid[data-layout="speaker"] > :first-child { grid-column: 1 / -1; }

/* Classroom: the shared screen on paper, people in a column beside it. */
.app-room-grid[data-layout="classroom"] {
  grid-template-columns: minmax(0, 1fr) clamp(160px, 18vw, 240px);
  grid-template-rows: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 0;
}
.app-room-grid[data-layout="classroom"] > :not(.is-screen) { grid-column: 2; }

.app-room-tile {
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
  transition: border-color 0.15s ease;
}
.app-room-tile.is-speaking { border-color: var(--room-gold); }
/* contain, not cover: a wide tile must not crop (zoom into) a 16:9 camera picture */
.app-room-tile video { width: 100%; height: 100%; object-fit: contain; }
.app-room-tile video.is-mirrored { transform: scaleX(-1); }
.app-room-avatar {
  width: clamp(48px, 22%, 104px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(1.1rem, 3vw, 2rem);
}
.app-room-avatar svg { width: 40%; height: 40%; }
.app-room-avatar.is-small { width: 32px; font-size: 0.8rem; box-shadow: none; }
.app-room-name {
  position: absolute;
  max-width: calc(100% - 20px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-room-name svg { width: 14px; height: 14px; }
.app-room-name em { font-style: normal; border-radius: 999px; }
.app-room-tile-hand {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.app-room-tile-hand svg { width: 20px; height: 20px; }

.app-room-pager { grid-column: 1; display: flex; justify-content: center; align-items: center; gap: 12px; }

/* ---------- side panel ---------- */
.app-room-side {
  grid-column: 2;
  grid-row: 1 / -1;
  width: min(340px, 86vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--room-line);
  border-radius: 22px;
  min-height: 0;
}
.app-room-side-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--room-line); }
.app-room-side .text-button { color: var(--room-gold-ink); }
.app-room-people { min-width: 0; overflow: auto; padding: 10px; display: grid; gap: 10px; align-content: start; }
.app-room-hands { padding: 12px; border-radius: 16px; }
.app-room-hands h3 { margin: 0 0 8px; font-size: 0.8rem; font-weight: 500; }
.app-room-hands ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: hand; }
.app-room-hands li { display: flex; align-items: center; gap: 8px; counter-increment: hand; }
.app-room-hands li::before { content: counter(hand); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; }
.app-room-hands li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-room-allow { border: 0; border-radius: 999px; padding: 5px 12px; background: var(--room-gold); color: #fff; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.app-room-person { display: flex; align-items: center; padding: 8px; border-radius: 12px; }
.app-room-person:hover { background: var(--room-soft); }
.app-room-person-name { text-overflow: ellipsis; white-space: nowrap; }
.app-room-muted svg { width: 16px; height: 16px; color: #a8323a; }
.app-room-person .is-danger { color: #9b2c33; }
.app-room-chat { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.app-room-chat-note { margin: 0; padding: 8px 16px; color: var(--room-sub); font-size: 0.75rem; }
.app-room-chat-log { list-style: none; margin: 0; padding: 8px 16px; overflow: auto; display: grid; gap: 12px; align-content: start; }
.app-room-chat-log li strong { display: block; font-size: 0.75rem; font-weight: 500; color: var(--room-gold-ink); }
.app-room-chat-log li p { margin: 2px 0 0; overflow-wrap: anywhere; line-height: 1.7; }
.app-room-chat-log li.is-mine strong { color: var(--room-safe-ink); }
.app-room-chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--room-line); }
.app-room-chat-form input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--room-line);
  background: var(--room-soft);
  color: var(--room-ink);
  padding: 10px 12px;
}
.app-room-chat-form .primary-button { background: var(--room-navy); border-color: var(--room-navy); color: #fff; }

/* ---------- controls ---------- */
.app-room-controls {
  grid-row: 4;
  overflow-x: auto;
}
.app-room-control {
  position: relative;
  flex: none;
  place-items: center;
  cursor: pointer;
}
.app-room-control > span { overflow: hidden; }
.app-room-control:hover { border-color: var(--room-gold); }
.app-room-control.is-on { border-color: var(--room-navy); }
.app-room-control.is-danger {
  width: auto;
  display: flex;
  border-color: var(--room-seal);
  margin-inline-start: 6px;
}
.app-room-control.is-danger > span { position: static; width: auto; height: auto; clip-path: none; }
.app-room-control:disabled { opacity: 0.6; cursor: progress; }
.app-room-control:focus-visible, .app-room-toggle:focus-visible, .app-room-chip:focus-visible { outline: 2px solid var(--room-gold); outline-offset: 2px; }
.app-room-badge {
  position: absolute;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--room-gold);
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}
.app-room-dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--room-seal); }
.app-room-control [data-waiting-dot] { inset-inline-end: auto; inset-inline-start: -2px; top: -2px; width: 12px; height: 12px; }
.app-room-audio { position: absolute; inset-inline: 0; margin-inline: auto; width: max-content; z-index: 2; }

/* ---------- host tools and waiting room ---------- */
.app-room-host-tools, .app-room-waiting { padding: 12px; border-radius: 16px; border: 1px solid var(--room-line); background: var(--room-soft); }
.app-room-host-tools h3, .app-room-waiting h3 { margin: 0 0 8px; font-size: 0.8rem; font-weight: 500; color: var(--room-gold-ink); }
.app-room-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.app-room-tool-grid button {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--room-line);
  background: var(--room-paper);
  color: var(--room-ink);
  font-size: 0.78rem;
  cursor: pointer;
}
.app-room-tool-grid button:hover { border-color: var(--room-gold); }
.app-room-tool-grid button.is-danger { grid-column: 1 / -1; background: var(--room-seal); border-color: var(--room-seal); color: #fff; }
.app-room-waiting ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.app-room-waiting li { display: flex; align-items: center; gap: 6px; }
.app-room-waiting li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-room-deny { border: 1px solid var(--room-line); border-radius: 999px; padding: 5px 10px; font-size: 0.75rem; cursor: pointer; }

/* ---------- guest entry page ---------- */
.app-guest-body { margin: 0; min-height: 100vh; background: #eef2fb; color: #0f172a; font-family: Vazirmatn, Inter, system-ui, sans-serif; }
.app-guest { min-height: 100vh; display: grid; place-items: center; padding: 24px; box-sizing: border-box; }
.app-guest-card {
  box-sizing: border-box;
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 32px 28px;
  border-radius: 26px;
  background: #ffffff;
  border: 1px solid #dbe3f3;
}
.app-guest-card h1 { margin: 0; font-size: 1.4rem; font-weight: 500; }
.app-guest-when { margin: 0; color: #647085; }
.app-guest-form { display: grid; gap: 8px; width: 100%; text-align: start; }
.app-guest-form label { font-weight: 500; }
.app-guest-form input { min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid #dbe3f3; background: #f5f7fd; color: #0f172a; font: inherit; }
.app-guest-form small, .app-guest-note { color: #647085; font-size: 0.8rem; line-height: 1.7; margin: 0; }
.app-guest-primary { margin-top: 6px; min-height: 48px; border: 0; border-radius: 14px; background: #2b4bc4; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.app-guest-primary:disabled { opacity: 0.6; }
.app-guest-wait { display: grid; gap: 10px; justify-items: center; }
.app-guest-wait p { margin: 0; }
.app-guest-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #dbe3f3; border-top-color: var(--brand-primary-2, #3a5bd0); animation: app-spin 1s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .app-guest-spinner { animation: none; } }
.app-guest-message { margin: 0; padding: 10px 14px; border-radius: 12px; background: #fbeaea; color: #8a2a30; }
.app-guest [hidden] { display: none !important; }

/* ---------- meeting cards (outside the room) ---------- */
.meeting-room-pill { background: rgba(58, 102, 224, 0.12); color: var(--brand-primary-ink, #27348f); white-space: nowrap; }
.meeting-room-hint { display: block; width: 100%; color: var(--rg-sub, #414b5a); font-size: 0.8rem; }
/* Admin form: fields that only apply to external links stay hidden for Rah rooms. */
[data-external-link-field][hidden], [data-provider-help][hidden] { display: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .app-room-chips { justify-content: flex-start; }
  .app-room-chip.is-button:not(.is-invite) span { display: none; }
  .app-room-prejoin { grid-template-columns: 1fr; gap: 16px; }
  .app-room-stage { grid-template-columns: 1fr; }
  .app-room-grid, .app-room-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
  .app-room-grid[data-count="1"] { grid-template-columns: 1fr; }
  .app-room-grid[data-layout="speaker"] { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) 84px; }
  .app-room-grid[data-layout="classroom"] { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) 84px; }
  .app-room-grid[data-layout="classroom"] > :not(.is-screen) { grid-column: auto; grid-row: 2; }
  .app-room-side { position: absolute; inset: 0; width: auto; grid-column: 1; z-index: 3; }
  .app-room-control svg { width: 20px; height: 20px; }
  .app-room-control.is-danger { margin-inline-start: 2px; }
  .app-room-grid[data-layout] > :not(:first-child) .app-room-avatar { width: 34px; font-size: 0.9rem; box-shadow: 0 0 0 1px var(--room-gold); }
  .app-room-grid[data-layout] > :not(:first-child) .app-room-name { bottom: 4px; inset-inline-start: 4px; padding: 2px 6px; font-size: 0.68rem; }
  .app-room-grid[data-layout] > :not(:first-child) .app-room-tile-hand { width: 24px; height: 24px; top: 4px; inset-inline-end: 4px; }
  .app-room-control.is-danger > span { display: none; }
}

/* ---------- invite and settings sheets (v5) ---------- */
.app-room-sheet {
  --room-paper: #ffffff; --room-soft: #f5f7fd; --room-tile: #e6ebf7; --room-line: #dbe3f3;
  --room-ink: #0f172a; --room-sub: #647085; --room-gold: var(--brand-primary-2, #3a5bd0); --room-gold-ink: var(--brand-primary-ink, #27348f);
  --room-navy: #13204a; --room-seal: #a8323a;
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
  color: var(--room-ink);
}
.app-room-sheet[hidden] { display: none !important; }
/* The invite sheet also opens outside the room (admin list): hidden must win there too. */
.app-room-sheet [hidden] { display: none !important; }
.app-room .app-room-sheet { position: absolute; }
.app-room-sheet-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--room-paper);
  border: 1px solid var(--room-line);
  border-radius: 24px;
  padding: 20px 22px 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  box-sizing: border-box;
}
.app-room-sheet-card.is-wide { width: min(860px, 100%); }
.app-room-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--room-line); padding-bottom: 12px; margin-bottom: 14px; }
.app-room-sheet-head h2 { margin: 0; font-size: 1.25rem; font-weight: 400; }
.app-room-sheet button { font: inherit; }
.app-invite-meeting { margin: 0 0 12px; color: var(--room-sub); }
.app-invite-option { border: 1px solid var(--room-line); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; background: var(--room-soft); }
.app-invite-option.is-guest { border-color: var(--room-gold); background: #edf1fb; }
.app-invite-option h3 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; }
.app-invite-option p { margin: 0 0 10px; color: var(--room-sub); line-height: 1.7; font-size: 0.92rem; }
.app-invite-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.app-invite-row input { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--room-line); border-radius: 12px; padding: 0 12px; background: #fff; color: var(--room-ink); font: inherit; font-size: 0.85rem; }
.app-invite-codes { display: flex; gap: 12px; margin: 4px 0 12px; }
.app-invite-codes div { flex: 1; border: 1px solid var(--room-line); border-radius: 12px; padding: 8px 12px; background: #fff; }
.app-invite-codes dt { font-size: 0.75rem; color: var(--room-muted, #5b6676); margin: 0 0 2px; }
.app-invite-codes dd { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: 0.06em; color: var(--room-ink); font-variant-numeric: tabular-nums; text-align: start; }
.app-invite-copy, .app-invite-primary, .app-invite-danger {
  flex: none; min-height: 42px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--room-navy); background: transparent; color: var(--room-navy); font-weight: 500;
}
.app-invite-copy:hover { background: var(--room-navy); color: #fff; }
.app-invite-primary { background: var(--room-navy); color: #fff; }
.app-invite-danger { border-color: var(--room-seal); color: var(--room-seal); }
.app-invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app-invite-note { display: block; margin-top: 8px; color: var(--room-sub); font-size: 0.82rem; }
.app-invite-status { min-height: 1.4em; margin: 4px 0 0; color: var(--room-gold-ink); font-weight: 500; }
.app-room-sheet button:disabled { opacity: 0.55; cursor: progress; }
.app-room-sheet :focus-visible { outline: 2px solid var(--room-gold); outline-offset: 2px; }

.app-settings-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.app-settings-section h3 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 600; }
.app-settings-section h4 { margin: 16px 0 8px; font-size: 0.92rem; font-weight: 600; color: var(--room-sub); }
.app-settings-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--room-navy); display: grid; place-items: center; margin-bottom: 12px; }
.app-settings-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.app-settings-preview p { position: relative; margin: 0; padding: 0 16px; text-align: center; color: #e9dfc8; font-size: 0.9rem; }
.app-settings-field { display: grid; gap: 6px; margin-bottom: 10px; font-size: 0.9rem; }
.app-settings-field select { height: 42px; border: 1px solid var(--room-line); border-radius: 12px; padding: 0 10px; background: #fff; color: var(--room-ink); font: inherit; max-width: 100%; }
.app-settings-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.9rem; cursor: pointer; }
.app-settings-check input { width: 18px; height: 18px; accent-color: var(--room-navy); }
.app-settings-meter { height: 8px; border-radius: 6px; background: var(--room-tile); overflow: hidden; margin: 2px 0 10px; }
.app-settings-meter i { display: block; block-size: 100%; inline-size: 0; background: linear-gradient(90deg, #6f9a6a, var(--room-gold)); transition: inline-size 80ms linear; }
.app-settings-note { margin: 8px 0 0; color: var(--room-sub); font-size: 0.85rem; }
.app-bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.app-bg-choice {
  position: relative; aspect-ratio: 16 / 10; border-radius: 12px; border: 2px solid var(--room-line);
  background: var(--room-tile) center / cover no-repeat; cursor: pointer; overflow: hidden; padding: 0;
  display: grid; align-items: end;
}
.app-bg-choice span { display: block; padding: 3px 6px; font-size: 0.72rem; background: rgba(255, 253, 248, 0.88); color: var(--room-ink); text-align: center; }
.app-bg-choice.is-blur-soft, .app-bg-choice.is-blur { background-image: radial-gradient(circle at 50% 42%, #c9b892 0 18%, transparent 19%), linear-gradient(135deg, #d9cdb4, #b9c4cf); }
.app-bg-choice.is-blur { filter: saturate(0.9); }
.app-bg-choice.is-blur::before, .app-bg-choice.is-blur-soft::before { content: ""; position: absolute; inset: 0; backdrop-filter: blur(2px); }
.app-bg-choice.is-blur::before { backdrop-filter: blur(5px); }
.app-bg-choice[aria-pressed="true"] { border-color: var(--room-navy); box-shadow: 0 0 0 2px var(--room-gold); }
.app-bg-choice:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- reactions, pin, full screen ---------- */
.app-room-stage { position: relative; }
.app-room-reactions { position: absolute; inset-inline-start: 18px; bottom: 12px; width: 140px; height: 70%; pointer-events: none; z-index: 2; }
.app-room-reaction {
  position: absolute; bottom: 0; inset-inline-start: 0; display: grid; justify-items: center; gap: 2px;
  animation: app-react-float 3.2s ease-out forwards;
}
.app-room-reaction b { font-size: 2.1rem; line-height: 1; font-weight: 400; }
.app-room-reaction small { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; color: #edf1fb; }
@keyframes app-react-float {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  12% { transform: translate(0, -20px) scale(1.08); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--drift, 0), -260px) scale(1); opacity: 0; }
}
.app-room-react-menu {
  position: absolute; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 76px); inset-inline: 0; margin-inline: auto; width: max-content;
  display: flex; gap: 2px; padding: 6px; border-radius: 22px; background: var(--room-paper);
  border: 1px solid var(--room-line); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); z-index: 4;
}
.app-room-react-menu button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 1.4rem; cursor: pointer; }
.app-room-react-menu button:hover, .app-room-react-menu button:focus-visible { background: var(--room-tile); }
.app-room-tile { position: relative; }
.app-room-pin {
  position: absolute; top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255, 253, 248, 0.5); background: rgba(15, 23, 42, 0.55); color: #edf1fb;
  display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity 0.15s ease; z-index: 2; padding: 0;
}
.app-room-pin svg { width: 16px; height: 16px; }
.app-room-tile:hover .app-room-pin, .app-room-pin:focus-visible, .app-room-pin[aria-pressed="true"] { opacity: 1; }
.app-room-pin[aria-pressed="true"] { background: var(--room-gold); border-color: var(--room-gold); color: #fff; }
.app-room-tile.is-pinned { border-color: var(--room-gold); }
@media (hover: none) { .app-room-pin { opacity: 0.85; } }
.app-room-chip.is-icon { padding-inline: 8px; }
.app-room:fullscreen { padding: 14px 18px; }
.app-member-link-notice {
  max-width: 560px; margin: 16px auto 0; padding: 12px 16px; border-radius: 14px;
  background: #edf1fb; border: 1px solid var(--brand-primary-2, #3a5bd0); color: #4a3a18; line-height: 1.7; text-align: start;
}
@media (max-width: 720px) {
  .app-settings-body { grid-template-columns: 1fr; }
  .app-room-sheet { padding: 0; place-items: end stretch; }
  .app-room-sheet-card, .app-room-sheet-card.is-wide { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .app-room-react-menu { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 62px); }
}
@media (prefers-reduced-motion: reduce) { .app-room-reaction { animation-duration: 0.01s; } }
.app-room-controls { position: relative; z-index: 5; }
.app-room-sheet-head .text-button { background: none; border: 0; color: var(--room-navy); font-weight: 600; cursor: pointer; padding: 6px 4px; }
.app-room-sheet-head .text-button:hover { color: var(--room-seal); }

/* co-host manager */
.app-cohost-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.app-cohost-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--room-line); }
.app-cohost-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-cohost-list li button { min-height: 36px; }
.app-cohost-search { width: 100%; box-sizing: border-box; height: 42px; border: 1px solid var(--room-line); border-radius: 12px; padding: 0 12px; margin-bottom: 8px; background: #fff; color: var(--room-ink); font: inherit; }
.app-cohost-actions { display: inline-flex; gap: 6px; flex: none; }
.app-main-host { margin: 0 0 10px; font-weight: 600; color: var(--room-gold-ink, var(--brand-primary-ink, #27348f)); }

/* course page: live classes */
.course-live-classes { margin: 0 0 18px; padding: 16px 18px; border-radius: 18px; background: #ffffff; border: 1px solid #dbe3f3; }
.course-live-classes h2 { margin: 0 0 10px; font-size: 1.1rem; }
.course-live-classes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.course-live-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid #e6ebf7; }
.course-live-row.is-open { border-color: #1f8a5b; box-shadow: inset 0 0 0 1px #1f8a5b; }
.course-live-row div { display: grid; gap: 2px; min-width: 0; }
.course-live-row span { color: #647085; font-size: 0.9rem; }
.course-live-soon { color: var(--brand-primary-ink, #27348f); font-weight: 600; }
.meeting-course-pill { background: #edf1fb; color: var(--brand-primary-ink, #27348f); }

/* ======================================================================
   Layout v2 — Zoom-style stage: tiles keep a 16:9 shape sized from the real
   stage box (JS sets --tile-w/--tile-h), 1:1 calls get a floating self view,
   speaker/classroom use one main picture plus a scrolling strip.
   ====================================================================== */
.app-room-grid[data-layout] {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.app-room-grid[data-layout] > .app-room-tile { flex: none; }
.app-room-grid[data-layout="gallery"] > .app-room-tile { width: var(--tile-w, 320px); height: var(--tile-h, 180px); }

/* 1:1 — the other person fills the stage; you float in a corner (drag-free, always visible). */
.app-room-grid[data-layout="duo"] > .is-main { width: 100%; height: 100%; }
.app-room-grid[data-layout="duo"] > .is-pip {
  position: absolute; width: var(--pip-w, 220px); height: var(--pip-h, 124px);
  z-index: 3; border-radius: 16px;
}
.app-room-grid[data-layout="duo"] > .is-pip.is-speaking { border-color: var(--room-gold); }

/* Speaker and classroom: one big picture, a strip of thumbnails under it. */
.app-room-grid[data-layout="speaker"], .app-room-grid[data-layout="classroom"] { flex-direction: column; flex-wrap: nowrap; align-content: stretch; }
.app-room-grid[data-layout="speaker"] > .is-main, .app-room-grid[data-layout="classroom"] > .is-main { flex: 1 1 auto; width: 100%; min-height: 0; }
.app-room-strip {
  flex: none; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px;
  justify-content: safe center; scrollbar-width: thin; scroll-snap-type: x proximity;
}
.app-room-strip > .app-room-tile { flex: none; width: var(--thumb-w, 180px); height: var(--thumb-h, 101px); border-radius: 14px; scroll-snap-align: start; }
.app-room-strip .app-room-avatar { width: 38px; font-size: 0.95rem; box-shadow: 0 0 0 1px var(--room-gold); }
.app-room-strip .app-room-name { bottom: 4px; inset-inline-start: 4px; padding: 2px 7px; font-size: 0.7rem; }
.app-room-strip .app-room-tile-hand { width: 24px; height: 24px; top: 4px; inset-inline-end: 4px; }
.app-room-grid[data-layout="classroom"] > .is-screen { grid-row: auto; grid-column: auto; }

/* The picture is never cropped; empty space behind a tall phone video is a soft blur of itself. */
/* absolute: a grid item at height:100% of an auto row would grow to the video's own height */
.app-room-tile video { position: absolute; inset: 0; z-index: 1; }
.app-room-tile video.app-room-fill {
  position: absolute; inset: -8%; width: 116%; height: 116%; z-index: 0; object-fit: cover;
  filter: blur(28px) brightness(0.62) saturate(1.1); background: var(--room-navy); pointer-events: none;
}
.app-room-tile.has-fill video:not(.app-room-fill) { background: transparent; }
.app-room-tile .app-room-name, .app-room-tile .app-room-tile-hand { z-index: 2; }

/* Per-tile tools: mute, pin and ⋯ appear on hover (always on touch screens). */
.app-room-tile-tools {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3; display: flex; gap: 6px;
  opacity: 0; transition: opacity 0.15s ease;
}
.app-room-tile:hover .app-room-tile-tools, .app-room-tile-tools:focus-within, .app-room-tile.is-pinned .app-room-tile-tools { opacity: 1; }
.app-room-tile-btn, .app-room-tile-tools .app-room-pin {
  position: static; opacity: 1; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.app-room-tile-btn svg { width: 16px; height: 16px; }
.app-room-tile-btn:hover, .app-room-tile-btn:focus-visible { border-color: var(--room-gold); }
.app-room-tile:has(.app-room-tile-hand) .app-room-tile-tools { inset-inline-end: 50px; }
.app-room-strip .app-room-tile-tools, .is-pip .app-room-tile-tools { top: 4px; inset-inline-end: 4px; gap: 4px; }
.app-room-strip .app-room-tile-btn, .is-pip .app-room-tile-btn { width: 26px; height: 26px; }
.app-room-strip .app-room-tile-tools [data-pin], .is-pip .app-room-tile-tools [data-pin] { display: none; }
@media (hover: none) { .app-room-strip .app-room-tile-tools { opacity: 0; } }

/* Shared pop-up menu: tile ⋯, right-click, people ⋯, view and more. */
.app-room-menu {
  position: absolute; z-index: 30;
  max-height: min(70dvh, 460px); padding: 6px; border-radius: 16px; border: 1px solid var(--room-line);
  display: grid; gap: 2px;
}
.app-room-menu-title { margin: 4px 10px 6px; font-size: 0.78rem; color: var(--room-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-room-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--room-ink); cursor: pointer; text-align: start;
}
.app-room-menu button svg { width: 18px; height: 18px; }
.app-room-menu button:hover, .app-room-menu button:focus-visible { outline: none; }
.app-room-menu button[aria-checked="true"] { font-weight: 600; }
.app-room-menu button[aria-checked="true"] svg { color: var(--room-navy); }
.app-room-menu button.is-danger { border-top: 1px solid var(--room-line); border-radius: 0 0 10px 10px; margin-top: 2px; }

/* People list: one tidy row per person. */
.app-room-person { flex-wrap: nowrap; gap: 8px; }
.app-room-person.is-speaking .app-room-avatar { box-shadow: 0 0 0 2px var(--room-gold); }
.app-room-person-name { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; }
.app-room-person-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app-room-tag { flex: none; font-style: normal; font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--room-line); color: var(--room-sub); }
.app-room-tag.is-host { border-color: var(--room-gold); color: var(--room-gold-ink); }
.app-room-cam, .app-room-person .app-room-muted { flex: none; display: grid; place-items: center; width: 30px; height: 30px; color: var(--room-sub); }
.app-room-cam svg, .app-room-person .app-room-muted svg, .app-room-icon-btn svg { width: 17px; height: 17px; }
.app-room-person .app-room-muted:has(svg) { color: #a8323a; }
.app-room-icon-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--room-ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.app-room-icon-btn:hover, .app-room-icon-btn:focus-visible { border-color: var(--room-line); outline: none; }

/* The side panel takes its own column on wide screens, so tiles re-fit beside it and no face is covered. */

/* Controls: compact bar; the "More" button only exists on narrow screens. */
.app-room-control.is-more { display: none; }
@media (max-width: 720px) {
  .app-room-control.is-more { display: grid; }
  .app-room-grid[data-layout="duo"] > .is-pip { border-radius: 12px; }
}

/* Slides bar (phone sharing a PDF or pictures). */
.app-room-slides-bar {
  position: absolute; inset-inline: 0; margin-inline: auto; width: max-content; z-index: 7;
  top: calc(max(14px, env(safe-area-inset-top)) + 62px);
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; color: #edf1fb; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.3);
}
.app-room-slides-bar button { min-width: 40px; height: 40px; border-radius: 999px; border: 0; background: rgba(255, 253, 248, 0.12); color: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; padding: 0 10px; }
.app-room-slides-bar button svg { width: 18px; height: 18px; }
.app-room-slides-bar .is-stop { background: var(--room-seal); }
.app-room-slides-bar [data-slides-page] { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
[dir="rtl"] .app-room-slides-bar [data-slides-prev] svg, [dir="rtl"] .app-room-slides-bar [data-slides-next] svg { transform: scaleX(-1); }

/* Full screen: the picture uses the whole display; header and controls float and fade when idle. */
.app-room.is-immersive { padding: 0; gap: 0; grid-template-rows: minmax(0, 1fr); }
.app-room.is-immersive > .app-room-stage { grid-row: 1; grid-column: 1; padding: 10px; }
.app-room.is-immersive > .app-room-header, .app-room.is-immersive > .app-room-controls {
  position: absolute; z-index: 8; transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-room.is-immersive > .app-room-header { top: 12px; inset-inline: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.app-room.is-immersive > .app-room-controls { bottom: 14px; inset-inline: 0; margin-inline: auto; width: max-content; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.app-room.is-immersive > :not(.app-room-header):not(.app-room-controls):not(.app-room-stage):not(.app-room-host) { z-index: 9; }
.app-room.is-immersive .app-room-tile { border-radius: 14px; }
.app-room.is-immersive .app-room-side { margin-block: 62px 78px; }
.app-room.is-immersive .app-room-tile.is-screen { background: #0b1230; border-color: transparent; }
.app-room.is-immersive .app-room-tile.is-screen video { background: #0b1230; }
.app-room.is-immersive.is-idle > .app-room-header { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.app-room.is-immersive.is-idle > .app-room-controls { opacity: 0; transform: translateY(12px); pointer-events: none; }
.app-room.is-immersive.is-idle { cursor: none; }
.app-room.is-immersive.is-idle .app-room-tile-tools { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .app-room.is-immersive > .app-room-header, .app-room.is-immersive > .app-room-controls { transition: none; }
}

/* Phones: one-line header (no wrapping chips), lighter tile tools (long-press opens the full menu). */
@media (max-width: 720px) {
  .app-room-header { flex-wrap: nowrap; }
  .app-room-title { flex: 1 1 auto; min-width: 0; }
  .app-room-title > span { display: none; }
  .app-room-chips { width: auto; flex: none; flex-wrap: nowrap; gap: 4px; }
  .app-room-chip { padding: 4px 8px; font-size: 0.72rem; }
  .app-room-chip.is-invite > span { display: none; }
  .app-room-chip[data-room-count] { display: none; }
  .app-room-tile-tools { gap: 4px; top: 6px; inset-inline-end: 6px; }
  .app-room-tile-btn, .app-room-tile-tools .app-room-pin { width: 28px; height: 28px; }
  .app-room-tile-tools [data-pin] { display: none; }
}
@media (hover: none) {
  .app-room-grid[data-layout="gallery"] .app-room-tile-tools [data-pin] { display: none; }
}
/* Self view in a 1:1 call sits on the start side so the people/chat panel never covers it. */
.app-room-grid[data-layout="duo"] > .is-pip { top: 14px; bottom: auto; inset-inline-end: auto; inset-inline-start: 14px; }
.app-room.is-immersive .app-room-grid[data-layout="duo"] > .is-pip { top: 76px; transition: top 0.25s ease; }
.app-room.is-immersive.is-idle .app-room-grid[data-layout="duo"] > .is-pip { top: 14px; }
@media (max-width: 720px) { .app-room-grid[data-layout="duo"] > .is-pip { top: 8px; inset-inline-start: 8px; } }

/* ---------- v12: device arrows on mic/camera, touch-up slider, people panel never scrolls sideways ---------- */
.app-room-split { display: inline-flex; flex: none; }
.app-room-caret {
  cursor: pointer; z-index: 1;
}
.app-room-caret:hover, .app-room-caret:focus-visible, .app-room-caret[aria-expanded="true"] { background: var(--room-navy); color: var(--room-gold); border-color: var(--room-navy); outline: none; }
.app-room-menu hr { border: 0; border-top: 1px solid var(--room-line); margin: 4px 6px; }
.app-room-menu .app-room-menu-title { margin-top: 8px; font-weight: 600; color: var(--room-gold-ink); }
.app-room-menu button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-settings-touchup { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--room-soft); border: 1px solid var(--room-line); }
.app-settings-touchup h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.app-settings-touchup h4 svg { width: 18px; height: 18px; color: var(--room-gold-ink); }
.app-settings-touchup h4 span { flex: 1; }
.app-settings-touchup output { font-variant-numeric: tabular-nums; color: var(--room-gold-ink); font-weight: 600; }
.app-settings-touchup input[type="range"] { width: 100%; accent-color: var(--room-gold); }
.app-settings-touchup .app-settings-note { margin: 6px 0 0; }

.app-room-side { overflow: hidden; }
.app-room-people { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; overflow-y: auto; }
.app-room-people > * { min-width: 0; }
.app-room-tool-grid button { min-width: 0; overflow-wrap: anywhere; }
.app-room-person { min-width: 0; }
.app-room-person-name { min-width: 0; overflow: hidden; }

/* ---------- v13: host asks a participant to start video / unmute ---------- */
.app-room-ask {
  position: absolute; z-index: 40; top: calc(max(14px, env(safe-area-inset-top)) + 70px); inset-inline: 0; margin-inline: auto;
  width: min(420px, calc(100% - 24px)); box-sizing: border-box; display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center;
  padding: 14px 16px; border-radius: 18px; border: 1px solid var(--room-gold); color: var(--room-ink);
}
.app-room-ask-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.app-room-ask-icon svg { width: 20px; height: 20px; }
.app-room-ask p { margin: 0; line-height: 1.6; }
.app-room-ask-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.app-room-ask-actions button { min-height: 40px; padding: 0 16px; border-radius: 12px; cursor: pointer; font-weight: 500; }
.app-room-ask-actions .primary-button { background: var(--room-navy); border: 1px solid var(--room-navy); color: #fff; }
.app-room-ask-actions .secondary-button { background: transparent; border: 1px solid var(--room-line); color: var(--room-ink); }
button.app-room-cam { border: 1px solid transparent; background: transparent; cursor: pointer; border-radius: 50%; padding: 0; color: var(--room-sub); }
button.app-room-cam.is-on { color: var(--room-ink); }
button.app-room-cam:hover, button.app-room-cam:focus-visible { background: var(--room-tile); border-color: var(--room-line); outline: none; }

/* =====================================================================
   v14/v15 — Design 8 layout (people grid, three-part control bar, framed
   controls with words under them) in Rah's ivory and gold colours.
   ===================================================================== */
.app-room {
  --room-ground: #eef2fb;
  --room-paper: #ffffff;
  --room-soft: #f5f7fd;
  --room-tile: #e6ebf7;
  --room-line: #dbe3f3;
  --room-ink: #0f172a;
  --room-sub: #647085;
  --room-gold: var(--brand-primary-2, #3a5bd0);
  --room-gold-ink: var(--brand-primary-ink, #27348f);
  --room-navy: #13204a;
  --room-seal: #a8323a;
  --room-safe-bg: #eef3ea;
  --room-safe-ink: #2c5a3c;
  --room-red: #b3362f;
  padding: max(10px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  gap: 10px;
}
.app-room ::selection { background: rgba(58, 91, 208, 0.35); }

/* header: brand, title + "not recorded", timer, faces, view, full screen */
.app-room-header { background: transparent; border: 0; padding: 4px 4px; border-radius: 0; gap: 14px; }
.app-room-seal { width: 34px; height: 34px; border-radius: 10px; background: var(--room-gold); color: #fff; box-shadow: none; font-size: 10px; }
.app-room-title strong { font-size: 0.98rem; }
.app-room-title .app-room-secure { display: inline-flex; align-items: center; gap: 6px; color: var(--room-sub); font-size: 0.74rem; letter-spacing: 0; }
.app-room-title .app-room-secure svg { width: 12px; height: 12px; color: var(--room-safe-ink); }
.app-room-chip { background: var(--room-paper); color: var(--room-ink); border: 1px solid var(--room-line); }
.app-room-chip.is-timer { flex: none; gap: 8px; font-variant-numeric: tabular-nums; border-radius: 999px; }
.app-room-chip.is-timer::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--room-safe-ink); }
.app-room-chip.is-button { border-color: var(--room-line); color: var(--room-ink); background: var(--room-paper); border-radius: 10px; }
.app-room-chip.is-button:hover { background: var(--room-soft); color: var(--room-ink); border-color: var(--room-gold); }
.app-room-chip.is-button svg { width: 15px; height: 15px; }
.app-room-chip.is-locked { background: rgba(58, 91, 208, 0.14); color: var(--room-gold); border-color: rgba(58, 91, 208, 0.4); }
.app-room-chip.is-leave { background: var(--room-seal); border-color: var(--room-seal); color: #fff; font-weight: 600; cursor: pointer; border-radius: 10px; }
.app-room-chip.is-phone-only { display: none; }
.app-room-avatars { display: inline-flex; align-items: center; padding-inline-start: 8px; }
.app-room-avatars i { width: 28px; height: 28px; border-radius: 50%; margin-inline-start: -8px; display: grid; place-items: center; font-style: normal; font-size: 0.72rem; font-weight: 600; color: #f1f4fb; border: 2px solid var(--room-ground); }
.app-room-avatars i.is-more { background: var(--room-soft); color: var(--room-sub); font-size: 0.68rem; }
.app-room-banner { background: var(--room-soft); color: var(--room-ink); border: 1px solid var(--room-line); }

/* tiles */
.app-room-tile { background: var(--room-paper); border: 1px solid #dbe3f3; border-radius: 16px; }
.app-room-tile.is-speaking { border: 2px solid var(--room-gold); box-shadow: 0 0 0 5px rgba(58, 91, 208, 0.14); }
.app-room-tile video { background: #0b1230; }
.app-room-tile.is-screen { background: #ffffff; border-color: #dbe3f3; }
.app-room-tile.is-screen video { background: #ffffff; }
.app-room-avatar { color: #f1f4fb; font-weight: 600; box-shadow: 0 0 0 6px rgba(15, 23, 42, 0.06); background: #4f6f8f; }
.app-room-avatar svg { color: #f1f4fb; }
.app-room-name { background: rgba(8, 10, 14, 0.6); color: #f1f4fb; border-radius: 9px; padding: 5px 11px 5px 9px; font-size: 0.82rem; font-weight: 500; bottom: 12px; inset-inline-start: 12px; }
.app-room-name svg { color: var(--room-red); }
.app-room-name em { border: 0; padding: 0; font-size: 0.72rem; }
.app-room-name em::before { content: "· "; }
.app-room-tile-hand { background: var(--room-gold); color: #fff; }
.app-room-tile-btn, .app-room-tile-tools .app-room-pin { border-radius: 10px; border: 0; background: rgba(8, 10, 14, 0.62); color: #f1f4fb; }
.app-room-tile-btn:hover, .app-room-tile-btn:focus-visible { background: #13204a; outline: 1px solid var(--room-gold); }
.app-room-tile-tools [data-mod="mute"]:hover, .app-room-tile-tools [data-ctl-mic]:hover { background: var(--room-seal); }
.app-room-grid[data-layout="duo"] > .is-pip { border: 2px solid #ffffff; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2); }
.app-room-pager { color: var(--room-sub); }

/* control bar: three parts, framed icons with words under them */
.app-room-controls {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-inline: calc(-1 * max(20px, env(safe-area-inset-left)));
  padding: 10px max(24px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
  border-radius: 0;
  border: 0;
  border-top: 1px solid #dbe3f3;
  background: #ffffff;
  overflow: visible;
}
.app-room-ctl-group { display: flex; align-items: flex-start; gap: 12px; }
.app-room-ctl-group.is-center { justify-content: center; flex: 1; }
.app-room-control {
  width: auto;
  min-width: 56px;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
}
.app-room-control > svg {
  width: 54px;
  height: 42px;
  box-sizing: border-box;
  padding: 10px 16px;
  border-radius: 13px;
  background: #edf1fb;
  border: 1px solid #dbe3f3;
  overflow: visible;
}
.app-room-control > span { position: static; width: auto; height: auto; clip-path: none; font-size: 0.72rem; font-weight: 500; color: #4b4f66; white-space: nowrap; }
.app-room-control:hover > svg { background: #e6ebf7; }
.app-room-control:hover { border: 0; }
.app-room-control.is-on > svg { background: linear-gradient(135deg, var(--brand-lapis, #2341a0), var(--brand-primary-2, #3a5bd0)); border-color: var(--brand-lapis, #2341a0); color: #fff; }
.app-room-control.is-on { background: transparent; color: #0f172a; }
.app-room-control.is-primary > svg { background: var(--room-gold); border-color: var(--room-gold); color: #fff; width: 64px; }
.app-room-control.is-primary.is-on > svg { background: #d9b874; }
.app-room-control.is-danger { flex-direction: row; gap: 8px; height: 42px; padding: 0 20px; margin: 0; border-radius: 13px; background: var(--room-seal); color: #fff; }
.app-room-control.is-danger > svg { width: 18px; height: 18px; padding: 0; background: none; border: 0; }
.app-room-control.is-danger > span { color: #fff; font-size: 0.9rem; font-weight: 600; }
.app-room-control:focus-visible { outline: none; }
.app-room-control:focus-visible > svg { outline: 2px solid var(--room-gold); outline-offset: 2px; }
/* microphone / camera: icon and arrow share one frame; muted mic turns the frame red */
.app-room-split { position: relative; }
.app-room-split > .app-room-control { padding-inline-end: 26px; }
.app-room-split > .app-room-control > svg { border-start-end-radius: 0; border-end-end-radius: 0; border-inline-end: 0; }
.app-room-split > .app-room-control > span { margin-inline-end: -26px; }
.app-room-caret {
  position: absolute; top: 0; inset-inline-end: 0; bottom: auto; width: 26px; height: 42px; border-radius: 0; padding: 0;
  border-start-end-radius: 13px; border-end-end-radius: 13px; border: 1px solid #dbe3f3;
  border-inline-start: 1px solid #e0d3b5; background: #edf1fb; color: var(--brand-primary-ink, #27348f); box-shadow: none; display: grid; place-items: center;
}
.app-room-caret svg { width: 12px; height: 12px; }
.app-room-caret:hover, .app-room-caret:focus-visible { background: #e6ebf7; color: var(--room-gold); border-color: #c7d3f0; }
.app-room-split > [data-ctl-mic]:not(.is-on) > svg { color: var(--room-red); border-color: rgba(179, 54, 47, 0.45); }
.app-room-split:has(> [data-ctl-mic]:not(.is-on)) > .app-room-caret { border-color: rgba(179, 54, 47, 0.45); }
.app-room-split > [data-ctl-cam]:not(.is-on) > svg { color: var(--room-red); }
.app-room-split > .app-room-control.is-on > svg { background: #edf1fb; border-color: #dbe3f3; color: #2b4bc4; }
.app-room-badge { top: -6px; inset-inline-end: -6px; border: 2px solid #ffffff; color: #0f172a; font-weight: 700; }
.app-room-control [data-chat-dot] { top: -3px; inset-inline-end: 2px; background: var(--room-red); box-shadow: 0 0 0 2px #ffffff; }
.app-room-control [data-waiting-dot] { box-shadow: 0 0 0 2px #ffffff; }
.app-room-audio { bottom: 104px; }

/* side panel, menus, sheets inside the room */
.app-room-side { background: var(--room-paper); border-color: var(--room-line); }
.app-room-menu { border-color: var(--room-line); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2); }
.app-room-menu button svg { color: var(--room-gold); }
.app-room-menu button.is-danger, .app-room-menu button.is-danger svg { color: var(--room-red); }
.app-room-waiting { background: rgba(58, 91, 208, 0.1); border-color: rgba(58, 91, 208, 0.45); }
.app-room-deny { background: transparent; color: var(--room-red); border-color: var(--room-line); }
.app-room-error { color: var(--room-red); }
.app-room-person .is-danger, .app-room-person .app-room-muted:has(svg), .app-room-muted svg { color: var(--room-red); }
.app-room-prejoin-actions .primary-button, .app-room-chat-form .primary-button, .app-room-ask-actions .primary-button { background: var(--room-gold); border-color: var(--room-gold); color: #fff; }
.app-room-icon-btn:hover, .app-room-icon-btn:focus-visible { background: var(--room-soft); }
.app-room-ask { background: #edf1fb; border-color: rgba(58, 91, 208, 0.5); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2); }
.app-room-ask-icon { background: rgba(58, 91, 208, 0.16); color: var(--room-gold); }
.app-room-reaction small { background: rgba(8, 10, 14, 0.7); }
.app-room-hands { background: #edf1fb; border: 1px solid var(--room-line); }
.app-room-slides-bar { background: #edf1fb; border: 1px solid var(--room-line); }
.app-room input, .app-room textarea, .app-room select { color-scheme: light; }
.app-room.is-immersive { background: #e6ebf7; }
.app-room.is-immersive > .app-room-header { background: rgba(255, 255, 255, 0.88); border: 1px solid var(--room-line); border-radius: 14px; padding: 8px 12px; }
.app-room.is-immersive > .app-room-controls { border: 1px solid var(--room-line); border-radius: 18px; margin: 0; padding: 10px 16px; gap: 22px; }

/* phones: leave and camera flip move to the header; five big buttons below */
@media (max-width: 720px) {
  .app-room { padding-inline: 10px; gap: 6px; }
  .app-room-header { gap: 8px; padding: 2px 0; }
  .app-room-seal { width: 30px; height: 30px; border-radius: 9px; font-size: 8px; }
  .app-room-chip.is-timer, .app-room-avatars, .app-room-chips [data-ctl-view], .app-room-chips [data-room-fullscreen], .app-room-chips .is-invite { display: none; }
  .app-room-chip.is-phone-only { display: inline-flex; }
  .app-room-chip.is-leave { padding: 6px 14px; }
  .app-room-controls { margin-inline: -10px; padding: 8px 6px max(14px, env(safe-area-inset-bottom)); gap: 0; justify-content: center; }
  .app-room-ctl-group { gap: 6px; }
  .app-room-ctl-group.is-center { flex: none; }
  .app-room-ctl-group.is-end { display: none; }
  .app-room-ctl-group.is-start { gap: 6px; }
  .app-room-control { min-width: 0; width: auto; height: auto; }
  .app-room-control > svg { width: 52px; height: 44px; padding: 11px 15px; border-radius: 14px; }
  .app-room-split > .app-room-control { padding-inline-end: 0; }
  .app-room-split > .app-room-control > svg { border-radius: 14px; border-inline-end: 1px solid #dbe3f3; }
  .app-room-split > .app-room-control > span { margin-inline-end: 0; }
  .app-room-caret { display: none; }
  .app-room-control.is-primary > svg { width: 52px; }
  .app-room-control.is-optional { display: none; }
  .app-room-control > span { font-size: 0.68rem; }
}
.app-room-controls { max-width: none; }
@media (hover: none) {
  /* phones: a clean picture; mute and pin live in the long-press / ⋯ menu */
  .app-room-tile-tools [data-mod="mute"], .app-room-tile-tools [data-ctl-mic], .app-room-tile-tools [data-pin] { display: none; }
  .app-room-tile-tools { opacity: 0.9; }
}
.app-room-tile { box-sizing: border-box; }
.app-room-menu button:hover, .app-room-menu button:focus-visible { background: #e9eefa; color: var(--room-ink); }
.app-room-name em { color: #d9cfb8; }
.app-room-menu { background: var(--room-paper); }
/* Pop-up menus: everything fits — no sideways scroll, no bare white scrollbars. */
.app-room-menu {
  grid-template-columns: minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 240px;
  max-width: min(400px, calc(100% - 16px));
  max-height: min(86dvh, 720px);
  scrollbar-width: thin;
  scrollbar-color: #c7d3f0 transparent;
}
.app-room-menu::-webkit-scrollbar { width: 6px; height: 0; }
.app-room-menu::-webkit-scrollbar-thumb { background: #c7d3f0; border-radius: 3px; }
.app-room-menu::-webkit-scrollbar-track { background: transparent; }
.app-room-menu button { min-height: 36px; min-width: 0; }
.app-room-menu .app-room-menu-title { margin: 6px 10px 2px; }

/* v16 — end-to-end encrypted meetings: the lock chip turns gold */
.app-room-secure.is-e2ee { color: var(--brand-lapis, #2341a0); }
.app-room-secure.is-e2ee svg { color: var(--brand-primary-2, #3a5bd0); }
.session-e2ee-field input[type="checkbox"] { width: auto; margin-inline-end: 6px; vertical-align: middle; }

/* v17 — presence check ("I'm here") */
.app-room-presence {
  position: absolute; inset-inline: 0; top: 18%; margin: 0 auto; z-index: 40;
  width: min(360px, calc(100vw - 32px)); padding: 22px 20px 20px; text-align: center;
  background: #ffffff; border: 1px solid var(--brand-primary-2, #3a5bd0); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
}
.app-room-presence[hidden] { display: none; }
.app-room-presence-title { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.app-room-presence-count { margin: 0 0 14px; color: var(--brand-lapis, #2341a0); font-variant-numeric: tabular-nums; }
.app-room-presence .primary-button { width: 100%; min-height: 48px; font-size: 1.05rem; background: var(--brand-primary-2, #3a5bd0); border-color: var(--brand-primary-2, #3a5bd0); color: #fff; }

/* v18 — readable "raise hand" queue on the ivory panel; banner floats instead of pushing the room down */
.app-room-hands { color: var(--room-ink, #0f172a); }
.app-room-hands h3 { color: var(--brand-lapis, #2341a0); }
.app-room-hands li span { color: #0f172a; font-weight: 600; }
.app-room-hands li::before { background: #efe3c6; color: var(--brand-primary-ink, #27348f); }
.app-room > .app-room-banner, .app-room-banner[data-room-banner] {
  position: absolute; top: 58px; inset-inline: 0; margin: 0 auto; width: max-content; z-index: 35;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12); pointer-events: none;
}
/* Same gold "Join now" for members and guests (members picked up the app's blue button). */
.app-room-prejoin .primary-button { background: linear-gradient(135deg, var(--brand-lapis, #2341a0), var(--brand-primary-2, #3a5bd0)); border-color: var(--brand-lapis, #2341a0); color: #fff; }
.app-room-prejoin .primary-button:hover { background: linear-gradient(135deg, #1d3688, var(--brand-lapis, #2341a0)); border-color: #1d3688; }
.app-guest-rejoin { margin-top: 12px; width: 100%; }
/* v20 — worship mode badge on a tile name */
.app-room-worship-badge { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-inline-end: 4px; border-radius: 50%; background: var(--brand-primary-2, #3a5bd0); color: #fff; font-size: 0.75rem; font-weight: 700; }

/* App glass ground, as on the dashboard. The colour sits in its own property: a colour inside the
   first of several background layers is invalid CSS, so the old one-line version never applied. */
.app-room {
  background-color: #eef2fb !important;
  background-image:
    radial-gradient(560px 480px at 96% -4%, rgba(86, 130, 255, 0.30), rgba(86, 130, 255, 0) 72%),
    radial-gradient(520px 460px at -6% 44%, rgba(150, 132, 255, 0.18), rgba(150, 132, 255, 0) 72%),
    radial-gradient(540px 460px at 70% 104%, rgba(255, 190, 140, 0.22), rgba(255, 190, 140, 0) 72%) !important;
}

.app-room-prejoin .is-on, .app-room-prejoin [aria-pressed="true"] { background: linear-gradient(135deg, var(--brand-lapis, #2341a0), var(--brand-primary-2, #3a5bd0)) !important; color: #fff !important; border-color: var(--brand-lapis, #2341a0) !important; }
