/* Presentation variants sharing one application core. */
html[data-device="tv"] { --transition:0s; }
html[data-device="tv"] *,html[data-device="tv"] *::before,html[data-device="tv"] *::after { scroll-behavior:auto!important; }
html[data-device="tv"] * { animation-duration:0s!important; transition-duration:0s!important; }
/* Android TV WebViews pay a large compositing cost for translucent, blurred and
   pre-promoted layers.  Keep the TV presentation flat and immediate. */
html[data-device="tv"] :is(nav,.side-nav,.player-bar,.full-player,.setting-section,.settings-sidebar,.profile-settings-block,.card,.queue-panel,.modal,.nav-search-menu,.nav-more-menu,.player-more-menu,.context-menu,.downloads-panel) { backdrop-filter:none!important; -webkit-backdrop-filter:none!important; }
html[data-device="tv"] :is(.card,.song-row,.queue-item,.nav-search-option) { box-shadow:none!important; will-change:auto!important; }
/* content-visibility caused delayed hit-testing/focus paint in Android WebView,
   which made mouse and remote movement feel one step behind. */
html[data-device="tv"] :is(.grid > .card,.song-row) { content-visibility:visible; contain:none; }
html[data-device="tv"] body { background-attachment:scroll!important; }
html[data-device="tv"] :is(.seasonal-lights,.seasonal-haze,.seasonal-snow) { animation:none!important; }
html[data-device="tv"] .seasonal-snow-near { display:none!important; }
html[data-device="tv"] .seasonal-haze { filter:none!important; opacity:.18!important; }
html[data-device="tv"] .full-player { transition:none!important; }
html[data-device="tv"] .card:hover,html[data-device="tv"] button:hover { transform:none; }

/* Android-box / TV shell keeps the navigation permanently expanded. Unlike
   desktop, it must not rely on a mouse hover to reveal destinations. */
@media (min-width:769px) {
  html[data-device="tv"] { --side-nav-width:188px!important; --side-nav-expanded-width:188px!important; }
  html[data-device="tv"] .side-nav,
  html[data-device="tv"] .side-nav:hover,
  html[data-device="tv"] .side-nav:focus-within {
    width:188px!important; padding:18px 14px 88px!important; overflow:visible!important;
    background:var(--bg-card)!important; box-shadow:none!important;
  }
  html[data-device="tv"] .side-nav-brand strong,
  html[data-device="tv"] .side-nav-btn span,
  html[data-device="tv"] .side-theme-btn span,
  html[data-device="tv"] .side-nav-themes-title {
    display:inline!important; max-width:140px!important; opacity:1!important;
    overflow:visible!important; pointer-events:auto!important;
  }
  html[data-device="tv"] .side-nav-themes { display:grid!important; grid-template-columns:1fr!important; gap:5px!important; }
  html[data-device="tv"] .side-theme-btn { justify-content:flex-start!important; height:31px!important; }
}

/* Never let the themed glass backgrounds make the TV mini-player translucent. */
html[data-device="tv"] .player-bar {
  background:var(--bg)!important;
  opacity:1!important;
  isolation:isolate;
}

/* Remote/keyboard selection must remain visible even though TV mode removes
   decorative shadows.  The outline does not affect layout. */
html[data-device="tv"] .nav-search-option.kbd-active,
html[data-device="tv"] .nav-search-option[aria-selected="true"] {
  background:var(--accent-dim)!important;
  outline:2px solid var(--accent)!important;
  outline-offset:-2px;
  border-radius:var(--radius-sm);
  color:var(--text)!important;
}

/* Keep the current row unmistakable and allow only its tiny three-bar marker
   to animate.  This is deliberately exempt from the global TV animation cut;
   three 2px bars are cheap while still communicating that playback is live. */
html[data-device="tv"] .track-playing-list .song-row.now-playing {
  background:var(--accent-dim)!important;
  border:2px solid var(--accent)!important;
}
html[data-device="tv"] .track-playing-list .song-row.now-playing .playlist-playing-indicator {
  visibility:visible!important;
}
html[data-device="tv"] .track-playing-list .song-row.now-playing .playlist-playing-indicator i {
  animation:playlist-playing-bars .8s ease-in-out infinite alternate!important;
}
html[data-device="tv"] .track-playing-list .song-row.now-playing .playlist-playing-indicator i:nth-child(1) { animation-delay:-.15s!important; }
html[data-device="tv"] .track-playing-list .song-row.now-playing .playlist-playing-indicator i:nth-child(2) { animation-delay:-.55s!important; }
html[data-device="tv"] .track-playing-list .song-row.now-playing .playlist-playing-indicator i:nth-child(3) { animation-delay:-.3s!important; }
html[data-device="tv"] .queue-item.now-playing .queue-playing-indicator i {
  animation:queue-playing-bars .7s ease-in-out infinite alternate!important;
}
html[data-device="tv"] .queue-item.now-playing .queue-playing-indicator i:nth-child(1) { animation-delay:-.15s!important; }
html[data-device="tv"] .queue-item.now-playing .queue-playing-indicator i:nth-child(2) { animation-delay:-.48s!important; }
html[data-device="tv"] .queue-item.now-playing .queue-playing-indicator i:nth-child(3) { animation-delay:-.3s!important; }

/* Some Android-box WebViews do not resolve container-query units (cqw)
   reliably, leaving the cover play action at its absolute-position fallback
   near the top.  Use a one-cell grid in TV mode so the button is anchored to
   the actual square artwork rather than a calculated coordinate. */
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) {
  display:grid;
  grid-template-columns:minmax(0,1fr);
}
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) > .card-img,
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) > .playlist-cover-grid,
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) > .playlist-cover-empty {
  grid-column:1;
  grid-row:1;
}
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) > .card-body {
  grid-column:1;
  grid-row:2;
}
html[data-device="tv"] .card:not(.song-row):not(.top-result-card) > .card-play-btn {
  position:relative!important;
  grid-column:1;
  grid-row:1;
  align-self:end;
  justify-self:end;
  top:auto!important;
  right:auto!important;
  bottom:auto!important;
  margin:0 8px 8px 0;
}

body.player-shell { --player-height:68px; }
body.player-shell .player-bar { display:flex; }
body.player-shell main { padding-bottom:calc(28px + var(--player-height) + 20px); }
.player-bar:not(.active) :is(.player-controls,.player-progress-wrap,.player-actions) { opacity:.35; pointer-events:none; }
.player-bar:not(.active) .player-img { box-shadow:inset 0 0 0 1px var(--border); }
@media (max-width:768px) {
  html[data-device="mobile"] body[data-page="home"] nav { display:none; }
/* Live DJ mixing controls are desktop/TV features. Keep them entirely out of
   the phone UI while preserving them for web and Android-box/TV mode. */
html[data-device="mobile"] #fpDjPanelBtn,
html[data-device="mobile"] #fpDjMode,
html[data-device="mobile"] #fpDjPanel,
html[data-device="mobile"] #fpDjBackdrop { display:none!important; }
  body.player-shell main { padding-bottom:calc(140px + env(safe-area-inset-bottom,0px)); }
  body.player-shell .bottom-nav { bottom:calc(6px + env(safe-area-inset-bottom,0px)); }
}
