/* music.css - Station Music dock, Now Playing, Gym mode, sheets. All classes/ids prefixed mu-. */
:root { --mu-safe-b: 0px; }
@supports (padding: env(safe-area-inset-bottom)) { :root { --mu-safe-b: env(safe-area-inset-bottom); } }

body.mu-dock-on #view { padding-bottom: 88px; }
/* The YouTube box (above the dock) would hide the bottom of the page: reserve its height too. */
body.mu-dock-on.mu-yt-active:not(.mu-np-open):not(.mu-gym-open):not(.mu-reader-open) #view { padding-bottom: calc(88px + var(--mu-yt-h) + 8px + var(--mu-safe-b)); }
/* The busy veil (hub.css, z 40) must cover the dock and YouTube box; Gym/Now Playing (50-60) stay above-or-below as before. */
body #busy { z-index: 60; }

/* mini player */
#mu-dock {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--mu-safe-b)); z-index: 40;
  max-width: 704px; margin: 0 auto; height: 64px; display: flex; align-items: center; gap: 4px;
  padding: 0 6px 0 8px; overflow: hidden; background: var(--card); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--green-100);
}
#mu-dock[hidden] { display: none; }
.mu-open { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.mu-art { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: none; background: var(--green-100); display: grid; place-items: center; color: var(--green-900); font-size: 22px; }
.mu-meta { min-width: 0; display: block; }
.mu-ttl, .mu-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-ttl { font-weight: 700; }
.mu-sub { color: var(--muted); font-size: 14px; }
.mu-ibtn { width: 48px; height: 48px; min-width: 44px; border-radius: 50%; border: 0; background: none; color: var(--green-900); display: grid; place-items: center; font-size: 22px; flex: none; cursor: pointer; }
.mu-ibtn:active, .mu-btn:active { background: var(--green-100); }
.mu-ibtn.mu-on { color: var(--green-700); }
.mu-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--green-700); }
#mu-dock button:focus-visible, #mu-np button:focus-visible, #mu-np input:focus-visible,
#mu-sheet button:focus-visible, #mu-gym button:focus-visible { outline: 3px solid var(--green-900); outline-offset: 2px; }
#mu-gym button:focus-visible { outline-color: #fff; }

/* YouTube box */
#mu-yt {
  display: none; position: fixed; z-index: 39; left: 8px; right: 8px; max-width: 420px; margin: 0 auto;
  bottom: calc(80px + var(--mu-safe-b)); aspect-ratio: 16 / 9; border-radius: var(--radius-sm);
  overflow: hidden; background: #000; box-shadow: var(--shadow);
}
body.mu-yt-active #mu-yt { display: block; }
/* Fixed box (never re-parented). Open overlays pin it to the TOP, below the header row, so the control blocks at the bottom stay uncovered. */
:root { --mu-yt-h: calc(min(420px, 100vw - 16px) * 9 / 16); }
body.mu-np-open #mu-yt { z-index: 60; bottom: auto; top: 68px; }
body.mu-gym-open #mu-yt { z-index: 60; bottom: auto; top: 120px; }
#mu-yt iframe, #mu-yt .mu-yt-host { width: 100%; height: 100%; border: 0; display: block; }

