/*
 * Music: the album shelf, an album's page, the player along the foot of the
 * page and its signal path. Same stone and gold as the rest of the app
 * (style.css): gold only for what is playing and for progress; the
 * "playing the file itself" light green, and a converted copy gold.
 */

/* Albums are square, and a touch wider than posters. */
.grid.albums { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card-art.square { aspect-ratio: 1; }
#tracks-found h3 { margin-top: 34px; }

/* --- an album ------------------------------------------------------------- */

/* The frame (picture, cover, words) is the shared .detail-head (style.css);
   the cover a little wider than a poster. */
.album-head { grid-template-columns: 220px minmax(0, 1fr); margin-top: -150px; }
.detail-art.no-art + .album-head { margin-top: -110px; }
.album-artist { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: 500; color: var(--text); }
.album-quality { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; font-size: var(--fs-md); }
.album-quality strong { font-family: "Geist Mono", ui-monospace, monospace; font-weight: 600; font-size: var(--fs-sm); }
.quality-badge {
  padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text);
}
.quality-badge.lossy { color: var(--muted); }
.quality-badge.offline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

/* --- track lists ------------------------------------------------------------ */

.tracklist { list-style: none; margin: 0; padding: 10px 20px 24px; }
#tracks-found .tracklist { padding: 0; }
.disc-head {
  margin: 14px 12px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
}
.track { display: grid; grid-template-columns: 1fr auto; align-items: center; border-radius: var(--r-sm); }
.track + .track { border-top: 1px solid var(--hairline); }
@media (hover: hover) { .track:hover { background: color-mix(in srgb, var(--hover-wash) 60%, transparent); } }
button.track-main {
  display: grid; grid-template-columns: 28px 1fr auto 46px; align-items: center; gap: 12px;
  width: 100%; padding: 10px 6px 10px 12px; text-align: left;
  background: none; border: 0; box-shadow: none; border-radius: var(--r-sm); font-weight: 400;
}
button.track-main:hover:not(:disabled) { background: none; }
button.track-main:active:not(:disabled) { transform: none; }
.track-no { font-size: var(--fs-sm); color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.track-text { display: grid; min-width: 0; }
.track-title { font-size: var(--fs-md); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-by { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-time { font-size: var(--fs-sm); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.quality-chip {
  font-family: "Geist Mono", ui-monospace, monospace; font-size: var(--fs-xs); font-weight: 500;
  padding: 2px 7px; border-radius: var(--r-xs); white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text);
}
.quality-chip.hires { color: var(--text-strong); }
/* Same as the album's: said once at the top, so quiet here. */
.quality-chip.quiet { background: none; border-color: transparent; color: var(--faint); }
.track.now .track-title, .track.now .track-no { color: var(--accent-text); font-weight: 600; }
/* On a folder that can't be reached right now: still listed, plainly greyed. */
.track.unreachable .track-main { opacity: 0.5; }
.track.now-playing .track-no { animation: now-pulse 1.4s ease-in-out infinite; }
@keyframes now-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .track.now-playing .track-no { animation: none; } }
.track-info { margin-right: 4px; opacity: 0.55; }
.track:hover .track-info, .track-info.on { opacity: 1; }
.track-info.on { color: var(--text-strong); }
.track-details {
  grid-column: 1 / -1; margin: 0 12px 12px 52px; padding: 12px 14px;
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.track-details[hidden] { display: none; }
.track-details dt { color: var(--muted); }
.track-details dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }

/* --- the player ------------------------------------------------------------- */

body.has-music-bar main, body.has-music-bar .attribution { padding-bottom: 104px; }
body.has-music-bar .queue { bottom: 104px; }
/* Messages sit above the bar, not on its play button. */
body.has-music-bar .toast { bottom: 104px; }
/*
 * The bar stays in front of an album, a film's page and the other windows
 * (z-index 50), sharp, rather than lost under their blurred backdrop — so
 * what is playing can be paused or changed from anywhere — and the windows
 * keep clear of it. Only the video player covers it.
 */
body.has-music-bar .modal { padding-bottom: 104px; }
.music-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 55;
  display: grid; align-items: center; gap: 4px 16px;
  grid-template-columns: 52px minmax(140px, 1fr) minmax(260px, 1.4fr) minmax(150px, 1fr);
  grid-template-areas: "art text centre right";
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: var(--elev-3);
}
.music-bar[hidden] { display: none; }
button.mb-art {
  grid-area: art; width: 52px; height: 52px; padding: 0; overflow: hidden;
  border-radius: var(--r-sm); border: 1px solid var(--hairline); box-shadow: var(--elev-1); background: var(--surface-2);
}
.mb-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mb-text { grid-area: text; min-width: 0; display: grid; cursor: pointer; }
/*
 * The way into Now playing: a labelled pill in the bar's amber, not a bare
 * arrow, saying Close while it is open. It glows softly the first few
 * times the bar appears, until it has been opened once (music.js).
 */
button.mb-expand {
  gap: 6px; padding: 5px 12px 5px 9px; border-radius: var(--r-pill); box-shadow: none; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
button.mb-expand:hover:not(:disabled) {
  background: var(--hover-wash); color: var(--text-strong);
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
}
.mb-expand svg { width: 15px; height: 15px; transition: transform 0.2s; }
.mb-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.mb-expand.new { animation: mb-hint 2.4s ease-in-out 4; }
@keyframes mb-hint {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--text) 0%, transparent); }
  40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--text) 18%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .mb-expand.new { animation: none; } }

