/* Call journey: every call-screen rule lives here (room, stage, tiles, dock, panels, call dialogs,
   prejoin preview, waiting and post-call). Moved from base.css, components.css and theme.css in
   their original order, followed by the call refinements that override them. */
/* From base.css */

/* From components.css */

/* From theme.css */

/* Call refinements */
/* The call surface is dark in both app themes (tokens in theme.css). Dialogs and the toast
   join it while html.in-call; .call-surface marks other dark call elements outside .room. */
.room,
html.in-call #modal-root,
html.in-call #toast,
.call-surface { color-scheme: dark;
}

.prejoin-options { margin: 16px 0; border-block: 1px solid var(--border);
}
.prejoin-options > summary,
.advanced-connection > summary { min-height: 40px; padding: 10px 0; font-size: 13px; line-height: 20px; color: var(--body); cursor: pointer;
}
.prejoin-options-body { padding-bottom: 16px;
}
.prejoin-options .field-label,
.device-settings > .field-label { display: block; margin: 0 0 8px; font-size: 13px; line-height: 20px; font-weight: 500;
}
.prejoin-options .field { margin: 16px 0 0;
}
.prejoin-options .advanced-connection { margin: 8px 0 0;
}

.background-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px;
}
.background-picker > button { min-width: 0; padding: 8px; border: 1px solid var(--input-border); border-radius: 8px; font-size: 12px; line-height: 16px; background: var(--card); color: var(--body);
}
.background-picker > button.active { border-color: var(--foreground); background: var(--secondary); color: var(--foreground);
}
.background-swatch { height: 40px; border-radius: 4px;
}
.device-settings > .field { margin-bottom: 16px;
}
.device-settings .prejoin-options { margin-bottom: 0;
}
.device-settings .prejoin-options .note { font-size: 13px; line-height: 20px;
}

@media (max-width: 760px) {
  
  
  
  
  
  
  .prejoin-options > summary,
  .advanced-connection > summary { min-height: 44px;
  }
  
  
  
}
.chat-empty { display: grid; justify-items: center; align-content: center; min-height: 200px; gap: 8px; padding: 24px; text-align: center; color: var(--muted-foreground);
}
.chat-empty > svg { width: 24px; height: 24px; margin-bottom: 4px;
}
.chat-empty p { margin: 0; color: var(--body); font-size: 14px; line-height: 22px;
}
.chat-empty small { font-size: 13px; line-height: 20px;
}
.login .login-card { width: min(440px,100%); border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 32px; box-shadow: none;
}
.login .login-card > .brand { margin-bottom: 32px;
}
.login .login-card h1 { font-size: 28px; line-height: 34px; letter-spacing: -.02em; font-weight: 600; margin-bottom: 8px;
}
.login .login-card > p { margin-bottom: 24px; font-size: 14px; line-height: 22px; color: var(--muted-foreground);
}
.login .user-option { min-height: 64px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent;
}
.login .user-option:hover { background: var(--hover);
}
.login .user-option strong { font-size: 14px; line-height: 22px;
}
.login .user-option small { font-size: 13px; line-height: 20px;
}
.login .login-card > .login-note { margin: 24px 0 0; font-size: 13px; line-height: 20px;
}

@media (max-width: 760px) {
  .login .login-card { padding: 24px;
  }
  .login .user-option { min-height: 64px;
  }
  
}
/* A page bounds camera decoding; all remote audio stays connected. */

/* ===== Pre-join (Prejoin board), guest waiting and post-call (Main board «left» state) ===== */
/* Full-viewport dialog: dark in both app themes; back to the meetings list instead of a close icon. */
.overlay.full { padding: 0; background: transparent; backdrop-filter: none; animation: none; }
.modal.full {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--call-stage);
  color: var(--foreground);
  box-shadow: none;
}
.modal.full .full-head { justify-content: space-between; padding: 24px 32px 0 24px; }
.full-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.full-back svg { width: 18px; height: 18px; }
.full-back:hover { background: var(--call-item-hover); color: var(--foreground); }
.full-back:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.full-user { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted-foreground); font-size: 13px; }
.full-user > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full-user .avatar { width: 28px; height: 28px; flex-shrink: 0; background: var(--call-avatar); color: var(--call-avatar-fg); font-size: 11px; }
/* Column flex + auto margins: centred when it fits, scrollable from the top when it does not. */
.modal.full .modal-body { display: flex; flex: 1; flex-direction: column; padding: 0 32px 40px; }
.prejoin { display: flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 56px; width: 100%; max-width: 1216px; margin: auto; }
.prejoin-media { display: flex; flex: 0 1 760px; flex-direction: column; gap: 16px; min-width: 0; }
.prejoin-preview {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 28px;
  background: var(--call-tile);
}
.prejoin-preview > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prejoin-preview.mirror > video { transform: scaleX(-1); }
.prejoin-preview > .avatar { width: 120px; height: 120px; background: var(--call-avatar); color: var(--call-avatar-fg); font-size: 36px; }
.prejoin-chip,
.prejoin-name {
  position: absolute;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(50% - 24px);
  height: 30px;
  padding: 0 12px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--call-chip);
  backdrop-filter: blur(12px);
  color: var(--body);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.prejoin-name { left: 16px; color: var(--foreground); font-weight: 500; }
