/* Shared Library player presentation and isolated comparison effects. */
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-pulse {
  background: #9165ff !important;
  color: #fff !important;
  border-color: #9165ff !important;
  transform: scale(var(--library-test-motion, 1)) !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-pulse::before,
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-pulse::after {
  color: #fff;
}
/* Release Tools motion, with a lavender palette for Library's dark surface.
   The violet disk and translucent rim move together; the outer ring expands
   independently. Simple-pulse comparisons keep their single disk. */
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse {
  position: relative;
  isolation: isolate;
  overflow: visible;
  background: #9165ff !important;
  border: 0 !important;
  box-shadow: 0 0 0 4px rgba(177, 144, 255, .28), 0 10px 24px rgba(95, 55, 189, .3) !important;
  transform: scale(calc(1 + var(--library-test-beat, 0) * .065)) !important;
  transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 75ms linear !important;
  margin-inline: 2px;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse::before {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  inset: -6px;
  border: 2px solid rgba(196, 169, 255, calc(.18 + var(--library-test-beat, 0) * .48));
  opacity: 0;
  transform: scale(.9) !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse::after {
  content: none;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse.library-test-beat-active {
  transition: transform 75ms linear, box-shadow 75ms linear !important;
  will-change: transform, box-shadow;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse.library-test-beat-active::before {
  opacity: calc(.3 + var(--library-test-beat, 0) * .65);
  transform: scale(calc(.92 + var(--library-test-beat, 0) * .2)) !important;
  box-shadow: 0 0 calc(4px + var(--library-test-beat, 0) * 11px) rgba(145, 101, 255, .25);
  transition: opacity 75ms linear, transform 75ms linear, box-shadow 75ms linear !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-intro-pulse.library-test-beat-active::before {
  opacity: calc((.3 + var(--library-test-beat, 0) * .65) * var(--library-test-intro-strength, 1));
}
/* Larger devices keep the disk/rim moving. Only the outermost ring fades
   after each track's first four seconds, over the following one second. */
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-track-ring.library-test-beat-active::before {
  opacity: calc((.3 + var(--library-test-beat, 0) * .65) * var(--library-test-ring-strength, 0));
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-track-ring:not(.library-test-track-ring-visible)::before {
  content: none;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse .topbar-player-symbol {
  display: block !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin-left: 3px !important;
  border: 0 !important;
  border-top: 8px solid transparent !important;
  border-bottom: 8px solid transparent !important;
  border-left: 12px solid currentColor !important;
  border-radius: 0 !important;
  background: none !important;
  font-size: 0 !important;
  transform: none !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse.is-playing .topbar-player-symbol {
  width: 14px !important;
  height: 17px !important;
  margin-left: 0 !important;
  border: 0 !important;
  background: linear-gradient(to right, currentColor 0 4px, transparent 4px 10px, currentColor 10px 14px) !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse .topbar-player-symbol::before,
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse .topbar-player-symbol::after {
  content: none !important;
}
html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse:focus-visible {
  outline: 3px solid rgba(142, 96, 255, .42) !important;
  outline-offset: 11px;
}
@media (max-width:560px), ((hover:none) and (pointer:coarse) and (max-width:820px) and (max-height:1180px)) {
  body.library-page:has(#topbar-player-toggle.library-test-layered-pulse) {
    --library-player-halo-space: 9px;
  }
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse {
    margin-block: var(--library-player-halo-space, 0px);
  }
  /* Reserve the halo's space for both control groups, preserving one center. */
  body.library-page .topbar-player-dock.is-favorites-bottom-player .topbar-player-utilities {
    bottom: calc(17px + var(--library-player-halo-space, 0px) + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Shared across the standard Library and every comparison run. Clear the
     slider thumb as well as its rail; collapsed navigation stays at the bottom. */
  body.library-page.favorites-three-pane-active.favorites-mobile-chrome-player-active:not(.favorites-mobile-chrome-collapsed):not(.favorites-mobile-idle-player-dismissed) .favorites-mobile-panel-dots {
    bottom: calc(108px + 2 * var(--library-player-halo-space, 0px) + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Side panels keep a bottom grip when collapsed; leave the dots tappable
     above it so returning to the center remains navigation only. */
  body.library-page.favorites-three-pane-active.favorites-mobile-chrome-collapsed:not(:has(.favorites-mobile-panel-dot[data-mobile-panel-target="center"].is-active)) .favorites-mobile-panel-dots {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
html:is(.elara-playback-still, .elara-library-pulse) .favorites-topbar-logo-bars i.library-test-logo,
html:is(.elara-playback-still, .elara-library-pulse) [data-track-image-wave-bar].library-test-wave {
  transform: scaleY(var(--library-test-motion, 1)) !important;
  transform-origin: center;
}
@media (prefers-reduced-motion: reduce) {
  html:is(.elara-playback-still, .elara-library-pulse) .library-test-pulse,
  html:is(.elara-playback-still, .elara-library-pulse) .library-test-logo,
  html:is(.elara-playback-still, .elara-library-pulse) .library-test-wave,
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse::before,
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse::after { transform: none !important; }
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse,
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse.library-test-beat-active,
  html:is(.elara-playback-still, .elara-library-pulse) #topbar-player-toggle.library-test-layered-pulse::before { transition: none !important; }
}

/* Purple communicates an explicit selection or playback. The automatic first
   track suggestion stays neutral; these rules do not start any animation. */
html body.library-page #topbar-player-dock #topbar-player-toggle[data-library-play-state="selected"] {
  background: #9165ff !important;
  color: #fff !important;
  border-color: #9165ff !important;
}
html body.library-page #topbar-player-dock #topbar-player-toggle[data-library-play-state="idle"] {
  background: #393641 !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 0 0 4px rgba(177, 171, 193, .22) !important;
  transform: none !important;
  will-change: auto !important;
}
html[data-library-idle-style="white"] body.library-page #topbar-player-dock #topbar-player-toggle[data-library-play-state="idle"] {
  background: #f5f6f8 !important;
  color: #171820 !important;
  box-shadow: none !important;
}
html body.library-page #topbar-player-dock #topbar-player-toggle[data-library-play-state="idle"]::before,
html body.library-page #topbar-player-dock #topbar-player-toggle[data-library-play-state="idle"]::after {
  content: none !important;
}
/* Run 20C/20D: static visibility changes avoid extra compositor work. */
html.library-quiet-visibility-test body.library-page .favorites-mobile-now-playing-label {
  min-height: 2.4em;
  font-size: .85rem;
  line-height: 1.2;
}
html.library-quiet-visibility-test body.library-page .favorites-mobile-now-playing-label > span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 560px), ((hover: none) and (pointer: coarse) and (max-width: 820px) and (max-height: 1180px)) {
  html.library-quiet-visibility-test body.library-page #topbar-player-dock {
    transition: none !important;
  }
  html.library-quiet-visibility-test body.library-page.library-quiet-controls-hidden #topbar-player-dock {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  html.library-quiet-visibility-test body.library-page.favorites-three-pane-active.favorites-mobile-chrome-player-active.library-quiet-controls-hidden:not(.favorites-mobile-chrome-collapsed):not(.favorites-mobile-idle-player-dismissed) .favorites-mobile-panel-dots {
    bottom: calc(34px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.library-quiet-visibility-test body.library-page #topbar-player-dock { transition: none !important; }
}