/* now playing */
#mu-np {
  position: fixed; inset: 0; z-index: 50; background: var(--cream); color: var(--ink); overflow-y: auto;
  padding: 12px 20px calc(24px + var(--mu-safe-b));
}
#mu-np[hidden], #mu-gym[hidden], #mu-sheet[hidden], #mu-sheet-bd[hidden] { display: none; }
.mu-wrap { max-width: 520px; margin: 0 auto; }
.mu-row { display: flex; align-items: center; gap: 8px; }
.mu-spacer { flex: 1; }
.mu-btn { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--green-700); background: var(--card); color: var(--green-900); font: inherit; font-weight: 700; cursor: pointer; }
.mu-npart { width: min(80vw, 340px); height: auto; aspect-ratio: 1; margin: 16px auto; display: grid; place-items: center; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow); font-size: 80px; }
body.mu-yt-active .mu-npart { visibility: hidden; width: 1px; height: var(--mu-yt-h); aspect-ratio: auto; margin: 8px auto; }
.mu-nptitle { font-size: 22px; font-weight: 800; margin: 10px 0 2px; }
.mu-artist-btn { min-height: 44px; padding: 0; border: 0; background: none; color: var(--green-900); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.mu-np-station { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-weight: 700; }
.mu-seek { width: 100%; margin: 16px 0 4px; accent-color: var(--green-700); height: 32px; }
.mu-times { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.mu-ctrls { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.mu-ctrls .mu-ibtn { width: 56px; height: 56px; font-size: 26px; }
.mu-ctrls .mu-playbig { width: 76px; height: 76px; background: var(--green-700); color: #fff; font-size: 32px; }
.mu-ctrls.mu-ctrls-live { justify-content: center; gap: 28px; }
.mu-err { color: #b3261e; font-size: 14px; min-height: 20px; margin-top: 6px; }
.mu-h2 { font-size: 16px; margin: 18px 0 6px; }
.mu-uprow { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 4px 8px; background: var(--card); border: 0; border-bottom: 1px solid var(--green-100); color: inherit; font: inherit; text-align: left; cursor: pointer; }

/* gym mode */
#mu-gym {
  position: fixed; inset: 0; z-index: 55; background: #000; color: #fff; display: flex; flex-direction: column;
  padding: 12px 14px calc(16px + var(--mu-safe-b)); user-select: none; -webkit-user-select: none; touch-action: pan-y;
}
#mu-gym .mu-gtop { display: flex; justify-content: space-between; align-items: center; }
#mu-gym .mu-gbtn { min-height: 52px; padding: 0 18px; border-radius: 26px; border: 0; background: #1a1a1a; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.mu-phase { margin-top: 14px; display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .06em; font-size: 14px; }
.mu-pbar { flex: 1; height: 8px; border-radius: 4px; background: #222; overflow: hidden; }
.mu-pbar i, .mu-gprog i { display: block; height: 100%; width: 0; }
.mu-pbar i { background: var(--green-500); }
.mu-ginfo { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; min-height: 0; }
.mu-gtitle { font-size: clamp(26px, 7vw, 44px); font-weight: 800; line-height: 1.1; margin: 0 0 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mu-gartist { font-size: 20px; color: #bbb; margin: 0; }
.mu-gbpm { font-size: 18px; color: var(--green-500); font-weight: 700; margin-top: 10px; }
.mu-gprog { height: 10px; background: #222; border-radius: 5px; margin: 18px 0 6px; overflow: hidden; }
.mu-gprog i { background: #fff; }
.mu-gtimes { display: flex; justify-content: space-between; color: #aaa; font-variant-numeric: tabular-nums; }
.mu-big3 { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px; margin: 16px 0 12px; }
.mu-big3 button { min-height: 128px; border-radius: 22px; border: 0; background: #1a1a1a; color: #fff; font-size: 44px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.mu-big3 small { font-size: 13px; letter-spacing: .08em; color: #aaa; }
.mu-big3 .mu-gp { background: #fff; color: #000; }
.mu-big3 .mu-gp small { color: #444; }
.mu-big2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mu-big2 button { min-height: 76px; border-radius: 18px; border: 0; background: #1a1a1a; color: #fff; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.mu-big2 .mu-liked { color: var(--green-500); }
.mu-big2.mu-big2-one { grid-template-columns: 1fr; }
.mu-gerr { color: #ff8a80; font-size: 16px; font-weight: 700; margin: 12px 0 0; }
#mu-gym button.mu-holding { background: #14431f; }
.mu-hint { text-align: center; color: #999; font-size: 13px; margin-top: 10px; }
#mu-gym button:active { transform: scale(.97); }
#mu-gym.mu-locked .mu-big3, #mu-gym.mu-locked .mu-big2, #mu-gym.mu-locked .mu-phase { opacity: .25; pointer-events: none; }
.mu-lockveil { display: none; }
#mu-gym.mu-locked .mu-lockveil { display: flex; position: absolute; inset: 0; align-items: flex-end; justify-content: center; padding-bottom: calc(40px + var(--mu-safe-b)); z-index: 2; }
.mu-lockveil button { min-height: 72px; padding: 0 32px; border-radius: 36px; border: 0; background: #222; color: #fff; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.mu-lockveil button.mu-holding { background: var(--green-700); }
body.mu-yt-active #mu-gym .mu-ginfo { padding-top: calc(var(--mu-yt-h) + 28px); }

/* bottom sheet */
#mu-sheet-bd { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .5); }
#mu-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-width: 560px; margin: 0 auto; background: var(--card); color: var(--ink); border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + var(--mu-safe-b)); max-height: 80vh; overflow-y: auto; animation: mu-up .18s ease-out; }
.mu-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--green-100); margin: 0 auto 10px; }
.mu-sh-title { font-weight: 700; margin: 4px 0 2px; }
.mu-sh-item { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 14px; text-align: left; font: inherit; font-size: 17px; border-radius: 10px; padding: 0 6px; border: 0; background: none; color: inherit; cursor: pointer; }
.mu-sh-item:active { background: var(--green-100); }
@keyframes mu-up { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #mu-sheet { animation: none; } }
#mu-yt[hidden] { display: none !important; }

/* ---- Music screens (Home / Search / Library, artist page, playlist detail) ---- */
.mu-screen { padding: 4px 0 24px; }
.mu-topbar { display: flex; align-items: center; gap: 2px; min-height: 48px; margin: 0 0 8px -8px; }
.mu-topbar .mu-h1 { margin: 0; min-width: 0; }
.mu-tabs { display: flex; gap: 4px; background: var(--green-100); border-radius: 18px; padding: 4px; margin-bottom: 16px; }
.mu-tab { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; border-radius: 14px; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--green-900); cursor: pointer; }
.mu-tab-ic { font-size: 18px; line-height: 1; }
.mu-tab.mu-on { background: var(--card); box-shadow: 0 1px 4px rgba(20, 119, 60, .25); }
.mu-h1 { font-family: "Fraunces", Georgia, serif; font-size: 26px; font-weight: 600; margin: 10px 0 6px; color: var(--green-900); display: flex; align-items: center; gap: 6px; }
.mu-h3 { font-size: 15px; margin: 14px 0 4px; }
.mu-hero { background: var(--green-100); border-radius: var(--radius); padding: 14px 16px; }
.mu-hero .mu-h2 { margin: 0; }
.mu-hero > p.mu-sub { margin: 4px 0 0; }
.mu-hero-head { min-height: 36px; }
.mu-linkbtn { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 0; background: var(--card); color: var(--green-900); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mu-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.mu-grid3 .mu-btn { padding: 0 4px; min-height: 48px; }
.mu-h2 { margin-top: 22px; }
.mu-gap { margin-top: 12px; }
.mu-wide { width: 100%; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.mu-grow { flex: 1; }
.mu-wrapx { flex-wrap: wrap; }
.mu-primary { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.mu-primary:active { background: var(--green-900); }
.mu-danger { color: #b3261e; border-color: #b3261e; }
a.mu-btn { display: inline-flex; align-items: center; text-decoration: none; }
.mu-btn:disabled { opacity: .45; }
.mu-backbtn { margin: 4px 0 8px; }
.mu-input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 24px; border: 2px solid var(--green-100); font: inherit; background: var(--card); color: var(--ink); width: 100%; box-sizing: border-box; }
.mu-input:focus { outline: 2px solid var(--green-700); border-color: var(--green-700); }
.mu-sh-btns { margin-top: 12px; }
.mu-sh-head { margin-bottom: 6px; min-width: 0; }
.mu-ic { width: 24px; text-align: center; flex: none; }
.mu-chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--green-700); background: var(--card); color: var(--green-900); font: inherit; font-weight: 700; cursor: pointer; }
.mu-chip.mu-on { background: var(--green-700); color: #fff; }
.mu-results { margin-top: 6px; }
.mu-note, .mu-callout { background: var(--green-100); border-radius: var(--radius-sm); padding: 11px 14px; margin: 10px 0; font-size: 14px; }
.mu-empty { padding: 8px 2px; }
.mu-spin { width: 28px; height: 28px; margin: 16px auto; border-radius: 50%; border: 3px solid var(--green-100); border-top-color: var(--green-700); animation: mu-rot .8s linear infinite; }
@keyframes mu-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mu-spin { animation-duration: 3s; } }

/* track rows */
.mu-list { display: flex; flex-direction: column; }
.mu-trk { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--green-100); }
.mu-trk.mu-playing .mu-trk-title { color: var(--green-700); }
.mu-trk-art { position: relative; border: 0; background: none; padding: 0; flex: none; cursor: pointer; }
.mu-src { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; line-height: 1; background: var(--card); color: var(--green-900); box-shadow: 0 0 0 2px var(--cream, #fff); }
.mu-src-audius { background: #7e1bcc; color: #fff; }
.mu-src-youtube { background: #e00; color: #fff; font-size: 8px; }
.mu-trk-text { flex: 1; min-width: 0; position: relative; }
/* The whole text block plays the song; the artist link sits above that tap area. */
.mu-trk-title::after { content: ""; position: absolute; inset: 0; }
.mu-trk-line .mu-artist-link { position: relative; z-index: 1; }
.mu-trk-title { display: block; width: 100%; min-height: 24px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-trk-line { display: flex; align-items: center; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.mu-trk-line > .mu-sub { overflow: hidden; text-overflow: ellipsis; }
.mu-artist-link { min-height: 44px; margin: -12px 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--green-900); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; max-width: 60%; cursor: pointer; }
.mu-artist-link > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.mu-tick { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--green-700); color: #fff; font-size: 10px; flex: none; }
.mu-tick.mu-big { width: 24px; height: 24px; font-size: 15px; }
.mu-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.mu-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--green-100); color: var(--green-900); }
.mu-badge.mu-unoff { background: #fdecea; color: #8c1d18; }
.mu-badge.mu-off { background: var(--green-700); color: #fff; }

/* cards + library */
.mu-hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 8px; scroll-snap-type: x proximity; }
.mu-card { flex: none; width: 120px; display: flex; flex-direction: column; gap: 2px; border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; scroll-snap-align: start; }
.mu-card .mu-cardart { width: 120px; height: 120px; border-radius: 14px; font-size: 36px; }
.mu-lib { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 6px 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.mu-libic { background: linear-gradient(135deg, var(--green-500), var(--green-900)); color: #fff; }
.mu-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-top: 18px; padding: 0 4px; font-weight: 700; border-top: 1px solid var(--green-100); }
.mu-switch input { width: 48px; height: 28px; accent-color: var(--green-700); flex: none; }

/* artist page */
.mu-hero-artist { text-align: center; }
.mu-hero-artist .mu-h1 { justify-content: center; }
.mu-artist-pic { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; margin: 6px auto; display: block; background: var(--green-100); }
.mu-artist-pic.mu-ph { display: grid; place-items: center; font-size: 56px; color: var(--green-900); }
.mu-verified { color: var(--green-900); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.mu-bio { white-space: pre-line; max-height: 9em; overflow: auto; }
p.mu-sub, .mu-bio { white-space: normal; }
.mu-trk-line > .mu-sub { white-space: pre; }

/* Sprout Reader owns the bottom edge (its toolbar is fixed there): hide dock + YouTube box (the video is paused on entry). Kept last so it wins ties. */
body.mu-reader-open #mu-dock, body.mu-reader-open #mu-yt { display: none; }

/* Tidy pass: dock buttons a little narrower so more of the song name shows. */
#mu-dock .mu-ibtn { width: 44px; height: 44px; min-width: 44px; font-size: 20px; }
#mu-dock { gap: 0; }
/* Section headings with a count on the right: keep the count level with the heading. */
.mu-row:has(> .mu-h3) { align-items: baseline; }
.mu-gap + .mu-lib { margin-top: 10px; }

/* radio + offline downloads */
.mu-src-radio { background: #1d4ed8; color: #fff; font-size: 9px; }
.mu-trk.mu-radio .mu-ibtn { width: 44px; height: 44px; }
.mu-badge.mu-saved { background: #e0ecff; color: #1d3f8a; }
.mu-live { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 1px 7px; margin-right: 6px; border-radius: 8px; background: #d92d20; color: #fff; vertical-align: middle; }
.mu-live.mu-big { font-size: 15px; padding: 4px 14px; margin: 0; border-radius: 12px; }
.mu-live-row { display: flex; justify-content: center; margin: 18px 0 10px; }