.prejoin-chip { right: 16px; }
.prejoin-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.prejoin-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  display: flex;
  gap: 10px;
  padding: 8px;
  translate: -50% 0;
  border-radius: 22px;
  background: var(--call-chip-soft);
  backdrop-filter: blur(16px);
}
.prejoin-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--call-control-open);
  color: var(--foreground);
  cursor: pointer;
}
.prejoin-control svg { width: 22px; height: 22px; stroke-width: 1.8; }
.prejoin-control:hover { background: var(--call-segment-on); }
.prejoin-control.off { background: var(--call-off-bg); color: var(--call-off-fg); }
.prejoin-control:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.prejoin-meter { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--muted-foreground); font-size: 13px; }
.prejoin-meter > svg { width: 18px; height: 18px; flex-shrink: 0; }
.prejoin-meter.muted > svg { color: var(--call-off-fg); }
.meter-segments { display: flex; flex: 1; gap: 4px; }
.meter-segments i { flex: 1; height: 6px; border-radius: 3px; background: var(--call-meter-off); transition: background-color .1s; }
.meter-segments i.on { background: var(--call-speak); }
.prejoin-side { display: flex; flex: 0 1 400px; flex-direction: column; gap: 20px; min-width: 0; }
.prejoin-head h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.prejoin-sub { margin: 8px 0 0; color: var(--muted-foreground); font-size: 14px; line-height: 20px; }
.prejoin-presence { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted-foreground); }
.prejoin-avatars { display: flex; flex-shrink: 0; }
.prejoin-avatars .avatar { width: 28px; height: 28px; border: 2px solid var(--call-stage); background: var(--call-avatar-strong); color: var(--foreground); font-size: 10px; font-weight: 600; }
.prejoin-avatars .avatar + .avatar { margin-left: -8px; }
#prejoin-form { display: flex; flex-direction: column; gap: 20px; }
.prejoin-devices { display: flex; flex-direction: column; gap: 10px; }
#prejoin-form .field { margin: 0; }
#prejoin-form .field > span { margin-bottom: 6px; color: var(--muted-foreground); font-weight: 400; }
#prejoin-form .field :is(input, .w-pick-btn) { height: 44px; padding: 0 14px; border: 1px solid var(--call-panel-border); border-radius: 14px; background: var(--call-panel); color: var(--foreground); font-size: 14px; }
.prejoin-link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.prejoin-link svg { width: 16px; height: 16px; }
.prejoin-link:hover { background: var(--call-item-hover); color: var(--foreground); }
.prejoin-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
#prejoin-form .prejoin-options { margin: 0; border: 0; }
#prejoin-form .prejoin-options > summary { min-height: 32px; padding: 6px 0; color: var(--muted-foreground); }
.prejoin-submit-row { display: flex; flex-direction: column; gap: 12px; }
#prejoin-form .prejoin-submit { width: 100%; height: 52px; min-height: 52px; margin: 0; border: 0; border-radius: 16px; background: var(--call-active-bg); color: var(--call-active-fg); font-size: 15px; font-weight: 600; }
#prejoin-form .prejoin-submit:disabled { opacity: .7; }
.prejoin-consent-note { margin: -2px 8px 0; color: var(--muted-foreground); font-size: 13px; line-height: 19px; text-align: center; text-wrap: pretty; }
.modal.full .employee-only { padding: 24px; border-radius: 20px; background: var(--call-panel); }
@media (max-width: 1100px) {
  .prejoin { gap: 32px; }
}
@media (max-width: 900px) {
  .prejoin { flex-direction: column; align-items: stretch; justify-content: flex-start; max-width: 560px; }
  .prejoin-media,
  .prejoin-side { flex: none; }
}
@media (max-width: 760px) {
  .modal.full .full-head { padding: max(12px, env(safe-area-inset-top)) 16px 8px 8px; }
  .full-back { height: 44px; }
  .modal.full .modal-body { padding: 0 16px; }
  .prejoin { gap: 20px; margin: 0 auto auto; }
  .prejoin-media { gap: 12px; }
  .prejoin-preview { border-radius: 20px; }
  .prejoin-preview > .avatar { width: 72px; height: 72px; font-size: 24px; }
  .prejoin-chip,
  .prejoin-name { top: 10px; height: 26px; padding: 0 10px; font-size: 12px; }
  .prejoin-name { left: 10px; }
  .prejoin-chip { right: 10px; }
  .prejoin-controls { bottom: 10px; gap: 8px; padding: 6px; border-radius: 18px; }
  .prejoin-control { width: 48px; height: 48px; border-radius: 14px; }
  .prejoin-side { gap: 16px; }
  .prejoin-head h1 { font-size: 20px; line-height: 26px; }
  #prejoin-form { gap: 16px; }
  #prejoin-form .field input { font-size: 16px; }
  .prejoin-link { height: 44px; }
  /* The entry button stays reachable while the form scrolls. */
  .prejoin-submit-row { position: sticky; bottom: 0; z-index: 2; margin: 0 -16px; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); background: var(--call-stage); }
}

/* Guest waiting room: the same dark surface as the call it leads to. */
.guest-waiting { min-height: 100dvh; padding: 24px 32px; background: var(--call-stage); color: var(--foreground); }
.guest-top { display: flex; align-items: center; max-width: 1150px; margin: 0 auto; }
.waiting-card {
  width: min(440px, 100%);
  margin: 12vh auto 0;
  padding: 32px;
  border: 1px solid var(--call-panel-border);
  border-radius: 28px;
  background: var(--call-panel);
  text-align: center;
}
.waiting-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 18px; background: var(--call-admit-bg); color: var(--call-speak); }
.waiting-icon.rejected { background: var(--call-off-bg); color: var(--call-off-fg); }
.waiting-icon svg { width: 26px; height: 26px; }
.guest-waiting .eyebrow { margin: 0; color: var(--muted-foreground); font-size: 14px; line-height: 20px; font-weight: 500; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.guest-waiting h1 { margin: 6px 0 8px; color: var(--foreground); font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.waiting-card > p { margin: 0 auto 20px; max-width: 340px; color: var(--muted-foreground); font-size: 14px; line-height: 22px; }
.waiting-card > .note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.waiting-name { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 36px; padding: 0 12px 0 6px; border-radius: 12px; background: var(--call-control); color: var(--foreground); font-size: 14px; }
.waiting-name .avatar { width: 24px; height: 24px; flex-shrink: 0; background: var(--call-avatar-strong); color: var(--foreground); font-size: 10px; }
.guest-waiting-actions { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.guest-waiting-actions .btn { height: 44px; min-height: 44px; padding: 0 18px; border-radius: 14px; }

/* Post-call card (Main board, «left» state). */
.post-call { display: grid; place-items: center; min-height: 100dvh; padding: 20px; background: var(--call-stage); color: var(--foreground); }
.post-call-card {
  width: min(400px, 100%);
  padding: 32px;
  border: 1px solid var(--call-panel-border);
  border-radius: 28px;
  background: var(--call-panel);
  text-align: center;
}
.post-call-card > .room-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 18px; background: var(--call-admit-bg); color: var(--call-speak); }
.post-call-card > .room-icon svg { width: 26px; height: 26px; }
.post-call-card h1 { margin: 0; color: var(--foreground); font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.post-call-card > p { margin: 6px 0 20px; color: var(--muted-foreground); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.post-call-card .feedback-label { display: block; margin-bottom: 8px; color: var(--muted-foreground); font-size: 13px; line-height: 20px; }
.post-call-card .rating { display: flex; justify-content: center; gap: 6px; margin: 0 0 24px; }
.post-call-card .rating button { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: var(--call-item-hover); color: var(--call-star-off); cursor: pointer; }
.post-call-card .rating button.active { background: var(--call-item-hover); color: var(--call-hand); }
.post-call-card .rating button.active svg { fill: currentColor; color: var(--call-hand); }
.post-call-card .rating svg { width: 20px; height: 20px; }
.post-call-card .rating button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.post-call-actions { display: flex; gap: 8px; }
.post-call-actions .btn { flex: 1; height: 44px; min-height: 44px; margin: 0; border: 0; border-radius: 14px; background: var(--call-soft-button); color: var(--foreground); font-size: 14px; font-weight: 500; }
.post-call-actions .btn.primary { background: var(--call-active-bg); color: var(--call-active-fg); font-weight: 600; }
@media (max-width: 760px) {
  .guest-waiting { padding: max(16px, env(safe-area-inset-top)) 16px 24px; }
  .waiting-card { margin-top: 8vh; padding: 24px; }
  .post-call-card { padding: 24px; }
  .post-call-card .rating button { width: 44px; height: 44px; }
}

/* ===== Call room (redesign): stage, tiles, three-zone bar, dock, popovers, panel ===== */
.room {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--call-stage);
  color: var(--foreground);
}
.room h1, .room h2, .room p { margin: 0; }
.room .connection-banner,
.room .audio-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 12px 16px 0;
  padding: 8px 16px;
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--foreground);
  font-size: 13px;
  line-height: 20px;
}
.room .connection-banner svg,
.room .audio-banner svg { width: 16px; height: 16px; color: var(--warning); }
.room .connection-banner .btn,
.room .audio-banner .btn { min-height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.room-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 16px;
  padding: 16px 16px 0;
}
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  gap: 12px;
}

