:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-soft: #111823;
  --surface: #16202c;
  --surface-2: #1d2938;
  --line: #26344a;
  --text: #eaf1f8;
  --muted: #93a3b6;
  --accent: #2ee6a8;
  --accent-ink: #05261b;
  --danger: #ff5d6c;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1200px 600px at 12% -10%, #16324a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #132c26 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #4bf0bb; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: #3a4f6d; background: rgba(255, 255, 255, 0.04); }
.btn-ghost[aria-pressed="false"] { opacity: 0.55; }

.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.btn-danger {
  background: #3d1620;
  border-color: #702733;
  color: #ffc2c8;
}
.btn-danger:hover { background: #521c28; border-color: #8b3040; }
.btn-wide { width: 100%; padding: 14px 18px; margin-top: 6px; }

.link-btn {
  display: block;
  margin: 18px auto 0;
  padding: 6px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* ------------------------------------------------------------------ lobby */

.lobby {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  /* the start screen's own content, then the footer along the bottom */
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 48px;
  padding: 48px clamp(20px, 6vw, 96px) 0;
}

.lobby-card { max-width: 560px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(46, 230, 168, 0.16);
}
.brand-tag {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(46, 230, 168, 0.35);
  background: rgba(46, 230, 168, 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.lobby h1 {
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 22px 0 16px;
}

.lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 32px;
  max-width: 46ch;
}

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 13, 20, 0.65);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]::placeholder { color: #5f7187; }
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.14);
}

.lobby-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.or { color: var(--muted); font-size: 13px; }
.join-row { display: flex; gap: 8px; flex: 1 1 240px; }
.join-row input { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }

.lobby[data-mode="invite"] { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.lobby[data-mode="invite"] .lobby-art { display: none; }

.invite-card { width: 100%; max-width: 460px; }
.invite-kicker {
  margin: 22px 0 18px;
  font-size: 15px;
  color: var(--muted);
}
.invite-room {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 13, 20, 0.6);
}
.invite-room span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.invite-room strong { font-size: 24px; letter-spacing: 0.16em; }

.lobby-msg { min-height: 20px; margin: 16px 0 0; font-size: 14px; color: var(--danger); }
.lobby-msg.is-info { color: var(--muted); }
/* a room that is gone gets said out loud, not muttered in grey */
.lobby-msg.is-error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 93, 108, 0.45);
  border-radius: 10px;
  background: rgba(255, 93, 108, 0.12);
  font-size: 15px;
  font-weight: 600;
  color: #ffb3ba;
}
html[data-theme="light"] .lobby-msg.is-error {
  border-color: #e6a7af;
  background: #fdebed;
  color: #8a1b26;
}

