/* HackerMusic. Dark by default, light when the system asks for it.
   Cover art carries the colour. The accent marks only what is live.
   The Now Playing panel is frosted glass tinted by the current cover. */

:root {
  --bg: #131315;
  --surface: #1d1d20;
  --surface-2: #28282c;
  --bar-bg: rgba(24, 24, 27, 0.82);
  --ink: #f2f2f4;
  --muted: #8e8e93;
  --faint: #5f5f65;
  --rule: #2a2a2e;
  --accent: #8ea2ff;
  --on-accent: #10121a;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);

  --glass: rgba(28, 28, 32, 0.46);
  --glass-edge: rgba(255, 255, 255, 0.1);
  --np-ink: #fff;
  --np-muted: rgba(255, 255, 255, 0.62);
  --np-faint: rgba(255, 255, 255, 0.34);
  --np-fill: rgba(255, 255, 255, 0.1);
  --np-fill-2: rgba(255, 255, 255, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --rail: 68px;
  --bar: 76px;
  --card: 168px;
  --gutter: 40px;
  --np-w: 420px;
  --tint-mix: 38%;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --surface: #f0f0f3;
    --surface-2: #e4e4e9;
    --bar-bg: rgba(246, 246, 248, 0.86);
    --ink: #1c1c1f;
    --muted: #6e6e73;
    --faint: #a3a3a8;
    --rule: #e2e2e7;
    --accent: #3558e0;
    --on-accent: #fff;
    --shadow: 0 16px 48px rgba(20, 24, 40, 0.16);
    --glass: rgba(250, 250, 252, 0.66);
    --tint-mix: 14%;
    --glass-edge: rgba(255, 255, 255, 0.7);
    --np-ink: #111114;
    --np-muted: rgba(0, 0, 0, 0.56);
    --np-faint: rgba(0, 0, 0, 0.3);
    --np-fill: rgba(0, 0, 0, 0.06);
    --np-fill-2: rgba(0, 0, 0, 0.12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  padding-bottom: calc(var(--bar) + 40px);
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { display: block; }
svg .f { fill: currentColor; stroke: none; }
main:focus { outline: none; }

.link { text-align: left; color: inherit; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link.accent { color: var(--accent); }

/* ---------- left rail ---------- */

.rail {
  position: fixed;
  top: 0; left: 0;
  bottom: var(--bar);
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0 16px;
  border-right: 1px solid var(--rule);
  z-index: 6;
  transition: bottom 0.22s var(--ease);
}
.rail a, .rail > button {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
}
.rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail a:hover, .rail > button:hover { color: var(--ink); background: var(--surface); }
.rail a[aria-current] { color: var(--accent); background: var(--surface); }
.rail-gap { flex: 1; }

.account { overflow: hidden; border-radius: 50% !important; width: 34px !important; height: 34px !important; margin-top: 6px; background: var(--surface); }
.account.is-off { opacity: 0.55; }
.account img { width: 100%; height: 100%; object-fit: cover; }
.account .initial { font-weight: 650; font-size: 14px; color: var(--ink); }

/* ---------- page + search ---------- */

.page { margin-left: var(--rail); padding: 0 var(--gutter); }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 76px;
  display: flex;
  align-items: center;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  background: var(--bg);
}
.search {
  flex: 1;
  max-width: 600px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 16px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 21px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 15px; color: var(--ink); background: transparent; border: 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within kbd { visibility: hidden; }

/* ---------- home ---------- */

.home { padding-top: 4px; }
.shelf { margin: 0 0 40px; }
.shelf-chips { margin-bottom: 34px; }

.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.shelf-head h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.012em; }
.shelf-head h2 a { text-decoration: none; }
.shelf-head h2 a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.shelf-tools { display: flex; align-items: center; gap: 4px; }
.nudge { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.nudge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nudge:hover:not(:disabled) { color: var(--ink); background: var(--surface); }
.nudge:disabled { opacity: 0.3; }
.see-all { margin-left: 10px; font-size: 13px; color: var(--muted); text-decoration: none; }
.see-all:hover { color: var(--ink); }

.row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--card);
  gap: 22px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding: 0 6px;
  scrollbar-width: none;
  padding: 6px calc(var(--gutter) + 6px) 6px 6px;
  margin: -6px calc(-1 * var(--gutter) - 6px) -6px -6px;
}
.row::-webkit-scrollbar { display: none; }

.row.chips { grid-auto-columns: max-content; gap: 10px; }
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 6px 16px 6px 6px;
  background: var(--surface);
  border-radius: 12px;
  scroll-snap-align: start;
  transition: background-color 0.15s ease;
}
.chip:hover, .kbd .chip.is-sel { background: var(--surface-2); }
.kbd .chip.is-sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-art { width: 40px !important; height: 40px; flex: none; border-radius: 8px !important; }
.chip-title { font-size: 13.5px; font-weight: 550; white-space: nowrap; }

.card, .tile-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
  scroll-snap-align: start;
  border-radius: 8px;
}
.card:focus-visible, .tile-card:focus-visible { outline: none; }

