:root {
  --bg: #0f0f10;
  --bg2: #19191b;
  --card: #232326;
  --line: #36363b;
  --text: #f1f1f3;
  --muted: #a3a3aa;
  --accent: #ff4d5a;
  --accent2: #5cb8ff;
  --danger: #e2675b;
  --on-accent: #ffffff;
  --topbar-bg: rgba(15, 15, 16, .92);
  --player-bg: rgba(27, 27, 29, .97);
  --shadow: rgba(0, 0, 0, .5);
  --radius: 12px;
  --player-h: 0px;
  --nav-h: 0px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* no pull-to-refresh: a stray swipe down shouldn't reload the app and stop the music */
html, body { overscroll-behavior-y: contain; }
body { padding-bottom: calc(var(--player-h) + var(--nav-h) + 16px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--topbar-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; font-weight: 800; letter-spacing: .01em; font-size: 1.2rem; display: inline-flex; align-items: center; gap: 8px; flex: none; }
.logo { width: 30px; height: 30px; flex: none; }
.lg-ring { fill: var(--accent); }
.lg-disc { fill: var(--bg); }
.lg-play { fill: var(--text); }
.side-nav { display: flex; gap: 4px; }
.side-nav a, .bottom-nav a { text-decoration: none; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.side-nav a { padding: 7px 14px; border-radius: 999px; }
.side-nav a.active { background: var(--card); color: var(--text); }
.side-nav .ni svg { width: 20px; height: 20px; }
.badge { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
.top-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; display: flex; align-items: center; }
.top-search input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px 9px 40px; }
.top-search input:focus { outline: none; border-color: var(--muted); background: var(--card); }
.ts-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.ts-icon svg { width: 18px; height: 18px; }
.sugg { position: absolute; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px var(--shadow); z-index: 30; }
.sugg li button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.sugg li button:hover, .sugg li button:focus-visible { background: var(--card); outline: none; }
.sugg svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent2); color: var(--bg); display: grid; place-items: center;
  font-weight: 800; text-decoration: none; flex: none; overflow: hidden; font-size: .95rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; display: none; background: var(--player-bg);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(10px); }
.bottom-nav a { flex: 1; flex-direction: column; gap: 2px; padding: 8px 0 6px; font-size: .72rem; font-weight: 600; justify-content: center; }
.bottom-nav a.active { color: var(--text); }
.bottom-nav .ni svg { width: 24px; height: 24px; }

main { max-width: 1200px; margin: 0 auto; padding: 16px 20px; outline: none; }
h1 { font-size: 1.6rem; margin: 4px 0 6px; }
h2 { font-size: 1.2rem; margin: 26px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 16px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; padding: 0; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
input.field, select.field, textarea.field { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input.field:focus, textarea.field:focus, select.field:focus { outline: none; border-color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 8px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: .9rem; text-decoration: none; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
.toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); }

/* ------------------------------------------------------------- shelves */
.shelf-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.shelf-head h2 { margin: 0; }
.shelf-nav { display: flex; gap: 6px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 6px; scrollbar-width: thin; }
.card { scroll-snap-align: start; min-width: 0; text-decoration: none; display: grid; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.card .art { position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--card); }
.card.round .art { border-radius: 50%; }
.card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .art .play-o { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.65);
  color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; border: 0; cursor: pointer; }
