@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/barlow-regular.ttf") format("truetype"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/barlow-bold.ttf") format("truetype"); }
:root {
  color-scheme: dark;
  --bg: #101318;
  --surface: #171d26;
  --surface-2: #222b38;
  --hover: #2b3546;
  --video: #13171e;
  --line: #354151;
  --line-2: #4a586c;
  --text: #eef2fa;
  --dim: #aab6c8;
  --faint: #8592a6;
  --accent: #8eb4fa;
  --accent-hover: #a8c5fb;
  --on-accent: #0c1022;
  --brand: #2649cc;
  --green: #60c99b;
  --red: #ef8791;
  --red-line: #a8525e;
  --red-strong: #9b3845;
  --red-bg: #2a1a21;
  --amber: #f2c46d;
  --amber-line: #8a6d33;
  --radius: 10px;
  --radius-sm: 8px;
  --font: "Barlow", Arial, sans-serif;
  --display: var(--font);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tray-panel { display: none; }
body.compact-tray #join-screen, body.compact-tray #app-screen { display: none !important; }
body.compact-tray .tray-panel { display: flex; flex-direction: column; height: 100dvh; padding: 16px; gap: 12px; overflow-y: auto; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.tray-panel > :not(.tray-participants) { flex-shrink: 0; }
.tray-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.tray-header > div { min-width: 0; }
.tray-header small { color: var(--dim); font: 400 10px var(--mono); letter-spacing: .1em; }
.tray-header h1 { margin: 3px 0 0; font: 700 16px var(--mono); overflow-wrap: anywhere; }
.tray-count { flex-shrink: 0; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--dim); font-size: 11px; }
.tray-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tray-media .btn { min-width: 0; height: auto; min-height: 44px; padding: 8px 6px; text-align: center; line-height: 1.35; font-size: 12px; }
.tray-media .slash { display: none; }
#tray-mic[aria-pressed="false"] .slash, #tray-camera[aria-pressed="false"] .slash, #tray-output[aria-pressed="true"] .slash { display: inline; }
.tray-media #tray-screen { grid-column: 1 / -1; min-height: 44px; gap: 9px; font-size: 14px; }
.tray-quality-section h2 { margin: 0 0 8px; color: var(--dim); font-size: 12px; font-weight: 400; }
.tray-quality, .tray-footer, .tray-view-actions { display: flex; gap: 6px; }
.tray-quality { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.tray-quality .btn { height: 32px; border-color: transparent; background: transparent; color: var(--dim); font-weight: 400; }
.tray-quality [aria-pressed="true"] { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.tray-quality-more { display: flex; width: 100%; min-height: 32px; align-items: center; justify-content: space-between; margin-top: 2px; padding: 0 2px; border: 0; background: transparent; color: var(--dim); font-size: 12px; text-align: left; }
.tray-quality-more:hover:not(:disabled) { color: var(--text); }
.tray-quality-more svg { width: 14px; height: 14px; }
.tray-quality-more:disabled { opacity: .45; cursor: default; }
.tray-participants { flex: 1; min-height: 72px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); padding-top: 8px; scrollbar-width: thin; }
.tray-participants::before { content: "Participantes"; display: block; margin-bottom: 6px; color: var(--dim); font-size: 12px; font-weight: 400; }
.tray-user { padding: 7px 0; }
.tray-user + .tray-user { border-top: 1px solid var(--line); }
.tray-user-row { display: flex; align-items: center; gap: 10px; }
.tray-user .avatar-circle { width: 30px; height: 30px; flex: 0 0 30px; border-width: 2px; background: var(--surface-2); font-size: 12px; }
.tray-user.speaking .avatar-circle { border-color: var(--green); }
.tray-user-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-user-icons { display: flex; flex-shrink: 0; align-items: center; gap: 8px; color: var(--dim); }
.state-icon svg { width: 17px; height: 17px; }
.state-mic { color: var(--green); }
.state-mic.muted { color: var(--red); }
.state-mic .slash { display: none; }
.state-mic.muted .slash { display: inline; }
.tray-user.speaking .state-mic:not(.muted) svg { stroke-width: 2.4; filter: drop-shadow(0 0 3px var(--green)); }
.tray-user-volume { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-left: 40px; }
.tray-user-volume .range { flex: 1; }
.tray-participants:empty { display: none; }
.tray-view-actions { flex-wrap: wrap; margin: 6px 0 0 40px; }
.tray-view-actions .btn { min-height: 30px; padding: 0 9px; font-size: 11px; }
.tray-footer { gap: 6px; margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.tray-footer .btn { min-height: 38px; flex: 1; padding: 0 6px; font-size: 13px; }
.tray-footer svg { width: 17px; height: 17px; }
.tray-footer .tray-leave { flex: 0 0 44px; padding: 0; }
.tray-media #tray-screen[aria-pressed="true"] { border-color: var(--red); background: var(--surface-2); color: var(--red); }
.tray-media #tray-mic[aria-pressed="true"], .tray-media #tray-camera[aria-pressed="true"] { border-color: var(--green); color: var(--green); }
.tray-media #tray-mic[aria-pressed="false"], .tray-media #tray-camera[aria-pressed="false"] { color: var(--red); }
.tray-media #tray-output[aria-pressed="true"] { border-color: var(--red); color: var(--red); }
.w-4, .h-4 { width: 16px; height: 16px; }
.w-5, .h-5 { width: 20px; height: 20px; }
.w-6, .h-6 { width: 24px; height: 24px; }
.w-10 { width: 36px; }
.rounded-full { border-radius: 50%; }
.text-xs { font-size: 12px; }
.font-semibold { font-weight: 700; }
.opacity-50 { opacity: .5; }
.opacity-70 { opacity: .7; }
.ml-2 { margin-left: 8px; }
.bg-primary { background: var(--accent); }
.text-primary-content { color: var(--on-accent); }
.bg-base-300 { background: var(--surface-2); }
.text-base-content { color: var(--text); }
.text-error { color: var(--red); }
.text-success { color: var(--green); }

#join-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.join-form { width: min(100%, 430px); padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.join-logo { display: block; width: 112px; height: auto; margin: 0 0 22px; }
.join-form h1 { margin: 0 0 7px; font: 700 26px/1.15 var(--display); }
.join-form p { margin: 0 0 24px; color: var(--dim); }
.join-fields { display: grid; gap: 8px; }
.join-fields label { font-size: 14px; }
.input-icon { position: relative; display: grid; }
.input-icon > svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.input-icon > .input { padding-left: 40px; }
#joinBtn svg { width: 18px; height: 18px; }
.input, .select {
  min-width: 0; height: 43px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { border-color: var(--accent); }
.input[aria-invalid=true] { border-color: var(--red); }
.field-hint { color: var(--faint); font-size: 11px; margin: -3px 0 9px; }
/* Recent and favorite rooms: a click joins, the star keeps one at the front. */
.recent-rooms { display: flex; flex-wrap: wrap; gap: 6px; margin: -3px 0 9px; }
.recent-room { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.recent-room button { border: 0; background: none; color: var(--text); min-height: 30px; }
.recent-room-join { max-width: 180px; padding: 0 4px 0 10px; font: 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-room-star { width: 28px; padding: 0; color: var(--faint); font-size: 14px; }
.recent-room-star[aria-pressed="true"] { color: var(--amber); }
.recent-room:hover { border-color: var(--line-2); }
.field-error { color: var(--red); font-size: 11px; }
.join-fields .btn { width: 100%; margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 700;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-error { color: var(--red); border-color: var(--red-line); }
.btn-ghost { background: transparent; color: var(--dim); }
.btn-circle, .btn-square { width: 40px; padding: 0; }
.btn-lg { height: 43px; font-size: 14px; }

#app-screen { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
#app-screen:not(.hidden) { animation: fade-in .2s ease-out; }
.dock-status, .connection-status { color: var(--dim); font-size: 11px; margin: 0; }
.connection-alert { color: var(--red); font-size: 12px; }
.dock-tools { grid-column: 2; }
.room-actions { grid-column: 3; }
.dock-status { justify-self: start; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-actions { justify-self: end; gap: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.workspace {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  flex: 1; min-height: 0;
  transition: grid-template-columns .2s cubic-bezier(.2, 0, 0, 1);
}
/* The chat column slides shut; its content keeps a width instead of squeezing on the way. */
.workspace.chat-collapsed { grid-template-columns: minmax(0, 1fr) 0px; }
.workspace .sidebar { min-width: 0; overflow: hidden; transition: opacity .15s; }
.workspace .sidebar > * { min-width: 245px; }
.workspace.chat-collapsed .sidebar { opacity: 0; visibility: hidden; transition: opacity .12s, visibility 0s .2s; }
.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.screen-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.screens-main { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); grid-auto-rows: 1fr; }
.screen-stage.focus-mode .screens-main { display: block; }
.screen-stage.focus-mode .screens-main .screen-tile { width: 100%; height: 100%; }
.screen-stage.no-video .screens-main { display: block; }
.empty-state { width: 100%; height: 100%; padding: 16px; display: grid; place-items: center; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: var(--video); }
.empty-state strong { display: block; margin-bottom: 6px; font-weight: 700; }
.empty-state p { margin: 0; color: var(--dim); }
.screens-rail {
  flex: 0 0 110px; min-height: 0; display: flex; align-items: center; gap: 8px;
  padding-right: 46px; overflow-x: auto; overflow-y: hidden;
  justify-content: safe center; scrollbar-width: none;
  transition: flex-basis .2s cubic-bezier(.2, 0, 0, 1), opacity .15s;
}
.screens-rail::-webkit-scrollbar { display: none; }
.screens-rail .screen-tile, .participant-tile { flex: none; width: 168px; height: 94.5px; aspect-ratio: 16 / 9; }
.screens-rail .screen-tile { order: 0; }
.screens-rail .screen-tile.speaking { border-color: var(--green); }
.participant-tile { order: 1; }
/* Folds down to the strip the toggle sits on, so the stage grows instead of jumping. */
.screen-stage.rail-collapsed .screens-rail {
  flex-basis: 34px; opacity: 0; visibility: hidden;
  transition: flex-basis .2s cubic-bezier(.2, 0, 0, 1), opacity .12s, visibility 0s .2s;
}
.screen-tile {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--video); cursor: pointer;
  transition: border-color .15s;
}
.screen-tile.focused { border-color: var(--accent); }
/* The first frame fades in over the tile instead of popping. */
.screen-tile video { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s ease-out; }
.screen-tile video.ready { opacity: 1; }
.screen-tile-controls {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  display: flex; align-items: center; gap: 6px;
}
.screens-rail .screen-tile-controls { opacity: 0; right: 5px; bottom: 5px; }
.screens-rail .screen-tile:hover .screen-tile-controls,
.screens-rail .screen-tile:focus-within .screen-tile-controls { opacity: 1; }
.glass-chip {
  display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 9px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: rgba(16,19,24,.92); color: var(--text);
}
button.glass-chip { width: 34px; justify-content: center; padding: 0; }
.screen-volume-toggle { display: grid; place-items: center; padding: 0; border: 0; background: none; color: inherit; }
.screen-volume-toggle svg, .glass-chip svg { width: 17px; height: 17px; }
.range { width: 78px; accent-color: var(--accent); }
.screens-rail .range { width: 52px; }
.screen-tile.video-hidden video { visibility: hidden; }
.screen-tile.video-hidden::after { content: "Vídeo oculto"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }
.screen-tile.video-hidden .screen-tile-controls { z-index: 3; }
/* "Por que está travando?": only while something holds the quality back; a click explains it. */
.quality-bar { position: absolute; left: 12px; top: 12px; z-index: 2; display: flex; align-items: center; gap: 6px; }
.quality-chip {
  display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--amber-line); border-radius: var(--radius-sm);
  background: rgba(16,19,24,.92); color: var(--amber); font-size: 13px; font-weight: 700;
}
.quality-chip svg { width: 16px; height: 16px; }
.quality-chip span { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screens-rail .quality-bar { left: 5px; top: 5px; }
.screens-rail .quality-chip { min-height: 22px; padding: 0 5px; }
.screens-rail .quality-action { display: none; }
.quality-action { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: rgba(16,19,24,.92); color: var(--text); font-size: 13px; }
.quality-action:hover { border-color: var(--amber-line); }
.screens-rail .quality-chip span { display: none; }
/* Whose screen or camera: bottom left, centred on the 34 px controls on the right. */
.tile-name {
  position: absolute; left: 12px; bottom: 16px; z-index: 2; max-width: 40%;
  padding: 4px 9px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: rgba(16,19,24,.92); color: var(--text); font-size: 12px; line-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}
/* Fullscreen is for watching: the name and the controls leave with the pointer (ui.js sets .awake). */
.screen-tile:fullscreen :is(.tile-name, .screen-tile-controls) { transition: opacity .2s; }
.screen-tile:fullscreen:not(.awake):not(:has(:focus-visible)) :is(.tile-name, .screen-tile-controls) { opacity: 0; }
.screen-tile:fullscreen:not(.awake) { cursor: none; }
.screens-rail .tile-name {
  position: absolute; left: 6px; bottom: 6px; z-index: 1; display: block; max-width: calc(100% - 12px); border: 0; line-height: normal;
  padding: 1px 6px; border-radius: 6px; background: rgba(16,19,24,.85); color: var(--text);
  font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}
.screen-tile-mirror {
  position: relative; order: -1; flex: none; width: 168px; height: 94.5px; overflow: hidden;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--video); cursor: pointer;
}
.screen-tile-mirror video { display: block; width: 100%; height: 100%; object-fit: contain; }
.screen-tile.video-hidden::after { z-index: 1; }

.participant-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
}
.participant-name { max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
button.participant-options { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.screen-tile-controls .participant-options { position: static; }
.participant-tile:hover { border-color: var(--faint); }
.avatar-circle {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px;
  border: 2px solid transparent; border-radius: 50%; background: var(--line);
  font-size: 13px; font-weight: 700;
  transition: border-color .15s, box-shadow .15s;
}
.avatar-circle.speaking { border-color: var(--green); box-shadow: 0 0 0 3px var(--surface-2); }
.avatar-circle .mute-overlay {
  position: absolute; right: -5px; bottom: -3px; display: grid; place-items: center;
  width: 18px; height: 18px; border: 2px solid var(--surface-2); border-radius: 50%;
  background: var(--red-strong); color: #fff;
}
.mute-overlay svg { width: 10px; height: 10px; stroke-width: 2; }
.strip-toggle, .chat-restore, .chat-hide {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: rgba(16,19,24,.92); color: var(--text);
}
.strip-toggle svg, .chat-restore svg, .chat-hide svg { width: 16px; height: 16px; }
.strip-toggle { position: absolute; right: 16px; bottom: 50px; z-index: 5; transition: bottom .2s cubic-bezier(.2, 0, 0, 1); }
/* Keep the toggle on the right without covering the focused tile's controls. */
.screen-stage.rail-collapsed .strip-toggle { bottom: 12px; }
.chat-restore { position: absolute; right: 16px; top: 16px; z-index: 8; display: none; }
.workspace.chat-collapsed .chat-restore { display: grid; animation: fade-in .2s ease-out; }

.dock {
  --control-size: 42px; --glyph-size: 20px;
  flex: 0 0 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: 13px; padding: 8px 12px; border-top: 1px solid var(--line);
  background: var(--bg);
}
.dock-tools { display: flex; align-items: center; gap: inherit; }
.toolgroup { display: flex; position: relative; }
.toolgroup .icon-button, .device-picker summary {
  display: grid; place-items: center; height: var(--control-size);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.toolgroup .icon-button { width: var(--control-size); padding: 0; border-radius: 10px; }
.toolgroup.with-device .icon-button { border-radius: 10px 0 0 10px; }
.toolgroup .icon-button svg { width: var(--glyph-size); height: var(--glyph-size); }
.toolgroup .icon-button[data-control=camera] svg { transform: scale(1.08); }
.toolgroup .icon-button[data-control=output] svg { transform: scale(1.15); }
.toolgroup .icon-button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toolgroup .icon-button.muted { color: var(--red); }
.toolgroup .icon-button:hover, .device-picker summary:hover { background: var(--hover); }
.toolgroup .btn { width: var(--control-size); height: var(--control-size); padding: 0; border-radius: 10px; }
.toolgroup.with-device .btn { border-radius: 10px 0 0 10px; }
.toolgroup .btn svg { width: var(--glyph-size); height: var(--glyph-size); }
.toolgroup .btn-primary { background: var(--accent); color: var(--on-accent); }
.toolgroup .btn-error { color: var(--red); }
.toolgroup .btn, .device-picker summary { transition: background-color .15s, border-color .15s, color .15s, scale .09s; }
.toolgroup .btn:active, .device-picker summary:active { scale: .94; }
/* Shown again after display: none, so a toggle's counterpart replays this on each swap. */
.toolgroup .btn:not(.hidden) > svg { animation: icon-in .14s cubic-bezier(.2, 0, 0, 1); }
#micSlash:not(.hidden) { animation: fade-in .14s ease-out; }
.device-picker { position: relative; }
.device-picker summary { width: 24px; border-left: 0; border-radius: 0 10px 10px 0; cursor: pointer; list-style: none; }
.device-picker summary::-webkit-details-marker { display: none; }
.device-picker summary svg { width: 12px; height: 12px; }
.picker-panel {
  position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 20; width: min(260px, calc(100vw - 24px));
  padding: 10px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 16px 40px #0008;
}
.picker-panel label { display: block; margin-bottom: 6px; font-weight: 700; }
.picker-panel .select { width: 100%; height: 36px; }
.feedback-text { width: 100%; height: auto; min-height: 96px; margin: 4px 0 12px; padding: 8px 10px; resize: vertical; }
.picker-panel .sound-option { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-weight: 400; font-size: 13px; cursor: pointer; }
.toolgroup.with-device:nth-child(3) .picker-panel { left: -42px; right: auto; }
.share-picker .picker-panel { left: calc(-1 * var(--control-size)); right: auto; width: min(290px, calc(100vw - 24px)); padding: 6px; }
.share-menu-title { display: flex; align-items: center; justify-content: space-between; margin: 4px 6px 8px; font-weight: 700; }
.share-menu-state { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--dim); font-size: 11px; font-weight: 400; }
.share-menu-state.live { background: var(--accent); color: var(--on-accent); }
.share-menu-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 2px 6px; }
.share-menu-presets button { min-height: 34px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); font-size: 12px; }
.share-menu-presets button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.share-menu-note { margin: 0 8px 6px; color: var(--dim); font-size: 11px; }
.share-menu-app { display: block; margin: 6px 8px 2px; color: var(--dim); font-size: 11px; }
.share-menu-app:hover, .share-app-hint a:hover, .join-links a:hover { color: var(--text); }
.share-app-hint { margin: 10px 0 4px; color: var(--dim); font-size: 12px; }
.share-app-hint a, .join-links a { color: inherit; text-underline-offset: 3px; }
.join-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 18px 0 0 !important; font-size: 13px; }
.share-menu-rows { padding-top: 4px; border-top: 1px solid var(--line); }
.share-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 7px; background: none; color: var(--text); text-align: left; }
.share-menu-row:hover, .share-menu-row:focus-visible { background: var(--hover); }
.share-menu-value { margin-left: auto; color: var(--dim); }
.share-menu-rows .share-menu-row::after { content: "›"; color: var(--dim); }
.share-menu-source { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; }
.share-menu-back { justify-content: flex-start; margin-bottom: 4px; border-bottom: 1px solid var(--line); border-radius: 7px 7px 0 0; font-weight: 700; }
.share-menu-back::before { content: "‹"; color: var(--dim); }
.share-menu-row[aria-checked="true"] { color: var(--accent); }
.share-menu-row[aria-checked="true"]::after { content: "✓"; }
.tool-separator { width: 1px; height: 25px; background: var(--line); }

.sidebar { min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.conversation-header {
  flex: 0 0 32px; display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin: 10px 10px 0; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 10px 10px 0 0;
  background: var(--surface); font-size: 13px; font-weight: 700;
}
.conversation-header .room-code {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; max-width: 65%;
  height: 26px; padding: 0 7px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--surface-2); color: var(--text);
  font: 400 11px var(--mono);
}
#current-room-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-header > span, .room-code-label, .conversation-header svg, .chat-hide { flex-shrink: 0; }
.room-code-label { color: var(--faint); font-size: 9px; letter-spacing: .1em; }
.conversation-header .room-code svg { width: 13px; height: 13px; }
.conversation-header .room-code.copied { border-color: var(--green); color: var(--green); }
.copy-status { position: absolute; right: 12px; top: 48px; z-index: 25; max-width: calc(100% - 24px); margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; }
.copy-status:empty { display: none; }
.chat-hide { width: 27px; height: 27px; border-color: var(--line); background: var(--surface-2); color: var(--dim); }
.chat-area { display: flex; flex: 1; flex-direction: column; min-height: 0; }
#chat-messages {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px;
  margin: 0 10px; padding: 15px 10px; overflow-y: auto;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--surface);
}
/* "Na sala": everyone in a fixed order, part of the sidebar's bordered box, under the header. */
.room-people {
  flex: none; margin: 0 10px; padding: 8px 4px 6px;
  border: 1px solid var(--line); border-top: 0; background: var(--surface);
}
.room-people-title { margin: 0 6px 4px; color: var(--dim); font-size: 12px; font-weight: 400; }
.room-people-list { max-height: 152px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.person-row { display: flex; align-items: center; border-radius: 6px; }
.person-row:hover, .person-row:focus-within { background: var(--surface-2); }
.person-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 6px;
  border: 0; background: none; color: var(--text); font-size: 13px; text-align: left;
}
button.person-main { cursor: pointer; }
.person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-icons { display: flex; flex-shrink: 0; align-items: center; gap: 6px; color: var(--dim); }
.person-icons .state-icon svg { width: 15px; height: 15px; }
.person-screen.warn { color: var(--amber); }
.person-row .avatar-circle { width: 24px; height: 24px; flex: 0 0 24px; border-width: 2px; background: var(--surface-2); font-size: 10px; }
.person-row .avatar-circle.speaking { box-shadow: none; }
.person-row button.participant-options { position: static; flex: none; width: 26px; height: 26px; margin-right: 2px; opacity: 0; }
.person-row:hover button.participant-options, .person-row:focus-within button.participant-options { opacity: 1; }
@media (hover: none) { .person-row button.participant-options { opacity: 1; } }
.room-people-alone { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 0; color: var(--dim); font-size: 12px; }
.room-people-alone .btn { height: 26px; min-height: 26px; padding: 0 8px; font-size: 12px; }
.composer {
  flex: 0 0 54px; display: flex; align-items: center; gap: 6px;
  margin: 0 10px 10px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  background: var(--surface);
}
.composer .input { flex: 1; height: 34px; font-size: 13px; }
.composer .btn { height: 34px; padding: 0 10px; }
#send-message-btn { width: 34px; padding: 0; }
#send-message-btn svg { width: 17px; height: 17px; }
@media (min-width: 701px) {
  /* Hidden but still the form's default button, so Enter submits and disabled blocks it. */
  #send-message-btn { display: none; }
}
.chat { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 8px; }
.chat-end { grid-template-columns: minmax(0, 1fr) auto; text-align: right; }
.chat-start .chat-image { grid-column: 1; grid-row: 1 / span 2; }
.chat-end .chat-image { grid-column: 2; grid-row: 1 / span 2; }
.chat-start .chat-header, .chat-start .chat-bubble { grid-column: 2; }
.chat-end .chat-header, .chat-end .chat-bubble { grid-column: 1; }
.chat-header time { color: var(--faint); font: 10px var(--mono); }
.chat .chat-header { color: var(--dim); font-size: 11px; }
.chat-image > div { display: grid; place-items: center; width: 26px; height: 26px; font-size: 10px; }
.chat-bubble { width: fit-content; max-width: 100%; padding: 7px 10px; border: 1px solid var(--surface-2); border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.chat-bubble p { margin: 0; }
.chat-end .chat-bubble { margin-left: auto; }
.chat-bubble-primary { background: var(--brand); border-color: var(--brand); color: #fff; }

.context-menu {
  position: fixed; z-index: 60; width: 248px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 7px;
  border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface-2);
  box-shadow: 0 18px 50px #000a;
}
.context-menu h3 { margin: 5px 8px 8px; font-size: 12px; }
.context-menu label { display: block; margin: 9px 8px 4px; color: var(--dim); font-size: 11px; }
.context-menu input { display: block; width: calc(100% - 16px); margin: 0 8px 10px; accent-color: var(--accent); }
.context-menu button { display: block; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; font-size: 12px; }
.context-menu button:hover { background: var(--hover); }
.context-note { padding: 8px 8px 2px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.notice { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; max-width: min(560px, calc(100% - 32px)); padding: 12px 15px; border: 1px solid var(--red); border-radius: 9px; background: var(--red-bg); color: var(--text); font-size: 12px; }
.notice:not(.hidden) { animation: drop-in .18s cubic-bezier(.2, 0, 0, 1); }
.notice.leaving { animation: drop-out .15s ease-in forwards; }
.permission-recovery { position: fixed; z-index: 100; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 100vmax #0009, 0 18px 60px #0009; }
.permission-recovery h2 { margin: 0 0 12px; }
.startup-option { display: flex; align-items: center; gap: 9px; margin: 8px 0; font-size: 13px; }

#quality-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.68); }
.modal-panel {
  position: relative; width: min(100%, 540px); max-height: calc(100dvh - 36px); overflow-y: auto;
  padding: 24px; border: 1px solid var(--line-2); border-radius: 13px;
  background: var(--surface); box-shadow: 0 22px 65px #0009;
}
#quality-modal:not(.hidden) .modal-backdrop { animation: fade-in .15s ease-out; }
#quality-modal:not(.hidden) .modal-panel, .permission-recovery:not(.hidden) { animation: grow-in .18s cubic-bezier(.2, 0, 0, 1); }
.device-picker[open] > .picker-panel, .context-menu:not(.hidden) { animation: rise-in .12s ease-out; }
.connecting::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  background: currentColor; vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite;
}
/* `translate` and `scale` stack on the `transform` some of these already use for placing. */
/* New chat message (InterfaceMutations.addMessageToChat); the list glides down to it. */
#chat-messages { scroll-behavior: smooth; }
#chat-messages > .animate-fade-in { animation: rise-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; translate: 0 4px; } }
@keyframes grow-in { from { opacity: 0; scale: .97; } }
@keyframes drop-in { from { opacity: 0; translate: 0 -8px; } }
@keyframes drop-out { to { opacity: 0; translate: 0 -8px; } }
@keyframes pulse { 50% { opacity: .25; } }
@keyframes icon-in { from { opacity: 0; scale: .85; } }
.modal-title { margin: 0 0 6px; font: 700 20px var(--display); }
.modal-desc { margin: 0 0 15px; color: var(--dim); }
.modal-section { margin-top: 18px; }
.field-label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.segmented { display: flex; flex-wrap: wrap; gap: 5px; }
.audio-mode-grid { display: grid; gap: 7px; }
.audio-mode-card { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); text-align: left; }
.audio-mode-card strong { display: block; font-weight: 700; }
.audio-mode-card span { display: block; margin-top: 3px; color: var(--dim); font-size: 11px; }
.audio-mode-card.selected, .audio-source-tile.selected { border-color: var(--accent); }
.audio-mode-card, .audio-source-tile { transition: border-color .12s, background-color .12s, scale .09s; }
.audio-mode-card:hover:not(.selected), .audio-source-tile:hover:not(.selected) { border-color: var(--line-2); background: var(--hover); }
.audio-mode-card:active, .audio-source-tile:active { scale: .98; }
.audio-source-toolbar { display: flex; align-items: center; justify-content: space-between; }
.audio-source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.audio-source-tile { min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); text-align: left; }
.audio-source-preview { display: grid; place-items: center; width: 100%; aspect-ratio: 16/9; margin-bottom: 7px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--dim); font-size: 11px; }
.audio-source-preview canvas { display: block; width: 100%; height: auto; }
.audio-source-title { font-size: 12px; overflow-wrap: anywhere; }
.source-group { grid-column: 1 / -1; margin: 6px 0 0; color: var(--dim); font-size: 11px; font-weight: 700; }
#share-preset-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
/* Titles line up even when one description wraps. */
#share-preset-grid .audio-mode-card { display: flex; flex-direction: column; justify-content: flex-start; }
.share-advanced { margin-top: 10px; border: 1px solid var(--line); border-radius: 7px; }
.share-advanced summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 9px 12px; cursor: pointer; }
.share-advanced summary .field-label { margin: 0; }
.share-advanced[open] summary { border-bottom: 1px solid var(--line); }
#share-quality-summary { color: var(--dim); font-size: 11px; }
.advanced-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; padding: 12px; }
.advanced-field .field-label { margin-bottom: 5px; font-weight: 400; color: var(--dim); }
.advanced-field .select { width: 100%; height: 34px; }
.advanced-hint { margin: -4px 12px 12px; color: var(--dim); font-size: 11px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); text-align: left; }
.switch-text strong { display: block; font-weight: 700; }
.switch-text span { display: block; margin-top: 3px; color: var(--dim); font-size: 11px; }
.switch { position: relative; flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch-row[aria-checked="true"] .switch { background: var(--accent); }
.switch-row[aria-checked="true"] .switch::after { transform: translateX(14px); }
.wizard-kicker { color: var(--dim); font: 400 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.wizard-note { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--dim); font-size: 11px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
/* Keep confirm/cancel reachable while a long app list scrolls inside the panel. */
#quality-modal .modal-actions { position: sticky; bottom: -24px; z-index: 1; margin-bottom: -24px; padding-bottom: 24px; background: var(--surface); }
.modal-actions .btn { min-height: 36px; height: auto; padding-top: 8px; padding-bottom: 8px; }
.modal-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 245px; }
}
@media (max-width: 700px) {
  /* Status gets its own line so the controls keep their size. */
  .dock { flex-basis: auto; grid-template-columns: auto auto; justify-content: center; row-gap: 4px; padding-top: 4px; }
  .dock-status { grid-column: 1 / -1; justify-self: center; max-width: 100%; }
  .dock-tools, .room-actions { grid-column: auto; }
  .screen-tile-mirror { width: 126px; height: 71px; }
  .workspace { display: flex; flex-direction: column; }
  .stage { flex: 1; min-height: 0; }
  .screens-rail { flex-basis: 84px; }
  .screens-rail .screen-tile, .participant-tile { width: 126px; height: 71px; }
  .participant-tile .avatar-circle { width: 32px; height: 32px; }
  button.participant-options { top: 3px; right: 3px; width: 22px; height: 22px; font-size: 12px; }
  .dock { --control-size: 40px; --glyph-size: 19px; gap: 8px; }
  .toolgroup.with-device:nth-child(3) .picker-panel { left: -40px; }
  .screens-rail { padding-right: 43px; }
  .strip-toggle { right: 12px; }
  .sidebar { flex: 0 0 40%; min-height: 132px; }
  /* The sidebar is only 40% of a phone: the chat keeps it, the rail already shows who is there. */
  .room-people { display: none; }
  .workspace.chat-collapsed .sidebar { display: none; }
  .workspace.chat-collapsed .stage { flex: 1; }
  .conversation-header .room-code { font-size: 9px; }
  .modal-panel { padding: 16px; }
  .audio-source-grid { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .dock { --control-size: 36px; gap: 5px; }
  .device-picker summary { width: 20px; }
  .toolgroup.with-device:nth-child(3) .picker-panel { left: -36px; }
  .tray-count { font-size: 10px; padding: 3px 5px; }
  .tray-footer .btn { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  /* One iteration too: a looping pulse at .01ms would flicker instead of stopping. */
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #chat-messages { scroll-behavior: auto; }
}
.update-banner { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.35); font-size: 13px; }
.update-banner progress { width: 120px; }
