/* Phase 11.3 — expanded video only. No rules match collapsed video or audio.
   The viewport budget includes the dedicated header, player margins and inset.
   Keep information panels and the DJ Mix queue in the normal scroll flow. */
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:is(.xtra-dedicated-player,.expanded):not(.mx-floating-video:not(.expanded)) {
  --mx11-frame-budget:max(100px, calc(100vh - 175px));
  --mx11-frame-budget:max(100px, calc(100dvh - 175px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));
  min-width:0!important;box-sizing:border-box!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer#globalPlayer.mx11-full-video:is(.xtra-dedicated-player,.expanded):not(.mx-floating-video:not(.expanded)) :is(.xtra-dedicated-stage,.xtra-djmix-video-player):not(:fullscreen) {
  position:relative!important;inset:auto!important;transform:none!important;display:block!important;
  width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:none!important;
  aspect-ratio:auto!important;padding:0!important;margin:0 auto!important;overflow:visible!important;border:0!important;background:transparent!important;box-shadow:none!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:is(.xtra-dedicated-player,.expanded):not(.mx-floating-video:not(.expanded)) .mx11-video-frame:not(:fullscreen) {
  position:relative!important;inset:auto!important;display:block!important;transform:none!important;
  box-sizing:border-box!important;width:min(100%,calc(var(--mx11-frame-budget) * 16 / 9))!important;
  max-width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:var(--mx11-frame-budget)!important;
  aspect-ratio:16/9!important;margin:0 auto!important;padding:0!important;
  border:1px solid #273649!important;border-radius:12px!important;overflow:hidden!important;background:#000!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:is(.xtra-dedicated-player,.expanded):not(.mx-floating-video:not(.expanded)) .mx11-video-frame :is(video#globalMedia,iframe#globalEmbed):not(:fullscreen) {
  position:absolute!important;inset:0!important;display:block!important;transform:none!important;
  width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-width:100%!important;max-height:100%!important;
  aspect-ratio:auto!important;object-fit:contain!important;object-position:center!important;border:0!important;border-radius:0!important;margin:0!important;padding:0!important;background:#000!important;
}
/* Do not allow the surrounding page's 16:9 styles to constrain true fullscreen. */
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-video-frame :is(video#globalMedia,iframe#globalEmbed):fullscreen {
  position:fixed!important;inset:0!important;width:100vw!important;height:100vh!important;height:100dvh!important;max-width:none!important;max-height:none!important;
  margin:0!important;padding:0!important;border:0!important;border-radius:0!important;object-fit:contain!important;aspect-ratio:auto!important;background:#000!important;
}
/* Buffer indicator is driven by media waiting/canplay events, not a fake timer. */
#globalPlayer.mx11-full-video .mx11-video-buffer[hidden]{display:none!important;}
#globalPlayer.mx11-full-video:not(.mx-floating-video:not(.expanded)) .mx11-video-buffer:not([hidden]){
  position:absolute;z-index:2;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;gap:8px;
  pointer-events:none;background:#0b121ae8;border:1px solid #273649;padding:9px 12px;border-radius:99px;color:#fff;font-size:12px;white-space:nowrap;
}
#globalPlayer.mx11-full-video .mx11-video-buffer span{width:18px;height:18px;border-radius:50%;border:2px solid #526070;border-top-color:#ff1464;animation:mx11-buffer .85s linear infinite;}
@keyframes mx11-buffer{to{transform:rotate(360deg);}}
@media(prefers-reduced-motion:reduce){#globalPlayer.mx11-full-video .mx11-video-buffer span{animation:none;}}
/* Dedicated Playing Now header follows the Phase 11.1 design and uses its account state. */
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:not(.mx-floating-video:not(.expanded)) .mx11-player-head{
  position:relative!important;inset:auto!important;transform:none!important;display:grid!important;
  grid-template-columns:48px minmax(0,1fr) 44px 44px!important;align-items:center!important;gap:9px!important;
  width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;min-height:64px!important;
  box-sizing:border-box!important;margin:0 auto 10px!important;padding:8px 16px!important;
  background:#0b121a!important;color:#fff!important;border:1px solid #253543!important;border-radius:14px!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-back{
  position:relative!important;inset:auto!important;display:grid!important;place-items:center!important;box-sizing:border-box!important;
  width:48px!important;height:48px!important;min-width:48px!important;min-height:48px!important;max-width:48px!important;max-height:48px!important;
  border:1px solid #37475b!important;border-radius:50%!important;background:#112132!important;
  color:transparent!important;font-size:0!important;padding:0!important;margin:0!important;box-shadow:none!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-back::after{
  content:'×'!important;position:absolute!important;inset:0!important;display:grid!important;place-items:center!important;
  color:#fff!important;font:300 31px/1 Arial,sans-serif!important;pointer-events:none!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-title{min-width:0!important;margin:0!important;padding:0!important;text-align:left!important;}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-title b{
  display:block!important;font-size:16px!important;font-weight:900!important;line-height:1.25!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
}
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-title small{
  display:block!important;white-space:normal!important;overflow-wrap:anywhere!important;font-size:10.5px!important;line-height:1.35!important;color:#bac7dd!important;margin:3px 0 0!important;
}
#globalPlayer.mx11-full-video .mx11-player-head em{font-style:normal;color:#ff4b8a;font-weight:700;}
html body #globalPlayer.mx11-full-video .mx11-player-head .mx11-action{
  box-sizing:border-box;position:relative;display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:50%;background:#0d1522;padding:0;margin:0;cursor:pointer;
}
#globalPlayer.mx11-full-video .mx11-action[data-kind="notify"]{color:#ff1464;}
#globalPlayer.mx11-full-video .mx11-action[data-kind="account"]{color:#00bfff;}
#globalPlayer.mx11-full-video .mx11-action svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;}
#globalPlayer.mx11-full-video .mx11-action[data-mx11-avatar] svg{visibility:hidden;}
#globalPlayer.mx11-full-video .mx11-action .mx11-avatar{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:cover!important;border-radius:50%!important;margin:0!important;padding:0!important;}
#globalPlayer.mx11-full-video .mx11-action .mx11-initials{position:absolute;inset:0;display:grid;place-items:center;color:#00bfff;font-size:14px;font-weight:800;}
#globalPlayer.mx11-full-video .mx11-action .mx11-badge{position:absolute;top:-3px;right:-3px;min-width:19px;height:19px;padding:0 3px;box-sizing:border-box;border-radius:99px;background:#ff1464;color:white;font:700 10px/19px Arial,sans-serif;text-align:center;}
/* The existing share and more-options controls remain available BELOW video. */
html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:not(.mx-floating-video:not(.expanded)) .mx11-video-tools{
  position:relative;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;margin:10px 0;padding:0;max-width:100%;
}
html body #globalPlayer.mx11-full-video .mx11-video-tools > button{
  position:relative!important;inset:auto!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;
  min-height:44px!important;height:auto!important;width:auto!important;min-width:0!important;max-width:100%!important;
  flex:0 1 auto!important;background:#14212f!important;color:#fff!important;padding:8px 12px!important;border:1px solid #2b3c4e!important;border-radius:10px!important;font-size:12px!important;font-weight:700!important;
}
#globalPlayer.mx11-full-video .mx11-video-tools > button:focus-visible,#globalPlayer.mx11-full-video .mx11-player-head button:focus-visible{outline:2px solid #ff0757;outline-offset:2px;}
#globalPlayer.mx11-full-video .mx11-video-tools #mxFlutterPlayerMenu{position:absolute!important;top:100%!important;bottom:auto!important;right:0!important;left:auto!important;z-index:25;}
@media(max-width:420px){
 html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:not(.mx-floating-video:not(.expanded)) .mx11-player-head{grid-template-columns:44px minmax(0,1fr) 40px 40px!important;gap:6px!important;padding:8px 10px!important;}
 html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video .mx11-player-head .dedicated-player-back{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px!important;max-height:44px!important;}
 #globalPlayer.mx11-full-video .mx11-player-head .mx11-action{width:40px!important;height:40px!important;}
}
@media(max-height:480px) and (orientation:landscape){
 html body :is(#app #page #inlinePlayerMount,#playerHost) #globalPlayer.mx11-full-video:is(.xtra-dedicated-player,.expanded):not(.mx-floating-video:not(.expanded)){--mx11-frame-budget:max(100px,calc(100dvh - 170px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));}
}
/* Expanded floating playback is a dedicated viewing surface. The underlying
   navigation must not intercept its controls. Restore it automatically on collapse. */
html body #playerHost.mx-video-overlay:has(> #globalPlayer.mx11-full-video.mx-floating-video.expanded){z-index:11000!important;}
html body:has(#playerHost.mx-video-overlay > #globalPlayer.mx11-full-video.mx-floating-video.expanded) :is(#bottomNav,#mxUnifiedMainNavV2,#mxHomeAirplayNavV14,#mxRemainingFlutterWorkspace,#mxPhoneNavUnified,#mxFlutterMarketTabs,#mxNavRescue){visibility:hidden!important;pointer-events:none!important;}

/* Dedicated playback: one scrollport, not a fixed screen inside a fixed page.
   The extra ID in the stage selector above intentionally supersedes the old
   Phase 6.2 route-specific aspect ratio without modifying its other rules. */
html body.video-playback-active:has(> #app > #page > .dedicated-video-screen #globalPlayer.mx11-full-video){overflow:hidden!important;height:100vh!important;height:100dvh!important;}
html body.video-playback-active:has(> #app > #page > .dedicated-video-screen #globalPlayer.mx11-full-video) > #app.app-shell{
  position:fixed!important;inset:0!important;width:100%!important;max-width:none!important;height:100vh!important;height:100dvh!important;min-height:0!important;max-height:none!important;
  overflow:hidden!important;margin:0!important;padding:0!important;transform:none!important;
}
html body.video-playback-active:has(> #app > #page > .dedicated-video-screen #globalPlayer.mx11-full-video) > #app.app-shell > #page.page{
  position:absolute!important;inset:0!important;display:block!important;box-sizing:border-box!important;width:100%!important;max-width:none!important;height:100%!important;min-height:0!important;max-height:none!important;
  margin:0!important;padding:0!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior-y:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;
}
html body.video-playback-active:has(> #app > #page > .dedicated-video-screen #globalPlayer.mx11-full-video) > #app.app-shell > #page.page > section.dedicated-video-screen.native-only-video-screen{
  position:relative!important;inset:auto!important;display:block!important;box-sizing:border-box!important;
  width:min(960px,100%)!important;max-width:960px!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:none!important;
  padding:max(10px,env(safe-area-inset-top,0px)) max(10px,env(safe-area-inset-right,0px)) calc(96px + env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px))!important;
  margin:0 auto!important;overflow:visible!important;transform:none!important;
}
html body.video-playback-active:has(> #app > #page > .dedicated-video-screen #globalPlayer.mx11-full-video) > #app.app-shell > #page.page > section.dedicated-video-screen #inlinePlayerMount{
  position:relative!important;inset:auto!important;display:block!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important;
}
