/* Layout and text only: the glass itself is drawn by the wgpu canvas behind every .glass element. */
:root {
  --text: rgba(255, 255, 255, 0.96);
  --text-dim: rgba(255, 255, 255, 0.55);
  --text-faint: rgba(255, 255, 255, 0.38);
  --active: rgb(77, 230, 128);
  --accent: rgb(110, 160, 255);
  --gap: 16px;
  /* Tiles: the glass corner, the gap to the picture, and the picture's corner (outer - gap). */
  --tile-r: 18px;
  --tile-pad: 6px;
  --tile-inner: calc(var(--tile-r) - var(--tile-pad));
  font-family: -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05060b;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

#ui > * { pointer-events: auto; }
/* A faded-out panel must not catch clicks meant for what's under it (same specificity as above, later). */
#ui > .hidden { pointer-events: none; }

/* Glass elements have no CSS background: the canvas draws them. */
.glass { background: transparent; border: none; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: none;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sub { color: var(--text-dim); font-weight: 400; font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---- Top bar ---- */
.bar {
  position: absolute;
  top: var(--gap);
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100vw - 2 * var(--gap)));
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
}

.title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; white-space: nowrap; }

.live {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 0.2s, box-shadow 0.2s;
}
.live.on { background: var(--active); box-shadow: 0 0 10px var(--active); }

.chip { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.meter { display: flex; align-items: center; gap: 10px; }
.meter-track {
  position: relative;
  width: 110px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
#level {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  transition: width 0.06s linear;
}
#level.voice { background: var(--active); }
#floor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: rgba(255, 210, 90, 0.9);
}
#perf { min-width: 74px; text-align: right; }

/* ---- Side panel ---- */
.side {
  position: absolute;
  top: calc(var(--gap) + 56px + 14px);
  right: var(--gap);
  width: 300px;
  padding: 16px;
}

.side-title { font-weight: 600; font-size: 14px; margin: 2px 4px 10px; display: flex; justify-content: space-between; }

#pip {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
}