.card:hover .art .play-o, .card:focus-visible .art .play-o { opacity: 1; }
.card .art .play-o svg { width: 22px; height: 22px; }
.card .c-title { font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card.round .c-title, .card.round .c-sub { text-align: center; }
.card .c-sub { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 16px; }
/* "Quick picks": songs in columns of four, scrolling sideways */
.qp { display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, auto); grid-auto-columns: minmax(300px, 1fr); gap: 2px 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.qp .trow { scroll-snap-align: start; }

/* ---------------------------------------------------------- track rows */
.tracks { display: grid; gap: 2px; }
.trow { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 6px 4px 6px 6px;
  border-radius: 8px; cursor: pointer; min-width: 0; }
.trow:hover, .trow:focus-visible { background: var(--card); outline: none; }
.trow.numbered { grid-template-columns: 28px minmax(0, 1fr) auto auto; }
.trow .t-n { color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.trow .t-art { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--card); display: block; }
.trow .t-main { min-width: 0; }
.trow .t-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .t-sub { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .t-sub a { text-decoration: none; } .trow .t-sub a:hover { text-decoration: underline; }
/* on touch screens a tap anywhere on a row plays it (artist/album are in the ⋮ menu) */
@media (pointer: coarse) { .trow .t-sub a { pointer-events: none; } }
.trow .t-dur { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.trow .t-flags { display: inline-flex; gap: 4px; vertical-align: 1px; margin-right: 4px; }
.trow .t-flags:empty { display: none; }
.trow.playing .t-title { color: var(--accent); }
.flag { font-size: .62rem; font-weight: 800; border-radius: 3px; padding: 1px 4px; background: var(--muted); color: var(--bg); line-height: 1.3; }
.flag.dev { background: var(--accent2); }
.flag.srv { background: transparent; color: var(--muted); border: 1px solid var(--muted); }
.trow .icon-btn { width: 36px; height: 36px; }

/* -------------------------------------------------------------- heroes */
.hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: end; margin: 8px 0 18px; }
.hero > img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--card); box-shadow: 0 16px 40px var(--shadow); }
.hero.artist > img { border-radius: 50%; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.6rem); margin: 0 0 6px; line-height: 1.15; }
.hero .meta { color: var(--muted); }
.hero .meta a { text-decoration: none; color: var(--text); } .hero .meta a:hover { text-decoration: underline; }
.hero .desc { color: var(--muted); font-size: .9rem; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }

/* ------------------------------------------------------------- library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.lib-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; text-decoration: none; background: var(--bg2); }
.lib-item:hover { background: var(--card); }
.lib-item .li-art { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--card); display: grid; place-items: center; color: var(--muted); }
.lib-item .li-art svg { width: 26px; height: 26px; }
.lib-item .li-art.liked { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.lib-item .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item .li-sub { color: var(--muted); font-size: .85rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 10px 14px; min-width: 140px; }
.stat b { display: block; font-size: 1.2rem; }
.meter { height: 6px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.job { background: var(--card); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.job + .job { margin-top: 6px; }
.job .meter { grid-column: 1 / -1; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px 14px; }
.setting + .setting { margin-top: 6px; }
.setting select { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.setting input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.panel { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.panel + .panel { margin-top: 8px; }
.panel ol { padding-left: 20px; line-height: 1.6; }
.panel code { background: var(--bg2); border-radius: 4px; padding: 1px 5px; font-size: .9em; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form .field { flex: 1 1 160px; width: auto; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.pill { font-size: .72rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-weight: 700; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--bg2), var(--card), var(--bg2)); background-size: 200% 100%; animation: skel 1.2s ease infinite; border-radius: 8px; }
@keyframes skel { to { background-position: -200% 0; } }
.offline-banner { position: sticky; top: 0; z-index: 25; background: var(--accent2); color: var(--bg); text-align: center; padding: 6px 12px; font-size: .9rem; font-weight: 600; }
.toast { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; z-index: 90; box-shadow: 0 8px 30px var(--shadow); max-width: calc(100% - 32px); font-weight: 600; }
img.fallback { object-fit: contain !important; padding: 18%; background: var(--card); }

/* ---------------------------------------------------- sign-in / setup */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-box { width: min(380px, 100%); display: grid; gap: 12px; }
.gate-box .logo { width: 64px; height: 64px; margin: 0 auto 4px; }
.gate-box h1 { text-align: center; margin: 0; }
.gate-box p { text-align: center; margin: 0 0 6px; }
.gate-box label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.gate-box .btn { justify-content: center; padding: 11px; }
.err { color: var(--danger); font-size: .9rem; min-height: 1.2em; text-align: center; }