/* The cover says it opens something: an expand mark on hover. */
button.mb-art { position: relative; cursor: pointer; }
button.mb-art::after {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 0.15s;
  background: rgb(12 10 9 / 0.55) center / 22px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7'/%3E%3C/svg%3E");
}
button.mb-art:hover::after, button.mb-art:focus-visible::after { opacity: 1; }
.mb-text strong, .mb-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-text strong { font-size: var(--fs-md); font-weight: 600; color: var(--text-strong); }
.mb-text span { font-size: var(--fs-sm); color: var(--muted); }
.mb-text .mb-status { color: var(--muted); }
.mb-centre { grid-area: centre; display: grid; gap: 2px; justify-items: center; }
.mb-controls { display: flex; align-items: center; gap: 6px; }
.mb-controls .icon-only svg { width: 16px; height: 16px; }
button.mb-play {
  width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%;
  background: var(--text-strong); color: var(--surface); border: 0;
}
button.mb-play:hover:not(:disabled) { background: color-mix(in srgb, var(--text-strong) 82%, transparent); color: var(--surface); }
.mb-play svg { width: 16px; height: 16px; }
.mb-play .i-pause, .mb-play.playing .i-play { display: none; }
.mb-play.playing .i-pause { display: block; }
.mb-progress { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; width: 100%; }
.mb-progress span { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.mb-progress span:first-child { text-align: right; }
/*
 * The position and volume sliders, drawn here rather than by the browser:
 * the page's general input style (padding, border) threw the browser's own
 * fill and dot out of line. The fill is worked out to end at the middle of
 * the dot wherever it is: half the dot's width, plus the share of what is
 * left (--p, 0 to 1, set by music.js).
 */
.music-bar input[type="range"] {
  --p: 0;
  --dot: 12px;
  --track: color-mix(in srgb, var(--text) 18%, transparent);
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer;
}
.music-bar input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--amber-500) 0 calc(var(--dot) / 2 + var(--p) * (100% - var(--dot))), var(--track) 0);
}
.music-bar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--dot); height: var(--dot); margin-top: calc((4px - var(--dot)) / 2);
  border-radius: 50%; border: 0; background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 4px rgb(0 0 0 / 0.35);
  transition: transform 0.12s;
}
.music-bar input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.music-bar input[type="range"]::-moz-range-track { height: 4px; border-radius: var(--r-pill); background: var(--track); }
.music-bar input[type="range"]::-moz-range-progress { height: 4px; border-radius: var(--r-pill); background: var(--amber-500); }
.music-bar input[type="range"]::-moz-range-thumb {
  width: var(--dot); height: var(--dot); border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 4px rgb(0 0 0 / 0.35);
}
.music-bar input[type="range"]:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 4px; border-radius: var(--r-xs); }
.mb-right { grid-area: right; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.mb-volume { max-width: 96px; }
/* What is playing, with a light: green for the file itself, amber for a copy. */
button.mb-quality {
  font-family: "Geist Mono", ui-monospace, monospace; font-size: var(--fs-xs); font-weight: 600;
  padding: 5px 10px; border-radius: var(--r-pill); box-shadow: none; white-space: nowrap; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text);
}
button.mb-quality::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9cbf7a;
  box-shadow: 0 0 0 3px rgb(156 191 122 / 0.2);
}
button.mb-quality.converted::before { background: var(--amber-500); box-shadow: 0 0 0 3px rgb(233 162 59 / 0.2); }
button.mb-quality.hires { color: var(--text-strong); }