#people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#people li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px;
  border-radius: 14px;
  transition: background 0.2s;
}
#people li.active { background: rgba(77, 230, 128, 0.14); }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
}
li.active .avatar { background: var(--active); color: #0b2414; text-shadow: none; }
.who { font-size: 14px; }
.speak-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); margin-top: 5px; overflow: hidden; }
.speak-track div { height: 100%; background: var(--active); width: 0; transition: width 0.1s linear; }
.talk { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.hint { color: var(--text-faint); font-size: 12px; margin: 14px 4px 2px; line-height: 1.4; }

/* ---- Liquid tab selector ---- */
.tabs {
  position: absolute;
  bottom: calc(var(--gap) + 6px);
  left: 50%;
  transform: translateX(-50%);
  height: 60px;
  padding: 6px;
  display: flex;
  align-items: center;
}
.tabs button {
  position: relative;
  width: 112px;
  height: 48px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.25s;
}
.tabs button.on { color: var(--text); }
.lens { position: absolute; pointer-events: none; }

/* ---- Round buttons ---- */
.dock { position: absolute; bottom: calc(var(--gap) + 22px); display: flex; gap: 14px; }
/* The control bar: one glass bar, centred at the bottom, labels inside it. */
.bar-dock {
  left: 50%;
  bottom: calc(var(--gap) + 6px);
  transform: translateX(-50%);
  padding: 10px 18px 26px;
  gap: 12px;
  max-width: calc(100vw - 2 * var(--gap));
}
.bar-dock .round { width: 52px; height: 52px; }
.bar-dock .round[data-label]::after { top: calc(100% + 3px); }
.dock.left { left: calc(var(--gap) + 4px); }
.dock.right { right: calc(var(--gap) + 4px); }
.round { width: 56px; height: 56px; display: grid; place-items: center; }

/* ---- Screens: home, new meeting, pre-join ---- */
.screen {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 2 * var(--gap)));
  max-height: calc(100vh - 2 * var(--gap));
  overflow-y: auto;
  padding: 30px 32px 26px;
  transition: opacity 0.3s;
}
.screen.hidden { opacity: 0; pointer-events: none; }
.screen h1 { margin: 0 0 10px; font-size: 30px; font-weight: 650; letter-spacing: -0.015em; }
.screen h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.screen > p { margin: 0 0 22px; color: rgba(255, 255, 255, 0.78); line-height: 1.5; font-size: 15px; }
.screen-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.screen .sub { color: var(--text-dim); font-size: 13px; }
/* Pre-join: centred like the other screens; the camera shows in the card's preview. */
.prejoin { width: min(460px, calc(100vw - 2 * var(--gap))); }
.pj-note { margin: -8px 0 12px !important; font-size: 13px !important; }
.pj-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--tile-inner); margin-bottom: 16px; background: rgba(0, 0, 0, 0.25); }
.pj-preview-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); font-size: 14px; }
.pj-preview-off[hidden] { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.screen input:not([type=radio]):not([type=checkbox]), .screen select {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  width: 100%;
}
.screen select option { background: #1b2033; }
.screen input:focus, .screen select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.join-row { display: flex; gap: 8px; margin: 16px 0 6px; }
.join-row input { flex: 1; }
.actions.end { justify-content: flex-end; margin-top: 6px; }
.divider { height: 1px; background: rgba(255, 255, 255, 0.14); margin: 20px 0 14px; }
.home .field-label { display: block; margin-bottom: 10px; }
.recent-wrap { margin-top: 18px; }
#recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
#recent li { display: flex; align-items: center; gap: 8px; }
#recent .rejoin { flex: 1; text-align: left; padding: 8px 10px; border-radius: 12px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
#recent .rejoin:hover { background: rgba(255, 255, 255, 0.1); }
#recent .when { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.choice { display: grid; gap: 8px; }
.choice label, .check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.35; cursor: pointer; }
.choice label { padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.12); }
.choice label:has(input:checked) { border-color: var(--accent); background: rgba(110, 160, 255, 0.12); }
.choice input, .check input { accent-color: var(--accent); margin-top: 3px; }
.check { margin: 2px 0 6px; }
.pj-meter { display: flex; align-items: center; gap: 10px; margin: -4px 0 18px; }
.pj-meter .meter-track { width: 120px; flex: none; }
#pj-level { height: 100%; width: 0; background: var(--active); border-radius: inherit; transition: width 0.08s; }
.toggles { display: flex; align-items: center; gap: 12px; }
.toggles .join-now { margin-left: auto; }
/* Mic / camera buttons: struck through when off. */
.round .slash { position: absolute; display: none; }
.round { position: relative; }
.round.toggle:not(.on) .slash { display: block; }
.round.toggle:not(.on) { color: rgb(255, 170, 160); }
/* Every round button says what it is, under it. */
.round[data-label]::after {
  content: attr(data-label);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-dim);
  pointer-events: none;
}
.round.toggle:not(.on)[data-label]::after { color: rgb(255, 170, 160); }
/* Leave: red, apart from the others (bottom right). */
.round.leave { color: #fff; margin-left: 14px; width: 64px !important; }
.in-call .round.leave { display: grid !important; }
.in-call .not-in-call { display: none !important; }
/* Developer tools only with ?debug. */
#btn-debug, #perf { display: none !important; }
.debug #btn-debug { display: grid !important; position: absolute; }
.debug #perf { display: inline !important; }
.in-call.debug #btn-debug { right: calc(var(--gap) + 84px); }
/* "Framing" over the Speaker / Group / Off selector. */
.tabs-label {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gap) + 66px);
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  pointer-events: none;
}
.toast {
  position: fixed;
  z-index: 30;
  top: calc(var(--gap) + 64px);
  left: 50%;
  transform: translate(-50%, -12px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 24, 40, 0.92);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
/* ---- Not in the meeting yet ---- */
.waiting {
  position: absolute;
  z-index: 15;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 2 * var(--gap)));
  padding: 30px 32px 26px;
  text-align: center;
  transition: opacity 0.3s;
}
.waiting.hidden { opacity: 0; pointer-events: none; }
.waiting h2 { margin: 4px 0 10px; font-size: 24px; font-weight: 650; }
.waiting p { margin: 0 0 12px; color: rgba(255, 255, 255, 0.8); line-height: 1.5; font-size: 15px; }
.waiting .sub { font-size: 13px; color: var(--text-dim); }
.waiting #wait-kicker { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; font-size: 12px; color: rgb(255, 200, 120); }
.waiting.denied #wait-kicker, .waiting.failed #wait-kicker { color: rgb(255, 150, 140); }
.actions.center { justify-content: center; margin-top: 18px; }
/* Three dots that pulse while waiting. */
.wait-icon { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; height: 12px; }
.wait-icon span { width: 10px; height: 10px; border-radius: 50%; background: rgb(255, 200, 120); animation: wait-pulse 1.4s infinite ease-in-out; }
.wait-icon span:nth-child(2) { animation-delay: 0.2s; }
.wait-icon span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wait-pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.1); } }
.waiting.denied .wait-icon, .waiting.failed .wait-icon { display: none; }
/* While not in: what only works inside the meeting steps aside, and the top bar says so. */
.not-in #btn-call, .not-in #btn-cc, .not-in #btn-leave, .not-in #remotes, .not-in #stage-name,
.not-in #captions, .not-in #invite, .not-in #side { opacity: 0 !important; pointer-events: none !important; }
.not-in #e2ee { color: rgb(255, 200, 120); }
/* ---- In calls the captions bar is the transcript: no side panel; framing lives in the camera menu ---- */
#side, #tabs, #tabs-label, #btn-switchcam, #cam-menu { display: none !important; }
.stage-name { top: auto !important; left: calc(var(--gap) + 4px) !important; transform: none !important; bottom: calc(var(--gap) + 20px); }
.cap-tools #cap-save { font-size: 12px; font-weight: 600; color: var(--accent); }