.facts {
  list-style: none;
  padding: 0;
  margin: 34px 0 0;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.facts strong { color: var(--accent); margin-right: 8px; }

/* -------------------------------------------------------------- footer */

.site-foot {
  grid-column: 1 / -1;
  align-self: end;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 24px;
  margin-top: 28px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.foot-logo { height: 18px; width: auto; }

.foot-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.foot-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
/* line icons, so the footer stays light and follows the theme colour */
.foot-links svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.foot-links a:hover,
.foot-links a:focus-visible {
  color: var(--text);
  border-bottom-color: currentColor;
}

.foot-note {
  grid-column: 1 / -1;
  margin: 0;
  max-width: 92ch;
  line-height: 1.5;
}
.foot-note strong { color: var(--text); font-weight: 600; }
.foot-copy { margin-left: 6px; opacity: 0.8; }

html[data-theme="light"] .foot-links a:hover,
html[data-theme="light"] .foot-links a:focus-visible { color: #10202e; }
html[data-theme="light"] .foot-note strong { color: #10202e; }

.foot-pages {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.foot-pages a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.foot-pages a:hover,
.foot-pages a:focus-visible { color: var(--text); border-bottom-color: currentColor; }
html[data-theme="light"] .foot-pages a:hover,
html[data-theme="light"] .foot-pages a:focus-visible { color: #10202e; }

@media (max-width: 620px) {
  .site-foot {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 28px;
    text-align: left;
  }
  .foot-links { gap: 14px; }
  /* thumb-sized targets rather than bare text */
  .foot-links a { padding: 6px 2px; }
  .foot-pages a { padding: 4px 2px; }
}

/* ------------------------------------------- about / privacy / terms pages */

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 22px 72px;
  font-size: 15px;
  line-height: 1.65;
}

.doc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.doc-top .brand { text-decoration: none; }

.doc h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.doc-lead {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 6px;
  max-width: 62ch;
}
.doc-updated {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 30px;
}
.doc h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 32px 0 8px;
}
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 14px; padding-left: 20px; }
.doc li { margin-bottom: 7px; }
.doc a { color: var(--accent); text-underline-offset: 2px; }
.doc a:hover { color: #6bffcf; }
.doc strong { color: #ffffff; }
.doc code {
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
}

.doc-card {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.doc-card p:last-child { margin-bottom: 0; }

.doc-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.doc-foot a { color: var(--muted); text-decoration: none; }
.doc-foot a:hover { color: var(--text); }

html[data-theme="light"] .doc a { color: #0b7a55; }
html[data-theme="light"] .doc a:hover { color: #0d9a63; }
html[data-theme="light"] .doc strong { color: #10202e; }
html[data-theme="light"] .doc code { background: rgba(10, 26, 42, 0.07); }
html[data-theme="light"] .doc-card { background: #ffffff; }
html[data-theme="light"] .doc-foot a:hover { color: #10202e; }

/* This build is a test bed: say so on the way in, and keep a small reminder
   in the call header. */
.test-note {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(240, 180, 92, 0.45);
  border-radius: 10px;
  background: rgba(240, 180, 92, 0.12);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.test-note strong { color: #ffd9a0; }

.test-chip {
  padding: 3px 8px;
  border: 1px solid rgba(240, 180, 92, 0.5);
  border-radius: 999px;
  background: rgba(240, 180, 92, 0.14);
  color: #ffd9a0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

html[data-theme="light"] .test-note {
  border-color: #e6c391;
  background: #fff6e5;
  color: #5a3c11;
}
html[data-theme="light"] .test-note strong { color: #8a5a12; }
html[data-theme="light"] .test-chip {
  border-color: #e6c391;
  background: #fff6e5;
  color: #8a5a12;
}

/* "paid version" teaser in the corner of the start screen */
.teaser {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 6;
  width: 212px;
  padding: 12px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(14, 22, 32, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none; /* the panel is transparent to clicks; only its summary takes them */
}
.teaser-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.teaser-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.teaser-head strong { color: var(--accent); font-weight: 700; }
.teaser-paid { margin: 6px 0 0; }
/* the line that opens the perk list: the little arrow turns as it opens */
.teaser-soon {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  list-style: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.teaser-soon::-webkit-details-marker { display: none; }
.teaser-soon::before { content: "▸"; color: var(--muted); font-size: 10px; }
.teaser-paid[open] .teaser-soon::before { content: "▾"; }
.teaser-soon:hover { color: var(--accent); }
.teaser-perks { margin: 8px 0 0; padding-left: 15px; display: grid; gap: 4px; line-height: 1.4; }
/* the list is display:grid, which would otherwise beat the browser's own
   rule that hides a closed <details> content, so hide it here by hand */
.teaser-paid:not([open]) .teaser-perks { display: none; }

/* narrow screens: the teaser joins the flow under the card instead of floating
   over it */
@media (max-width: 900px) {
  .teaser {
    position: static;
    justify-self: start;
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
  }
  .teaser-paid { margin: 3px 0 0; }
}

.lobby-art {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 460px;
  justify-self: center;
  width: 100%;
}

.art-tile {
  position: absolute;
  border-radius: 22px;
  background: linear-gradient(160deg, #23364b, #101a26);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.art-main { inset: 0 18% 22% 0; }
.art-side { inset: 58% 0 0 56%; background: linear-gradient(160deg, #1c3a33, #0e1c19); }
.art-avatar {
  width: 74px; height: 74px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
}
.art-avatar-2 { background: #9ad7ff; color: #06283b; }
.art-pill {
  position: absolute;
  left: 14px; bottom: 12px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(6, 11, 17, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.art-chat {
  position: absolute;
  left: 4%; bottom: 0;
  width: 56%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 9px;
  box-shadow: var(--shadow);
}
.art-chat .line { height: 8px; border-radius: 999px; background: #2b3d53; }
.art-chat .line.short { width: 62%; background: #35506b; }

/* ------------------------------------------------------------------- call */

.call {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px clamp(12px, 3vw, 28px) 18px;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brand-small { font-size: 11px; }
.room-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  gap: 8px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}
.room-chip-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.room-chip strong { letter-spacing: 0.14em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.people { color: var(--muted); font-size: 13px; }

.workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(var(--chat-w, 320px), 70%);
  gap: 14px;
}
.workspace.chat-hidden { grid-template-columns: minmax(0, 1fr); }
.workspace.chat-hidden .chat { display: none; }

.stage {
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 280px;
  padding: 4px;
  /* Columns come from the number of cameras on screen (see refreshStageLayout),
     and the rows share the height, so the tiles always fill the stage. */
  grid-template-columns: repeat(var(--stage-cols, 2), minmax(0, 1fr));
  grid-auto-rows: 1fr;
}

.tile {
  position: relative;
  min-height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a1119;
  border: 1px solid var(--line);
  min-height: 0;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a1119;
}
.tile.mirror video { transform: scaleX(-1); }
.tile-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #1a2b3b, #0a1119 70%);
}
.tile-fallback[hidden] { display: none; }
.tile-initial {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 32px; font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.tile-status {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.tile-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #6b7d92;
}
.tile-status[data-state="active"] { color: #9df0cb; }
.tile-status[data-state="active"]::before { background: var(--accent); box-shadow: 0 0 8px rgba(46, 230, 168, 0.8); }
.tile-status[data-state="idle"] { color: #ffd9a0; }
.tile-status[data-state="idle"]::before { background: #f0b45c; }

/* a frozen last frame is not a person: hide the picture when the stream is idle */
.tile.is-idle video { visibility: hidden; }

.stage-empty {
  margin: 0;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.stage-empty[hidden] { display: none; }

.tile-bar {
  position: absolute;
  z-index: 2;
  left: 10px; right: 10px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  pointer-events: none;
}
.tile-name {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-badges { display: flex; gap: 6px; margin-left: auto; }
.tile-expand,
.tile-hide,
.tile-show {
  pointer-events: auto;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 9, 14, 0.72);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.tile-expand:hover,
.tile-hide:hover,
.tile-show:hover { background: rgba(22, 34, 48, 0.92); border-color: rgba(255, 255, 255, 0.24); }
.tile-expand:focus-visible,
.tile-hide:focus-visible,
.tile-show:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a camera can be hidden on this screen only; the other person keeps sending it */
.tile.is-view-hidden video { display: none; }
.tile.is-view-hidden .tile-fallback { display: none; }
.tile-hidden-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: #0a1119;
  color: var(--muted);
  font-size: 12px;
}
.tile-hidden-note[hidden] { display: none; }

/* one remote camera filling the window */
.tile.is-full {
  position: fixed;
  inset: 0;
  z-index: 9400;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: #000;
}
.tile.is-full video { object-fit: contain; }
.tile.is-full .tile-bar { left: 18px; right: 18px; bottom: 18px; }
.badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(5, 9, 14, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}
.badge.off { background: rgba(255, 93, 108, 0.16); border-color: rgba(255, 93, 108, 0.4); }
.badge.rec { color: #ff5d6c; background: rgba(255, 93, 108, 0.18); border-color: rgba(255, 93, 108, 0.5); }

/* ---------------------------------------------------------------- recording */

.rec-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 93, 108, 0.5);
  background: rgba(255, 93, 108, 0.14);
  color: #ffc2c8;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rec-status[hidden] { display: none; }
.rec-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ff5d6c;
  animation: rec-blink 1.2s steps(2, start) infinite;
}
@keyframes rec-blink { 50% { opacity: 0.25; } }

#recBtn.is-recording { background: #3d1620; border-color: #702733; color: #ffc2c8; }

/* ------------------------------------------------------------------- chat */

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.02em; }
.chat-hint { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }

.messages {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 92%; }
.msg-head { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.msg-head strong { color: #cfe0f0; font-weight: 600; }
.msg-body {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-body a {
  color: #7ef0c6;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.msg-body a:hover { color: #b6ffe8; }

/* Every message starts from the left, name and time above the bubble: your own
   is told apart by its colour, not by jumping to the far side. */
.msg.mine { align-self: flex-start; align-items: flex-start; }
.msg.mine .msg-body { background: #16342c; border-color: #245544; }
.msg.system { max-width: 100%; align-self: center; }
.msg.system .msg-body {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
  text-align: center;
}

/* someone leaving: a small red bullet in front of the line, so it is noticed */
.msg.system.is-leave .msg-body {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffb3bd;
}
.sys-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 93, 108, 0.18);
}
html[data-theme="light"] .msg.system.is-leave .msg-body { color: #b3263a; }
.msg.system.is-leave { transition: opacity 0.4s ease; }
.msg.system.is-leave.is-going { opacity: 0; }

.chat-form {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.chat-form input { flex: 1; padding: 10px 12px; border-radius: 10px; }
.btn-send { padding: 10px 16px; border-radius: 10px; }

/* --------------------------------------------------------------- controls */

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ctrl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.ctrl:hover { transform: translateY(-1px); border-color: #3a4f6d; }
.ctrl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ctrl svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctrl[aria-pressed="false"] { background: #3a1620; border-color: #6b2733; color: #ffb3bb; }
/* the pause button is "pressed" while video is paused */
#pauseBtn[aria-pressed="true"] { background: #3a1620; border-color: #6b2733; color: #ffb3bb; }
#pauseBtn[aria-pressed="false"] { background: var(--surface); border-color: var(--line); color: var(--text); }

.ctrl-danger { background: #3d1620; border-color: #702733; color: #ffc2c8; }
.ctrl-danger:hover { background: #521c28; }

.banner {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 16px;
  border-radius: 12px;
  background: #3a1620;
  border: 1px solid #6b2733;
  color: #ffd7db;
  font-size: 13px;
  max-width: min(92vw, 620px);
}
.banner[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(9, 15, 22, 0.94);
  border: 1px solid var(--line);
  font-size: 13px;
  animation: pop 0.16s ease;
}
.toast[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; padding: 36px 20px 48px; gap: 28px; }
  .lobby-art { display: none; }
  .lobby h1 { font-size: clamp(30px, 8vw, 42px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace .chat { max-height: 40vh; }
  .stage { align-content: start; grid-auto-rows: auto; grid-template-columns: minmax(0, 1fr); }
  .tile { aspect-ratio: 4 / 3; min-height: 0; }
}

@media (max-width: 560px) {
  .call { padding: 10px 10px 14px; }
  .brand-small, .people, .room-chip-label { display: none; }
  .topbar { gap: 8px; }
  .topbar-right { gap: 6px; }
  .ctrl-label { display: none; }
  .ctrl { padding: 13px; }
  .btn-small { font-size: 12px; padding: 0 10px; }
  .controls {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 60%, transparent);
  }
}

/* On a desktop the call fills the window, so the stage has a definite height and the
   rows can share it (see refreshStageLayout). Phones keep the layout that scrolls. */
@media (min-width: 901px) {
  .call { height: 100dvh; min-height: 0; }
  .stage { min-height: 0; }
}

/* what the tab shows after the call moved to its own window */
.moved {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* while hidden, the page itself must not scroll behind the cover */
html.privacy-on { overflow: hidden; }

/* neutral cover for the hide shortcut */
.privacy {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background: #f1f2f4;
}

/* "Hide shows" chooser in the call header */
.hide-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.hide-mode select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.hide-mode select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hide-mode option { background: var(--surface); color: var(--text); }

/* ------------------------------------------------ cover: spreadsheet */
.sheet {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1f2328;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12.5px;
}
.sheet-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  background: #217346;
  color: #fff;
}
.sheet-head strong { font-size: 13px; font-weight: 600; }
.sheet-head span { font-size: 11.5px; opacity: 0.85; }
.sheet-ribbon {
  display: flex;
  gap: 18px;
  padding: 6px 14px;
  border-bottom: 1px solid #e1e4e8;
  color: #444;
  font-size: 12px;
}
.sheet-ribbon .on { color: #217346; font-weight: 600; box-shadow: inset 0 -2px 0 #217346; }
.sheet-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 5px;
  border-bottom: 1px solid #e1e4e8;
  background: #fafbfc;
  color: #3b4048;
  font-size: 11.5px;
  overflow: hidden;
}
.sheet-tools .tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #dfe3e7;
  border-radius: 3px;
  background: #fff;
  white-space: nowrap;
}
.sheet-tools .tool.wide { min-width: 78px; justify-content: space-between; }
.sheet-tools .bold { font-weight: 700; }
.sheet-tools .ital { font-style: italic; }
.sheet-tools .und { text-decoration: underline; }
.sheet-tools .sep { width: 1px; height: 20px; margin: 0 4px; background: #e1e4e8; }
.sheet-formula {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-bottom: 1px solid #e1e4e8;
  color: #333;
  font-size: 12px;
}
.sheet-formula .ref {
  min-width: 54px;
  padding: 3px 8px;
  border: 1px solid #d5d9de;
  border-radius: 3px;
  background: #f7f8fa;
}
.sheet-formula .fx { color: #6b7280; font-style: italic; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; }
.sheet-grid { border-collapse: collapse; width: 100%; table-layout: fixed; }
.sheet-grid th,
.sheet-grid td { border: 1px solid #e6e8eb; padding: 4px 8px; text-align: left; font-weight: 400; }
.sheet-grid thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  color: #5b6169;
  text-align: center;
  font-size: 11px;
}
.sheet-grid .corner,
.sheet-grid .rowhead {
  width: 42px;
  background: #f3f4f6;
  color: #6b7280;
  text-align: center;
  font-size: 11px;
}
.sheet-grid td.head { font-weight: 600; background: #f7f9fa; }
.sheet-grid td.label { color: #31363c; }
.sheet-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-grid td.sel { outline: 2px solid #217346; outline-offset: -2px; background: #eaf5ef; }
.sheet-bar {
  display: flex;
  gap: 2px;
  padding: 4px 12px 0;
  border-top: 1px solid #e1e4e8;
  color: #555;
  font-size: 12px;
}
.sheet-bar span { padding: 4px 10px 6px; }
.sheet-bar .on { color: #217346; font-weight: 600; box-shadow: inset 0 -2px 0 #217346; }
.sheet-status {
  display: flex;
  gap: 24px;
  padding: 4px 12px;
  border-top: 1px solid #e1e4e8;
  background: #fafbfc;
  color: #6b7280;
  font-size: 11.5px;
}

/* ---------------------------------------------------- cover: news site */
.news {
  height: 100%;
  overflow: auto;
  background: #fbf9f5;
  color: #16181c;
  font-family: Georgia, "Times New Roman", serif;
}
.news-masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 24px 10px;
  border-bottom: 3px double #16181c;
}
.news-masthead strong { font-size: 34px; letter-spacing: 0.06em; text-transform: uppercase; }
.news-date,
.news-sub {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a6b70;
}
.news-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  padding: 8px;
  border-bottom: 1px solid #d9d4c7;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4b4d55;
}
.news-nav .on { color: #a3161b; border-bottom: 2px solid #a3161b; }
.news-main {
  display: grid;
  grid-template-columns: minmax(0, 720px) 260px;
  gap: 36px;
  justify-content: center;
  padding: 26px 24px 40px;
}
.news-kicker {
  margin: 0 0 6px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a3161b;
}
.news-main h1 { margin: 0 0 10px; font-size: 30px; line-height: 1.2; }
.news-deck { margin: 0 0 12px; font-size: 16px; line-height: 1.5; color: #40434b; }
.news-byline {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d9d4c7;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  color: #6a6b70;
}
.news-main article p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.62; }
.news-side h2 {
  margin: 4px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d9d4c7;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a6b70;
}
.news-side ol { margin: 0; padding-left: 18px; }
.news-side li { margin-bottom: 10px; font-size: 14px; line-height: 1.4; }
.news-foot {
  padding: 14px 24px 20px;
  border-top: 1px solid #d9d4c7;
  text-align: center;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  color: #6a6b70;
}

@media (max-width: 760px) {
  .news-main { grid-template-columns: minmax(0, 1fr); }
  .news-side { display: none; }
  .news-masthead strong { font-size: 26px; }
}

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

/* ------------------------------------------------------------- light theme */

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6f9;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --line: #d6dee7;
  --text: #15202b;
  --muted: #5c6c7e;
  --accent: #0d9a63;
  --accent-ink: #ffffff;
  --danger: #c8303f;
  --shadow: 0 18px 44px rgba(17, 34, 51, 0.14);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 12% -10%, #dcebf8 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #d9f1e5 0%, transparent 55%),
    var(--bg);
}

html[data-theme="light"] .btn-primary:hover { background: #12b374; }
html[data-theme="light"] .btn-ghost:hover { border-color: #9fb0c3; background: rgba(21, 32, 43, 0.05); }
html[data-theme="light"] .btn-small { background: rgba(21, 32, 43, 0.04); }
html[data-theme="light"] .room-chip { background: rgba(21, 32, 43, 0.04); }
html[data-theme="light"] .ctrl:hover { border-color: #9fb0c3; }
html[data-theme="light"] input[type="text"] { background: #ffffff; }
html[data-theme="light"] input[type="text"]::placeholder { color: #8593a3; }
html[data-theme="light"] .invite-room { background: #f7fafc; }
html[data-theme="light"] .teaser { background: rgba(255, 255, 255, 0.92); }

html[data-theme="light"] .btn-danger,
html[data-theme="light"] .ctrl-danger,
html[data-theme="light"] .ctrl[aria-pressed="false"],
html[data-theme="light"] #pauseBtn[aria-pressed="true"],
html[data-theme="light"] #recBtn.is-recording {
  background: #fdebed;
  border-color: #f0bcc2;
  color: #a3161b;
}
html[data-theme="light"] .btn-danger:hover,
html[data-theme="light"] .ctrl-danger:hover { background: #fbdfe3; border-color: #e6a7af; }

html[data-theme="light"] .rec-status {
  background: #fdebed;
  border-color: #f0bcc2;
  color: #a3161b;
}
html[data-theme="light"] .banner { background: #fdebed; border-color: #f0bcc2; color: #8a1b26; }
html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  color: var(--text);
}

html[data-theme="light"] .msg-head strong { color: #1b3a4b; }
html[data-theme="light"] .msg-body a { color: #0b7a55; }
html[data-theme="light"] .msg-body a:hover { color: #0d9a63; }
html[data-theme="light"] .msg.mine .msg-body { background: #e7f7f0; border-color: #c2e6d7; }

/* tiles keep their dark video look, so everything drawn on them stays light */
html[data-theme="light"] .tile-name,
html[data-theme="light"] .tile-status,
html[data-theme="light"] .badge,
html[data-theme="light"] .tile-expand,
html[data-theme="light"] .tile-hide,
html[data-theme="light"] .tile-show,
html[data-theme="light"] .tile-hidden-note,
html[data-theme="light"] .art-pill { color: #eaf1f8; }
html[data-theme="light"] .tile-status[data-state="active"] { color: #9df0cb; }
html[data-theme="light"] .tile-show { background: rgba(5, 9, 14, 0.72); border-color: rgba(255, 255, 255, 0.14); }

.theme-btn { text-transform: none; letter-spacing: 0; }

@media (max-width: 560px) {
  /* the call header is crowded on phones; the theme lives on the start screen */
  .topbar .theme-btn { display: none; }
}

/* --------------------------------------------------------------------- ads */

.ad {
  display: grid;
  gap: 3px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 10px 12px;
  font-size: 12px;
}
.ad[hidden] { display: none; }
.ad-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-title { font-size: 13px; font-weight: 600; }
.ad-text { color: var(--muted); line-height: 1.45; }
.ad-cta { margin-top: 6px; color: var(--accent); font-weight: 600; text-decoration: none; }
.ad-cta:hover { text-decoration: underline; }

.lobby-card .ad { margin-top: 18px; }
.ad-call { flex: 0 0 auto; margin: 0 12px 4px; }

/* ------------------------------------------------------ moving things about */

.tile.is-dragging { opacity: 0.45; }
.tile.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -3px; }

.chat-head { cursor: grab; }
.chat-head:active { cursor: grabbing; }

.workspace:not(.chat-hidden)[data-chat-side="left"] {
  grid-template-columns: min(var(--chat-w, 320px), 70%) minmax(0, 1fr);
}
.workspace[data-chat-side="left"] .chat { order: -1; }

/* a lone camera does not need the whole stage, so it is kept to a comfortable size */
/* :not(.is-full) so a camera opened full page is never held to this size */
.stage[data-count="1"] .tile:not(.is-full) {
  width: min(100%, 640px);
  max-height: 100%;
  aspect-ratio: 16 / 10;
  justify-self: center;
  align-self: center;
}

/* the stage with every camera off is the biggest empty panel in the call */
.stage-empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 24px 16px;
}
.stage-empty-note { margin: 0; }
.ad-stage { width: min(100%, 420px); text-align: left; padding: 16px 18px; }

@media (max-width: 900px) {
  .workspace:not(.chat-hidden)[data-chat-side] { grid-template-columns: minmax(0, 1fr); }
  .workspace[data-chat-side="left"] .chat { order: 0; }
  .stage[data-count="1"] .tile:not(.is-full) { width: 100%; max-height: none; aspect-ratio: 4 / 3; }
}

/* ------------------------------------------------ chat takes over when idle */

/* No camera on: there is no video to watch, so the chat becomes the main window
   and the empty stage panel steps aside (it is still there if the chat is hidden). */
.workspace.chat-wide:not(.chat-hidden) { grid-template-columns: minmax(0, 1fr); }
.workspace.chat-wide:not(.chat-hidden) .stage { display: none; }
.workspace.chat-wide .chat-split { display: none; }

.chat-cam-note {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.chat-cam-note[hidden] { display: none; }

/* the divider between video and chat */
.chat-split {
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(min(var(--chat-w, 320px), 70%) + 3px);
  width: 9px;
  z-index: 6;
  cursor: col-resize;
  touch-action: none;
  border-radius: 6px;
  background: transparent;
  transition: background 0.15s ease;
}
.workspace[data-chat-side="left"] .chat-split {
  right: auto;
  left: calc(min(var(--chat-w, 320px), 70%) + 3px);
}
.chat-split:hover,
.chat-split:focus-visible,
.chat-split.is-resizing { background: var(--accent); outline: none; }
.workspace.chat-hidden .chat-split { display: none; }

@media (max-width: 900px) {
  .chat-split { display: none; }
}

/* ------------------------------------------------------------------- brand */

/* Both logo files are cut out of their card, so they sit straight on the page
   background — whatever it is — with no tile behind them. */
.brand-logo {
  display: block;
  height: 64px;
  width: auto;
  flex: 0 0 auto;
}
.brand-small .brand-logo { height: 30px; }
.brand { text-transform: none; letter-spacing: 0; }

@media (max-width: 560px) {
  .brand-logo { height: 48px; }
  .brand-small .brand-logo { height: 26px; }
}

/* ------------------------------------------------- a recording waiting to save */

.rec-save {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
}
.rec-save[hidden] { display: none; }
.rec-save-copy { display: grid; gap: 2px; margin-right: auto; min-width: 0; }
.rec-save-meta {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

/* the little credit under the logo on the start screens */
.brand-mark {
  display: grid;
  gap: 5px;
  justify-items: start;
}
.brand-credit {
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
/* only shows while the logo itself is hovered (or the credit, so it doesn't flicker) */
.brand-logo:hover + .brand-credit,
.brand-credit:hover {
  opacity: 1;
  visibility: visible;
}
.brand-small .brand-credit { display: none; }

/* ------------------------------------------- chat: emoji picker and attachments */

.chat { position: relative; }

.chat-tool {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  border-radius: 10px;
}

.emoji-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 2px;
  padding: 8px;
  max-height: 186px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.emoji-panel[hidden] { display: none; }
.emoji-item {
  font-size: 18px;
  line-height: 1;
  padding: 6px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.emoji-item:hover,
.emoji-item:focus-visible { background: rgba(255, 255, 255, 0.1); }

.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}
.msg-file-icon { font-size: 15px; }
.msg-img {
  display: block;
  max-width: 100%;
  max-height: 170px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.msg-file-name { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }

html[data-theme="light"] .emoji-panel { box-shadow: 0 18px 40px rgba(15, 32, 51, 0.18); }
html[data-theme="light"] .emoji-item:hover,
html[data-theme="light"] .emoji-item:focus-visible { background: rgba(12, 26, 42, 0.08); }

/* the host's "wipe everything" control, in the chat header */
.chat-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-clear { flex: 0 0 auto; padding: 4px 9px; font-size: 11px; }
#adminBtn { display: inline-flex; align-items: center; text-decoration: none; }
.chat-head-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* "Host link" / "Invite link" — which of the two links this page came from */
.role-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.role-chip[hidden] { display: none; }
.role-chip.is-host {
  color: #7ef0c6;
  border-color: rgba(126, 240, 198, 0.45);
  background: rgba(126, 240, 198, 0.12);
}
.role-chip.is-invite {
  color: #9cc3ff;
  border-color: rgba(156, 195, 255, 0.4);
  background: rgba(156, 195, 255, 0.12);
}
.invite-kicker .role-chip { margin-left: 6px; }

html[data-theme="light"] .role-chip.is-host {
  color: #06795a;
  border-color: #9ad8c4;
  background: #e6f7f1;
}
html[data-theme="light"] .role-chip.is-invite {
  color: #1a5aa8;
  border-color: #b6cdf0;
  background: #eaf1fc;
}

/* the host's door: people waiting to be let in. Kept small, with dark text on a
 * plain surface so the name and the two answers stay readable in both themes. */
.join-queue {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: auto;
  max-width: 360px;
  margin: 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.join-queue[hidden] { display: none; }
.join-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto; /* the lobby's join row sets a 240px basis; this one is a single line */
  font-size: 12px;
  color: var(--text);
}
.join-row-name {
  margin-right: auto;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--text);
}
.join-row .btn {
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.5;
}
html[data-theme="light"] .join-queue { box-shadow: 0 4px 14px rgba(15, 32, 51, 0.14); }

/* who is in the chat, above the messages: an avatar, a name and a bullet that
   says what that page is doing — active, idle, writing, or gone */
.chat-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 4px;
}
.chat-people[hidden] { display: none; }
.chat-person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
  max-width: 100%;
}
.person-avatar {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(46, 230, 168, 0.16);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.person-name {
  color: var(--text);
  font-weight: 600;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #5b7286;
  transition: background 0.2s ease;
}
.person-dot[data-state="active"] { background: var(--accent); box-shadow: 0 0 0 2px rgba(46, 230, 168, 0.18); }
.person-dot[data-state="idle"] { background: #f0b45c; box-shadow: 0 0 0 2px rgba(240, 180, 92, 0.18); }
.person-dot[data-state="typing"] {
  background: #7ec8ff;
  box-shadow: 0 0 0 2px rgba(126, 200, 255, 0.22);
  animation: person-typing 1s ease-in-out infinite;
}
.person-dot[data-state="left"] { background: var(--danger); box-shadow: 0 0 0 2px rgba(255, 93, 108, 0.2); }
@keyframes person-typing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.55; }
}
.person-tag {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.chat-person[data-state="typing"] { border-color: rgba(126, 200, 255, 0.45); }
.chat-person[data-state="typing"] .person-tag { color: #7ec8ff; }
.chat-person[data-state="idle"] .person-tag { color: #f0b45c; }
.chat-person[data-state="left"] { opacity: 0.72; border-style: dashed; }
.chat-person[data-state="left"] .person-tag { color: var(--danger); }
.chat-person[data-state="left"] .person-name { color: var(--muted); text-decoration: line-through; }
.chat-person.is-you { color: var(--text); border-color: rgba(126, 240, 198, 0.4); }
html[data-theme="light"] .chat-person.is-you { border-color: #9ad8c4; }
html[data-theme="light"] .person-avatar { background: rgba(10, 122, 79, 0.12); color: #0a7a4f; }

/* A small primary button keeps its accent fill: the light-theme `.btn-small` rule
 * was painting the fill away and leaving white text on a white button. */
.btn-small.btn-primary { background: var(--accent); color: var(--accent-ink); }
html[data-theme="light"] .btn-small.btn-primary {
  background: #0a7a4f;
  border-color: #0a7a4f;
  color: #ffffff;
}
html[data-theme="light"] .btn-small.btn-primary:hover {
  background: #08633f;
  border-color: #08633f;
}
.join-row .btn-primary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ------------------------------------------ starting the camera and microphone */

/* A call is joined with the camera and microphone closed. This bar sits above the
   stage, so it stays visible whatever the layout (chat-only included) is doing. */
.media-start {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.media-start[hidden] { display: none; }

.media-start-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
}
.media-start-copy strong { font-size: 13px; }
.media-start-copy span { font-size: 12px; color: var(--muted); }

.btn-start {
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  letter-spacing: 0.01em;
}
.btn-start:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Once both are running the bar stays, so the same button can switch them off. */
.media-start.is-on {
  border-color: rgba(46, 230, 168, 0.45);
  background: rgba(46, 230, 168, 0.08);
}

html[data-theme="light"] .btn-start.btn-danger {
  background: #fde8ea;
  border-color: #f0bcc2;
  color: #a3161b;
}
html[data-theme="light"] .btn-start.btn-danger:hover {
  background: #fbdfe3;
  border-color: #e6a7af;
}

@media (max-width: 620px) {
  .btn-start { width: 100%; padding: 16px 20px; }
  .media-start-copy { margin-right: 0; }
}

/* ------------------------------------------------------------ feedback form */
.fb-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}
.fb-dialog::backdrop { background: rgba(4, 10, 18, 0.62); }
.fb-dialog form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.fb-dialog h2 { margin: 0; font-size: 18px; }
.fb-lead { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.fb-dialog .field { display: flex; flex-direction: column; gap: 6px; }
.fb-dialog .field span { font-size: 12px; color: var(--muted); }
.fb-dialog input,
.fb-dialog textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
}
.fb-dialog textarea { resize: vertical; min-height: 110px; }
.fb-dialog input:focus,
.fb-dialog textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.fb-actions { display: flex; justify-content: flex-end; gap: 10px; }
.fb-status { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); }


/* ------------------------------------------------------------ keep it free */

.keep-free {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.donate-btn { gap: 6px; flex: none; }

.heart { color: #ff7b8a; }
.donate-dialog .heart { color: inherit; }

.foot-donate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.donate-dialog .donate-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.donate-dialog h2 { display: flex; align-items: center; gap: 8px; }
.donate-heart { color: #ff7b8a; font-size: 16px; }
.donate-perks {
  margin: 0;
  padding-left: 17px;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.donate-note { margin: 0; font-size: 12px; color: var(--muted); }

html[data-theme="light"] .keep-free { background: #f7fafc; }
html[data-theme="light"] .heart { color: #c8303f; }