/* Tiles */
.tiles {
  display: grid;
  flex: 1;
  min-height: 0;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.tiles[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.tiles[data-count="2"],
.tiles[data-count="4"],
.room-body:has(.room-panel) .tiles:not([data-count="1"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 20px;
  background: var(--call-tile);
  box-shadow: inset 0 0 0 1px var(--call-tile-edge);
  transition: box-shadow .2s;
}
.tile.speaking { box-shadow: 0 0 0 2px var(--call-speak), 0 0 0 7px var(--call-speak-glow); }
/* Video and avatar are clipped here, not by the tile, so the tile menu may extend past small tiles. */
.tile-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  /* Avatars scale with small gallery tiles (50 people, panel open) instead of covering the name chip. */
  container-type: size;
}
.tile.menu-open { z-index: 6; }
.tile-avatar {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(40px, 38cqmin, 88px);
  height: clamp(40px, 38cqmin, 88px);
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--call-avatar);
  color: var(--call-avatar-fg);
  font-size: clamp(14px, 12cqmin, 28px);
  font-weight: 600;
  letter-spacing: -.02em;
  transition: box-shadow .2s;
}
.tile.speaking .tile-avatar { box-shadow: 0 0 0 6px var(--call-speak-glow); }
.tile [data-video],
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.tile video { object-fit: cover; background: var(--call-tile); }
.tile.local.mirror video { transform: scaleX(-1); }
.tile-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 68px);
}
.tile-pin {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 28px;
  padding: 0 4px 0 10px;
  border-radius: 10px;
  background: var(--call-chip);
  backdrop-filter: blur(12px);
  color: var(--call-pin-fg);
  font-size: 13px;
  white-space: nowrap;
}
.tile-pin svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }
.tile-pin span { overflow: hidden; text-overflow: ellipsis; }
.tile-pin button {
  flex-shrink: 0;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: var(--call-control-hover);
  color: var(--foreground);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tile-pin button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tile-pin button kbd { margin-left: 6px; font: inherit; opacity: .6; }
.stage.expanded .tiles { grid-template-columns: minmax(0, 1fr); }
.tile-hand {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 10px;
  background: var(--call-hand);
  color: var(--call-hand-fg);
  font-size: 13px;
  font-weight: 600;
}
.tile-hand svg { width: 16px; height: 16px; stroke-width: 2; }
.tile-more {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--call-chip);
  backdrop-filter: blur(12px);
  color: var(--foreground);
  opacity: 0;
  cursor: pointer;
}
.tile-more svg { width: 18px; height: 18px; stroke-width: 2.4; }
.tile:hover .tile-more,
.tile-more:focus-visible,
.tile.menu-open .tile-more { opacity: 1; }
@media (hover: none) { .tile-more { opacity: 1; } }
.tile-footer {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  height: 28px;
  margin-right: auto;
  padding: 0 10px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--call-chip);
  backdrop-filter: blur(12px);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.tile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tile-note { flex-shrink: 0; color: var(--muted-foreground); font-weight: 400; }
.speaking-indicator {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--call-chip);
}
.tile.speaking .speaking-indicator { display: flex; }
.speaking-indicator i {
  display: block;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: var(--call-speak);
  animation: call-eq 1s ease-in-out infinite;
}
.speaking-indicator i:nth-child(2) { animation-delay: .15s; }
.speaking-indicator i:nth-child(3) { animation-delay: .3s; }
@keyframes call-eq { 0%, 100% { height: 5px; } 50% { height: 12px; } }
.tile-muted {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--call-off-chip);
  backdrop-filter: blur(12px);
  color: var(--call-off-fg);
}
.tile-muted svg { width: 15px; height: 15px; stroke-width: 2; }

/* Speaker layout: main tile and a 216 px strip (Main board, speaker state) */
.speaker-view .tiles {
  grid-template-columns: minmax(0, 1fr) 216px;
  grid-template-rows: repeat(3, minmax(0, 1fr));
}
.speaker-view .tiles[data-count="1"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.speaker-view .tiles > .tile.lead { grid-row: 1 / -1; }
.speaker-view .tiles > .tile:not(.lead),
.screen-thumbnails .tile { border-radius: 16px; }
.speaker-view .tiles > .tile:not(.lead) .tile-avatar,
.screen-thumbnails .tile-avatar { width: 48px; height: 48px; font-size: 16px; }
.speaker-view .tiles > .tile:not(.lead) .tile-footer,
.screen-thumbnails .tile-footer { right: 8px; bottom: 8px; left: 8px; gap: 6px; }
.speaker-view .tiles > .tile:not(.lead) .tile-label,
.screen-thumbnails .tile-label { height: 24px; padding: 0 8px; border-radius: 8px; font-size: 12px; }
.speaker-view .tiles > .tile:not(.lead) :is(.tile-note, .speaking-indicator),
.screen-thumbnails :is(.tile-note, .speaking-indicator) { display: none; }
.speaker-view .tiles > .tile:not(.lead) .tile-muted,
.screen-thumbnails .tile-muted { width: 24px; height: 24px; border-radius: 8px; }
.speaker-view .tiles > .tile:not(.lead) .tile-badges,
.screen-thumbnails .tile-badges { top: 8px; left: 8px; }
.speaker-view .tiles > .tile:not(.lead) .tile-hand,
.screen-thumbnails .tile-hand { height: 24px; padding: 0 8px 0 6px; border-radius: 8px; font-size: 12px; }
.speaker-view .tiles > .tile:not(.lead) .tile-more,
.screen-thumbnails .tile-more { top: 8px; right: 8px; width: 28px; height: 28px; }

/* Screen share: screen left, participant strip right (Share board) */
.stage.sharing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px;
  grid-template-rows: minmax(0, 1fr);
  grid-auto-rows: auto;
}
.stage.sharing > .gallery-pagination { grid-column: 1 / -1; }
.screen-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--call-panel);
}
.screen-stage header {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  height: 32px;
  padding: 0 12px 0 10px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--call-chip-strong);
  backdrop-filter: blur(12px);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.screen-stage header svg { width: 16px; height: 16px; flex-shrink: 0; }