/* --- the signal path ---------------------------------------------------------- */

.signal {
  position: fixed; right: 12px; bottom: 104px; z-index: 56;
  width: min(430px, calc(100vw - 24px));
  max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); overflow: auto;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); box-shadow: var(--elev-3); padding: 6px 0 14px;
}
.signal[hidden] { display: none; }
.signal-head { display: flex; align-items: center; padding: 8px 10px 4px 18px; }
.signal-head strong { font-size: var(--fs-md); }
.signal-head button { margin-left: auto; }
.signal-rows { display: grid; padding: 4px 18px 0; }
.signal-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 0; }
.signal-row + .signal-row { border-top: 1px dashed var(--hairline); }
.signal-step {
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted); padding-top: 2px;
}
.signal-row strong { font-size: var(--fs-sm); font-weight: 600; color: var(--text-strong); }
.signal-row p { margin: 3px 0 0; font-size: var(--fs-sm); line-height: 1.45; }
.signal-saver { margin: 6px 18px 0; font-size: var(--fs-sm); color: var(--muted); }

/* --- now playing ---------------------------------------------------------------- */

/* Over the page and its windows, under the bar, which stays the controls. */
.now-view {
  position: fixed; inset: 0; z-index: 54; overflow: auto; isolation: isolate;
  padding: 28px 32px 112px; background: var(--surface);
  animation: now-in 0.22s ease-out;
}
.now-view[hidden] { display: none; }
@keyframes now-in { from { opacity: 0; transform: translateY(18px); } }
body.now-open { overflow: hidden; }
.now-wash {
  position: fixed; inset: -80px; z-index: -2; pointer-events: none;
  background: center / cover no-repeat; filter: blur(70px) saturate(1.5); opacity: 0.55;
}
.now-view::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 20% 10%, transparent, color-mix(in srgb, var(--surface) 55%, transparent) 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 30%, transparent), color-mix(in srgb, var(--surface) 88%, transparent) 70%);
}
.now-inner { width: min(1180px, 100%); margin: 0 auto; }
.now-top { display: flex; align-items: center; margin-bottom: 26px; }
.now-top .icon-only { margin-left: auto; }
.now-kicker {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-size: var(--fs-xs); font-weight: 600; color: var(--accent-text);
}
/* Three bars that move while it plays, and rest when paused. */
.now-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.now-bars i { width: 3px; height: 100%; border-radius: 1px; background: currentColor; animation: now-bar 0.9s ease-in-out infinite; transform-origin: bottom; }
.now-bars i:nth-child(2) { animation-delay: -0.3s; }
.now-bars i:nth-child(3) { animation-delay: -0.6s; }
@keyframes now-bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.now-view.paused .now-bars i { animation: none; transform: scaleY(0.3); }
.now-view.paused .now-kicker { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .now-view, .now-bars i { animation: none; } }

.now-main { display: grid; grid-template-columns: minmax(240px, 400px) minmax(0, 1fr); gap: 44px; align-items: center; }
.now-art {
  aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6), var(--elev-3);
}
/* The cover fills its square, whatever its own size or shape (the redesign
   lost this line, and Now playing's cover sat small or off-centre in its frame). */