/* --------------------------------------------------------- menu sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; }
.menu-sheet { position: fixed; z-index: 81; left: 50%; bottom: 0; transform: translateX(-50%); width: min(480px, 100%); max-height: 80vh; overflow-y: auto;
  background: var(--bg2); border-radius: 18px 18px 0 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px var(--shadow); }
.menu-head { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--card); }
.menu-head .t-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-head .t-sub { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item { width: 100%; display: flex; gap: 16px; align-items: center; background: none; border: 0; padding: 12px 14px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--card); outline: none; }
.menu-item svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.menu-item.danger { color: var(--danger); }
.menu-title { font-weight: 700; padding: 10px 14px; }

/* -------------------------------------------------------------- mobile */
@media (max-width: 899px) {
  .side-nav, .top-search { display: none; }
  .topbar { justify-content: space-between; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .bottom-nav:not([hidden]) { display: flex; }
  :root { --nav-h: 58px; }
  main { padding: 12px 14px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; }
  .hero > img { width: min(220px, 60vw); }
  .hero .actions { justify-content: center; }
  .shelf { grid-auto-columns: 140px; gap: 12px; }
  .qp { grid-auto-columns: 86%; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 12px; }
  h1 { font-size: 1.35rem; }
  .shelf-nav { display: none; }
}

/* mobile search box (search page) */
.search-box { position: relative; display: flex; align-items: center; margin-bottom: 4px; }
.search-box input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px 11px 40px; }
.search-box .ts-icon { position: absolute; left: 12px; }
.search-box .sugg { position: static; margin-top: 6px; box-shadow: none; }

/* appearance settings */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.theme-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--card); border: 2px solid transparent; cursor: pointer; text-align: left; }
.theme-opt.active { border-color: var(--accent); }
.swatch { display: inline-flex; width: 38px; height: 22px; border-radius: 6px; overflow: hidden; flex: none; border: 1px solid var(--line); }
.swatch i { flex: 1; }
.color-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.color-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.color-row input[type=color] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }

/* ================================================================ player */
.ctl { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer; padding: 0; flex: none; transition: background .15s, transform .1s; }
.ctl svg { width: 26px; height: 26px; display: block; }
.ctl:hover { background: var(--card); }
.ctl:active { transform: scale(.94); }
.ctl.small { width: 38px; height: 38px; } .ctl.small svg { width: 22px; height: 22px; }
.ctl.big { width: 60px; height: 60px; } .ctl.big svg { width: 34px; height: 34px; }
.ctl-play { width: 48px; height: 48px; background: var(--text); color: var(--bg); }
.ctl-play:hover { background: var(--text); filter: brightness(.92); }
.ctl.toggle { color: var(--muted); }
.ctl.toggle.on { color: var(--accent); }
.like-btn.on { color: var(--accent); }

.player input[type=range], .np input[type=range] {
  -webkit-appearance: none; appearance: none; background: transparent; width: 100%; height: 28px; margin: 0; cursor: pointer; --fill: 0%; }
.player input[type=range]::-webkit-slider-runnable-track, .np input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill)); }
.player input[type=range]::-moz-range-track, .np input[type=range]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
.player input[type=range]::-moz-range-progress, .np input[type=range]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
.player input[type=range]::-webkit-slider-thumb, .np input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; }
.player input[type=range]::-moz-range-thumb, .np input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }

/* mini bar */
.player { position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 40; background: var(--player-bg); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
.bottom-nav[hidden] ~ .player, body:not(.has-nav) .player { padding-bottom: env(safe-area-inset-bottom); }
.mini-progress { height: 3px; background: var(--line); display: none; }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.player-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(180px, 1.4fr) auto auto; gap: 14px; align-items: center;
  padding: 8px 16px; max-width: 1400px; margin: 0 auto; }
