/* Only /directo. The physical-screen checks cover desktop-site mode, where
   a phone can report a layout viewport as wide as a desktop browser. */
@media (max-width: 600px) and (orientation: portrait),
       (any-pointer: coarse) and (max-device-width: 600px) and (orientation: portrait),
       (max-width: 1080px) and (max-height: 500px) and (orientation: landscape),
       (any-pointer: coarse) and (max-device-height: 520px) and (orientation: landscape) {
  .app-shell:has(> .watch-page) > .site-header { display: none; }
  .watch-page .watch-layout { --watch-header-height: 0px; }
}

@media (max-width: 1080px) and (max-height: 500px) and (orientation: landscape),
       (any-pointer: coarse) and (max-device-height: 520px) and (orientation: landscape) {
  .watch-page .watch-layout--chat-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(260px, 34vw, 360px);
    grid-template-areas: 'video chat' 'info info';
    grid-template-rows: max(220px, var(--watch-viewport-height, 100dvh)) auto;
  }
  .watch-page .watch-layout--chat-column .watch-main { display: contents; }
  .watch-page .watch-layout--chat-column .watch-stage { grid-area: video; height: 100%; }
  .watch-page .watch-layout--chat-column .channel-bar { grid-area: info; }
  .watch-page .watch-layout--chat-column .chat-panel { grid-area: chat; position: relative; inset: auto; width: 100%; height: 100%; min-height: 0; }
  .watch-page .chat-resize-handle { display: none; }
  .watch-page .watch-layout--chat-hidden .watch-stage,
  .watch-page .watch-layout--chat-overlay .watch-stage { height: max(220px, var(--watch-viewport-height, 100dvh)); }
  .watch-page .watch-stage { max-height: none; aspect-ratio: auto; }
  .watch-page .watch-layout--chat-overlay .chat-panel { top: 6px; right: 6px; width: clamp(260px, 34vw, 360px); height: max(0px, calc(var(--stage-height) - 58px)); }
  .watch-page .watch-layout--chat-overlay .chat-layout-controls { left: 6px; right: auto; }
  .watch-page .chat-layout-cycle span, .watch-page .vk-player__actions .vk-player__button span { display: none; }
}

/* A desktop-sized layout viewport on a phone in portrait still stacks chat. */
@media (min-width: 981px) and (any-pointer: coarse) and (max-device-width: 600px) and (orientation: portrait) {
  .watch-page .watch-layout--chat-column {
    --compact-video-height: min(calc(56.25vw + 46px), calc(var(--watch-viewport-height, 100dvh) * .42));
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'video' 'chat' 'info';
    grid-template-rows: var(--compact-video-height) max(180px, calc(var(--watch-viewport-height, 100dvh) - var(--compact-video-height))) auto;
  }
  .watch-page .watch-layout--chat-column .watch-main { display: contents; }
  .watch-page .watch-layout--chat-column .watch-stage { grid-area: video; height: 100%; max-height: none; aspect-ratio: auto; }
  .watch-page .watch-layout--chat-column .channel-bar { grid-area: info; }
  .watch-page .watch-layout--chat-column .chat-panel { grid-area: chat; position: relative; inset: auto; width: 100%; height: 100%; min-height: 0; }
  .watch-page .chat-resize-handle { display: none; }
}
