/* Audience phones keep the presentation and a clear way back from Q&A. */
@media (max-width:850px), (pointer:coarse) and (max-width:1100px), (orientation:landscape) and (max-height:600px) and (max-width:1000px) {
  body[data-presentation=audience].rsi-floating .rsi-side-panel {
    inset:var(--rsi-chat-viewport-top,0px) 0 auto;
    width:100%;
    height:var(--rsi-chat-viewport-height,100dvh);
    max-height:none;
    min-height:0;
    border:0;
    border-radius:0;
    z-index:1000;
  }
  body[data-presentation=audience] .rsi-panel-head {
    flex-wrap:wrap;
    gap:0;
    padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));
    background:#fffefa;
  }
  body[data-presentation=audience] .rsi-panel-head .rsi-panel-tabs {flex:0 0 100%;width:100%;padding:0 0 8px}
  body[data-presentation=audience] .rsi-panel-tabs button {min-height:44px}
  body[data-presentation=audience] .rsi-panel-close {
    order:-1;
    justify-content:space-between;
    width:100%;
    min-height:44px;
    padding:8px 14px;
    margin-bottom:6px;
    border:1px solid #244d3e;
    background:#244d3e;
    color:#fff;
    font-size:14px;
    font-weight:600;
  }
  body[data-presentation=audience] .rsi-panel-close-label {display:inline}
  body[data-presentation=audience] .rsi-panel-close-icon {font-size:25px;font-weight:400}
  body[data-presentation=audience].rsi-floating .rsi-chat {flex:1;min-height:0;height:auto;max-height:none}
  body[data-presentation=audience] .rsi-chat-log {min-height:0}
  body[data-presentation=audience] .rsi-chat-form {
    padding:8px max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  }
  body[data-presentation=audience] .rsi-chat-composer textarea {font-size:16px;min-height:44px}
  body[data-presentation=audience] .rsi-side-panel[data-keyboard=true] :is(.rsi-chat-intro,.rsi-chat-tips,.rsi-chat-form>label,.rsi-chat-form>.small) {display:none}
  body[data-presentation=audience] .rsi-side-panel[data-keyboard=true] .rsi-chat-composer textarea {height:44px;max-height:64px}
}