.art {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.art img, .art-fill img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* hqdefault is 4:3 with letterbox bars; scale crops to the square centre. */
.art img.crop, .art-fill img.crop { transform: scale(1.34); }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic .tile { overflow: hidden; background: var(--surface-2); }
.art-icon { position: absolute; inset: 0; margin: auto; width: 36%; height: 36%; fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.play-dot {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.play-dot svg { width: 20px; height: 20px; transform: translateX(1px); }
.card:hover .play-dot, .kbd .card.is-sel .play-dot, .card:focus-visible .play-dot { opacity: 1; transform: none; }
.kbd .card.is-sel .art, .card:focus-visible .art,
.kbd .tile-card.is-sel .art, .tile-card:focus-visible .art { outline: 2px solid var(--accent); outline-offset: 3px; }

.card-title, .card-artist, .card-why { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title { margin-top: 10px; font-size: 13.5px; font-weight: 550; }
.card-artist { font-size: 13px; color: var(--muted); }
.card-why { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.card.is-playing .card-title { color: var(--accent); }
.card.is-off, tr.is-off, .q-row.is-off { opacity: 0.35; }
.card.is-off .play-dot { display: none; }

/* ---------- detail pages ---------- */

.detail { padding-top: 8px; }
.page-head { display: flex; align-items: flex-end; gap: 32px; margin: 4px 0 32px; }
.page-cover { width: 208px; flex: none; border-radius: 12px; box-shadow: var(--shadow); }
.page-text { min-width: 0; padding-bottom: 4px; }
.page-sub { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.page-text h1 { margin: 0; font-size: 44px; line-height: 1.05; font-weight: 750; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.page-desc { margin: 12px 0 0; color: var(--muted); max-width: 60ch; }
.page-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.btn {
  height: 38px;
  padding: 0 18px 0 14px;
  border-radius: 19px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  background: var(--surface);
  transition: background-color 0.15s ease;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn:disabled { opacity: 0.4; }

.list-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 4px 0 24px; }
.list-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface);
}
.seg button {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 28px 22px; }
.tile-card { cursor: pointer; }
.tile-card .art { width: 100%; }
.art-new { border: 1px dashed var(--faint); background: transparent; }
.tile-new:hover .art-new { border-color: var(--muted); }
.inline-input {
  margin-top: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  outline: none;
}
.yt-section { margin-top: 44px; }
.sub-h { font-size: 17px; font-weight: 650; margin: 0 0 16px; }
.note { color: var(--muted); margin: 0; }
.empty { color: var(--muted); padding: 36px 0; margin: 0; }

/* track table */
.list { width: 100%; border-collapse: collapse; table-layout: fixed; }
.list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); height: 32px; padding: 0 10px; border-bottom: 1px solid var(--rule); }
.list td { height: 56px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list tbody tr { cursor: pointer; }
.list tbody td:first-child { border-radius: 8px 0 0 8px; }
.list tbody td:last-child { border-radius: 0 8px 8px 0; }
.list tbody tr:hover td, .kbd .list tbody tr.is-sel td { background: var(--surface); }
.kbd .list tbody tr.is-sel td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.c-n { width: 48px; text-align: right; color: var(--faint); padding-right: 12px !important; }
.c-title { width: 36%; font-weight: 500; }
.c-artist { width: 22%; color: var(--muted); }
.c-artist .link { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.c-album { color: var(--muted); }
.c-time, .c-liked, .c-last { width: 110px; text-align: right; color: var(--muted); }
th.c-time, th.c-liked, th.c-last { text-align: right; }
.c-act { width: 112px; text-align: right; }
.art-row { display: inline-block; width: 38px; height: 38px; margin-right: 12px; vertical-align: middle; border-radius: 5px; }
.c-title .t { vertical-align: middle; }
tr.is-playing .c-title .t { color: var(--accent); }

.row-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
  vertical-align: middle;
}
.row-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-btn:hover { color: var(--ink); background: var(--surface-2); }
tr:hover .row-btn, .kbd tr.is-sel .row-btn, .row-btn:focus-visible { opacity: 1; }
.row-btn.like.on { opacity: 1; color: var(--accent); }
.row-btn.like.on svg { fill: currentColor; }

.eq {
  display: inline-block;
  width: 11px; height: 11px;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 100% / 3px 60% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 4px 100% / 3px 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 8px 100% / 3px 40% no-repeat;
}
body.is-on .eq { animation: eq 0.9s steps(3) infinite alternate; }
@keyframes eq {
  0%   { background-size: 3px 60%, 3px 100%, 3px 40%; }
  50%  { background-size: 3px 100%, 3px 45%, 3px 80%; }
  100% { background-size: 3px 35%, 3px 75%, 3px 100%; }
}

/* ---------- mini player ---------- */

.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--bar);
  background: var(--bar-bg);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-top: 1px solid var(--rule);
  z-index: 10;
  cursor: pointer;
  transition: transform 0.22s var(--ease), opacity 0.2s ease;
}
body.np-open .bar { transform: translateY(100%); opacity: 0; pointer-events: none; }
body.np-open .rail { bottom: 0; }

.seek { position: absolute; left: 0; right: 0; top: -7px; height: 13px; cursor: pointer; touch-action: none; }
.seek::before, .seek-fill { content: ""; position: absolute; left: 0; top: 6px; height: 2px; transition: height 0.15s ease, top 0.15s ease; }
.seek::before { right: 0; background: transparent; }
.seek-fill { background: var(--accent); width: 0; }
.seek-fill::after {
  content: ""; position: absolute; right: -6px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform 0.15s ease;
}
.seek:hover::before, .seek:focus-visible::before { background: var(--surface-2); height: 4px; top: 5px; }
.seek:hover .seek-fill, .seek:focus-visible .seek-fill { height: 4px; top: 5px; }
.seek:hover .seek-fill::after, .seek:focus-visible .seek-fill::after { transform: scale(1); }
.seek:focus-visible { outline: none; }

.bar-inner { height: 100%; padding: 0 20px 0 14px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.art-now { flex: none; width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--surface); }
.art-fill { width: 100%; height: 100%; overflow: hidden; }
.now-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.now-title, .now-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-title { font-weight: 550; }
.now-artist { color: var(--muted); font-size: 13px; }
.controls { display: flex; align-items: center; gap: 14px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.play { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.play svg, .np-play svg { grid-area: 1 / 1; width: 22px; height: 22px; fill: currentColor; }
.play .i-play, .np-play .i-play { transform: translateX(1px); }
.play .i-pause, body.is-on .play .i-play { display: none; }
body.is-on .play .i-pause { display: block; }
.extras { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.time { color: var(--muted); font-size: 12.5px; white-space: nowrap; margin-right: 6px; }
.like[aria-pressed="true"] { color: var(--accent); }
.like[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- the glass Now Playing panel ---------- */

/* Wide screens: the panel is a column. The page gives up its width instead of hiding under it. */
.page { transition: margin-right 0.24s var(--ease); }
body.np-open .page { margin-right: calc(var(--np-w) + 12px); }
body.np-resizing .page, body.np-resizing .np { transition: none; }
body.np-resizing { cursor: col-resize; user-select: none; }
body.np-resizing iframe { pointer-events: none; }

.np {
  --tint: rgb(70 70 78);
  position: fixed;
  top: 12px; right: 12px; bottom: 12px;
  width: var(--np-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  color: var(--np-ink);
  border-radius: 26px;
  background: color-mix(in srgb, var(--tint) var(--tint-mix), var(--glass));
  backdrop-filter: blur(44px) saturate(1.8);
  -webkit-backdrop-filter: blur(44px) saturate(1.8);
  box-shadow: inset 0 0 0 1px var(--glass-edge), 0 30px 90px rgba(0, 0, 0, 0.35);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.24s var(--ease), opacity 0.2s ease, visibility 0s linear 0.24s, background-color 0.4s ease;
}
body.np-open .np { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }

.np-handle {
  position: absolute;
  left: -6px; top: 24px; bottom: 24px;
  width: 12px;
  cursor: col-resize;
  z-index: 2;
  touch-action: none;
}
.np-handle::after {
  content: "";
  position: absolute;
  left: 4px; top: 50%;
  width: 4px; height: 44px;
  margin-top: -22px;
  border-radius: 2px;
  background: var(--np-faint);
  opacity: 0;
  transition: opacity 0.15s ease, height 0.15s ease, margin-top 0.15s ease;
}
.np-handle:hover::after, body.np-resizing .np-handle::after { opacity: 1; height: 64px; margin-top: -32px; background: var(--np-muted); }

.np-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px 12px; }
.np-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--np-muted); }
.np .seg { background: var(--np-fill); }
.np .seg button { color: var(--np-muted); }
.np .seg button:hover { color: var(--np-ink); }
.np .seg button[aria-selected="true"] { background: var(--np-fill-2); color: var(--np-ink); }
.seg-small button { padding: 4px 12px; font-size: 12px; }

.np-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--np-muted); flex: none; }
.np-icon:hover { color: var(--np-ink); background: var(--np-fill); }
.np-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.np-icon.big svg { width: 26px; height: 26px; }
.np-icon.like[aria-pressed="true"] { color: var(--np-ink); }
.np-icon.like[aria-pressed="true"] svg { fill: currentColor; }

.np-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 24px;
  container-type: inline-size;
  scrollbar-width: thin;
  scrollbar-color: var(--np-fill-2) transparent;
}
.np-slot { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: rgba(0, 0, 0, 0.35); }

.np-info { padding: 18px 2px 4px; }
.np-title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.np-by { margin: 4px 0 0; color: var(--np-muted); font-size: 14.5px; line-height: 1.4; }
.np-link { color: var(--np-ink); opacity: 0.86; font: inherit; text-align: left; }
.np-link:hover { opacity: 1; text-decoration: underline; text-underline-offset: 2px; }
.np-album { color: var(--np-muted); opacity: 1; }
.np-sep { color: var(--np-muted); }

.np-seek { --p: 0%; position: relative; height: 18px; margin-top: 16px; cursor: pointer; touch-action: none; }
.np-seek::before, .np-seek span { content: ""; position: absolute; left: 0; top: 7px; height: 4px; border-radius: 2px; }
.np-seek::before { right: 0; background: var(--np-fill-2); }
.np-seek span { width: var(--p); background: var(--np-ink); }
.np-seek span::after {
  content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--np-ink); transform: scale(0); transition: transform 0.15s ease;
}
.np-seek:hover span::after, .np-seek:focus-visible span::after { transform: scale(1); }
.np-seek:focus-visible { outline: none; }
.np-times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--np-muted); margin-top: 2px; }
.np-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.np-transport { display: flex; align-items: center; gap: 22px; }
.np-play { width: 56px; height: 56px; border-radius: 50%; background: var(--np-ink); color: var(--bg); display: grid; place-items: center; }
.np-play svg { width: 26px; height: 26px; }
.np-play .i-pause, .np.is-on .np-play .i-play { display: none; }
.np.is-on .np-play .i-pause { display: block; }
.np.is-empty .np-controls { opacity: 0.4; pointer-events: none; }