.now-art img, .now-art .standin { width: 100%; height: 100%; object-fit: cover; display: block; }
.now-art .standin { font-size: var(--fs-3xl); }
.now-info { min-width: 0; }
.now-info h2 { margin: 0 0 8px; font-size: var(--fs-2xl); line-height: 1.05; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.now-artist { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 0 0 10px; font-size: var(--fs-lg); font-weight: 500; color: var(--text-strong); }
button.now-album {
  padding: 0; border: 0; background: none; box-shadow: none; font: inherit; color: var(--text);
  text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 4px;
}
button.now-album:hover:not(:disabled) { background: none; color: var(--text-strong); text-decoration-color: currentColor; }
.now-info .meta { margin: 0 0 16px; }
.now-quality { margin-bottom: 20px; }
.now-quality strong { font-size: var(--fs-xl); }

/* The file's every detail, as tiles. */
.now-specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.now-spec {
  padding: 12px 14px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--hairline);
}
.now-spec dt { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.now-spec dd { margin: 4px 0 0; font-family: "Geist Mono", ui-monospace, monospace; font-size: var(--fs-md); font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.now-file { margin: 0; font-family: "Geist Mono", ui-monospace, monospace; font-size: var(--fs-xs); color: var(--faint); overflow-wrap: anywhere; }

.now-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 40px; }
.now-panel {
  padding: 18px 20px; border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.now-panel h3 { margin: 0 0 14px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }

/* The signal path as a chain of steps, each with its light. */
.now-path { list-style: none; margin: 0; padding: 0; }
.now-step { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 14px; padding-bottom: 16px; }
.now-step:not(:last-child)::before {
  content: ''; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--hairline);
}
.now-step-light { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--faint); }
.now-step.ok .now-step-light { background: #9cbf7a; border-color: transparent; box-shadow: 0 0 0 4px rgb(156 191 122 / 0.2); }
.now-step.changed .now-step-light { background: var(--amber-500); border-color: transparent; box-shadow: 0 0 0 4px rgb(233 162 59 / 0.2); }
/* A track that couldn't be played: nothing was sent, so no green light. */
.now-step.failed .now-step-light { background: var(--danger); border-color: transparent; box-shadow: 0 0 0 4px rgb(239 68 68 / 0.2); }
.now-step-name { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.now-step-body strong { display: block; margin-top: 2px; font-size: var(--fs-md); color: var(--text-strong); }
.now-step-body p { margin: 3px 0 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.now-saver { margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); }

/* What plays next. */
.now-queue { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.now-queue li + li { border-top: 1px solid var(--hairline); }
button.now-queue-row {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 42px; align-items: center; gap: 12px;
  width: 100%; padding: 9px 6px; text-align: left; font-weight: 400;
  background: none; border: 0; box-shadow: none; border-radius: var(--r-sm);
}
button.now-queue-row:hover:not(:disabled) { background: color-mix(in srgb, var(--hover-wash) 60%, transparent); }
button.now-queue-row:active:not(:disabled) { transform: none; }
.now-queue-end { padding: 6px 0; font-size: var(--fs-sm); color: var(--muted); }

/* --- smaller screens ---------------------------------------------------------- */

@media (max-width: 1000px) {
  .now-main { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 28px; }
  .now-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .music-bar {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    grid-template-areas: "art text right" "centre centre centre";
  }
  .mb-volume { display: none; }
  /* A word from the player ("Couldn't play", "Buffering…") takes the
     artist's line, whole: beside it the narrow column cut it to "Couldn't p…". */
  .mb-text:has(.mb-status:not([hidden])) #mb-artist { display: none; }
  .mb-text .mb-status { white-space: normal; }
  body.has-music-bar main, body.has-music-bar .attribution, body.has-music-bar .modal { padding-bottom: 160px; }
  body.has-music-bar .queue, .signal, body.has-music-bar .toast { bottom: 160px; }
  .now-view { padding-bottom: 168px; }
}
@media (max-width: 640px) {
  .now-view { padding: 16px 16px 168px; }
  .now-top { margin-bottom: 14px; }
  .now-main { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .now-art { width: min(320px, 78vw); justify-self: center; }
  .now-info { text-align: center; }
  .now-artist, .now-info .meta, .now-quality { justify-content: center; }
  .now-artist { font-size: var(--fs-lg); }
  .now-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); text-align: left; }
  .now-panels { margin-top: 24px; }
  .now-panel { padding: 16px; }
  button.now-queue-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .now-queue-row .track-time { display: none; }
}
@media (max-width: 640px) {
  .grid.albums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .tracklist { padding: 4px 6px 14px; }
  button.track-main { grid-template-columns: 22px 1fr auto; gap: 10px; padding-left: 8px; }
  .track-main .track-time { display: none; }
  .track-main .quality-chip.quiet { display: none; }
  .track-details { margin-left: 8px; margin-right: 8px; }
  .music-bar { left: 8px; right: 8px; bottom: 8px; padding: 8px 10px; gap: 2px 10px; }
  button.mb-quality { font-size: var(--fs-xs); padding: 4px 8px; }
  /* No room for the words: a round button with the arrow. */
  button.mb-expand { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .mb-expand-label { display: none; }
  .mb-expand svg { width: 17px; height: 17px; }
  .signal-row { grid-template-columns: 1fr; gap: 4px; }
}

/* --- adding music ------------------------------------------------------------ */

.music-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
button.music-choice {
  display: grid; gap: 6px; justify-items: start; text-align: left;
  padding: 18px; border-radius: var(--r-md); font-weight: 400;
  background: var(--surface-2); border: 1px solid var(--hairline); box-shadow: none;
}
button.music-choice:hover:not(:disabled) { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 30%, transparent); box-shadow: var(--elev-1); }
button.music-choice svg {
  width: 26px; height: 26px; margin-bottom: 4px; fill: none; stroke: var(--text);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.music-choice strong { font-size: var(--fs-md); color: var(--text-strong); }
.music-choice span { font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); }
@media (max-width: 640px) { .music-choices { grid-template-columns: 1fr; } }

/* AirPlay, in Safari: lit while the music is going to a speaker or TV. */
.mb-airplay.on { color: var(--accent-text); }

/* --- the front of a music library: its newest album on a wash of its cover --- */

.music-hero {
  position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: center;
  margin: 6px 0 26px; padding: 26px; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); border: 1px solid var(--hairline); background: var(--surface);
  box-shadow: var(--elev-2);
}
.music-hero-wash {
  position: absolute; inset: -40px; z-index: -2;
  background: center / cover no-repeat; filter: blur(48px) saturate(1.4); opacity: 0.6;
}
.music-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 20%, transparent), color-mix(in srgb, var(--surface) 82%, transparent) 55%);
}
.music-hero-art {
  padding: 0; border: 0; background: none; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--elev-3); cursor: pointer;
}
.music-hero-art:hover:not(:disabled) { background: none; }
@media (hover: hover) { .music-hero-art:hover:not(:disabled) { transform: translateY(-3px); } }
.music-hero-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-hero-line { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 10px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.music-hero-name { color: var(--text); }
.music-hero-kicker { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--muted); }
.music-hero-title { margin: 0 0 4px; font-size: var(--fs-2xl); line-height: 1.1; letter-spacing: -0.025em; }
.music-hero-artist { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: 500; }