.screen-container { position: absolute; inset: 0; }
.screen-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.screen-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.screen-thumbnails .tile { flex: 1; }

.gallery-pagination {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.gallery-pagination > span { min-width: 140px; text-align: center; font-size: 13px; color: var(--body); }
.gallery-pagination small { color: var(--call-subtle); font-size: 13px; }
.gallery-pagination .btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--call-control);
  color: var(--foreground);
  font-size: 13px;
}
.gallery-pagination .btn:hover:not(:disabled) { background: var(--call-control-hover); }
.floating-reaction {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  min-width: 52px;
  padding: 0 12px;
  border-radius: 26px;
  background: var(--call-popover);
  backdrop-filter: blur(20px);
  font-size: 30px;
  line-height: 1;
  pointer-events: none;
  animation: call-float 2.4s ease-out forwards;
}
@keyframes call-float {
  0% { opacity: 0; transform: translateY(10px) scale(.8); }
  15% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* Floating self view in a two-person call (MobileCall board): the other person fills the stage. */
.tile.self-view-floating {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 224px;
  height: 140px;
  border-radius: 18px;
  box-shadow: var(--call-float-shadow), inset 0 0 0 1px var(--call-float-edge);
}
.tile.self-view-floating.speaking { box-shadow: 0 0 0 2px var(--call-speak), var(--call-float-shadow); }
.self-view-floating .tile-avatar { width: 48px; height: 48px; font-size: 16px; }
.self-view-floating .tile-footer { right: 6px; bottom: 6px; left: 6px; gap: 4px; }
.self-view-floating .tile-label { height: 22px; padding: 0 7px; border-radius: 7px; font-size: 12px; }
.self-view-floating .speaking-indicator { display: none !important; }
.self-view-floating .tile-muted { width: 22px; height: 22px; border-radius: 7px; }
.self-view-floating .tile-muted svg { width: 13px; height: 13px; }
.self-view-floating .tile-more { top: 6px; right: 6px; width: 28px; height: 28px; }
.self-view-floating .tile-badges { top: 6px; left: 6px; }

/* Notice stack over the stage (Share board): lobby request card, hand, join and info notices. */
.notice-stack {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: min(340px, calc(100% - 24px));
  pointer-events: none;
}
.notice-stack:empty { display: none; }
.stage.has-floating-self .notice-stack { right: 248px; width: min(340px, calc(100% - 260px)); }
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--call-notice-border);
  border-radius: 16px;
  /* Near-opaque glass: tiles and avatars must not show through the text. */
  background: var(--call-notice);
  backdrop-filter: blur(20px);
  box-shadow: var(--call-popover-shadow);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
  pointer-events: auto;
}
@keyframes call-notice { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.notice-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9px; background: var(--call-control); }
.notice-icon svg { width: 16px; height: 16px; stroke-width: 2; }
.notice-hand .notice-icon { background: var(--call-hand); color: var(--call-hand-fg); }
.notice-info .notice-icon { color: var(--call-speak); }
.notice .avatar { flex-shrink: 0; background: var(--call-avatar-strong); color: var(--call-avatar-fg); }
.notice-join .avatar { width: 28px; height: 28px; font-size: 11px; }
.notice.enter { animation: call-notice .22s ease-out; }
.notice-btn.reject svg { display: none; width: 16px; height: 16px; }
.notice-lobby { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; border-radius: 20px; }
.notice-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.notice-person .avatar { width: 40px; height: 40px; font-size: 14px; }
.notice-person > div { display: flex; flex-direction: column; min-width: 0; }
.notice-person b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.notice-person small { color: var(--muted-foreground); font-size: 13px; line-height: 18px; }
.notice-actions { display: flex; gap: 8px; }
.notice-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: var(--call-soft-button);
  color: var(--foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.notice-actions .notice-btn { flex: 1; height: 36px; border-radius: 12px; font-size: 14px; }
.notice-actions .notice-btn.quiet { flex: 0 0 auto; padding: 0 12px; background: transparent; color: var(--muted-foreground); }
.notice-btn.primary { background: var(--call-active-bg); color: var(--call-active-fg); font-weight: 600; }
.notice-btn:hover { background: var(--call-control-hover); }
.notice-btn.primary:hover { background: var(--call-active-hover); }
.notice-btn:focus-visible,
.notice-close:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.notice-close { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted-foreground); cursor: pointer; }
.notice-close svg { width: 16px; height: 16px; }

/* Pills centred above the dock: "you are talking while muted" and the own raised hand. */
.call-hints {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  translate: -50% 0;
  pointer-events: none;
}
.call-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--call-popover-border);
  border-radius: 14px;
  background: var(--call-popover);
  backdrop-filter: blur(20px);
  color: var(--foreground);
  font-size: 14px;
  white-space: nowrap;
  pointer-events: auto;
}
.call-hint.enter { animation: call-pop .16s ease-out; }
.call-hint > svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.muted-hint > svg { color: var(--call-off-fg); }
.hand-pill { padding-left: 12px; border-color: transparent; background: var(--call-hand); color: var(--call-hand-fg); font-weight: 500; }
.hint-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--call-active-bg);
  color: var(--call-active-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.hint-btn kbd { font: inherit; font-weight: 500; opacity: .6; }
.hand-pill .hint-btn { background: var(--call-hand-soft); color: var(--call-hand-fg); }
.hint-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Bottom bar: info zone · dock · panel toggles */
.room-footer {
  position: relative;
  /* Above the overlay panel (z-index 26 at <= 900 px) so dock popovers are never hidden under it. */
  z-index: 27;
  display: grid;
  flex-shrink: 0;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: 88px;
  padding: 0 16px;
}
.call-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.call-title {
  overflow: hidden;
  color: var(--foreground);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.call-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--call-subtle);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
}
#call-timer { font-variant-numeric: tabular-nums; }
.recording-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--call-off-fg); }
.recording-indicator > i { width: 6px; height: 6px; border-radius: 50%; background: var(--call-rec-dot); animation: call-blink 1.6s ease-in-out infinite; }
.recording-indicator.pending { color: var(--call-subtle); }
@keyframes call-blink { 50% { opacity: .35; } }
.transcribing-indicator { display: inline-flex; align-items: center; gap: 5px; color: var(--call-subtle); }
.transcribing-word { font-size: 12px; white-space: nowrap; }
@media (max-width: 760px) { .transcribing-word { display: none; } }
.transcribing-indicator svg { width: 14px; height: 14px; stroke-width: 1.8; }
.call-quality-warning { color: var(--warning); }
.call-capture-kept { color: var(--muted); }