/* ---- Hover menus (mic, camera) ---- */
.popover {
  position: absolute;
  z-index: 16;
  bottom: calc(var(--gap) + 112px); /* above the control bar */
  width: min(320px, calc(100vw - 2 * var(--gap)));
  padding: 16px 18px;
  display: grid;
  gap: 10px;
  transition: opacity 0.18s;
}
.popover.hidden { opacity: 0; pointer-events: none; }
.pop-title { font-weight: 650; font-size: 15px; }
.pop-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; margin-top: 4px; }
.popover .sub { color: var(--text-dim); font-weight: 400; font-size: 12px; }
.popover select { font: inherit; font-size: 14px; color: var(--text); background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px; padding: 7px 10px; width: 100%; }
.popover select option { background: #1b2033; }
.popover input[type=range] { width: 100%; accent-color: var(--accent); }
.pop-meter { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#mp-level { height: 100%; width: 0; background: var(--active); transition: width 0.08s; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-grid.wide { grid-template-columns: repeat(6, 1fr); }
.bg-grid.wide button { font-size: 11px; aspect-ratio: 4 / 3; }
.bg-status { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-faint); margin-left: 6px; }
.bg-grid button { aspect-ratio: 16 / 10; border-radius: 10px; font-size: 12px; font-weight: 600; background-size: cover; background-position: center; border: 2px solid transparent; background-color: rgba(255, 255, 255, 0.1); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.bg-grid button.on { border-color: var(--accent); }
.bg-grid button:hover { filter: brightness(1.15); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 4px; }
.seg button { height: 32px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.seg button.on { background: rgba(110, 160, 255, 0.4); color: var(--text); }
.pop-hint { margin: -2px 0 0; }
/* ---- Screen sharing ---- */
.share-guide { position: absolute; z-index: 18; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100vw - 2 * var(--gap))); padding: 26px 28px 22px; transition: opacity 0.25s; }
.share-guide.hidden { opacity: 0; pointer-events: none; }
.share-guide h2 { margin: 0; font-size: 22px; }
.share-guide p { color: rgba(255, 255, 255, 0.82); line-height: 1.5; font-size: 15px; margin: 0 0 12px; }
.share-steps { margin: 0 0 18px; padding-left: 22px; line-height: 1.8; font-size: 14.5px; color: rgba(255, 255, 255, 0.9); }
.share-screen-note { margin-top: 14px !important; font-size: 13px !important; color: var(--text-dim) !important; }
button.link { color: var(--accent); text-decoration: underline; padding: 0; font-size: inherit; }
.share-bar { position: absolute; z-index: 14; top: calc(var(--gap) + 56px + 14px); left: 50%; transform: translateX(-50%); height: 44px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; transition: opacity 0.25s; white-space: nowrap; }
.share-bar.hidden { opacity: 0; pointer-events: none; }
.share-bar.warn { color: rgb(255, 190, 150); }
.share-dot { width: 10px; height: 10px; border-radius: 50%; background: rgb(255, 90, 80); box-shadow: 0 0 8px rgb(255, 90, 80); }
.share-bar .mini.stop { background: rgba(255, 80, 70, 0.55); }
/* ---- Schedule ---- */
.schedule { width: min(520px, calc(100vw - 2 * var(--gap))); }
.schedule input[type=date], .schedule input[type=time], .schedule select { color-scheme: dark; }
.mini-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.schedule .sc-title { font-size: 18px !important; font-weight: 600; padding: 12px 14px !important; margin-bottom: 14px; }
.sc-when { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.sc-section { margin-bottom: 12px; }
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 46px; padding: 6px 8px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.24); border: 1px solid rgba(255, 255, 255, 0.18); cursor: text;
}
.chips:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips input { flex: 1; min-width: 160px; border: none !important; background: transparent !important; padding: 4px !important; outline: none !important; }
.chip-mail { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: rgba(110, 160, 255, 0.25); font-size: 13.5px; }
.chip-mail.bad { background: rgba(255, 110, 100, 0.3); }
.chip-mail button { width: 18px; height: 18px; border-radius: 50%; font-size: 11px; line-height: 1; color: var(--text-dim); }
.chip-mail button:hover { background: rgba(255, 255, 255, 0.2); color: var(--text); }
.sc-from { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.sc-from input { flex: 1; padding: 8px 12px !important; font-size: 14px !important; }
.sc-options, .sc-more { margin: 4px 0 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 10px; }
.sc-options summary, .sc-more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-dim); list-style: none; }
.sc-options summary::before, .sc-more summary::before { content: "▸ "; }
.sc-options[open] summary::before, .sc-more[open] summary::before { content: "▾ "; }
.sc-options .check { margin: 10px 0 0; }
.sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.sc-foot.end { justify-content: flex-end; margin-top: 12px; }
.sc-private { font-size: 12px; color: var(--text-faint); flex: 1; min-width: 180px; }
.sc-ok { display: flex; align-items: center; gap: 12px; }
.sc-tick { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(77, 230, 128, 0.25); color: var(--active); font-weight: 800; font-size: 18px; }
.sc-summary { padding: 14px 16px; border-radius: 16px; background: rgba(0, 0, 0, 0.22); margin-bottom: 14px; display: grid; gap: 3px; font-size: 14px; }
.sc-sum-title { font-size: 17px; font-weight: 650; }
.sc-next { margin: 0 0 14px !important; font-size: 14px !important; line-height: 1.5; }
.sc-more-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 14px; }
.sc-more-row .sub { font-size: 12px; }
.sc-more-row input { width: 46%; font-size: 12px !important; padding: 6px 10px !important; }
.sc-pair { display: flex; gap: 6px; }
.sc-more-row .mini { white-space: nowrap; flex: none; }
/* ---- Device.io branding ---- */
.brand { display: flex; align-items: center; gap: 12px; margin: 0 0 12px !important; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-product { font-size: 30px; font-weight: 650; letter-spacing: -0.015em; line-height: 1; padding-bottom: 3px;
  background: linear-gradient(90deg, #8a6bff, #c34bd8 55%, #ff6a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { height: 20px; width: auto; display: block; margin-right: 2px; }
.cam-off-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 12px 22px; font-size: 15px; font-weight: 600; color: var(--text-dim); transition: opacity 0.2s; pointer-events: none; }
.cam-off-note.hidden { opacity: 0; }
/* ---- Meeting transcript ---- */
.rec-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(220, 50, 45, 0.85); white-space: nowrap; }
.rec-chip[hidden] { display: none; }
.rec-chip:hover { background: rgba(240, 70, 65, 0.95); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: rec-blink 1.6s infinite; }
@keyframes rec-blink { 50% { opacity: 0.3; } }
#btn-rec.on { color: rgb(255, 120, 110); }
.rec-pop { top: calc(var(--gap) + 56px + 14px); bottom: auto; width: min(380px, calc(100vw - 2 * var(--gap))); }
.rec-pop p { margin: 0; line-height: 1.45; }
.rec-pop .mini.stop { background: rgba(220, 60, 50, 0.7); }
.tr-view { position: absolute; z-index: 19; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(720px, calc(100vw - 2 * var(--gap))); max-height: calc(100vh - 2 * var(--gap)); display: flex; flex-direction: column; padding: 24px 26px 20px; transition: opacity 0.25s; }
.tr-view.hidden { opacity: 0; pointer-events: none; }
.tr-lines { list-style: none; margin: 0 0 14px; padding: 0; overflow-y: auto; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.5; }
.tr-lines time { color: var(--text-faint); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.tr-lines b { margin-right: 6px; }
.pj-transcript { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 0 0 14px; border-radius: 14px; background: rgba(77, 230, 128, 0.12); font-size: 13.5px; }
.why { margin: 4px 0 14px; font-size: 13px; color: rgba(255, 255, 255, 0.8); }
.why summary { cursor: pointer; color: var(--accent); }
.why p { margin: 8px 0 0 !important; }
.cap-actions { display: flex; gap: 10px; margin-top: 10px; }
.cap-actions button { height: 34px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; background: rgba(255, 255, 255, 0.14); }
.cap-actions button.go { background: rgba(110, 160, 255, 0.45); }
.cap-actions button:hover { filter: brightness(1.15); }
.in-call-only { display: none !important; }
/* While a screen is open only it and the camera picture behind it show. */
#ui > * { transition: opacity 0.3s; }
/* Screens and cards ease in and out (opacity and a small lift); the glass follows both. */
#ui > .screen, #ui > .waiting, #ui > .dl-ask { transition: opacity 0.32s ease, transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.4s ease, max-height 0.4s ease; }
#ui > .screen.hidden, #ui > .waiting.hidden, #ui > .dl-ask.hidden { transform: translate(-50%, calc(-50% + 14px)) scale(0.97); }
.screen-open #ui > :not(.screen):not(.dl-ask):not(.dl-progress) { opacity: 0; pointer-events: none; }
.e2ee[hidden] { display: none; }
/* In a call the source buttons give way to microphone and camera on/off. */
.in-call #btn-cam, .in-call #btn-file { display: none; }

/* ---- Call layout: the speaker fills the screen, you and the others are tiles ---- */
/* The stage's tile keeps playing (the canvas copies its frames) but isn't shown. */
.tile.on-stage { position: fixed !important; left: 0; top: 0; width: 2px !important; height: 2px; opacity: 0; pointer-events: none; padding: 0; }
.tile.self .self-video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--tile-inner); }
.tile.self .self-off[hidden] { display: none; }
.tile.self .self-off { position: absolute; inset: 6px; display: grid; place-items: center; color: var(--text-dim); font-size: 13px; }
.stage-name {
  position: absolute;
  left: 50%;
  top: calc(var(--gap) + 56px + 14px); /* under the top bar: the bottom has the captions */
  transform: translateX(-50%);
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s;
}
.stage-name.hidden { opacity: 0; pointer-events: none; }
.stage-name .sub { color: var(--text-dim); font-weight: 400; }
.speaking-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.speaking-dot.on { background: var(--active); box-shadow: 0 0 8px var(--active); }
/* The camera menu, above the dock. */
.cam-menu {
  position: absolute;
  z-index: 13;
  left: calc(var(--gap) + 4px);
  bottom: calc(var(--gap) + 76px);
  width: min(320px, calc(100vw - 2 * var(--gap)));
  padding: 14px 16px;
  transition: opacity 0.2s;
}
.cam-menu.hidden { opacity: 0; pointer-events: none; }
.cam-menu .field-label { display: block; margin-bottom: 8px; }
#cam-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
#cam-list button { width: 100%; text-align: left; padding: 9px 12px; border-radius: 12px; font-size: 14px; }
#cam-list button:hover { background: rgba(255, 255, 255, 0.1); }
#cam-list button.current { background: rgba(110, 160, 255, 0.22); }
.in-call .in-call-only { display: grid !important; }
.pill { height: 48px; padding: 0 24px; font-size: 15px; font-weight: 600; }
.error { color: rgb(255, 150, 140) !important; margin: 16px 0 0 !important; font-size: 13px !important; }
.error:empty { display: none; }

