/* A bounded meeting stage between the header and an in-flow control dock. */
/* Solo camera is a preview, never a full-stage broadcast. Screen content is excluded. */
.room-page.room-active .video-grid[data-count="1"]:not(.screen-sharing):not(.speaker-view) { place-items: center; }
.room-page.room-active .video-grid[data-count="1"]:not(.screen-sharing):not(.speaker-view) > .local-tile { width: min(100%, 420px); height: auto; max-height: 100%; aspect-ratio: 16 / 9; justify-self: center; align-self: center; }
/* Only history scrolls. Composer and header are fixed-size flex siblings. */
#chat-panel { padding: 12px 16px 16px; gap: 8px; }
#chat-panel .panel-heading { position: static; min-height: 48px; padding: 0; background: none; }
.panel-close { flex: 0 0 48px; display: grid; place-items: center; padding: 0; line-height: 1; }
#chat-panel .panel-close { background: transparent; }
#chat-panel .panel-close:hover { background: #ffffff0d; }
#chat-panel svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#chat-panel .panel-note { flex: 0 0 auto; margin: 0; font-size: 12px; line-height: 1.4; }
#chat-panel .chat-messages { flex: 1 1 0; min-height: 0; max-height: none; align-content: start; padding: 4px 2px; scrollbar-gutter: stable; }
#chat-panel .chat-message { min-width: 0; font-size: 14px; line-height: 1.45; }
#chat-panel .chat-form { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: end; gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
#chat-panel .chat-form textarea { display: block; box-sizing: border-box; width: 100%; height: 80px; min-height: 80px; max-height: 80px; resize: none; overflow-y: auto; margin: 0; font: inherit; font-size: 16px; line-height: 24px; padding: 14px 12px; }
#chat-panel .chat-form button { display: grid; place-items: center; width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0; margin: 0 0 16px; align-self: end; border-radius: 14px; }
#chat-panel .chat-form button:disabled { cursor: not-allowed; }
@media (min-width: 921px) {
  body.room-active:has(#chat-panel:not(.hidden)) > main { padding-right: 412px; }
  body.room-active:has(#chat-panel:not(.hidden)) > .meeting-panel-backdrop { background: transparent; }
}
@media (max-width: 920px) {
  #chat-panel { top: max(56px, env(safe-area-inset-top)); bottom: calc(88px + env(safe-area-inset-bottom)); right: 8px; width: min(380px, calc(100vw - 16px)); }
  .room-page.room-active .video-grid[data-count="1"]:not(.screen-sharing):not(.speaker-view) > .local-tile { width: min(100%, 320px); max-height: min(100%, 240px); }
}
@media (max-height: 480px) {
  #chat-panel { top: 8px; bottom: 8px; }
  #chat-panel .chat-form textarea { height: 56px; min-height: 56px; max-height: 56px; }
  #chat-panel .chat-form button { margin-bottom: 4px; }
}
body.room-active { height: 100dvh; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 56px minmax(0, 1fr) auto; }
.room-active > .site-header { grid-row: 1; height: 56px; padding: 0 20px; }
.room-page.room-active > main { grid-row: 2; height: auto; min-height: 0; width: 100%; max-width: none; padding: 8px 16px 0; overflow: hidden; }
.room-page.room-active .room-view { min-width: 0; gap: 8px; }
.room-page.room-active .room-header { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 48px; padding: 0; gap: 10px; align-items: center; }
.room-page.room-active .room-header > :first-child { min-width: 0; }
.room-page.room-active .room-header-controls { position: static; grid-column: -2; grid-row: 1; }
.room-page.room-active .room-header h1 { font-size: 20px; }
.room-page.room-active .status-banner { flex: 0 0 auto; margin: 0; min-height: 0; padding: 6px 10px; font-size: 12px; }
.room-page.room-active .status-banner.success { display: none; }
.room-page.room-active .conference { min-width: 0; gap: 6px; padding: 0; }
.room-page.room-active .conference-stage { width: 100%; min-width: 0; min-height: 0; padding: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; scrollbar-gutter: auto; gap: 6px; }
.room-page.room-active.screen-sharing-active .conference-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.room-page.room-active.screen-sharing-active .video-grid { grid-column: 1; grid-row: 1; }
.room-page.room-active.screen-sharing-active .screen-more-participants { grid-column: 1; grid-row: 2; width: clamp(170px, 19vw, 270px); justify-self: end; }
.room-page.room-active .video-grid:not(.screen-sharing):not(.speaker-view):not(.is-two-person) { grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--grid-rows), minmax(0, 1fr)); align-content: stretch; width: 100%; height: 100%; gap: 8px; }
.room-page.room-active .video-grid:not(.is-two-person) > .video-tile { min-width: 0; min-height: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; margin: 0; border-radius: 12px; }
.room-page.room-active .video-grid > .page-hidden, .room-page.room-active .video-grid > .screen-side-hidden { display: none !important; }
.room-active .video-placeholder { overflow: hidden; }
.room-active .video-tile { container-type: size; container-name: participant-tile; }
.room-active .video-placeholder { gap: 6px; padding-bottom: 22px; }
.room-active .video-placeholder span { width: 56px; height: 56px; font-size: 23px; }
@container participant-tile (max-height: 145px) {
  .room-active .video-placeholder small { display: none; }
  .room-active .video-placeholder span { width: 36px; height: 36px; font-size: 16px; }
}
.room-active .video-placeholder small { font-size: 11px; }
.room-active .tile-footer { min-width: 0; gap: 6px; background: none; font-size: 12px; padding: 7px 9px; }
.room-active .tile-footer > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-active .empty-room { flex: 0 0 auto; margin: 0; padding: 5px 0; font-size: 12px; }
.gallery-pagination { flex: 0 0 auto; display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 48px; }
.gallery-pagination button { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--panel); font-size: 25px; cursor: pointer; }
.gallery-pagination button:disabled { opacity: .3; cursor: default; }
.gallery-pagination span { min-width: 145px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.room-page.room-active > .control-dock { grid-row: 3; position: relative; left: auto; bottom: auto; transform: none; justify-self: center; align-self: end; display: flex; align-items: center; gap: 8px; margin: 12px 0 max(12px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 8px); min-height: 0; padding: 8px 10px; border: 1px solid #ffffff0d; border-radius: 22px; background: #191d24; box-shadow: 0 8px 24px #00000026; backdrop-filter: none; opacity: 1; pointer-events: auto; }
.room-page.room-active > .control-dock:focus-within { opacity: 1; pointer-events: auto; }
.room-page.room-active .control-dock .round-control { position: relative; flex: 0 0 auto; display: grid; place-content: center; justify-items: center; width: 52px; min-width: 52px; height: 52px; min-height: 52px; padding: 0; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: #f4f6fa; box-shadow: none; transition: background .15s ease, color .15s ease; }
.room-page.room-active .control-dock .round-control:hover { background: #ffffff0d; }
.room-page.room-active .control-dock .round-control:active { background: #ffffff17; }
.room-page.room-active .control-dock .round-control:disabled { opacity: .4; cursor: not-allowed; }
.room-page.room-active .control-dock .control-svg { width: 26px; height: 26px; color: inherit; stroke: currentColor; stroke-width: 1.8; }
.room-page.room-active .control-dock .round-control.is-off { background: #ffffff08; color: #f4f6fa; }
.room-page.room-active .control-dock .control-off-mark { display: none; stroke: #ff9aa7; stroke-width: 2.2; paint-order: stroke; }
.room-page.room-active .control-dock .is-off .control-off-mark { display: block; }
.room-page.room-active .control-dock .round-control.is-active, .room-page.room-active .control-dock .round-control[aria-expanded="true"] { background: #233d3b; color: #8ce6d4; }
.room-page.room-active .control-dock #open-more { width: 76px; min-width: 76px; }
.room-page.room-active .control-dock #open-more .control-icon { font-size: 22px; }
.room-page.room-active .control-dock #open-more .control-label { font-size: 11px; line-height: 14px; }
.room-page.room-active .control-dock .leave-control { margin-left: 12px; background: #e63e52; color: #fff; border-radius: 16px; }
.room-page.room-active .control-dock .leave-control:hover { background: #f14b5e; }
.room-page.room-active.screen-sharing-active .room-header { grid-template-columns: minmax(72px, .55fr) minmax(0, 1.45fr) auto; }
.room-page.room-active.screen-sharing-active .room-header-controls { grid-column: 3; }
.room-page.room-active.screen-sharing-active .screen-share-statusbar { grid-column: 2; grid-row: 1; min-width: 0; padding: 0; margin: 0; border: 0; background: none; gap: 8px; }
.screen-share-statusbar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-page.room-active .screen-share-statusbar button { min-height: 48px; padding: 8px 12px; }
#screen-source-select { min-width: 60px; max-width: 160px; margin: 0; min-height: 48px; padding: 6px; font-size: 12px; }
.room-page.room-active .video-grid.screen-sharing, .room-page.room-active .video-grid.speaker-view { display: grid; grid-column: 1; grid-row: 1; height: 100%; grid-template-columns: minmax(0, 1fr) clamp(170px, 19vw, 270px) !important; grid-template-rows: repeat(var(--screen-side-count, 4), minmax(0, 1fr)); gap: 8px; }
.room-page.room-active .video-grid.screen-sharing > .screen-share-tile, .room-page.room-active .video-grid.speaker-view > .speaker-main { grid-column: 1; grid-row: 1 / -1; }
.room-page.room-active .video-grid.screen-sharing > .video-tile:not(.screen-share-tile), .room-page.room-active .video-grid.speaker-view > .speaker-side { grid-column: 2; grid-row: auto; }
.room-page.room-active .screen-more-participants { grid-column: 1; grid-row: 2; justify-self: end; min-height: 48px; width: clamp(170px, 19vw, 270px); }
.room-active .video-grid.is-two-person > .local-tile { max-height: 32%; max-width: 32%; min-width: 100px; }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid #c3d9ff; outline-offset: 3px; }
@media (max-width: 920px) {
  body.room-active { grid-template-rows: 48px minmax(0, 1fr) auto; }
  .room-active > .site-header { height: 48px; padding: 0 12px; }
  .room-page.room-active > main { padding: 4px 8px 0; }
  .room-page.room-active .room-view { gap: 5px; }
  .room-page.room-active .room-header { min-height: 48px; gap: 6px; }
  .room-page.room-active .room-header h1 { font-size: 17px; }
  .room-page.room-active .video-grid.screen-sharing, .room-page.room-active .video-grid.speaker-view { grid-template-columns: repeat(var(--screen-side-count, 3), minmax(0, 1fr)) !important; grid-template-rows: minmax(0, 1fr) clamp(72px, 17dvh, 120px); }
  .room-page.room-active .video-grid.screen-sharing > .screen-share-tile, .room-page.room-active .video-grid.speaker-view > .speaker-main { grid-column: 1 / -1; grid-row: 1; }
  .room-page.room-active .video-grid.screen-sharing > .video-tile:not(.screen-share-tile), .room-page.room-active .video-grid.speaker-view > .speaker-side { grid-column: auto; grid-row: 2; }
  .room-page.room-active .screen-more-participants { width: auto; min-width: 120px; }
  .room-page.room-active.screen-sharing-active .screen-more-participants { width: auto; min-width: 120px; }
  .room-page.room-active > .control-dock { padding: 6px; gap: 4px; margin-top: 8px; margin-bottom: max(8px, env(safe-area-inset-bottom)); border-radius: 19px; }
  .room-page.room-active .control-dock .round-control { width: 48px; min-width: 48px; min-height: 48px; height: 48px; border-radius: 12px; }
  .room-page.room-active .control-dock #open-more { width: 64px; min-width: 64px; }
  .room-page.room-active .control-dock .leave-control { margin-left: 8px; border-radius: 14px; }
  .room-active .video-placeholder span { width: 40px; height: 40px; font-size: 18px; }
  .room-active .video-placeholder small { font-size: 10px; }
  .room-active .tile-footer { font-size: 11px; padding: 6px; }
  .room-active .media-state { flex: 0 0 auto; width: 24px; height: 24px; }
}
@media (max-width: 640px) {
  .room-active .brand img { width: 96px; }
  .room-active .brand span { font-size: 13px; }
  .room-page.room-active .screen-share-statusbar span { font-size: 10px; }
  .room-page.room-active .screen-share-statusbar button { min-width: 48px; padding: 6px; font-size: 11px; }
  .room-active .participants-toggle { min-height: 48px; width: 52px; min-width: 52px; padding: 4px; gap: 5px; }
}
@media (max-width: 359px) {
  .room-page.room-active > .control-dock { padding: 4px; gap: 2px; border-radius: 17px; }
  .room-page.room-active .control-dock #open-more { width: 48px; min-width: 48px; }
  .room-page.room-active .control-dock #open-more .control-label { font-size: 10px; }
  .room-page.room-active .control-dock .leave-control { margin-left: 4px; }
}
@media (max-width: 920px) and (orientation: landscape) {
  body.room-active { grid-template-rows: 36px minmax(0, 1fr) auto; }
  .room-active > .site-header { height: 36px; }
  .room-active .brand span { display: none; }
  .room-page.room-active .video-grid.screen-sharing, .room-page.room-active .video-grid.speaker-view { grid-template-columns: minmax(0, 1fr) clamp(125px, 22vw, 200px) !important; grid-template-rows: repeat(var(--screen-side-count, 2), minmax(0, 1fr)); }
  .room-page.room-active .video-grid.screen-sharing > .screen-share-tile, .room-page.room-active .video-grid.speaker-view > .speaker-main { grid-column: 1; grid-row: 1 / -1; }
  .room-page.room-active .video-grid.screen-sharing > .video-tile:not(.screen-share-tile), .room-page.room-active .video-grid.speaker-view > .speaker-side { grid-column: 2; grid-row: auto; }
  .room-page.room-active > .control-dock { margin-top: 4px; margin-bottom: max(4px, env(safe-area-inset-bottom)); }
}
