/* Music lyrics: Apple Music style lines inside the player card. Colours come from themes.css tokens (light + dark). */
#musicLyricsToggle[hidden], .ml-panel [hidden] { display: none !important; }

.ml-panel {
  --ml-size: clamp(24px, 2.2vw + 10px, 44px);
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 16px; color: var(--ink);
  background: linear-gradient(155deg, var(--accent-soft) 0%, var(--surface-2) 60%, var(--surface) 100%);
}
.ml-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; padding: 14px 16px 4px 20px; }
.ml-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 160px; }
.ml-eyebrow { color: var(--ink-3); font-size: 11px; letter-spacing: .14em; font-weight: 800; text-transform: uppercase; }
.ml-track { display: none; font-size: clamp(18px, 2vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.ml-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ml-nudge { display: inline-flex; align-items: center; gap: 4px; }
.ml-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ml-tool:hover { border-color: var(--accent); color: var(--accent); }
.ml-tool:active { background: var(--accent-soft); }
.ml-tool:focus-visible, .ml-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ml-tool .i { width: 20px; height: 20px; }
.ml-nudge-val { min-width: 62px; border-color: transparent; background: transparent; color: var(--ink-2); }

.ml-stage { position: relative; min-height: 0; }
.ml-scroll {
  position: relative; height: clamp(300px, 56vh, 620px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none; -ms-overflow-style: none; touch-action: pan-y;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 13%, #000 84%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 13%, #000 84%, transparent 100%);
}
.ml-scroll::-webkit-scrollbar { display: none; }
.ml-lines { list-style: none; margin: 0; padding: 120px 24px 200px 20px; }

.ml-row {
  position: relative; margin: 0; padding: 0; opacity: .55; transform: scale(.9); transform-origin: left center;
  transition: opacity .4s ease, transform .4s ease, filter .4s ease;
}
.ml-row[data-pos="now"] { opacity: 1; transform: scale(1); }
.ml-row[data-pos="next"][data-dist="1"] { opacity: .68; }
.ml-row[data-dist="3"] { filter: blur(.8px); }
.ml-line {
  display: block; width: 100%; margin: 0; padding: .3em 0; border: 0; background: none; color: inherit; text-align: left; cursor: default;
  font: inherit; font-size: var(--ml-size); font-weight: 800; letter-spacing: -.02em; line-height: 1.22; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
}
.ml-seekable .ml-line { cursor: pointer; }
.ml-seekable .ml-row:hover { opacity: .9; filter: none; }
.ml-line:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 10px; }

.ml-gap { min-height: 1.9em; display: flex; align-items: center; font-size: var(--ml-size); }
.ml-dots { display: inline-flex; gap: .32em; padding: .2em 0; }
.ml-dots i { display: block; width: .46em; height: .46em; border-radius: 50%; background: var(--ink); opacity: .45; transform: scale(.75); }
.ml-gap[data-pos="now"] .ml-dots i { animation: ml-pulse 1.5s ease-in-out infinite; }
.ml-gap[data-pos="now"] .ml-dots i:nth-child(2) { animation-delay: .2s; }
.ml-gap[data-pos="now"] .ml-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ml-pulse { 0%, 100% { opacity: .3; transform: scale(.7); } 45% { opacity: 1; transform: scale(1); } }

.ml-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 28px; text-align: center; pointer-events: none; }
.ml-status > * { pointer-events: auto; }
.ml-status-text { margin: 0; max-width: 28em; color: var(--ink-2); font-size: clamp(16px, 1.3vw + 6px, 24px); font-weight: 700; line-height: 1.5; }
.ml-skel { display: grid; gap: 14px; width: min(420px, 80%); }
.ml-skel i { display: block; height: 22px; border-radius: 11px; background: var(--surface-3); opacity: .75; animation: ml-skel 1.4s ease-in-out infinite; }
.ml-skel i:nth-child(1) { width: 90%; } .ml-skel i:nth-child(2) { width: 64%; animation-delay: .15s; }
.ml-skel i:nth-child(3) { width: 80%; animation-delay: .3s; } .ml-skel i:nth-child(4) { width: 48%; animation-delay: .45s; }
@keyframes ml-skel { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }

.ml-plain { padding: 22px 24px 40px 20px; }
.ml-plain p { margin: 0 0 1.4em; font-size: clamp(18px, 1.2vw + 8px, 30px); font-weight: 700; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ml-plain-note { margin: 0; padding: 6px 20px 0; color: var(--ink-3); font-size: 12px; }
.ml-credit { margin: 0; padding: 4px 20px 12px; color: var(--ink-3); font-size: 11px; letter-spacing: .04em; }
.ml-panel[data-mode="plain"] .ml-scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 6%, #000 92%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 6%, #000 92%, transparent 100%); }

/* full screen (native API, or a fixed overlay when the browser cannot) */
.music-lyrics-mount.is-full { background: var(--bg); }
.music-lyrics-mount.is-full .ml-panel { height: 100%; border: 0; border-radius: 0; --ml-size: clamp(34px, 4.6vw, 92px); }
.music-lyrics-mount.is-full .ml-head { padding: max(18px, env(safe-area-inset-top)) 28px 6px 36px; }
.music-lyrics-mount.is-full .ml-track { display: block; }
.music-lyrics-mount.is-full .ml-tool { min-height: 56px; min-width: 56px; font-size: 18px; }
.music-lyrics-mount.is-full .ml-tool .i { width: 26px; height: 26px; }
.music-lyrics-mount.is-full .ml-stage { flex: 1 1 0; }
.music-lyrics-mount.is-full .ml-scroll { height: 100%; }
.music-lyrics-mount.is-full .ml-lines { padding-left: 36px; padding-right: 36px; }
.music-lyrics-mount.is-full .ml-row[data-dist="3"] { filter: none; }
.music-lyrics-mount.is-full .ml-credit { padding: 4px 36px max(14px, env(safe-area-inset-bottom)); }
.music-lyrics-mount.is-full .ml-plain { padding-left: 36px; padding-right: 36px; }
.music-lyrics-mount:fullscreen { width: 100vw; height: 100vh; }
.music-lyrics-mount:-webkit-full-screen { width: 100vw; height: 100vh; }
.music-lyrics-mount.ml-fixed { position: fixed; inset: 0; z-index: 10030; width: auto; height: auto; margin: 0; }
html.ml-lock { overflow: hidden; }
.ml-unfilter { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transform: none !important; filter: none !important; animation: none !important; }

@media (max-width: 560px) {
  .ml-head { padding: 12px 12px 2px 16px; }
  .ml-lines { padding-left: 16px; padding-right: 16px; }
  .ml-scroll { height: clamp(280px, 62vh, 520px); }
  .ml-tool { padding: 0 12px; }
  .music-lyrics-mount.is-full .ml-head, .music-lyrics-mount.is-full .ml-lines, .music-lyrics-mount.is-full .ml-plain { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ml-row { transition: none; transform: none; }
  .ml-row[data-pos="now"] { transform: none; }
  .ml-gap[data-pos="now"] .ml-dots i { animation: none; opacity: .85; transform: none; }
  .ml-skel i { animation: none; }
}
.ml-panel .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