/* ---- Side panel as a column: the transcript takes the rest of the height ---- */
.side {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--gap) - 56px - 14px - 100px);
}
.side > * { flex: none; }
.transcript-title { margin-top: 16px; align-items: baseline; }
.link { font-size: 13px; color: var(--accent); padding: 0; }
.link:hover { text-decoration: underline; }
.transcript-wrap { position: relative; flex: 1 1 auto; min-height: 60px; display: flex; }
#transcript {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 4px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
#transcript li { margin: 0 0 8px; }
#transcript time { color: var(--text-faint); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
#transcript b { font-weight: 600; margin-right: 4px; }
#transcript .empty { color: var(--text-faint); font-size: 13px; }
.jump {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(110, 160, 255, 0.85);
  color: #fff;
}

/* ---- Live captions ---- */
.captions {
  --cap-size: 24px;
  position: absolute;
  bottom: calc(var(--gap) + 104px); /* above the control bar */
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 2 * var(--gap)));
  padding: 14px 64px 14px 26px;
  transition: opacity 0.3s;
}
.captions.hidden { opacity: 0; pointer-events: none; }
/* At most three lines, newest at the bottom; older text scrolls off the top, as on TV. */
#cap-lines {
  font-size: var(--cap-size);
  line-height: 1.32;
  font-weight: 500;
  max-height: calc(var(--cap-size) * 1.32 * 3 + 8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
#cap-lines p { margin: 0; }
#cap-lines p + p { margin-top: 4px; }
#cap-lines .spk { font-weight: 700; margin-right: 8px; }
#cap-lines .partial .txt { color: rgba(255, 255, 255, 0.72); }
#cap-lines .status { font-size: 15px; color: var(--text-dim); font-weight: 400; display: flex; align-items: center; gap: 8px; }
.hear { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.hear.on { background: var(--active); box-shadow: 0 0 8px var(--active); }
.cap-tools { position: absolute; top: 10px; right: 12px; display: flex; flex-direction: column; gap: 2px; }
.cap-tools button { font-size: 13px; font-weight: 600; color: var(--text-dim); width: 34px; height: 26px; border-radius: 8px; }
.cap-tools button:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.cc { font-weight: 800; font-size: 14px; letter-spacing: 0.02em; }

/* With the side panel beside them, captions keep clear of it on mid-size screens. */
@media (min-width: 761px) and (max-width: 1500px) {
  .captions { left: calc(var(--gap) + (100vw - 300px - 3 * var(--gap)) / 2); width: min(880px, calc(100vw - 300px - 3 * var(--gap))); }
}

/* ---- Calls ---- */
.call-area { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pill.small { height: 36px; padding: 0 16px; font-size: 14px; font-weight: 600; }
.icon.small { width: 16px; height: 16px; }
.e2ee { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--active); }
.e2ee.warn { color: rgb(255, 170, 120); }

#remotes {
  position: absolute;
  top: calc(var(--gap) + 56px + 14px);
  left: var(--gap);
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.tile { position: relative; padding: var(--tile-pad); pointer-events: auto; }
/* Your shared screen: buttons over it on hover; Expand makes it large in the middle. */
.share-tools { position: absolute; top: calc(var(--tile-pad) + 8px); right: calc(var(--tile-pad) + 8px); display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.tile.myshare:hover .share-tools, .tile.myshare:focus-within .share-tools, .tile.myshare.expanded .share-tools { opacity: 1; }
.share-tools button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(10, 12, 20, 0.72); backdrop-filter: blur(6px); }
.share-tools button:hover { background: rgba(30, 36, 56, 0.9); }
.share-tools button.stop { background: rgba(220, 60, 50, 0.85); }
.share-tools button.stop:hover { background: rgba(240, 80, 70, 0.95); }
.tile.myshare { cursor: default; }
.tile.myshare.expanded { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1100px, 76vw); }
/* Your shared screen: shown whole (letterboxed), not cropped like a camera. */
.tile.myshare video { object-fit: contain; background: rgba(0, 0, 0, 0.45); }
.tile.myshare .tile-label { align-items: center; padding: 4px 10px; border-radius: 999px; background: rgba(10, 12, 20, 0.72); text-shadow: none; }
.tile.myshare .share-dot { width: 8px; height: 8px; }
.tile video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--tile-inner); background: rgba(0, 0, 0, 0.25); }
.tile-label { position: absolute; left: 16px; bottom: 12px; display: flex; gap: 8px; font-size: 13px; font-weight: 600; }
.tile-state { color: var(--text-dim); font-weight: 400; }

