
/*
 MAGIC 1XTRA — FLUTTER-STYLE PLAYING NOW LAYOUT V6

 Normal page: vertically scrollable
 Fullscreen: existing fullscreen player
 Existing player and playback controls unchanged
*/

/* Normal page scrolling */
html:has(section.mx-live-clean-screen) {
  height:auto!important;
  min-height:100%!important;
  overflow-x:clip!important;
  overflow-y:auto!important;
}

body.video-playback-active:has(section.mx-live-clean-screen) {
  position:relative!important;
  height:auto!important;
  min-height:100dvh!important;
  max-height:none!important;
  overflow-x:clip!important;
  overflow-y:auto!important;
  background:#07101f!important;
}

/* Release fixed application shell */
body.video-playback-active:has(section.mx-live-clean-screen)
#app.app-shell,
body.video-playback-active:has(section.mx-live-clean-screen)
#page.page {
  position:relative!important;
  inset:auto!important;
  width:100%!important;
  max-width:none!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
  background:transparent!important;
  transform:none!important;
}


/* Center the normal player page without changing fullscreen. */
body.video-playback-active:has(section.mx-live-clean-screen)
#page.page {
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
}

/* One centered container for the whole Playing Now page */
body.video-playback-active
section.dedicated-video-screen.native-only-video-screen.mx-live-clean-screen:not(:fullscreen) {
  position:relative!important;
  inset:auto!important;
  display:block!important;
  box-sizing:border-box!important;
  width:calc(100% - 32px)!important;
  max-width:800px!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0 auto!important;
  padding:16px 0 120px!important;
  overflow:visible!important;
  background:transparent!important;
  transform:none!important;
  isolation:auto!important;
}

body.video-playback-active
.mx-live-clean-screen::after {
  display:none!important;
  content:none!important;
}

/* Actual mount confirmed in app-audio-v2.js */
body.video-playback-active
.mx-live-clean-screen
#inlinePlayerMount.dedicated-video-mount {
  position:relative!important;
  inset:auto!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:16px!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
  background:transparent!important;
  transform:none!important;
}

/* Existing player, not a second frame */
body.video-playback-active
.mx-live-clean-screen
#globalPlayer.xtra-dedicated-player {
  position:relative!important;
  inset:auto!important;
  display:block!important;
  box-sizing:border-box!important;
  flex:0 0 auto!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  box-shadow:none!important;
  overflow:visible!important;
  background:transparent!important;
}

/* Channel header */
body.video-playback-active
.mx-live-clean-screen .dedicated-player-nav {
  position:relative!important;
  inset:auto!important;
  display:flex!important;
  align-items:center!important;
  gap:12px!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:auto!important;
  min-height:60px!important;
  margin:0 0 14px!important;
  padding:6px 10px!important;
  border:1px solid #28374d!important;
  border-radius:14px!important;
  background:#101827!important;
  transform:none!important;
}

body.video-playback-active
.mx-live-clean-screen .dedicated-player-back {
  position:relative!important;
  inset:auto!important;
  flex:0 0 44px!important;
  display:grid!important;
  place-items:center!important;
  width:44px!important;
  height:44px!important;
  margin:0!important;
  padding:0!important;
  border-radius:50%!important;
}

body.video-playback-active
.mx-live-clean-screen .dedicated-player-title {
  position:relative!important;
  inset:auto!important;
  flex:1 1 auto!important;
  min-width:0!important;
}

/* 16:9 video stage, no decorative outer container */
body.video-playback-active
.mx-live-clean-screen .xtra-dedicated-stage {
  position:relative!important;
  inset:auto!important;
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:16/9!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:12px!important;
  box-shadow:none!important;
  overflow:hidden!important;
  background:#000!important;
}

body.video-playback-active
.mx-live-clean-screen .xtra-dedicated-stage
:is(.player-video-wrap,.native-video-stage,.protected-player-wrap) {
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
}

body.video-playback-active
.mx-live-clean-screen .xtra-dedicated-stage
:is(video,iframe) {
  position:absolute!important;
  inset:0!important;
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
}