.call-controls,
.call-side {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--call-glass-border);
  border-radius: 24px;
}
/* Glass lives on a pseudo-element: a backdrop-filter on the dock itself would make it the backdrop root
   of its popovers (their blur would see only the dock) and the containing block of fixed sheets. */
.call-controls::before,
.call-side::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--call-glass);
  backdrop-filter: blur(20px);
}
.call-controls { box-shadow: var(--call-dock-shadow); }
.call-side { justify-self: end; }
.dock-item { position: relative; display: flex; }
.call-control {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--call-control);
  color: var(--foreground);
  font: inherit;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.call-control svg { width: 20px; height: 20px; stroke-width: 1.8; }
.call-control:hover { background: var(--call-control-hover); }
.call-control[aria-expanded="true"] { background: var(--call-control-open); }
.call-control.off { background: var(--call-off-bg); color: var(--call-off-fg); }
.call-control.on { background: var(--call-active-bg); color: var(--call-active-fg); }
.call-control.hand { background: var(--call-hand); color: var(--call-hand-fg); }
.call-control.recording { background: var(--call-off-bg); color: var(--call-rec-dot); }
.call-control:focus-visible,
.call-chevron:focus-visible,
.tile-more:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.dock-item.split { border-radius: 16px; background: var(--call-control); color: var(--foreground); transition: background-color .15s; }
.dock-item.split.off { background: var(--call-off-bg); color: var(--call-off-fg); }
.dock-item.split > .call-control { border-radius: 16px 0 0 16px; background: transparent; color: inherit; }
.call-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 48px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--call-split-line);
  border-radius: 0 16px 16px 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.call-chevron svg { width: 14px; height: 14px; stroke-width: 2.2; }
.dock-item.split > :is(.call-control, .call-chevron):hover,
.call-chevron[aria-expanded="true"] { background: var(--call-item-hover); }
.call-control.end {
  width: auto;
  padding: 0 18px 0 14px;
  background: var(--call-leave);
  color: var(--call-on-leave);
  font-size: 14px;
  font-weight: 600;
}
.call-control.end:hover,
.call-control.end[aria-expanded="true"] { background: var(--call-leave-hover); }
.dock-divider { width: 1px; height: 28px; margin: 0 2px; background: var(--call-divider); }
.call-control.people { width: auto; padding: 0 14px; font-size: 14px; font-weight: 600; }
.call-badge {
  position: absolute;
  top: 6px;
  right: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--call-badge);
  box-shadow: 0 0 0 2px var(--call-dock-solid);
  color: var(--call-on-leave);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.call-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--call-hand);
  box-shadow: 0 0 0 2px var(--call-dock-solid);
}
.tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  z-index: 40;
  translate: -50% 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--call-active-bg);
  color: var(--call-active-fg);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, translate .15s;
}
.tip kbd { margin-left: 6px; padding: 0 5px; border-radius: 5px; background: var(--call-tip-kbd); font: inherit; font-weight: 600; }
.dock-item:hover > .tip,
.dock-item:has(:focus-visible) > .tip { opacity: 1; translate: -50% 0; }
.call-side .dock-item:last-child > .tip { left: auto; right: 0; translate: 0 4px; }
.call-side .dock-item:last-child:is(:hover, :has(:focus-visible)) > .tip { translate: 0 0; }
.call-controls.has-popover .tip,
.dock-item.open > .tip { display: none; }