.p-open { display: flex; align-items: center; gap: 12px; min-width: 0; background: none; border: 0; color: inherit; text-align: left; padding: 0; cursor: pointer; font: inherit; }
.p-art { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--bg2); flex: none; }
.p-meta { min-width: 0; display: grid; }
.p-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-show { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-controls { display: flex; align-items: center; gap: 4px; }
.p-seek { display: flex; align-items: center; gap: 10px; min-width: 0; }
.p-time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
.p-vol { display: flex; align-items: center; gap: 2px; width: 140px; }
@media (max-width: 1080px) { .p-vol { display: none; } .player-row { grid-template-columns: minmax(0, 1fr) auto minmax(140px, 1fr) auto; } }
@media (max-width: 760px) {
  .player-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 6px 8px 6px 10px; }
  .p-seek, .p-expand { display: none; }
  .p-art { width: 44px; height: 44px; }
  .p-controls .ctl:not(.ctl-play) { width: 40px; height: 40px; }
  .ctl-play { width: 44px; height: 44px; background: transparent; color: var(--text); }
  .ctl-play svg { width: 30px; height: 30px; }
  .mini-progress { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
  #p-prev { display: none; }
}

/* full-screen "Now playing" */
body.np-open { overflow: hidden; }
.np { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .22s ease; overflow-y: auto; overscroll-behavior: contain;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.np.shown { transform: none; }
.np::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; transition: background .6s;
  background: radial-gradient(120% 70% at 50% -5%, color-mix(in srgb, var(--np-tint, var(--accent)) 45%, transparent), transparent 75%); }
.np-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; position: sticky; top: 0; z-index: 2; }
.np-label { display: grid; justify-items: center; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.np-count { letter-spacing: .04em; text-transform: none; font-weight: 500; font-size: .78rem; opacity: .85; }
.np-top-right { display: flex; align-items: center; }
.sleep-wrap { position: relative; display: inline-flex; }
.sleep-btn.on { color: var(--accent); }
.sleep-left { position: absolute; pointer-events: none; bottom: 0; left: 50%; transform: translateX(-50%); font-size: .58rem; font-weight: 800; color: var(--accent); }
.np-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px 28px; flex: 1; }
.np-main { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 520px; margin: 0 auto; }
.np-stage { position: relative; width: min(100%, 44vh, 460px); aspect-ratio: 1; touch-action: pan-y; }
.np-view { position: absolute; inset: 0; display: none; }
.np-stage[data-view="cover"] .v-cover, .np-stage[data-view="viz"] .v-viz, .np-stage[data-view="lyrics"] .v-lyrics { display: grid; place-items: center; animation: view-in .25s ease; }
@keyframes view-in { from { opacity: 0; transform: scale(.97); } }
.np-stage.nudge-l { animation: nudge-l .28s ease; } .np-stage.nudge-r { animation: nudge-r .28s ease; }
@keyframes nudge-l { 40% { transform: translateX(-18px); opacity: .6; } }
@keyframes nudge-r { 40% { transform: translateX(18px); opacity: .6; } }
.np-art-wrap { width: 100%; height: 100%; border-radius: 12px; overflow: hidden; background: var(--card);
  box-shadow: 0 24px 60px var(--shadow); transition: transform .35s ease; }
.np:not(.is-playing) .np-art-wrap { transform: scale(.94); }
.np-art-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-viz { border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--bg) 70%, #000); }
.v-viz canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.viz-mode { position: absolute; top: 12px; left: 14px; font: 700 .7rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .16em; color: var(--muted); pointer-events: none; }
.viz-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 700; cursor: pointer; }
/* lyrics */
.v-lyrics { place-items: stretch !important; }
.lyrics { width: 100%; height: 100%; overflow-y: auto; padding: 30% 8px; scroll-behavior: smooth; mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent);
  font-size: 1.35rem; font-weight: 800; line-height: 1.45; }