.np-sec { margin-top: 26px; }
.np-h { margin: 0 2px 10px; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

/* lyrics */
.lyrics {
  position: relative;
  max-height: 40vh;
  min-height: 120px;
  overflow-y: auto;
  resize: vertical;
  padding: 14px 16px 30%;
  border-radius: 16px;
  background: var(--np-fill);
  scrollbar-width: none;
}
.lyrics::-webkit-scrollbar { display: none; }
.lyrics.is-empty, .lyrics.is-plain { padding-bottom: 14px; }
.lyrics.is-empty { min-height: 0; resize: none; padding: 10px 16px; }
.lyr-line {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--np-faint);
  cursor: pointer;
  transition: color 0.2s ease;
}
.lyr-ts { font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--np-faint); font-variant-numeric: tabular-nums; opacity: 0.8; }
.lyr-line:hover { color: var(--np-muted); }
.lyr-line.past { color: var(--np-muted); opacity: 0.7; }
.lyr-line.on { color: var(--np-ink); opacity: 1; }
.lyr-line.on .lyr-ts { color: var(--np-muted); }
.lyr-gap { margin-bottom: 4px; }
.lyr-plain { margin: 0 0 4px; font-size: 16px; line-height: 1.5; font-weight: 600; color: var(--np-ink); }
.lyr-note { color: var(--np-muted); margin: 0; font-size: 13.5px; }
.lyr-note.small { font-size: 12.5px; margin: 8px 10px; }