.invite {
  position: absolute;
  z-index: 11;
  top: calc(var(--gap) + 56px + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 2 * var(--gap)));
  padding: 20px 24px;
  transition: opacity 0.25s;
}
.invite.hidden { opacity: 0; pointer-events: none; }
.invite-head { display: flex; justify-content: space-between; align-items: center; }
.invite h2 { margin: 0; font-size: 19px; }
.invite p { color: rgba(255, 255, 255, 0.8); font-size: 13.5px; line-height: 1.45; margin: 10px 0 14px; }
.x { font-size: 15px; color: var(--text-dim); width: 30px; height: 30px; border-radius: 50%; }
.x:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.link-row { display: flex; gap: 8px; }
.invite input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 8px 12px;
}
.safety-row b { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; color: var(--text); font-size: 15px; }
.name-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255, 255, 255, 0.8); margin-bottom: 16px; }
.danger { color: #fff; }

/* ---- Lobby and identities ---- */
/* Someone knocking: a dialog in the middle of the screen, above every other panel. */
.lobby {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 2 * var(--gap)));
  padding: 22px 24px;
  transition: opacity 0.25s;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  border-radius: 26px; /* the dimming's corners match the glass (data-radius) */
}
.lobby.hidden { box-shadow: none; }
.knocking #invite, .knocking #cam-menu { opacity: 0 !important; pointer-events: none; }
.lobby-sub { margin: 0 0 14px; font-size: 13px; color: var(--text-dim); }
.lobby .mini { height: 36px; padding: 0 18px; font-size: 14px; }
.room-check { margin: -6px 0 14px; flex-wrap: wrap; }
.room-check .sub { flex-basis: 100%; padding-left: 26px; }
.lobby.hidden { opacity: 0; pointer-events: none; }
.lobby-title { font-weight: 650; font-size: 18px; margin-bottom: 4px; }
#knocks, #roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#knocks li, #roster li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who-col { flex: 1; min-width: 0; }
.fp { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: var(--text-dim); letter-spacing: 0.02em; }
.ok { color: var(--active); font-size: 12px; font-weight: 600; }
.mini { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.14); }
.mini:hover { background: rgba(255, 255, 255, 0.22); }
.mini.go { background: rgba(77, 230, 128, 0.32); }
.mini.go:hover { background: rgba(77, 230, 128, 0.45); }
.roster-head { font-size: 13.5px; font-weight: 600; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 2px; }
#my-device { margin: 10px 0 12px; font-size: 12.5px; }

