/* Omni 0.2.58 - viewport-aware room controls and video player.
   The channel cover, right drawer, voice tiles and compact call dock share
   the active chat column and retain their existing media/audio handlers. */

/* Never hide the right drawer control just because a stream is watched.
   Legacy channel header rules hide the whole topbar for watched streams. */
#appShell:not(.nexo-video-fullscreen)
 .chat-column:not(:has(> #homePanel:not([hidden]))):not(:has(> #nexoSocialCenter:not([hidden]))):has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar {
  display:flex !important;
  position:absolute !important;
  left:auto !important;
  right:clamp(12px,1.5vw,22px) !important;
  top:clamp(112px,12.5vh,129px) !important;
  bottom:auto !important;
  width:max-content !important;
  min-height:0 !important;
  height:auto !important;
  padding:0 !important;
  z-index:40 !important;
  border:0 !important;
  background:transparent !important;
  background-color:transparent !important;
  background-image:none !important;
  box-shadow:none !important;
  pointer-events:none;
}
#appShell:not(.nexo-video-fullscreen)
 .chat-column:has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar .topbar-actions {
  display:flex !important;
  align-items:center;
  justify-content:flex-end;
  pointer-events:none;
}
#appShell:not(.nexo-video-fullscreen)
 .chat-column:has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar .topbar-actions > #membersButton:not([hidden]) {
  display:inline-flex !important;
  position:relative;
  pointer-events:auto !important;
  visibility:visible !important;
  opacity:1 !important;
  flex:0 0 auto;
  min-width:38px !important;
  width:38px !important;
  height:38px !important;
  z-index:1;
  background:rgba(23,29,32,.70) !important;
  border:1px solid rgba(212,229,222,.34) !important;
  box-shadow:0 5px 19px rgba(0,0,0,.28) !important;
  backdrop-filter:blur(18px) saturate(120%) !important;
  -webkit-backdrop-filter:blur(18px) saturate(120%) !important;
}
#appShell:not(.nexo-video-fullscreen)
 .chat-column:has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar .topbar-actions > :is(#inviteCurrentChatButton,#searchHistoryButton) {
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

/* Keep the screen below the community cover and the sidebar trigger.
   Reserve an independent bottom lane for the photo and compact call controls. */
#appShell:not(.nexo-video-fullscreen) .chat-column
 > #voiceStage:not([hidden]) > .voice-stage-panel:has(> .remote-media.has-video) {
  box-sizing:border-box;
  padding:clamp(119px,14vh,145px) clamp(9px,1.4vw,17px)
          clamp(85px,10vh,103px) !important;
  overflow:hidden;
  min-width:0;
  min-height:0;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video[data-watched-count="1"]{
  box-sizing:border-box;
  display:flex !important;
  flex-wrap:wrap !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  align-items:center !important;
  align-content:center !important;
  justify-content:center !important;
  padding-inline:clamp(7px,1vw,14px) !important;
  margin:0 !important;
  gap:clamp(9px,1.2vw,16px) !important;
  scrollbar-gutter:auto !important;
}
/* The video card follows the actual source aspect ratio, not an old fixed
   player size. This avoids black space introduced by the player layout while
   deliberately never cropping another person's transmitted pixels. */
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video[data-watched-count="1"]
 > .remote-tile:is(.is-stream-primary,.is-stream-equal).is-stream-watching {
  box-sizing:border-box !important;
  flex:0 0 var(--nexo-fit-width,100%) !important;
  width:var(--nexo-fit-width,100%) !important;
  height:var(--nexo-fit-height,auto) !important;
  max-width:100% !important;
  max-height:calc(100% - 10px) !important;
  min-width:0 !important;
  min-height:0 !important;
  margin:0 !important;
  align-self:center !important;
  aspect-ratio:var(--nexo-fit-aspect,16 / 9) !important;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video[data-watched-count="1"]
 > .remote-tile:is(.is-stream-primary,.is-stream-equal).is-stream-watching video {
  display:block !important;
  box-sizing:border-box;
  width:100% !important;
  height:100% !important;
  max-height:100% !important;
  min-height:0 !important;
  object-fit:contain !important;
  object-position:50% 50% !important;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video[data-watched-count="1"]
 > .remote-tile.is-voice-participant:not(.has-video) {
  align-self:center !important;
  margin-inline:0 !important;
}

/* Match the slim chevrons in the right-hand sidebar: no Unicode glyph.
   Keep original button IDs/aria labels for microphone and speaker menus. */
#appShell .chat-column #voiceStage .stage-control-group
 > .stage-control-arrow .nexo-device-chevron{
  display:inline-grid;
  place-items:center;
  box-sizing:border-box;
  width:16px !important;
  height:16px !important;
  min-width:16px !important;
  font-size:0;
  line-height:0;
  color:inherit;
  transform:none;
}
#appShell .chat-column #voiceStage .stage-control-group
 > .stage-control-arrow .nexo-device-chevron::after{
  content:"";
  display:block;
  box-sizing:border-box;
  width:7px;
  height:7px;
  border-right:1.65px solid currentColor;
  border-bottom:1.65px solid currentColor;
  border-radius:.4px;
  transform:translateY(-2px) rotate(45deg);
}
#appShell .chat-column #voiceStage .stage-control-group
 > .stage-control-arrow{
  font-size:0 !important;
  line-height:1 !important;
}

/* Narrow or short windows retain the same two-sided safe area. */
@media(max-height:660px){
 #appShell:not(.nexo-video-fullscreen) .chat-column
 > #voiceStage:not([hidden]) > .voice-stage-panel:has(> .remote-media.has-video){
   padding-top:clamp(92px,16vh,113px) !important;
   padding-bottom:clamp(64px,13vh,83px) !important;
 }
 #appShell:not(.nexo-video-fullscreen)
 .chat-column:has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar{
   top:clamp(80px,13vh,108px) !important;
 }
}
@media(max-width:760px){
 #appShell:not(.nexo-video-fullscreen) .chat-column
 > #voiceStage:not([hidden]) > .voice-stage-panel:has(> .remote-media.has-video){
   padding-inline:5px !important;
 }
 #appShell:not(.nexo-video-fullscreen)
 .chat-column:has(> #voiceStage:not([hidden]) #remoteMedia.has-video)
 > .chat-topbar{
   right:8px !important;
 }
}

/* Unified centering across every room preview, whether audio-only or
   streaming-enabled. No left-anchored room details or join/back controls. */
#appShell .chat-column > #voicePreviewPanel:not([hidden]) {
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:center !important;
  box-sizing:border-box !important;
  width:100%;
  min-height:0;
  height:100%;
  max-height:100%;
  padding:clamp(122px,15vh,149px) clamp(12px,3vw,32px)
          clamp(46px,8vh,74px) !important;
  gap:9px;
  text-align:center !important;
  overflow-x:hidden !important;
  overflow-y:auto;
}
#appShell #voicePreviewPanel > :is(.voice-stage-eyebrow,h2,p){
  text-align:center !important;
  margin-inline:auto !important;
}
#appShell #voicePreviewPanel #voicePreviewSubtitle{
  max-width:min(650px,100%);
}
#appShell #voicePreviewPanel #voicePreviewMembers{
  box-sizing:border-box;
  display:grid;
  width:min(850px,100%);
  max-width:100%;
  margin:12px auto 15px !important;
  grid-template-columns:repeat(auto-fit,minmax(110px,150px));
  justify-content:center;
  justify-items:stretch;
  gap:12px;
  min-height:0;
}
#appShell #voicePreviewPanel #voicePreviewMembers > .sidebar-empty{
  grid-column:1 / -1;
  max-width:100%;
  margin:4px auto;
  text-align:center;
}
#appShell #voicePreviewPanel .voice-preview-actions{
  justify-content:center !important;
  align-items:center !important;
  width:100%;
  gap:11px !important;
  margin-inline:auto !important;
}
#appShell #voicePreviewPanel .voice-preview-footnote{
  max-width:min(550px,100%);
  margin:8px auto 0 !important;
  text-align:center;
}