/* about this song */
.facts-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 82%);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -20px;
  padding: 2px 20px 4px;
  scroll-padding: 0 20px;
  align-items: start;
}
.facts-cards::-webkit-scrollbar { display: none; }
@container (min-width: 560px) {
  .facts-cards { grid-auto-flow: row; grid-template-columns: 1fr 1fr; grid-auto-columns: auto; overflow: visible; margin: 0; padding: 0; }
  .fact.open { grid-column: 1 / -1; }
}
.fact {
  scroll-snap-align: start;
  padding: 14px 16px 15px;
  border-radius: 16px;
  background: var(--np-fill);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.fact:hover { background: var(--np-fill-2); }
.fact:focus-visible { outline: 2px solid var(--np-ink); outline-offset: 2px; }
.fact-head { display: flex; gap: 12px; align-items: flex-start; }
.fact-text { flex: 1; min-width: 0; }
.fact-kind { display: block; font-size: 11.5px; font-weight: 600; color: var(--np-muted); margin-bottom: 4px; }
.fact-title { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 650; }
.fact-sub { display: block; font-size: 12.5px; color: var(--np-muted); margin-top: 2px; }
.fact-img { width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: cover; background: var(--np-fill-2); }
.fact-body {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--np-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fact.open .fact-body { -webkit-line-clamp: unset; display: block; color: var(--np-ink); }
.fact-src { display: none; margin: 10px 0 0; font-size: 12px; color: var(--np-muted); }
.fact.open .fact-src { display: block; }
.fact-src a { color: var(--np-ink); text-underline-offset: 2px; }

.fact.skeleton { cursor: default; }
.sk { display: block; border-radius: 6px; background: var(--np-fill-2); animation: sk 1.4s ease-in-out infinite; }
.sk-kind { width: 60px; height: 10px; }
.sk-title { width: 70%; height: 16px; margin: 10px 0 12px; }
.sk-line { width: 100%; height: 10px; margin-top: 7px; }
.sk-line.short { width: 55%; }
@keyframes sk { 50% { opacity: 0.45; } }

.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.person {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--np-fill);
  font-size: 12.5px;
  text-decoration: none;
  color: var(--np-ink);
}
a.person:hover { background: var(--np-fill-2); }
.person-name { font-weight: 600; }
.person-role { color: var(--np-muted); }

/* up next */
.np-queue summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: 8px 2px;
  margin-bottom: 0;
  border-radius: 8px;
}
.np-queue summary::-webkit-details-marker { display: none; }
.np-queue summary svg { width: 18px; height: 18px; fill: none; stroke: var(--np-muted); stroke-width: 2; stroke-linecap: round; transition: transform 0.2s ease; }
.np-queue[open] summary svg { transform: rotate(180deg); }
.upnext { margin: 4px -8px 0; }
.q-label { margin: 6px 10px 6px; font-size: 12.5px; color: var(--np-muted); font-weight: 550; }
.q-row { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 8px 0 4px; border-radius: 10px; cursor: pointer; }
.q-row:hover { background: var(--np-fill); }
.q-row.dragging { opacity: 0.4; }
.q-row.drop-above { box-shadow: inset 0 2px 0 var(--np-ink); }
.q-row.drop-below { box-shadow: inset 0 -2px 0 var(--np-ink); }
.q-grip { width: 18px; flex: none; color: var(--np-faint); cursor: grab; opacity: 0; }
.q-grip svg { width: 16px; height: 16px; }
.q-row:hover .q-grip { opacity: 1; }
.q-art { width: 40px; height: 40px; flex: none; border-radius: 6px; background: var(--np-fill); }
.q-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.q-title, .q-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-title { font-weight: 550; font-size: 13.5px; }
.q-artist { font-size: 12.5px; color: var(--np-muted); }
.q-x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--np-muted); opacity: 0; }
.q-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.q-row:hover .q-x { opacity: 1; }
.q-x:hover { background: var(--np-fill-2); color: var(--np-ink); }
.ghost-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin: 8px 0 0; height: 40px; border-radius: 12px;
  background: var(--np-fill); color: var(--np-ink); font-weight: 550; font-size: 13.5px;
}
.ghost-btn:hover { background: var(--np-fill-2); }
.ghost-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* The one iframe. Laid over #np-slot and clipped to the panel's scroll area. */
.video {
  position: fixed;
  left: 0; top: 0;
  width: 384px; height: 216px;
  z-index: 31;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
.video.shown { opacity: 1; pointer-events: auto; }
.video iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- menus, overlays, toast ---------- */

.menu {
  position: fixed;
  z-index: 50;
  width: 250px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow);
  color: var(--ink);
}
.menu-h { margin: 6px 10px 6px; font-size: 12px; color: var(--muted); }
.menu-list { overflow-y: auto; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; text-align: left; }
.menu-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.menu-new { color: var(--accent); }
.menu-new svg { stroke: var(--accent); }
.menu .inline-input { margin: 2px 0 4px; }

