/* 0.18.46 · Category 2 runtime corrective.
   K1 fullscreen Together owns the viewport, K2 uses native video-only PiP,
   K3 exposes room capacity 2..10 without a schema migration. */

/* K3 · Compact capacity control inside the room-info popover. */
.room-info-popover dd:has(.room-info-capacity-select) {
  display:inline-flex;
  align-items:center;
  gap:7px;
}
.room-info-capacity-select {
  width:76px;
  min-width:76px;
  height:28px;
  min-height:28px;
  padding:0 24px 0 9px;
  border:1px solid rgba(var(--rooms-rgb-526989,82,105,137),0.34);
  border-radius:8px;
  color:var(--text);
  background:rgba(var(--rooms-rgb-030910,3,9,16),0.76);
  font-size:10px;
  font-weight:850;
  box-shadow:none;
}
.room-info-capacity-select:disabled { opacity:.74; cursor:default; }
html[data-theme="light"] .room-info-capacity-select { background:rgb(var(--rooms-rgb-f8fbff,248,251,255)); border-color:rgb(var(--rooms-rgb-c8d4e3,200,212,227)); }

/* K1 · The fullscreen participant panel itself is the viewport owner.
   Do not depend on an ancestor selector: older mobile rules use !important
   relative positioning and otherwise win in a few resize/detach transitions. */
@media (max-width:760px) {
  #participantPanel.panel-fullscreen {
    position:fixed!important;
    z-index:1900!important;
    left:var(--buddy-vv-left,0px)!important;
    top:var(--buddy-vv-top,0px)!important;
    right:auto!important;
    bottom:auto!important;
    width:100vw!important;
    height:var(--buddy-vv-height,var(--app-viewport-height,100dvh))!important;
    min-width:0!important;
    min-height:0!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    transform:none!important;
    resize:none!important;
    box-shadow:none!important;
    background:rgb(var(--rooms-rgb-050a12,5,10,18))!important;
    overflow:hidden!important;
  }
  #participantPanel.panel-fullscreen.panel-mode-hybrid {
    display:grid!important;
    grid-template-rows:auto minmax(0,42fr) 0 minmax(0,58fr)!important;
  }
  #participantPanel.panel-fullscreen.panel-mode-hybrid .participants-pane {
    display:block!important;
    grid-row:2!important;
    min-height:0!important;
    overflow:auto!important;
  }
  #participantPanel.panel-fullscreen.panel-mode-hybrid .chat-resizer {
    display:block!important;
    grid-row:3!important;
    visibility:hidden!important;
    pointer-events:none!important;
    height:0!important;
    min-height:0!important;
    border:0!important;
  }
  #participantPanel.panel-fullscreen.panel-mode-hybrid .chat-panel {
    display:grid!important;
    grid-row:4!important;
    min-height:0!important;
    height:auto!important;
    align-self:stretch!important;
    overflow:hidden!important;
    padding-bottom:max(8px,env(safe-area-inset-bottom))!important;
  }
  #participantPanel.panel-fullscreen.panel-mode-participants,
  #participantPanel.panel-fullscreen.panel-mode-chat {
    grid-template-rows:auto minmax(0,1fr)!important;
  }

  /* Three tabs own the left side. Collapse is immediately left of the
     room/server status control; these slots never overlap. */
  #participantPanel.panel-fullscreen .panel-topbar {
    position:relative!important;
    min-height:54px!important;
    padding:max(8px,env(safe-area-inset-top)) 84px 8px 7px!important;
  }
  #participantPanel.panel-fullscreen .panel-tabs {
    width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important;
  }
  #participantPanel.panel-fullscreen #hybridTabBtn { display:flex!important; }
  #participantPanel.panel-fullscreen .panel-tab {
    min-width:0!important;
    width:auto!important;
    justify-content:center!important;
    padding-inline:4px!important;
    font-size:8.5px!important;
  }
  #participantPanel.panel-fullscreen .panel-actions {
    position:absolute!important;
    z-index:1952!important;
    top:calc(max(8px,env(safe-area-inset-top)) + 1px)!important;
    right:44px!important;
    width:36px!important;
    height:36px!important;
    display:block!important;
  }
  #participantPanel.panel-fullscreen .panel-actions #panelDetachBtn,
  #participantPanel.panel-fullscreen .panel-actions #panelCloseBtn { display:none!important; }
  #participantPanel.panel-fullscreen #panelFullscreenBtn {
    display:grid!important;
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    place-items:center!important;
  }
  .room.panel-fullscreen .buddy-room-status-cluster {
    position:fixed!important;
    z-index:1955!important;
    top:calc(var(--buddy-vv-top,0px) + max(9px,env(safe-area-inset-top)))!important;
    right:max(7px,env(safe-area-inset-right))!important;
    width:30px!important;
    height:36px!important;
    min-width:30px!important;
    gap:0!important;
  }
  .room.panel-fullscreen .buddy-room-status-cluster > .connection-indicator {
    width:30px!important;
    min-width:30px!important;
    height:36px!important;
    min-height:36px!important;
  }
  .room.panel-fullscreen .buddy-room-status-cluster .buddy-room-theme-circle { display:none!important; }
  .room.panel-fullscreen .buddy-room-status-cluster .buddy-room-status-popover {
    right:0!important;
    left:auto!important;
    top:43px!important;
  }

  /* The room chrome behind fullscreen may continue to exist for state, but it
     must not be visible through a failed/partial hybrid layout. */
  .room.panel-fullscreen .room-main,
  .room.panel-fullscreen .toolbar-wrap,
  .room.panel-fullscreen .room-resize-handle,
  .room.panel-fullscreen .mobile-panel-resizer { visibility:hidden!important; pointer-events:none!important; }
  #participantPanel.panel-fullscreen,
  #participantPanel.panel-fullscreen * { visibility:visible; }
  .room.panel-fullscreen .buddy-room-status-cluster,
  .room.panel-fullscreen .buddy-room-status-cluster * { visibility:visible; }
}

@media (max-width:340px) {
  #participantPanel.panel-fullscreen .panel-topbar { padding-left:5px!important; padding-right:82px!important; }
  #participantPanel.panel-fullscreen .panel-tab { padding-inline:2px!important; font-size:8px!important; }
  #participantPanel.panel-fullscreen .panel-actions { right:42px!important; }
  .room.panel-fullscreen .buddy-room-status-cluster { right:5px!important; }
}