/* ---- Narrow screens: the side panel becomes a strip under the bar ---- */
@media (max-width: 760px) {
  .bar .sub, .meter .icon { display: none; }
  .bar { padding: 0 16px; }
  .meter-track { width: 60px; }
  .side { left: var(--gap); width: auto; padding: 12px; }
  #pip { display: none; }
  #people { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .hint, .transcript-title, .transcript-wrap { display: none; }
  /* In a call the other participants take the strip under the bar. */
  .in-call .side { display: none; }
  #remotes { left: var(--gap); right: var(--gap); width: auto; flex-direction: row; overflow-x: auto; }
  .tile { flex: 0 0 calc(50% - 6px); }
  .call-area .e2ee .e2ee-text { display: none; }
  .captions { bottom: calc(var(--gap) + 150px); padding: 12px 56px 12px 18px; --cap-size: 20px; }
  .tabs button { width: 84px; }
  .bar-dock { padding: 8px 10px 24px; gap: 6px; }
  .bar-dock .round { width: 46px; height: 46px; }
  .dock.right { bottom: calc(var(--gap) + 76px); }
}

/* ---- Spotlight: a clicked tile, large, in full quality ---- */
.tile { cursor: pointer; }
.tile-res { color: var(--text-faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.tile.big {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, 72vw);
  z-index: 8;
}

/* Accounts: the signed-in row and sign-in form on home; the Users screen for admins. */
.acct { display: flex; align-items: center; gap: 12px; margin: -8px 0 18px; font-size: 14px; }
.acct[hidden], .signin[hidden], .actions[hidden] { display: none; }
.acct-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, rgba(110, 160, 255, 0.55), rgba(170, 110, 255, 0.55)); }
.acct-who { display: grid; flex: 1; min-width: 0; }
.acct-who b, .acct-who .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signin .join-row { margin: 10px 0 8px; }
.signin .sub { margin: 0; line-height: 1.45; }
.signin .sub.ok { color: rgb(150, 230, 170); }
.home .signin .field-label { margin-bottom: 0; }
.users { width: min(600px, calc(100vw - 2 * var(--gap))); }
.u-invite .field-label { display: block; margin: 18px 0 10px; }
.u-invite-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.u-invite-row input { flex: 1; min-width: 0; }
.u-invite-row .check { flex: 1; display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.u-invite-row .check input { flex: none; width: auto; margin: 0; }
.u-invite .sub { margin: 4px 0 0; min-height: 1.2em; }
.u-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.u-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.u-list li:last-child { border-bottom: 0; }
.u-list .acct-avatar { width: 30px; height: 30px; font-size: 12.5px; }
.u-list li.off .acct-avatar { background: rgba(255, 255, 255, 0.12); }
.u-who { flex: 1; min-width: 0; display: grid; font-size: 14px; }
.u-who b, .u-who .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(110, 160, 255, 0.25); margin-left: 6px; vertical-align: 1px; }
.u-tag.warn { background: rgba(255, 190, 90, 0.25); }
.u-tag.dim { background: rgba(255, 255, 255, 0.12); }
.u-acts { display: flex; gap: 10px; flex: none; }
.u-acts .link { font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.u-acts .link:hover { text-decoration: underline; }
.u-acts .danger { color: rgb(255, 140, 130); }

/* ---- Start-up: hidden until the renderer draws, then one fade-in ---- */
#ui { transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
body.booting #ui { opacity: 0; transform: scale(0.985); pointer-events: none; }
/* If the script never starts (an old browser, a failed load), the page shows anyway. */
body.booting #ui { animation: boot-fallback 0s 12s forwards; }
@keyframes boot-fallback { to { opacity: 1; transform: none; } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; transition: opacity 0.35s; }
body:not(.booting) .boot { opacity: 0; }
.boot img { width: 46px; height: 46px; opacity: 0; animation: boot-in 0.5s 0.4s ease forwards, boot-breathe 1.8s 0.9s ease-in-out infinite; }
@keyframes boot-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 0.85; transform: none; } }
@keyframes boot-breathe { 50% { opacity: 0.45; transform: scale(0.94); } }
@media (prefers-reduced-motion: reduce) {
  #ui, #ui > .screen, #ui > .waiting, #ui > .dl-ask, .dl-fill { transition: opacity 0.2s !important; }
  #ui > .screen.hidden, #ui > .waiting.hidden, #ui > .dl-ask.hidden, body.booting #ui { transform: translate(-50%, -50%); }
  body.booting #ui { transform: none; }
  .boot img, .dl-fill::after { animation: none !important; opacity: 0.8; }
}