.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(6px); }
.sheet {
  width: min(560px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow);
  padding: 22px 26px;
}
.sheet h2 { font-size: 16px; font-weight: 650; margin: 0 0 16px; }
.sheet-foot { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.sheet-tools { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.sheet-note { color: var(--muted); font-size: 12.5px; margin: 0; flex-basis: 100%; }
.static .account { display: none; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.keys, .facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 16px; margin: 0; align-content: start; }
.keys dt, .facts dt { color: var(--muted); }
.keys dd, .facts dd { margin: 0; }
.facts dd { overflow-wrap: anywhere; }
kbd { font: 11.5px var(--mono); display: inline-block; min-width: 20px; padding: 1px 6px; text-align: center; border: 1px solid var(--rule); border-radius: 5px; color: var(--muted); background: var(--bg); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar) + 20px);
  transform: translate(-50%, 6px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  padding: 9px 15px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.np-open .toast { left: calc((100vw - var(--np-w) + var(--rail)) / 2); bottom: 24px; }

/* ---------- narrow screens: panel becomes a bottom sheet ---------- */

@media (max-width: 900px) {
  body.np-open .page { margin-right: 0; }
  .np {
    top: 0; left: 0; right: 0; bottom: 0;
    width: auto;
    border-radius: 0;
    transform: translateY(100%);
  }
  .np-handle { display: none; }
  #np-close svg { transform: rotate(90deg); }
  body.np-open .toast { left: 50%; bottom: auto; top: 24px; }
}

@media (max-width: 760px) {
  :root { --rail: 0px; --gutter: 16px; --card: 140px; }
  .rail {
    top: auto; bottom: var(--bar); right: 0;
    width: auto; height: 52px;
    flex-direction: row; justify-content: space-around;
    padding: 0 8px;
    border-right: 0; border-top: 1px solid var(--rule);
    background: var(--bg);
  }
  .rail-gap { display: none; }
  .account { margin-top: 0; }
  body { padding-bottom: calc(var(--bar) + 84px); }
  .bar-inner { grid-template-columns: 1fr auto; padding: 0 12px; }
  .extras, #prev { display: none; }
  .c-album, .c-time, .c-liked, .c-last { display: none; }
  .c-title { width: 55%; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .page-cover { width: 160px; }
  .page-text h1 { font-size: 32px; }
  .help-cols { grid-template-columns: 1fr; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