/* Popovers: glass menus anchored above their opener; 160 ms fade + scale */
.popover {
  position: absolute;
  bottom: calc(100% + 14px);
  z-index: 30;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--call-popover-border);
  border-radius: 20px;
  background: var(--call-popover);
  backdrop-filter: blur(20px);
  box-shadow: var(--call-popover-shadow);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  cursor: default;
}
.popover.enter { animation: call-pop .16s ease-out; }
.popover.align-start { left: 0; }
.popover.align-center { left: 50%; translate: -50% 0; }
.popover.align-end { right: 0; }
@keyframes call-pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.popover[data-popover="camera"] { width: 340px; }
.popover[data-popover="react"] { width: 316px; padding: 10px; }
.popover[data-popover="record"] { width: 300px; padding: 16px; }
.popover[data-popover="more"] { width: 312px; }
.popover[data-popover="leave"] { width: 288px; }
.tile .popover {
  top: 50px;
  right: 12px;
  bottom: auto;
  width: 232px;
  padding: 6px;
  border-radius: 16px;
}
.menu-heading { padding: 8px 10px 4px; color: var(--call-subtle); font-size: 12px; line-height: 16px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s;
}
.menu-item[role="menuitemradio"],
.tile .menu-item { min-height: 38px; }
.menu-item:hover,
.menu-item:focus-visible,
.reaction-option:hover,
.reaction-option:focus-visible { background: var(--call-item-hover); outline: none; }
.menu-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.menu-item.quiet { color: var(--muted-foreground); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--call-subtle); font: inherit; font-size: 12px; }
.menu-check { display: flex; flex-shrink: 0; width: 16px; color: var(--call-speak); }
.menu-check svg { width: 16px; height: 16px; stroke-width: 2.2; }
.menu-switch {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--call-switch-off);
  transition: background-color .15s;
}
.menu-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--call-knob);
  transition: left .15s;
}
[aria-checked="true"] > .menu-switch { background: var(--call-speak); }
[aria-checked="true"] > .menu-switch i { left: 18px; }
.menu-divider { height: 1px; margin: 6px 10px; background: var(--call-glass-border); }
.level-meter { display: flex; align-items: center; gap: 3px; height: 24px; padding: 0 10px 0 36px; }
.level-meter i { width: 6px; height: 6px; border-radius: 2px; background: var(--call-meter-off); }
.level-meter i.on { background: var(--call-speak); }
.background-swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 10px 8px; }
.background-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--body);
  font: inherit;
  font-size: 12px;
  line-height: 16px;
  text-align: left;
  cursor: pointer;
}
.popover .background-swatch {
  display: block;
  height: 58px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--call-popover-border);
}
.popover .background-swatch.none { background: var(--call-swatch-none); }
.popover .background-swatch.blur { background: var(--call-swatch-blur); }
.background-option[aria-checked="true"] .background-swatch { box-shadow: 0 0 0 2px var(--foreground); }
.background-option:focus-visible { outline: none; }
.background-option:focus-visible .background-swatch { box-shadow: 0 0 0 2px var(--ring); }
.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 6px 6px;
  padding: 3px;
  border-radius: 12px;
  background: var(--call-segment);
}
.segmented button {
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--call-segment-on); color: var(--foreground); }
.segmented button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.reaction-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.reaction-option {
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.hand-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  background: var(--call-soft-button);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.hand-toggle svg { width: 18px; height: 18px; stroke-width: 2; }
.hand-toggle kbd { font: inherit; font-weight: 500; opacity: .6; }
.hand-toggle.on { background: var(--call-hand); color: var(--call-hand-fg); }
.hand-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.popover-title { margin: 0; color: var(--foreground); font-size: 15px; line-height: 20px; font-weight: 600; }
.room .popover-text { margin: 6px 0 14px; color: var(--muted-foreground); font-size: 13px; line-height: 19px; }
.popover-actions { display: flex; gap: 8px; }
.popover-btn {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: var(--call-soft-button);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.popover-btn.danger { background: var(--call-leave); color: var(--call-on-leave); font-weight: 600; }
.popover-btn:disabled { opacity: .5; cursor: not-allowed; }
.popover-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.menu-item.stacked { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; }
.menu-item.stacked .menu-label { font-weight: 600; white-space: normal; }
.menu-item.stacked small { color: var(--muted-foreground); font-size: 13px; line-height: 18px; }
.menu-item.stacked.danger { margin-top: 4px; background: var(--call-danger-soft); color: var(--call-off-fg); }
.menu-item.stacked.danger small { color: var(--call-danger-soft-fg); }
.menu-item.stacked.danger:hover,
.menu-item.stacked.danger:focus-visible { background: var(--call-danger-soft-hover); }

/* Side panel (restyled in Task 5) */
.room-panel {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 360px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--call-panel-border);
  border-radius: 20px;
  background: var(--call-panel);
}
.panel-tabs { display: flex; flex-shrink: 0; align-items: center; gap: 4px; padding: 12px; }
.panel-tablist { display: flex; flex: 1; min-width: 0; gap: 2px; padding: 3px; border-radius: 12px; background: var(--call-segment); }
.panel-tablist > button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.panel-tablist > button.active { background: var(--call-segment-on); color: var(--foreground); }
.panel-tablist > button span { color: var(--call-subtle); }
.panel-tablist > button .tab-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--call-badge); color: var(--call-on-leave); font-size: 11px; font-weight: 700; line-height: 18px; }
.panel-tablist > button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.panel-tabs > .icon-btn { width: 36px; height: 36px; margin-left: 4px; border-radius: 12px; color: var(--muted-foreground); }
.chat-content { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 16px; }
.room .chat-content:has(> .chat-empty) { display: grid; align-items: center; }
.room .panel-section-caption { margin: 18px 4px 8px; padding: 0; color: var(--muted-foreground); font-size: 13px; line-height: 20px; letter-spacing: 0; }
.room .panel-section-caption:first-child { margin-top: 4px; }
.chat-content.panel-people,
.chat-content.panel-moments { padding: 0 12px 16px; }
.panel-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 4px 8px; }
.room .panel-section-head .panel-section-caption { margin: 0; }
.panel-invite,
.panel-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--call-control);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.panel-invite:hover { background: var(--call-control-hover); }
.panel-invite svg,
.panel-primary svg { width: 16px; height: 16px; stroke-width: 2; }
.panel-primary { height: 44px; border-radius: 14px; background: var(--call-active-bg); color: var(--call-active-fg); font-weight: 600; }
.panel-primary:hover { background: var(--call-active-hover); }
.panel-primary kbd { font: inherit; font-weight: 500; color: var(--call-active-muted); }
:is(.panel-invite, .panel-primary, .panel-chip):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.panel-chip {
  flex-shrink: 0;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--call-control);
  color: var(--foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.panel-chip.primary { background: var(--call-active-bg); color: var(--call-active-fg); font-weight: 600; }
.hand-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.hand-row > .avatar { width: 36px; height: 36px; flex-shrink: 0; background: var(--call-avatar); color: var(--call-avatar-fg); font-size: 12px; }
.hand-row > div:not(.avatar) { flex: 1; min-width: 0; }
.hand-row b { display: block; overflow: hidden; color: var(--foreground); font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.hand-row small { color: var(--call-subtle); font-size: 12px; line-height: 16px; }
.hand-badge { display: flex; flex-shrink: 0; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 9px; background: var(--call-hand); color: var(--call-hand-fg); font-size: 12px; font-weight: 600; }
.hand-badge svg { width: 14px; height: 14px; stroke-width: 2; }
.panel-moments .panel-primary { margin-bottom: 4px; }
.room .panel-footnote { margin: 14px 4px 0; color: var(--call-subtle); font-size: 13px; line-height: 20px; }
.participant-row,
.lobby-person { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.participant-row > .avatar,
.lobby-person > .avatar { width: 36px; height: 36px; flex-shrink: 0; background: var(--call-avatar); color: var(--call-avatar-fg); font-size: 12px; }
.participant-row > div:not(.avatar),
.lobby-person > div:nth-child(2) { flex: 1; min-width: 0; }
.participant-row strong,
.lobby-person b { display: block; overflow: hidden; color: var(--foreground); font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.participant-row small,
.lobby-person small { color: var(--call-subtle); font-size: 12px; line-height: 16px; }
.participant-row > .icon-btn,
.lobby-person button { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--call-item-hover); color: var(--muted-foreground); cursor: pointer; }
.participant-row svg,
.lobby-person svg { width: 16px; height: 16px; }
.participant-mic { display: flex; color: var(--call-subtle); }
.participant-mic.off { color: var(--call-off-fg); }
.participant-mic svg { width: 18px; height: 18px; }
.lobby-person > div:last-child { display: flex; gap: 6px; }
.lobby-person button.admit { background: var(--call-admit-bg); color: var(--call-speak); }
.room-panel .btn.full { width: 100%; min-height: 36px; margin: 4px 0 8px; border: 0; border-radius: 12px; background: var(--call-soft-button); color: var(--foreground); }
.call-moment { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--call-panel-border); }
.call-moment > time { width: 40px; flex-shrink: 0; color: var(--muted-foreground); font-size: 13px; font-variant-numeric: tabular-nums; }
.call-moment > p { color: var(--body); font-size: 14px; }
.room-panel .panel-actions { flex-shrink: 0; padding: 12px; }
.room-panel .panel-actions > .btn { width: 100%; height: 44px; border: 0; border-radius: 14px; background: var(--call-active-bg); color: var(--call-active-fg); font-weight: 600; }

/* Narrow desktops and tablets: the info zone becomes one line above the dock and panel toggles. */
@media (max-width: 1100px) {
  .room-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "info info" "dock side";
    row-gap: 8px;
    height: auto;
    padding: 10px 16px 12px;
  }
  .call-info { grid-area: info; flex-direction: row; align-items: baseline; gap: 12px; }
  .call-title { flex: 0 1 auto; min-width: 0; }
  .call-controls { grid-area: dock; justify-self: center; }
  .call-side { grid-area: side; }
}
@media (max-width: 900px) {
  .room-panel { position: absolute; inset: 16px 16px 16px auto; z-index: 26; width: min(360px, calc(100% - 32px)); box-shadow: var(--call-popover-shadow); }
}
/* Phone top bar, sheet and their contents exist only in the phone markup (roomPage checks the same query). */
.call-topbar-actions { display: flex; flex-shrink: 0; gap: 8px; }
.topbar-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--call-control);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.topbar-btn.people { width: auto; min-width: 44px; padding: 0 12px; }
.topbar-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.topbar-btn.people svg { width: 18px; height: 18px; }
.topbar-btn.on { background: var(--call-active-bg); color: var(--call-active-fg); }
.topbar-btn .call-dot { top: 7px; right: 6px; width: 8px; height: 8px; }
.topbar-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 1; background: var(--call-scrim); }
.sheet-grabber { width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--call-grabber); }
.sheet-reactions { display: flex; gap: 6px; margin-bottom: 10px; }
.sheet-reaction {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--call-item-hover);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sheet-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--call-hand-tint);
  color: var(--call-hand);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.sheet-hand.on { background: var(--call-hand); color: var(--call-hand-fg); }
