/* ==========================================================================
 * MILLENOVA GLOBAL PLAYER — STAGE MOBILE LAYOUT CONTRACT
 *
 * OWNER:
 * This file owns mobile/coarse/narrow player and Stage composition: viewport sizing, sticky media, natural flow, quick-dock offsets and safe-area integration.
 *
 * MUST NOT OWN:
 * Do not define the desktop Stage as a convenience. Scrollbar chrome remains owned by
 * Styles/scrollbars.css. JavaScript state/queue/provider semantics stay
 * outside CSS.
 *
 * CASCADE CONTRACT:
 * Segment 1 of 3 for this owner. Phase 11A mechanical split: loaded at manifest position 10, after
 * 09-transport-controls--part-2-of-3.css. Rule order is unchanged from the former monolith (baseline
 * df93472, lines 1398–1660). New corrections go into the canonical owning
 * rule; never append dated Phase/fix blocks.
 *
 * DEPENDENCIES:
 * Depends on env(safe-area-inset-*) and the mobile shell state classes.
 * The universal mobile dock floats above Stage and must not reserve Stage height.
 * ========================================================================== */


/*
 * Real-mobile shell:
 * - expanded MPlayer is an edge-to-edge application surface, not an inset card;
 * - dynamic viewport top/bottom bounds;
 * - Stage owns the full mobile viewport; the quick dock floats above it;
 * - queue absorbs overflow;
 * - provider/video fullscreen is separate from player-shell expand/collapse.
 */
@media (max-width: 900px) and (pointer: coarse) {
  .floating-playlist:not(.is-minimized):not(.is-orientation-fullscreen) {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    max-height: none;
    box-sizing: border-box;
    filter: none;
  }

  .floating-playlist:not(.is-minimized) .floating-playlist__full {
    width: 100%;
    height: 100%;
    max-height: none;
    display: grid;
    grid-template-rows:
      auto
      auto
      auto
      minmax(0, 1fr)
      auto;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .floating-playlist:not(.is-minimized) .floating-playlist__tracks {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .floating-playlist:not(.is-minimized) .floating-playlist__video {
    max-height: min(30dvh, 220px);
  }

  .floating-playlist:not(.is-minimized)
    .floating-playlist__video[data-playback-adapter="spotify"] {
    height: min(152px, 24dvh);
  }

  .floating-playlist:not(.is-minimized)
    .floating-playlist__video[data-playback-adapter="soundcloud"] {
    height: min(206px, 30dvh);
  }

  .floating-playlist__header {
    min-height: 50px;
    padding: .52rem .62rem;
  }

  .floating-playlist__now {
    padding: .48rem .58rem;
    gap: .45rem;
  }

  .floating-playlist__tracks {
    padding: .34rem .42rem;
  }

  /* Player-shell expand/collapse remains independent from video fullscreen.
   * The uploaded-video expand action is capability-gated by JS and remains
   * absent for provider-linked playback.
   */

  .floating-playlist.is-minimized {
    top: auto;
    max-height: none;
  }

  .floating-playlist.is-minimized:not([hidden])
    .floating-playlist__mini:not([hidden]) {
    display: grid;
  }

  .floating-playlist__restore,
  .floating-playlist__minimize {
    min-width: 32px;
    min-height: 32px;
  }

  /*
   * Mobile queue thumbnails are already real playback buttons. Do not layer a
   * second visual Play affordance over the artwork; the active-row equalizer
   * remains the playback-state indicator.
   */
  .floating-playlist__thumb-play {
    display: none;
  }

  .floating-playlist__video:fullscreen .floating-playlist__video-collapse,
  .floating-playlist.is-orientation-fullscreen .floating-playlist__video-collapse {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .floating-playlist[data-native-ui-idle="true"] .floating-playlist__video-collapse {
    transform: translate(-50%, -4px);
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  .floating-playlist__header {
    border-bottom: 0;
  }

  .floating-playlist__track,
  .floating-playlist__track--up-next {
    min-height: 66px;
    grid-template-columns: 24px 72px minmax(0, 1fr) auto;
    gap: .52rem;
    padding: .38rem .28rem;
  }

  .floating-playlist.is-temporary-queue
    .floating-playlist__track--context {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .floating-playlist__thumb {
    width: 72px;
    border-radius: 8px;
  }

  .floating-playlist__thumb-play {
    width: 29px;
    height: 29px;
    font-size: .56rem;
  }

  .floating-playlist__track-eq {
    width: 31px;
    height: 27px;
  }

  .floating-playlist__track-copy {
    gap: .16rem;
  }

  .floating-playlist__track-copy strong {
    min-width: 0;
    max-height: 2.5em;
    display: -webkit-box;
    overflow: hidden;
    color: var(--mn-text);
    font-size: .86rem;
    font-weight: 680;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .floating-playlist__track-copy strong > span {
    display: block;
  }

  .floating-playlist__track-copy strong.is-marquee {
    display: block;
    max-height: 1.25em;
    white-space: nowrap;
    -webkit-line-clamp: unset;
  }

  .floating-playlist__track-copy strong.is-marquee > span {
    width: max-content;
    display: inline-block;
    white-space: nowrap;
    animation:
      floating-playlist-marquee var(--track-marquee-duration, 8s)
      ease-in-out infinite alternate;
  }

  .floating-playlist__track-copy small {
    font-size: .68rem;
    line-height: 1.25;
  }

  .floating-playlist__drag {
    width: 34px;
    height: 48px;
    color: rgba(255,255,255,.72);
  }

  .floating-playlist__drag-grip {
    width: 22px;
    height: 30px;
  }

  .floating-playlist__track-actions button {
    width: 32px;
    height: 32px;
    font-size: .68rem;
  }

  .floating-playlist__remove svg {
    width: 15px;
    height: 15px;
  }

  .floating-playlist__queue-section {
    padding: .52rem .18rem .22rem;
    font-size: .56rem;
  }

  .floating-playlist__now {
    padding: .58rem .62rem;
  }

  .floating-playlist__now-copy strong {
    font-size: .84rem;
  }

  .floating-playlist__now-copy small {
    max-width: 48vw;
    font-size: .64rem;
  }

  .floating-playlist__now-copy > div > span {
    font-size: .52rem;
  }

  .floating-playlist__transport {
    gap: .24rem;
  }

  .floating-playlist__transport button {
    width: 36px;
    height: 36px;
  }

  .floating-playlist__transport [data-floating-playlist-previous],
  .floating-playlist__transport [data-floating-playlist-next] {
    font-size: 1.3rem;
  }

  .floating-playlist__transport [data-floating-playlist-shuffle] svg,
  .floating-playlist__transport [data-floating-playlist-loop] svg {
    width: 17px;
    height: 17px;
  }
}


.floating-playlist__video-collapse {
  display: none;
  position: absolute;
  z-index: 20;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(5,6,9,.72);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: opacity .16s ease, transform .16s ease;
}

.floating-playlist__video-collapse svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.floating-playlist__video:fullscreen .floating-playlist__video-collapse,
.floating-playlist.is-orientation-fullscreen .floating-playlist__video-collapse {
  display: grid;
}

.floating-playlist[data-native-ui-idle="true"] .floating-playlist__video-collapse {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}