/* The look is .segmented's (style.css). */
.music-filter { margin-left: auto; margin-right: 10px; }

@media (max-width: 640px) {
  .music-hero { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .music-hero-title { font-size: var(--fs-xl); }
  .music-hero .detail-actions { flex-wrap: wrap; }
  /* The heading on its own line; the filter and sort share the next. */
  #music-view .section-head { flex-wrap: wrap; row-gap: 10px; }
  #music-view .section-head h2 { flex: 1 0 100%; }
  .music-filter { margin-left: 0; }
  .section-head .music-filter + .ghost-select { margin-left: auto; }
}
.section-head .music-filter + .ghost-select { margin-left: 0; }

@media (max-width: 640px) {
  /* Music's front: the cover and title side by side, the shelf's numbers on
     one quiet line under them, Play across the screen. */
  .music-hero {
    grid-template-columns: 96px minmax(0, 1fr); gap: 2px 16px;
    grid-template-areas: "art kicker" "art title" "art artist" "line line" "badges badges" "actions actions";
  }
  .music-hero-text { display: contents; }
  .music-hero-art { grid-area: art; align-self: center; }
  .music-hero-kicker { grid-area: kicker; align-self: end; margin: 0; }
  .music-hero-title { grid-area: title; margin: 0; }
  .music-hero-artist { grid-area: artist; align-self: start; margin: 0; }
  .music-hero-line {
    grid-area: line; display: block; margin: 12px 0 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .music-hero-line > span + span::before { content: ' · '; }
  .music-hero .album-quality { grid-area: badges; margin: 0 0 12px; }
  .music-hero .detail-actions { grid-area: actions; }
  .music-hero .detail-actions .primary { flex: 1; justify-content: center; }
}
/* Now playing's title a step up the scale on a wide screen. */
@media (min-width: 1000px) { .now-info h2 { font-size: var(--fs-3xl); } }

/*
 * --- Music like the other libraries ----------------------------------------
 * The banner is the films' (.film-hero, style.css): the same height, turning
 * through the newest albums, the cover washed across it and sharp at the
 * right where a home video's map sits (music.js, paintHero).
 */
.music-banner .fh-slides { inset: 0; }
.music-banner .fh-slide img { filter: blur(46px) saturate(1.5); transform: scale(1.25); opacity: 0.8; }
.music-banner .fh-shade {
  background: linear-gradient(90deg, #0c0a09 16%, rgb(12 10 9 / 0.72) 44%, rgb(12 10 9 / 0.3) 72%, rgb(12 10 9 / 0.42));
}
.music-banner .fh-kicker { margin: 0 0 4px; font-size: var(--fs-sm); color: #a8a29e; }
.music-banner .fh-title {
  font-weight: 650; margin: 0 0 6px; font-size: var(--fs-2xl); line-height: 1.1; letter-spacing: -0.025em; color: #fff;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.mh-cover {
  position: absolute; right: 32px; top: 50%; z-index: 1; transform: translateY(-50%);
  height: 78%; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden;
  background: #1c1917; box-shadow: 0 22px 46px -14px rgb(0 0 0 / 0.8); cursor: pointer;
  transition: opacity 260ms ease, transform 200ms ease;
}
.mh-cover img, .mh-cover .standin { width: 100%; height: 100%; object-fit: cover; display: block; }
.mh-cover:hover:not(:disabled) { background: #1c1917; transform: translateY(-50%) scale(1.015); }
.mh-cover.changing { opacity: 0; }
/* A phone: the cover at the top, the words and buttons under it. */
@media (max-width: 640px) {
  .film-hero.music-banner { flex-direction: column; align-items: stretch; height: auto; }
  .mh-cover { order: -1; position: relative; top: auto; right: auto; transform: none; display: block; height: auto; width: 112px; margin: 18px 0 0 18px; }
  .mh-cover:hover:not(:disabled) { transform: none; }
  .music-banner .fh-text { width: auto; }
}
/* Its shelves are the films' (.film-shelves, .shelf-row); the full grid follows. */
#music-shelves { margin-top: 4px; }

/* The Music tab: three moving bars in place of its icon while something plays. */
.tab-eq { display: none; width: 100%; height: 100%; align-items: center; justify-content: center; gap: 2px; }
.tab-eq i { width: 3px; height: 70%; border-radius: 1px; background: currentColor; transform-origin: bottom; animation: now-bar 0.9s ease-in-out infinite; }
.tab-eq i:nth-child(2) { animation-delay: -0.3s; }
.tab-eq i:nth-child(3) { animation-delay: -0.6s; }
body.music-playing #library-tabs .library-tab[data-type="music"] .tab-icon svg { display: none; }
body.music-playing #library-tabs .library-tab[data-type="music"] .tab-eq { display: flex; color: var(--amber-500); }
@media (prefers-reduced-motion: reduce) { .tab-eq i { animation: none; } }

/*
 * Now playing on a wide screen: a panel docked at the right, under the
 * header and above the player bar, with the library still in view beside it
 * (it covered the whole page). Narrower screens keep the full page.
 */
@media (min-width: 1200px) {
  body.now-open { overflow: auto; }
  body.now-open main { padding-right: calc(24px + 396px); }
  .now-view {
    inset: auto; top: calc(var(--bar-h, 64px) + 8px); right: 12px; bottom: 100px; width: 384px;
    padding: 16px 18px 20px; border-radius: var(--r-lg); border: 1px solid var(--hairline);
    box-shadow: var(--elev-3); z-index: 30; overscroll-behavior: contain;
  }
  .now-wash { position: absolute; inset: -40px; }
  .now-view::before { position: absolute; }
  .now-inner { width: auto; }
  .now-top { margin-bottom: 14px; }
  .now-main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .now-view .now-info h2 { font-size: var(--fs-xl); margin-bottom: 4px; }
  .now-view .now-artist { font-size: var(--fs-md); margin-bottom: 6px; }
  .now-view .now-quality { margin-bottom: 12px; }
  .now-view .now-quality strong { font-size: var(--fs-lg); }
  .now-specs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .now-panels { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; }
  .now-panel { padding: 14px 16px; }
}