/* ---- Extra downloads: the question, and the progress pill ---- */
.dl-ask {
  position: absolute; z-index: 25; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 2 * var(--gap))); padding: 26px 28px 22px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  /* The dimming follows the CSS corners: the same radius as the glass (data-radius). */
  border-radius: 28px;
}
.dl-ask.hidden { opacity: 0; pointer-events: none; box-shadow: none; }
.dl-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.dl-ask h2 { margin: 0 0 10px; font-size: 21px; font-weight: 650; }
.dl-ask p { margin: 0 0 16px; color: rgba(255, 255, 255, 0.8); line-height: 1.5; font-size: 14.5px; }
.dl-facts { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dl-facts li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); font-size: 12.5px; color: var(--text-dim); }
.dl-facts b { color: var(--text); font-size: 14px; }
.dl-progress {
  /* In a call: under the top bar. With a screen open (no top bar): the top edge, and the card
     moves down to make room (.dl-busy), so it never covers anything. */
  position: fixed; z-index: 28; left: 50%; top: calc(var(--gap) + 64px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px; font-size: 13.5px; font-weight: 600;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dl-progress.hidden { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
.screen-open .dl-progress { top: 8px; height: 34px; }
.dl-busy.screen-open #ui > .screen { top: calc(50% + 21px); max-height: calc(100vh - 2 * var(--gap) - 42px); }
.dl-label { white-space: nowrap; }
.dl-track { position: relative; width: 140px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.dl-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, rgb(110, 160, 255), rgb(170, 120, 255)); transition: width 0.5s cubic-bezier(0.3, 0.7, 0.3, 1); }
/* A soft sheen moves along the bar while it works. */
.dl-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent); transform: translateX(-100%); animation: dl-sheen 1.4s ease-in-out infinite; }
.dl-progress.done .dl-fill::after, .dl-progress.idle .dl-fill::after { animation-duration: 2.4s; }
.dl-progress.idle .dl-fill { width: 100% !important; opacity: 0.35; }
@keyframes dl-sheen { to { transform: translateX(100%); } }
.dl-amount { color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 6.5em; text-align: right; }
.dl-progress.done .dl-amount { color: rgb(150, 230, 170); }
/* Starting up from stored files: quiet animated dots, no numbers. */
.dots::after { content: "…"; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@media (max-width: 560px) {
  .dl-facts { grid-template-columns: 1fr; }
  .dl-track { width: 80px; }
  .dl-amount { min-width: 0; }
}
/* While the download question is open it stands alone: everything else fades (its text would
   show through the glass otherwise). */
.dl-open #ui > :not(.dl-ask):not(.dl-progress) { opacity: 0 !important; pointer-events: none; }