.lyrics .ly { color: color-mix(in srgb, var(--text) 38%, transparent); margin: 0 0 14px; cursor: pointer; transition: color .2s; }
.lyrics .ly.on { color: var(--text); }
.lyrics.plain { font-size: 1.05rem; font-weight: 600; white-space: pre-line; color: var(--text); padding: 12px 8px; mask-image: none; }
.lyrics .ly-src { font-size: .75rem; font-weight: 500; color: var(--muted); margin-top: 18px; }
.np-tabs { display: inline-flex; gap: 4px; background: color-mix(in srgb, var(--card) 85%, transparent); padding: 4px; border-radius: 999px; }
.np-tabs button { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.np-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.np-titles { width: 100%; }
.np-title-row { display: flex; align-items: center; gap: 10px; }
.np-title-text { flex: 1; min-width: 0; }
.np-title { font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 800; line-height: 1.25; white-space: nowrap; overflow: hidden; }
.np-title.mq { mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent); }
.mq-in { display: inline-flex; gap: 3em; animation: mq 12s linear infinite; padding-left: 4%; }
@keyframes mq { to { transform: translateX(calc(-50% - 1.5em)); } }
.np:not(.is-playing) .mq-in { animation-play-state: paused; }
.np-show { color: var(--muted); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.np-show a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); text-underline-offset: 3px; }
.np-show a:hover { color: var(--text); text-decoration-color: currentColor; }
.np-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-i { font-size: .72rem; font-weight: 700; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: color-mix(in srgb, var(--card) 70%, transparent); }
.chip-i.dev { color: var(--accent2); border-color: color-mix(in srgb, var(--accent2) 60%, transparent); }
.np-upnext { width: 100%; max-width: 420px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--card) 80%, transparent); color: var(--text); padding: 10px 14px; font: inherit; cursor: pointer; text-align: left; }
.un-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; flex: none; }
.un-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  width: min(420px, calc(100% - 24px)); background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: 0 -10px 40px var(--shadow); }
.sheet h3 { margin: 0 0 10px; font-size: 1rem; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-grid button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 12px; font: inherit; font-weight: 600; cursor: pointer; }
.sheet-grid button.off { color: var(--muted); }
.sheet p { margin: 10px 0 0; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 7px; vertical-align: -1px; flex: none; }
.eq i { width: 3px; height: 30%; background: var(--accent); border-radius: 1px; }
.is-playing .eq i { animation: eq .9s ease-in-out infinite; }
.is-playing .eq i:nth-child(2) { animation-delay: -.3s; } .is-playing .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
.player:not(.is-playing) .p-title-row .eq { display: none; }
.p-title-row { display: flex; align-items: center; min-width: 0; }
.np-seek { width: 100%; }
.np-times { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.np-controls { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 420px; }
.np-play { width: 76px; height: 76px; background: var(--text); color: var(--bg); }
.np-play svg { width: 38px; height: 38px; }
.np-play:hover { background: var(--text); filter: brightness(.92); }
.np-vol { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 360px; }
.np-queue { width: 100%; max-width: 520px; margin: 0 auto; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.np-queue h3 { font-size: 1rem; margin: 8px 0; }
.np-queue ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.np-queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 10px; }
.np-queue li:hover { background: var(--card); }
.q-item { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; background: none; border: 0; color: var(--text); padding: 6px 8px; border-radius: 10px; cursor: pointer; font: inherit; }
.q-item img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--card); }
.q-text { min-width: 0; display: grid; }
.q-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.q-sub { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-queue li.current { background: var(--card); }
.np-queue li.current .q-title { color: var(--accent); }
.np-queue li.played { opacity: .55; }
.q-rm { opacity: .7; }
@media (min-width: 960px) {
  .np-body { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; padding-top: 12px; }
  .np-queue { position: sticky; top: 70px; max-height: calc(100vh - 110px); overflow-y: auto; background: var(--bg2); border-radius: 16px; padding: 8px 10px; }
  #np-queue-btn { display: none; }
}
@media (max-width: 959px) { .np:not(.queue-open) .np-queue { display: none; } }
@media (max-height: 700px) and (max-width: 959px) { .np-stage { width: min(100%, 34vh); } .np-main { gap: 10px; } }
@media (prefers-reduced-motion: reduce) { .mq-in, .eq i, .np-stage, .np-view, .skel { animation: none !important; } }

/* loading: a ring spins around the play button while a song is on its way */
.player.loading .ctl-play, .np.loading .np-play { position: relative; }
.player.loading .ctl-play::after, .np.loading .np-play::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 3px solid transparent; border-top-color: var(--accent); animation: spin .8s linear infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .player.loading .ctl-play::after, .np.loading .np-play::after { animation-duration: 3s; } }