/* Actions and sections flow below the player */
body.video-playback-active
.mx-live-clean-screen
:is(.mx-live-clean-actions,.mx-live-clean-panel) {
  position:relative!important;
  inset:auto!important;
  flex:0 0 auto!important;
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:auto!important;
  margin:0!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-actions {
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:10px!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-btn {
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:0!important;
  min-height:46px!important;
  padding:10px!important;
  border:1px solid #354760!important;
  border-radius:12px!important;
  background:#15243e!important;
  color:#fff!important;
  font:700 13px/1.3 system-ui,sans-serif!important;
  text-decoration:none!important;
  cursor:pointer!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-btn.primary {
  background:#ff0767!important;
  border-color:#ff0767!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-panel {
  display:block!important;
  padding:20px!important;
  border:1px solid #32465f!important;
  border-radius:16px!important;
  background:#101c31!important;
  color:#fff!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-panel h2 {
  font-size:20px!important;
  margin:0 0 12px!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-panel p {
  color:#acbad0!important;
  line-height:1.5!important;
}

body.video-playback-active
.mx-live-clean-screen .mx-live-clean-link {
  color:#ff2477!important;
}

/* Existing bottom navigation; don't change its icon sizes */
body.video-playback-active:has(section.mx-live-clean-screen)
#bottomNav.bottom-nav {
  display:grid!important;
  visibility:visible!important;
  pointer-events:auto!important;
}

/* Mobile */
@media(max-width:767px) {
  body.video-playback-active
  section.mx-live-clean-screen:not(:fullscreen) {
    width:calc(100% - 20px)!important;
    padding:10px 0 110px!important;
  }

  body.video-playback-active
  .mx-live-clean-screen #inlinePlayerMount {
    gap:12px!important;
  }

  body.video-playback-active
  .mx-live-clean-screen .mx-live-clean-actions {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }

  body.video-playback-active
  .mx-live-clean-screen .mx-live-clean-panel {
    padding:15px!important;
  }
}

/* Genuine fullscreen remains video-only */
body.video-playback-active
section.mx-live-clean-screen:fullscreen {
  position:fixed!important;
  inset:0!important;
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  padding:0!important;
  margin:0!important;
  overflow:hidden!important;
  background:#000!important;
}

body.video-playback-active
section.mx-live-clean-screen:fullscreen #inlinePlayerMount,
body.video-playback-active
section.mx-live-clean-screen:fullscreen #globalPlayer {
  height:100%!important;
  max-height:100%!important;
}

body.video-playback-active
section.mx-live-clean-screen:fullscreen .xtra-dedicated-stage {
  height:100%!important;
  aspect-ratio:auto!important;
  border-radius:0!important;
}


/* MX_PLAYING_NOW_SCROLL_FIX_START */

/*
  The original video route uses a fullscreen application shell.
  Make #page the ONE vertical scroll container.
  Keep the main player, navigation and floating player independent.
*/

html:has(.mx-live-clean-screen),
html:has(.mx-live-clean-screen) body {
    height: 100% !important;
    overflow: hidden !important;
}

html body.video-playback-active:has(.mx-live-clean-screen)
#app.app-shell {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
}

/* This is the actual vertical scrolling surface. */
html body.video-playback-active:has(.mx-live-clean-screen)
#page.page {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;

    box-sizing: border-box !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;

    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    scrollbar-gutter: stable;
}

/* The content must be allowed to exceed the screen height. */
html body.video-playback-active
#page.page > section.mx-live-clean-screen:not(:fullscreen) {
    position: relative !important;
    inset: auto !important;

    box-sizing: border-box !important;
    width: calc(100% - 24px) !important;
    max-width: 800px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 auto !important;
    padding: 12px 0 140px !important;

    overflow: visible !important;
    transform: none !important;
}

html body.video-playback-active
.mx-live-clean-screen #inlinePlayerMount {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Keep bottom navigation outside the scrolling content. */
html body.video-playback-active:has(.mx-live-clean-screen)
#bottomNav.bottom-nav {
    position: fixed !important;
    pointer-events: auto !important;
}

/* Mobile remains fully responsive. */
@media (max-width: 767px) {
    html body.video-playback-active
    #page.page > section.mx-live-clean-screen:not(:fullscreen) {
        width: calc(100% - 20px) !important;
        padding: 10px 0 130px !important;
    }
}

/* MX_PLAYING_NOW_SCROLL_FIX_END */
