/* Trường Nguyễn Music V256 — isolated web-player vs V147 search overlay.
 * Keep V147's element within web-player so V244's intended z-order can work.
 * Do not alter native Play, queue, Angular router or YouTube iframe behavior. */
html.tn147-search-mode body web-player.tn-music-v1 > #tn-v147-search.tn256-player-layer-search {
  z-index:90!important;
  bottom:var(--tn256-player-reserve,150px)!important;
  max-height:calc(100dvh - var(--tn256-player-reserve,150px) - 54px)!important;
  overscroll-behavior-y:contain!important;
  scroll-padding-bottom:24px!important;
}
/* Native mobile controls are siblings of V147 Search after the portal.
 * V244 tried to target this structure but Search was appended to body. */
html.tn147-search-mode body web-player.tn-music-v1 > mobile-player-controls,
html.tn147-search-mode body web-player.tn-music-v1 > player-controls {
  z-index:1006!important;
}
html.tn147-search-mode body web-player.tn-music-v1 > mobile-player-controls .tn-mini-video-action {
  position:relative!important;
  z-index:1!important;
  pointer-events:auto!important;
  touch-action:manipulation!important;
}
/* Full-size video must appear over Search, mini-player and bottom menu.
 * Fullscreen-overlay is a DIRECT native child of web-player (same stack). */
html body web-player.tn-music-v1 > fullscreen-overlay.maximized {
  z-index:1500!important;
  position:fixed!important;
  top:0!important;
  right:0!important;
  bottom:0!important;
  left:0!important;
  width:100vw!important;
  height:100vh!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  overflow:auto!important;
  visibility:visible!important;
  pointer-events:auto!important;
}
/* Do not allow body-level autocomplete or a legacy outside catalogue to
   cover an already maximized native video overlay. Search is not destroyed. */
html.tn256-video-maximized #tn147-suggestions,
html.tn256-video-maximized #tn-v147-search,
html.tn256-video-maximized #tn-v145-track-catalog.tn-v145-outside {
  visibility:hidden!important;
  pointer-events:none!important;
}
@media (max-width:768px) {
  html.tn147-search-mode body web-player.tn-music-v1 > #tn-v147-search.tn256-player-layer-search {
    bottom:var(--tn256-player-reserve,150px)!important;
    padding-bottom:0!important;
    -webkit-overflow-scrolling:touch!important;
  }
  html.tn147-search-mode body web-player.tn-music-v1 > #tn-v147-search .tn147-search-layout {
    padding-bottom:22px!important;
  }
  html body web-player.tn-music-v1 > fullscreen-overlay.maximized {
    padding-bottom:env(safe-area-inset-bottom,0px)!important;
    -webkit-overflow-scrolling:touch!important;
  }
  html body web-player.tn-music-v1 > fullscreen-overlay.maximized .top-nav button {
    touch-action:manipulation!important;
  }
}
@media(prefers-reduced-motion:reduce){
  html body web-player.tn-music-v1 > fullscreen-overlay.maximized { transition:none!important; }
}