/* Audio-only rooms have the speaking portraits in the middle of the stage.
   The standby message is also centered, not pinned below the cover. */
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
  > .voice-stage-panel:not(:has(.remote-media.has-video)){
  display:flex !important;
  min-height:0;
  min-width:0;
  align-items:center !important;
  justify-content:center !important;
  padding:clamp(110px,13vh,138px) clamp(10px,2vw,26px)
          clamp(70px,10vh,100px) !important;
}
#appShell #voiceStage:not([hidden]) #voiceStageEmpty:not([hidden]){
  align-self:center !important;
  margin:auto !important;
  max-width:100%;
  text-align:center !important;
}

/* Fix the long-standing overflow produced by older fixed-height stream
   cards, pseudo-element breaks and reserved scrollbar gutters. The measured
   fit always keeps the entire image and participants within this surface. */
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video{
  overflow:hidden !important;
  overflow-x:hidden !important;
  overflow-y:hidden !important;
  overscroll-behavior:none !important;
  scrollbar-gutter:auto !important;
  scrollbar-width:none !important;
  min-height:0 !important;
  max-height:100% !important;
  justify-content:center !important;
  align-content:center !important;
  align-items:center !important;
  padding:6px 9px !important;
  margin:0 !important;
  gap:10px !important;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video::-webkit-scrollbar{
  display:none !important;
  width:0 !important;
  height:0 !important;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video::before{
  margin:0 !important;
  height:0 !important;
  min-height:0 !important;
}
#appShell:not(.nexo-video-fullscreen)
 #voiceStage:not([hidden]) .remote-media.has-video
 > .remote-tile.is-voice-participant:not(.has-video):not(.is-screen-sharing){
  flex:0 0 var(--nexo-voice-fit-size,118px) !important;
  box-sizing:border-box !important;
  width:var(--nexo-voice-fit-size,118px) !important;
  height:var(--nexo-voice-fit-size,118px) !important;
  min-height:0 !important;
  max-height:none !important;
  margin:0 !important;
  align-self:center !important;
}

/* No forced 160-205px video minimum when two or more broadcasts share a
   short window. Layout variables are recomputed as the right sidebar moves. */
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
 .remote-media.has-video:not([data-watched-count="0"]):not([data-watched-count="1"])
 > .remote-tile.is-stream-equal {
  box-sizing:border-box !important;
  flex:0 0 var(--nexo-multi-width,46%) !important;
  width:var(--nexo-multi-width,46%) !important;
  height:var(--nexo-multi-height,180px) !important;
  min-height:0 !important;
  max-height:100% !important;
  margin:0 !important;
}
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
 .remote-media.has-video:not([data-watched-count="0"]):not([data-watched-count="1"])
 > .remote-tile.is-stream-primary {
  box-sizing:border-box !important;
  flex:0 0 100% !important;
  width:100% !important;
  height:var(--nexo-primary-height,250px) !important;
  min-height:0 !important;
  max-height:100% !important;
  margin:0 !important;
}
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
 .remote-media.has-video:not([data-watched-count="0"]):not([data-watched-count="1"])
 > .remote-tile.is-stream-secondary{
  box-sizing:border-box !important;
  flex:0 0 var(--nexo-secondary-fit-width,32%) !important;
  width:var(--nexo-secondary-fit-width,32%) !important;
  height:var(--nexo-secondary-fit-height,90px) !important;
  min-height:0 !important;
  max-height:100% !important;
  margin:0 !important;
}
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
 .remote-media.has-video > .remote-tile:is(.is-stream-preview,.is-stream-pending){
  max-width:100% !important;
  min-height:0 !important;
  max-height:var(--nexo-preview-fit-height,120px) !important;
}
#appShell:not(.nexo-video-fullscreen) #voiceStage:not([hidden])
 .remote-media.has-video:not([data-watched-count="0"])
 > .remote-tile:is(.is-stream-preview,.is-stream-pending){
  flex:0 0 min(210px,39%) !important;
  width:min(210px,39%) !important;
  height:var(--nexo-preview-fit-height,108px) !important;
}
@media(max-height:670px){
  #appShell #voicePreviewPanel:not([hidden]){
    padding-top:clamp(80px,14vh,110px) !important;
    padding-bottom:30px !important;
    gap:6px;
  }
  #appShell #voicePreviewPanel #voicePreviewMembers{
    margin:6px auto !important;
    gap:8px;
  }
  #appShell #voicePreviewPanel .voice-preview-member{
    min-height:95px;
  }
  #appShell #voicePreviewPanel .voice-preview-avatar{
    width:46px;height:46px;
  }
}