/* Explicit phone focus mode scales the running animation, not a static copy. */
body[data-presentation=audience][data-audience-stage=open] {overflow:hidden;overscroll-behavior:none}
body[data-presentation=audience][data-audience-stage=open] .av:fullscreen {padding:0;background:#fffefa;overflow:hidden}
body[data-presentation=audience][data-audience-stage=open] :is(header,.viewbar,.av-script,.av-controls,.av-legend,.av-chapters,.av-tags,.av-poster,.live-bar,.rsi-fab,.rsi-side-panel,.live-featured,.live-qr) {display:none!important}
body[data-presentation=audience][data-audience-stage=open] .audience-stage-target {
  position:fixed!important;
  inset:auto!important;
  left:50%!important;
  top:50%!important;
  width:var(--audience-stage-width)!important;
  height:var(--audience-stage-height)!important;
  max-width:none!important;
  max-height:none!important;
  min-height:0!important;
  aspect-ratio:auto!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  box-sizing:border-box;
  z-index:1200;
  transform:translate(-50%,-50%);
  transform-origin:center;
  overflow:hidden;
  background:#fffefa;
}
body[data-presentation=audience][data-audience-stage=open] .audience-stage-target[data-audience-rotated=true] {transform:translate(-50%,-50%) rotate(90deg)}
body[data-presentation=audience][data-audience-stage=open] .audience-stage-target .av-svg {
  inset:0 0 auto;
  width:100%;
  height:calc(100% - 52px - env(safe-area-inset-bottom));
}
.audience-stage-close {
  position:absolute;
  bottom:max(4px,env(safe-area-inset-bottom));
  right:max(8px,env(safe-area-inset-right));
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  max-width:calc(100% - 16px);
  padding:8px 16px;
  border:1px solid #244d3e;
  border-radius:7px;
  background:#244d3e;
  color:#fff;
  font:600 14px/1.3 system-ui,sans-serif;
  cursor:pointer;
  z-index:1;
}
.audience-stage-close:focus-visible {outline:3px solid #a37227;outline-offset:2px}

/* A landscape phone follows the same animation, with touch controls outside it. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1000px) {
  body[data-presentation=audience][data-view=play].live-active {--audience-touch-bar:52px}
  body[data-presentation=audience][data-view=play].live-active .live-bar {
    position:fixed;
    inset:auto 0 0;
    height:calc(var(--audience-touch-bar) + env(safe-area-inset-bottom));
    min-height:0;
    padding:4px max(8px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
    z-index:70;
    border:0;
  }
  body[data-presentation=audience][data-view=play].live-active .live-bar>:not(.live-follow) {display:none}
  body[data-presentation=audience][data-view=play].live-active .live-follow {
    min-height:44px;
    max-width:calc(100% - 165px);
    padding:6px 10px;
    font-size:12px;
    line-height:1.3;
  }
  body[data-presentation=audience][data-view=play].live-active .rsi-fab {
    right:max(8px,env(safe-area-inset-right));
    bottom:calc(4px + env(safe-area-inset-bottom));
    display:flex;
    gap:8px;
    width:auto;
    height:44px;
    padding:8px 12px;
    border:1px solid #ffffff60;
    border-radius:7px;
    box-shadow:none;
    z-index:71;
    font-size:13px;
  }
  body[data-presentation=audience][data-view=play].live-active .rsi-fab svg {width:21px;height:21px}
  body[data-presentation=audience][data-view=play].live-active .rsi-fab-mobile-label {display:inline}
  body[data-presentation=audience][data-view=play].live-active.rsi-panel-open .rsi-fab {display:none}
  body[data-presentation=audience][data-view=play].live-active:not(.live-following) .map {padding-bottom:calc(72px + env(safe-area-inset-bottom))}
  body[data-presentation=audience][data-view=play].live-following {overflow:hidden}
  body[data-presentation=audience][data-view=play].live-following :is(header,.viewbar,.av-script,.av-controls,.av-legend,.av-chapters,.av-focus,.av-tags) {display:none!important}
  body[data-presentation=audience][data-view=play].live-following .layout {
    position:fixed;
    inset:env(safe-area-inset-top) env(safe-area-inset-right) calc(var(--audience-touch-bar) + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    display:block!important;
    min-height:0;
  }
  body[data-presentation=audience][data-view=play].live-following :is(.map,#play-view,.av,.av-wrap,.av-main) {
    display:block;
    width:100%;
    height:100%;
    min-height:0;
    max-width:none;
    margin:0;
    padding:0;
  }
  body[data-presentation=audience][data-view=play].live-following .av-stage {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    aspect-ratio:auto;
    margin:0;
    border:0;
    border-radius:0;
  }
  body[data-presentation=audience] .rsi-panel-head {flex-wrap:nowrap;gap:10px;padding:6px max(12px,env(safe-area-inset-right)) 6px max(12px,env(safe-area-inset-left))}
  body[data-presentation=audience] .rsi-panel-head .rsi-panel-tabs {flex:1 1 auto;width:auto;padding:0;gap:4px}
  body[data-presentation=audience] .rsi-panel-close {order:0;width:auto;min-width:180px;margin:0}
  body[data-presentation=audience] .rsi-chat-intro {padding:4px 12px}
  body[data-presentation=audience] :is(.rsi-chat-top,.rsi-chat-tips) {display:none}
  body[data-presentation=audience] .rsi-chat-form>label {display:none}
  body[data-presentation=audience] .rsi-chat-composer textarea {height:48px;max-height:72px}
  body[data-presentation=audience] .rsi-chat-form>.small {font-size:10px;line-height:1.35}
}