.sheet-hand svg { width: 20px; height: 20px; stroke-width: 2; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.sheet-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 84px;
  padding: 0 2px;
  border: 0;
  border-radius: 18px;
  background: var(--call-item-hover);
  color: var(--foreground);
  font: inherit;
  font-size: 12px;
  line-height: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.sheet-tile svg { width: 22px; height: 22px; flex-shrink: 0; stroke-width: 1.8; }
.sheet-tile > span { display: flex; flex-direction: column; align-items: center; max-width: 100%; overflow-wrap: normal; hyphens: manual; letter-spacing: -.01em; }
.sheet-tile small { color: var(--muted-foreground); font-size: 12px; line-height: 15px; font-weight: 400; }
.sheet-tile.danger { background: var(--call-off-bg); color: var(--call-off-fg); }
.sheet-tile.mint { background: var(--call-admit-bg); color: var(--call-speak); }
.sheet-tile.on { background: var(--call-active-bg); color: var(--call-active-fg); }
.sheet-dot { position: absolute; top: 10px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--call-hand); }
.sheet-caption { margin: 18px 4px 8px; color: var(--call-subtle); font-size: 13px; line-height: 20px; }
.sheet-list { overflow: hidden; border-radius: 18px; background: var(--call-sheet-row); }
.sheet-list.quiet { margin-top: 12px; }
.sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.sheet-row + .sheet-row { border-top: 1px solid var(--call-item-hover); }
.sheet-list.quiet .sheet-row { color: var(--muted-foreground); }
.sheet-row svg { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 1.8; }
:is(.sheet-reaction, .sheet-hand, .sheet-tile, .sheet-row):focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }

/* Phone (MobileGroup, MobileCall, MobileMore boards): top bar, six 52 px buttons, bottom sheets, full-screen panel. */
@media (max-width: 760px) {
  .room .connection-banner,
  .room .audio-banner { margin: 8px 12px 0; }
  .call-topbar {
    position: relative;
    z-index: 3;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) 16px 10px;
  }
  .call-topbar .call-info { flex: 1; flex-direction: column; align-items: stretch; gap: 0; }
  .call-topbar .call-title { font-size: 16px; line-height: 22px; }
  .call-topbar .call-meta { gap: 8px; font-size: 13px; }
  .room-body { padding: 0 12px; gap: 8px; }
  .tiles,
  .room-body:has(.room-panel) .tiles:not([data-count="1"]) { gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
  .tiles[data-count="2"] { grid-template-columns: minmax(0, 1fr); }
  .tile { border-radius: 18px; }
  .tile-avatar { width: 64px; height: 64px; font-size: 20px; }
  .tile-footer { right: 8px; bottom: 8px; left: 8px; gap: 6px; }
  .tile-label { height: 24px; padding: 0 8px; border-radius: 8px; font-size: 12px; }
  .tile-note,
  .speaking-indicator { display: none; }
  .tile-muted { width: 24px; height: 24px; border-radius: 8px; }
  .tile-muted svg { width: 13px; height: 13px; }
  .tile-badges { top: 8px; left: 8px; }
  .tile-hand { height: 24px; padding: 0 7px; border-radius: 8px; font-size: 12px; }
  .tile-hand svg { width: 13px; height: 13px; }
  /* Touch target: every variant (thumbnails, strip, floating self view) keeps 44 px. */
  .tile .tile-more,
  .speaker-view .tiles > .tile:not(.lead) .tile-more,
  .screen-thumbnails .tile .tile-more,
  .tile.self-view-floating .tile-more { top: 2px; right: 2px; width: 44px; height: 44px; background: transparent; backdrop-filter: none; }
  .tile.menu-open { z-index: 40; }
  .speaker-view .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: minmax(0, 3fr) minmax(0, 1fr); }
  .speaker-view .tiles > .tile.lead { grid-row: 1; grid-column: 1 / -1; }
  .stage.sharing { display: flex; }
  .stage.sharing .screen-stage { flex: 1; }
  .screen-thumbnails { flex-direction: row; height: 88px; flex-shrink: 0; gap: 8px; }
  .gallery-pagination .btn { min-height: 44px; }
  .room-footer {
    display: block;
    height: auto;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  }
  .call-controls {
    /* Chrome applies justify-self to block layout too: stretch, or the dock shrinks to its content. */
    justify-self: stretch;
    justify-content: space-between;
    gap: 4px;
    height: 76px;
    padding: 12px;
    border-color: var(--call-notice-border);
    border-radius: 28px;
  }
  .call-controls::before { background: var(--call-dock-phone); }
  .call-controls .dock-item { flex: 0 1 52px; justify-content: center; min-width: 44px; }
  .call-controls .call-control { width: 100%; max-width: 52px; height: 52px; border-radius: 18px; background: var(--call-control-phone); }
  .call-controls .call-control svg { width: 22px; height: 22px; }
  .call-controls .call-control.off { background: var(--call-off-bg); color: var(--call-off-fg); }
  .call-controls .call-control.on { background: var(--call-active-bg); color: var(--call-active-fg); }
  .call-controls .call-control.hand { background: var(--call-hand); color: var(--call-hand-fg); }
  .call-controls .call-control.end { padding: 0; background: var(--call-leave); color: var(--call-on-leave); }
  .call-controls .call-badge { top: 7px; right: 7px; box-shadow: 0 0 0 2px var(--call-dock-solid); }
  /* Every popover becomes a bottom sheet over the dock (fixed: the dock has no transform or filter). */
  .room .popover,
  .room .tile .popover {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 48px);
    padding: 26px 16px max(20px, env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 28px 28px 0 0;
    background: var(--call-sheet);
    box-shadow: var(--call-sheet-shadow);
    translate: none;
    animation: none;
  }
  .room .popover.enter { animation: call-sheet .22s ease-out; }
  .room .popover::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; translate: -50% 0; border-radius: 3px; background: var(--call-grabber); }
  .room .popover.sheet { padding-top: 10px; }
  .room .popover.sheet::before { display: none; }
  .room .popover[data-popover] { width: auto; }
  .menu-item { min-height: 48px; }
  .reaction-option { height: 48px; }
  .hand-toggle,
  .popover-btn { height: 48px; }
  /* Panels open full screen with the same tabs, down to the dock: mic, camera and leave stay reachable. */
  .room-panel {
    position: fixed;
    inset: 0 0 calc(88px + max(12px, env(safe-area-inset-bottom)));
    z-index: 26;
    width: auto;
    padding: env(safe-area-inset-top) 0 0;
    border: 0;
    border-radius: 0 0 24px 24px;
    box-shadow: none;
  }
  .panel-tabs { padding: 12px 12px 8px; }
  .panel-tablist > button { height: 38px; }
  /* Notices span the stage top (MobileGroup board): the lobby request is one row with «Впустить» and ✕. */
  .notice-stack { top: 0; right: 0; width: 100%; }
  .notice { min-height: 56px; border-radius: 18px; }
  .notice-lobby { flex-direction: row; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; }
  .notice-lobby .notice-person { flex: 1; gap: 10px; }
  .notice-person .avatar { width: 36px; height: 36px; font-size: 12px; }
  .notice-person b { display: -webkit-box; font-size: 13px; line-height: 17px; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .notice-person small { overflow: hidden; font-size: 12px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .notice-lobby .notice-actions { flex-shrink: 0; gap: 6px; }
  .notice-actions .notice-btn { flex: 0 0 auto; height: 44px; padding: 0 12px; font-size: 13px; }
  .notice-actions .notice-btn.reject { width: 44px; padding: 0; }
  .notice-btn.reject .notice-btn-label,
  .notice-actions .notice-btn.quiet { display: none; }
  .notice-btn.reject svg { display: block; }
  .notice-btn,
  .notice-close,
  .panel-chip,
  .tile-pin button { min-height: 44px; }
  .notice-close { width: 44px; }
  .tile.self-view-floating { top: 8px; right: 8px; width: 104px; height: 140px; }
  .stage.has-floating-self .notice-stack { right: 120px; width: calc(100% - 120px); }
  /* Pills above the dock become full-width bars (MobileGroup board). */
  .call-hints { right: 12px; left: 12px; align-items: stretch; translate: none; }
  .call-hint { height: 44px; padding: 0 6px 0 12px; font-size: 13px; }
  .call-hint > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .hint-btn { flex-shrink: 0; height: 36px; padding: 0 12px; border-radius: 10px; }
  .hint-btn kbd { display: none; }
  /* An open panel already shows the hand queue; the pills would cover its compose field. */
  .room-body:has(.room-panel) ~ .room-footer .call-hints { display: none; }
  .panel-tabs > .icon-btn,
  .participant-row > .icon-btn,
  .lobby-person button { width: 44px; height: 44px; }
  .room .chat-compose input { font-size: 16px; }

  /* One to one (MobileCall board): the other person fills the screen; bars float over the video. */
  .room.solo { position: relative; }
  .room.solo .room-body { position: absolute; inset: 0; padding: 0; }
  .room.solo .tiles { gap: 0; }
  .room.solo .tiles > .tile { border-radius: 0; box-shadow: none; }
  .room.solo .tiles > .tile .tile-avatar { width: 120px; height: 120px; font-size: 36px; }
  .room.solo .tiles > .tile .tile-footer { right: 16px; bottom: calc(132px + env(safe-area-inset-bottom)); left: 16px; }
  .room.solo .tiles > .tile .tile-label { height: 32px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
  .room.solo .tiles > .tile.speaking .speaking-indicator { display: flex; }
  .room.solo .tiles > .tile .tile-more { top: calc(max(12px, env(safe-area-inset-top)) + 58px); right: auto; left: 8px; }
  .room.solo .call-topbar { position: absolute; top: 0; right: 0; left: 0; padding-bottom: 32px; background: linear-gradient(180deg, var(--call-scrim-top) 0%, transparent 100%); }
  .room.solo .topbar-btn { background: var(--call-chip-soft); backdrop-filter: blur(14px); }
  .room.solo .room-footer { position: absolute; right: 0; bottom: 0; left: 0; padding-top: 48px; background: linear-gradient(0deg, var(--call-scrim-bottom) 0%, transparent 100%); }
  .room.solo .tile.self-view-floating { top: calc(max(12px, env(safe-area-inset-top)) + 60px); right: 16px; }
  .room.solo .stage.has-floating-self .notice-stack { top: calc(max(12px, env(safe-area-inset-top)) + 60px); right: 132px; left: 12px; width: auto; }
  /* The stage fills the screen and the dock floats over it: keep the reaction above the dock. */
  .room.solo .floating-reaction { bottom: calc(100px + env(safe-area-inset-bottom)); }
}
@keyframes call-sheet { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .popover.enter,
  .room .popover.enter,
  .notice.enter,
  .call-hint.enter,
  .floating-reaction,
  .speaking-indicator i,
  .recording-indicator > i { animation: none; }
  .tip,
  .tile,
  .tile-more,
  .call-control,
  .menu-switch,
  .menu-switch i { transition: none; }
}

/* Connection diagnostics dialog: left-aligned status, breathing room between blocks, compact download action. */
.modal .connection-detail { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; padding: 0 0 20px; text-align: left; }
.modal .connection-detail > svg { width: 24px; height: 24px; margin: 0; }
.modal .connection-detail h3 { margin: 0; font-size: 17px; line-height: 24px; }
.modal .connection-detail p { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 20px; }
.modal .connection-metrics { margin-bottom: 8px; border-top: 0; }
.modal .rtc-tracks > div:last-child { border-bottom: 0; }
.modal #rtc-metrics .note { margin: 12px 0 20px; }
