/* ============================================================
   Lyra · design tokens, shell, player bar
   ============================================================ */

:root {
  --font: "Inter", "SF Pro Display", system-ui, -apple-system, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;

  --r-0: 6px; --r-1: 10px; --r-2: 16px; --r-3: 22px; --r-4: 30px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.66, 0, .34, 1);
  --spring: cubic-bezier(.2, 1.3, .3, 1);
  --d-1: .18s; --d-2: .32s; --d-3: .55s;

  --sidebar-w: 250px;
  --topbar-h: 66px;
  --player-h: 88px;
  --drawer-w: 372px;

  --accent: #7fb4ff;
  --accent-2: #b48cff;
  --accent-ink: #06101f;
  --cover-mix: transparent;
}

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #07080c;
  --bg-1: #0d0f16;
  --surface: rgba(255, 255, 255, .055);
  --surface-2: rgba(255, 255, 255, .085);
  --surface-3: rgba(255, 255, 255, .13);
  --hairline: rgba(255, 255, 255, .09);
  --hairline-2: rgba(255, 255, 255, .16);
  --text: #f2f4f8;
  --text-2: rgba(238, 242, 250, .68);
  /* 最淡的一档也按 3:1 对比度定：.26 的 11px 数字（行号、计数、键位提示）在深色底上几乎读不出来，
     层级差交给字号和字重，不靠把颜色一路调没 */
  --text-3: rgba(232, 238, 248, .50);
  --text-4: rgba(232, 238, 248, .37);
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, .72);
  --shadow-soft: 0 8px 30px -10px rgba(0, 0, 0, .5);
  --veil: rgba(4, 5, 8, .62);
  --scrim: rgba(8, 9, 14, .55);
  --ok: #6ee7a8;
  --warn: #ffcf6b;
  --danger: #ff7d8a;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-0: #eceef4;
  --bg-1: #f6f7fb;
  --surface: rgba(255, 255, 255, .68);
  --surface-2: rgba(255, 255, 255, .85);
  --surface-3: rgba(20, 24, 40, .07);
  --hairline: rgba(20, 26, 45, .10);
  --hairline-2: rgba(20, 26, 45, .18);
  --text: #14161d;
  --text-2: rgba(20, 22, 30, .72);
  --text-3: rgba(20, 22, 30, .60);
  --text-4: rgba(20, 22, 30, .46);
  --shadow: 0 18px 44px -16px rgba(24, 30, 52, .28);
  --shadow-soft: 0 6px 22px -10px rgba(24, 30, 52, .2);
  --veil: rgba(255, 255, 255, .55);
  --scrim: rgba(255, 255, 255, .35);
  --accent-ink: #ffffff;
}

* { box-sizing: border-box; }
/* several overlays are laid out with display:grid/flex, which would beat the
   hidden attribute unless the reset wins */
[hidden] { display: none !important; }
*::selection { background: color-mix(in oklab, var(--accent) 45%, transparent); color: #fff; }
/* inline icons are 24-grid line art; context rules override size and fill */
svg {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-0); }

/* ---------------------------------------------------------- background */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg-0); }
.bg-art {
  position: absolute; inset: -14%;
  background-size: cover; background-position: center;
  filter: blur(64px) saturate(1.75) contrast(1.05) brightness(.82);
  transform: scale(1.18);
  opacity: .5;
  transition: background-image var(--d-3) linear, opacity var(--d-3) var(--ease);
  will-change: opacity;
}
/* 浅色主题下封面的模糊底要当「染色」用，不能当「背景」用：
   深色专辑封面在 42% 透明度上糊开就是一片灰，正文像浮在脏水上，所以压到三成并把白纱加厚 */
[data-theme="light"] .bg-art { filter: blur(70px) saturate(1.5) brightness(1.18); opacity: .3; }
.bg-wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 12% 0%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 62%),
    radial-gradient(90% 70% at 100% 100%, color-mix(in oklab, var(--accent-2) 20%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 62%, transparent), var(--bg-0) 78%);
}
[data-theme="light"] .bg-wash { background:
    radial-gradient(120% 80% at 12% 0%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 62%),
    radial-gradient(90% 70% at 100% 100%, color-mix(in oklab, var(--accent-2) 22%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in oklab, var(--bg-1) 62%, transparent), var(--bg-0) 92%); }
.bg-grain {
  position: absolute; inset: 0; opacity: .32; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='.5'/></svg>");
}

/* ---------------------------------------------------------- shell grid */
.shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "side top top" "side main drawer";
  height: calc(100vh - var(--player-h));
  transition: grid-template-columns var(--d-2) var(--ease);
}
/* on body, not .shell: the spectrum strip in the footer needs the same width */
body.side-collapsed { --sidebar-w: 76px; }

/* ---------------------------------------------------------- sidebar */
.sidebar {
  grid-area: side;
  display: flex; flex-direction: column;
  padding: 14px 12px 10px;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-1) 78%, transparent), color-mix(in oklab, var(--bg-0) 88%, transparent));
  backdrop-filter: blur(26px) saturate(1.3);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: 0 0 auto; filter: drop-shadow(0 0 10px color-mix(in oklab, var(--accent) 45%, transparent)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 19px; font-weight: 650; letter-spacing: .055em; }
.brand-text span { font-size: 10.5px; color: var(--text-3); letter-spacing: .16em; white-space: nowrap; }
.sidebar-collapse { margin-left: auto; }
.sidebar-collapse svg path { transition: transform var(--d-2) var(--ease); transform-origin: center; }
.shell.side-collapsed .sidebar-collapse svg { transform: rotate(180deg); }
.shell.side-collapsed .brand-text,
.shell.side-collapsed .nav-item span,
.shell.side-collapsed .nav-title,
.shell.side-collapsed .nav-count,
.shell.side-collapsed .playlist-list { display: none; }
.shell.side-collapsed .sidebar { align-items: stretch; padding-inline: 12px; }
.shell.side-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.shell.side-collapsed .brand { justify-content: center; }
.shell.side-collapsed .sidebar-collapse { position: absolute; opacity: 0; pointer-events: none; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; padding-right: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; padding-bottom: 6px; }
/* flex-basis 必须是 auto：写成 flex:1（basis 0）时这一组永远不参与容器的自然高度，
   窗口一矮它就缩到 min-height，播放列表被挤成 5px 完全看不见，而 .nav 又因为没有溢出而不滚动。
   basis auto 才是「按内容占位、有余量再长」，不够高时交给 .nav 自己滚 */
.nav-group.grow { flex: 1 0 auto; min-height: 40px; }
.nav-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-4);
  padding: 10px 10px 5px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 11px; border-radius: var(--r-1);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  position: relative; transition: color var(--d-1), background var(--d-1);
  text-align: left; width: 100%; min-width: 0;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--surface-2); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; translate: 0 -50%;
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 12px color-mix(in oklab, var(--accent) 70%, transparent);
}
.nav-item.wide { margin-top: auto; }
.nav-count { margin-left: auto; font-style: normal; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }

.playlist-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; }
.pl-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: var(--r-1);
  color: var(--text-2); font-size: 13px; text-align: left; width: 100%; min-width: 0;
  transition: background var(--d-1), color var(--d-1);
}
.pl-item:hover { background: var(--surface); color: var(--text); }
.pl-item.active { background: var(--surface-2); color: var(--text); }
.pl-item i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55; flex: 0 0 auto; }
.pl-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-item em { margin-left: auto; font-style: normal; color: var(--text-4); font-size: 11px; }
.pl-item.drop-target { outline: 2px dashed var(--accent); outline-offset: -3px; background: color-mix(in oklab, var(--accent) 14%, transparent); }

.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.scan-status {
  display: flex; align-items: center; gap: 8px; padding: 6px 11px;
  font-size: 11.5px; color: var(--text-3); cursor: pointer; border-radius: var(--r-1);
}
.scan-status:hover { background: var(--surface); color: var(--text-2); }
.scan-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: 0 0 auto; }
.scan-status.busy .dot { background: var(--accent); animation: pulse 1.1s var(--ease) infinite; }
.scan-status.done .dot { background: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.7); } }

/* ---------------------------------------------------------- topbar */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px 0 14px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in oklab, var(--bg-0) 30%, transparent);
  backdrop-filter: blur(18px);
}
.topbar-nav { display: flex; gap: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-1); display: grid; place-items: center;
  color: var(--text-2); transition: background var(--d-1), color var(--d-1), transform var(--d-1);
  position: relative; flex: 0 0 auto;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.93); }
.icon-btn.on { color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent); }
.icon-btn[disabled] { opacity: .32; pointer-events: none; }
.icon-btn .fill, .play-btn svg.i-play, .play-btn svg.i-pause { fill: currentColor; stroke: none; }
.mini-btn {
  padding: 5px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--hairline);
  transition: all var(--d-1); white-space: nowrap; flex: 0 0 auto;
}
.mini-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--hairline-2); }
.mini-btn.on { color: var(--accent-ink); background: var(--accent); border-color: transparent; }

.search-wrap { position: relative; flex: 1; max-width: 520px; }
.search-icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; fill: none; stroke: var(--text-3); stroke-width: 1.8; pointer-events: none; }
.search {
  width: 100%; padding: 10px 84px 10px 38px; border-radius: 999px;
  background: var(--surface); border: 1px solid transparent; color: var(--text);
  transition: background var(--d-1), border-color var(--d-1), box-shadow var(--d-1);
  font-size: 13.5px;
}
.search::placeholder { color: var(--text-4); }
.search:focus { outline: none; background: var(--surface-2); border-color: color-mix(in oklab, var(--accent) 45%, transparent); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 12%, transparent); }
.search::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 42px; top: 50%; translate: 0 -50%; font: 11px var(--font-mono); color: var(--text-4); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; }
.search:focus-visible ~ .search-kbd, .search-wrap:focus-within .search-kbd { opacity: 0; }
.search-clear { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 28px; height: 28px; }
.search-suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: color-mix(in oklab, var(--bg-1) 92%, transparent); border: 1px solid var(--hairline);
  border-radius: var(--r-2); box-shadow: var(--shadow); overflow-y: auto; overscroll-behavior: contain;
  max-height: min(58vh, 460px); backdrop-filter: blur(24px);
  animation: pop var(--d-2) var(--ease);
  scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent;
}
.sug-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.sug-row:hover, .sug-row.sel { background: var(--surface-2); }
.sug-row.sel { box-shadow: inset 2px 0 0 var(--accent); }
.sug-row.none { cursor: default; }
.sug-row .kind { margin-left: auto; padding-left: 10px; font-size: 10.5px; color: var(--text-4); letter-spacing: .06em; flex: 0 0 auto; }
.sug-head { position: sticky; top: 0; z-index: 1; padding: 9px 12px 4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-4); background: color-mix(in oklab, var(--bg-1) 96%, transparent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--hairline); font-size: 11.5px; color: var(--text-2);
  cursor: pointer; user-select: none; transition: all var(--d-1); white-space: nowrap; flex: 0 0 auto;
}
.chip:hover { background: var(--surface-2); }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chip.remote .chip-dot { background: var(--accent-2); }

/* ---------------------------------------------------------- main */
.main {
  grid-area: main; overflow: hidden auto; position: relative;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent;
}
.main::-webkit-scrollbar { width: 11px; height: 11px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.main::-webkit-scrollbar-thumb:hover { background: var(--text-4); background-clip: content-box; }
.view-head { padding: 26px 30px 4px; flex: 0 0 auto; }
.view { padding: 14px 30px 30px; flex: 1; min-height: 0; }
body.immersive .main, body.immersive .topbar, body.immersive .sidebar { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------- player bar */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--player-h);
  display: grid; grid-template-columns: minmax(210px, 1.1fr) minmax(300px, 2fr) minmax(330px, 1.4fr);
  align-items: center; gap: 18px; padding: 0 18px;
  background: color-mix(in oklab, var(--bg-1) 84%, transparent);
  border-top: 1px solid var(--hairline);
  backdrop-filter: blur(30px) saturate(1.5);
}
.player-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cover {
  width: 56px; height: 56px; border-radius: var(--r-1); position: relative; overflow: hidden; flex: 0 0 auto;
  background: var(--surface-2); box-shadow: var(--shadow-soft); transition: transform var(--d-2) var(--ease);
}
.cover:hover { transform: scale(1.05); }
.cover-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.cover-img::after {
  content: ""; position: absolute; inset: 0; display: grid; place-items: center;
  background: repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.05) 0 2px, transparent 2px 5px);
  opacity: .5;
}
.cover-vinyl { position: absolute; inset: 0; }
.track-info { min-width: 0; flex: 1; }
.track-title { font-size: 14px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.track-tags { display: flex; gap: 6px; margin-top: 4px; flex-wrap: nowrap; overflow: hidden; }
.track-tags span { font-size: 10px; color: var(--text-4); border: 1px solid var(--hairline); border-radius: 4px; padding: 0 4px; letter-spacing: .04em; flex: 0 0 auto; }
.fav-btn svg { fill: none; }
.fav-btn.on svg { fill: var(--danger); stroke: var(--danger); animation: heart var(--d-3) var(--spring); }
@keyframes heart { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.player-center { display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.transport { display: flex; align-items: center; justify-content: center; gap: 8px; }
.transport .icon-btn svg { width: 20px; height: 20px; }
.mode-btn { position: relative; }
.mode-badge {
  position: absolute; right: 3px; bottom: 3px; font: 9px/1 var(--font-mono); font-style: normal;
  color: var(--accent); background: color-mix(in oklab, var(--bg-1) 80%, transparent); border-radius: 3px; padding: 1px 2px;
}
.play-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--text); color: var(--bg-0); transition: transform var(--d-2) var(--spring), box-shadow var(--d-2);
  box-shadow: 0 4px 18px -4px color-mix(in oklab, var(--accent) 55%, transparent);
}
.play-btn svg { width: 20px; height: 20px; }
.play-btn:hover { transform: scale(1.07); }
.play-btn:active { transform: scale(.95); }
.player[data-state="playing"] .play-btn { background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.i-pause { display: none; }
.player[data-state="playing"] .i-pause { display: block; }
.player[data-state="playing"] .i-play { display: none; }

.seek { display: flex; align-items: center; gap: 10px; }
.time { font: 11px/1 var(--font-mono); color: var(--text-3); font-variant-numeric: tabular-nums; width: 38px; text-align: center; flex: 0 0 auto; }
.wave-wrap { position: relative; flex: 1; height: 34px; cursor: pointer; }
.wave { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; transition: opacity var(--d-2); }
.wave-wrap:hover .wave { opacity: .95; }
.wave-mask { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, transparent); pointer-events: none; }
.seek-rail { position: absolute; inset: 0; }
.seek-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: color-mix(in oklab, var(--accent) 26%, transparent); mix-blend-mode: plus-lighter; pointer-events: none; }
.seek-head {
  position: absolute; top: 50%; left: 0; width: 3px; height: 0; border-radius: 2px; background: var(--accent);
  translate: -1.5px -50%; transition: height var(--d-1); box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 80%, transparent);
}
.wave-wrap:hover .seek-head { height: 26px; }
.seek-tip {
  position: absolute; bottom: calc(100% + 4px); translate: -50% 0; padding: 3px 7px; border-radius: var(--r-0);
  background: var(--surface-3); color: var(--text); font: 11px var(--font-mono); pointer-events: none; white-space: nowrap;
  backdrop-filter: blur(10px); border: 1px solid var(--hairline);
}

.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.volume { display: flex; align-items: center; gap: 4px; }
.volume input[type="range"] { width: 74px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; background: var(--surface-3);
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--bg-1) 70%, transparent); transition: transform var(--d-1);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); }
.btn-filled, .play-btn { border: 0; }

/* progress fill for volume */
.volume input[type="range"] { background: linear-gradient(90deg, var(--accent) 0 var(--vol, 80%), var(--surface-3) var(--vol, 80%) 100%); }

/* ---------------------------------------------------------- drawer */
.drawer {
  grid-area: drawer; width: var(--drawer-w); display: none; flex-direction: column;
  border-left: 1px solid var(--hairline);
  background: color-mix(in oklab, var(--bg-1) 72%, transparent);
  backdrop-filter: blur(26px);
  min-height: 0;
}
body.has-drawer .drawer { display: flex; animation: slideIn var(--d-2) var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 16px 14px 10px; }
.drawer-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .01em; }
.drawer-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.queue-now { padding: 0 14px 12px; border-bottom: 1px solid var(--hairline); }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 8px; min-height: 0; scrollbar-width: thin; }
.drawer-foot { padding: 9px 14px; font-size: 11.5px; color: var(--text-3); border-top: 1px solid var(--hairline); display: flex; gap: 10px; }

/* ---------------------------------------------------------- track rows */
.rows { display: flex; flex-direction: column; }
.rows.virtual .row { height: 54px; }
.v-space { flex: none; }
.row {
  display: grid; grid-template-columns: 30px 40px minmax(0, 2.4fr) minmax(0, 1.7fr) minmax(0, 1.3fr) 54px 96px;
  align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-1);
  color: var(--text-2); font-size: 13px; cursor: pointer; position: relative;
  transition: background var(--d-1), color var(--d-1);
}
.row:hover { background: var(--surface); color: var(--text); }
.row.playing { color: var(--accent); }
.row.playing .row-title { color: var(--accent); }
.row-index { font: 11px var(--font-mono); color: var(--text-4); text-align: center; font-variant-numeric: tabular-nums; }
.row-thumb { width: 40px; height: 40px; border-radius: 8px; background-size: cover; background-position: center; background-color: var(--surface-2); flex: 0 0 auto; position: relative; }
/* 中文标题的字面几乎占满整行高，标题和艺人行紧贴着就像叠在一起，所以给两行之间留 3px */
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-size: 13.5px; font-weight: 550; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.playing .row-title { color: inherit; }
.row-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-rating { flex: none; color: var(--accent); font-variant-numeric: tabular-nums; }
.badge-warn {
  flex: none; display: inline-flex; align-items: center; font-size: 9.5px; line-height: 1; padding: 3px 6px;
  border-radius: 999px; color: var(--warn, #f0b35e); border: 1px solid color-mix(in oklab, var(--warn, #f0b35e) 45%, transparent);
  background: color-mix(in oklab, var(--warn, #f0b35e) 10%, transparent); letter-spacing: .03em;
}
.row.unplayable .row-title { color: var(--text-2); }
.row.unplayable .row-thumb { filter: grayscale(.55); opacity: .72; }
.row-album, .row-genre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--text-3); }
.row-dur { font: 11.5px var(--font-mono); color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--d-1); }
.row:hover .row-actions { opacity: 1; }
.row .row-play-ic { display: none; }
.row:hover .row-num-text { display: none; }
.row:hover .row-play-ic { display: block; }
.row-play-ic svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.rows-head {
  display: grid; grid-template-columns: 30px 40px minmax(0, 2.4fr) minmax(0, 1.7fr) minmax(0, 1.3fr) 54px 96px;
  gap: 10px; padding: 6px 10px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-4);
  border-bottom: 1px solid var(--hairline); margin-bottom: 6px; position: sticky; top: 0; z-index: 2;
  background: color-mix(in oklab, var(--bg-0) 72%, transparent); backdrop-filter: blur(12px);
}
.rows-head button { color: inherit; font: inherit; text-align: left; padding: 0; background: none; border: 0; cursor: pointer; }
.rows-head button:hover { color: var(--text); }
.rows-head button.on { color: var(--accent); }
.rows-head > * { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rows-head .hh-pair { display: flex; gap: 10px; align-items: baseline; }
.rows-head .hh-more { margin-left: auto; text-transform: none; letter-spacing: .02em; }
.rows-head > :nth-child(6) { text-align: right; }
.row-actions { display: flex; gap: 0; opacity: 0; transition: opacity var(--d-1); justify-content: flex-end; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.row-actions svg { width: 15px; height: 15px; }
.eq-bars { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 11px; }
.eq-bars i { width: 2px; background: var(--accent); border-radius: 1px; animation: eq 1.1s var(--ease-in-out) infinite; }
.eq-bars i:nth-child(1) { height: 40%; animation-delay: -.2s; }
.eq-bars i:nth-child(2) { height: 75%; animation-delay: -.5s; }
.eq-bars i:nth-child(3) { height: 55%; animation-delay: -.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.row.dragging { opacity: .4; }
.row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 20px 16px; }
.card {
  position: relative; border-radius: var(--r-2); padding: 12px; background: var(--surface);
  border: 1px solid transparent; transition: background var(--d-2) var(--ease), transform var(--d-2) var(--ease), border-color var(--d-2);
  cursor: pointer; overflow: hidden;
}
.card:hover { background: var(--surface-2); transform: translateY(-3px); border-color: var(--hairline); }
.card-art {
  aspect-ratio: 1; border-radius: var(--r-1); background: var(--surface-3) center/cover no-repeat;
  box-shadow: var(--shadow-soft); position: relative; overflow: hidden;
}
.card-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.45)); opacity: 0; transition: opacity var(--d-2); }
.card:hover .card-art::after { opacity: 1; }
.card-art .rounded { border-radius: 50% !important; }
.card-play {
  position: absolute; right: 10px; bottom: 10px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  opacity: 0; transform: translateY(10px) scale(.9); transition: all var(--d-2) var(--spring);
  box-shadow: 0 8px 22px -6px color-mix(in oklab, var(--accent) 80%, transparent);
}
.card:hover .card-play { opacity: 1; transform: none; }
.card-play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.card-title { margin: 11px 0 3px; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-badge { position: absolute; top: 18px; left: 18px; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.42); color: #fff; letter-spacing: .06em; backdrop-filter: blur(6px); }

/* ---------------------------------------------------------- popovers, modals, toast */
.popover-layer:empty { display: none; }
.pop {
  position: fixed; z-index: 60; min-width: 232px; max-height: 70vh; overflow-y: auto;
  background: color-mix(in oklab, var(--bg-1) 94%, transparent); border: 1px solid var(--hairline);
  border-radius: var(--r-2); box-shadow: var(--shadow); backdrop-filter: blur(26px);
  padding: 10px; animation: pop var(--d-2) var(--ease); color: var(--text);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.pop h4 { margin: 4px 6px 10px; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.pop h4 .spacer { margin-left: auto; }
.pop-sep { height: 1px; background: var(--hairline); margin: 9px -4px; }
.pop-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-1); font-size: 13px; cursor: pointer; }
.pop-row:hover { background: var(--surface-2); }
.pop-row.on { color: var(--accent); }
.pop-row .k { margin-left: auto; font: 10.5px var(--font-mono); color: var(--text-4); }
.menu {
  position: fixed; z-index: 70; min-width: 208px; padding: 6px;
  background: color-mix(in oklab, var(--bg-1) 96%, transparent); border: 1px solid var(--hairline);
  border-radius: var(--r-1); box-shadow: var(--shadow); backdrop-filter: blur(24px); animation: pop var(--d-1) var(--ease);
}
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-0); font-size: 13px; color: var(--text-2); }
.menu button:hover { background: var(--surface-2); color: var(--text); }
.menu button.danger:hover { background: color-mix(in oklab, var(--danger) 20%, transparent); color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 5px 2px; }
.menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.toasts { position: fixed; bottom: calc(var(--player-h) + 16px); left: 50%; translate: -50% 0; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: color-mix(in oklab, var(--bg-1) 92%, transparent); border: 1px solid var(--hairline);
  box-shadow: var(--shadow); font-size: 13px; backdrop-filter: blur(20px);
  animation: toastIn var(--d-3) var(--spring);
}
.toast.out { animation: toastOut var(--d-2) var(--ease) forwards; }
.toast.err { border-color: color-mix(in oklab, var(--danger) 60%, transparent); }
.toast.ok { border-color: color-mix(in oklab, var(--ok) 50%, transparent); }
.toast.warn { border-color: color-mix(in oklab, var(--warn, #f0b35e) 55%, transparent); }
.toast b { font-weight: 600; }
.toast .act { color: var(--accent); font-weight: 600; cursor: pointer; pointer-events: auto; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.98); } }

.modal-back { position: fixed; inset: 0; z-index: 75; background: var(--veil); backdrop-filter: blur(8px); display: grid; place-items: center; animation: fade var(--d-2); }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(560px, 92vw); max-height: 82vh; overflow: auto; padding: 22px 24px;
  background: color-mix(in oklab, var(--bg-1) 96%, transparent); border: 1px solid var(--hairline);
  border-radius: var(--r-3); box-shadow: var(--shadow); animation: pop var(--d-2) var(--ease);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; font-weight: 650; }
.modal .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.modal label { font-size: 11.5px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.modal input[type="text"], .modal textarea, .modal select {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-1); padding: 9px 11px; color: var(--text); font-size: 13.5px;
}
.modal input[type="text"]:focus, .modal textarea:focus { outline: none; border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--hairline); transition: all var(--d-1);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, transparent); }

.drop-veil { position: fixed; inset: 0; z-index: 90; background: var(--veil); backdrop-filter: blur(10px); display: grid; place-items: center; }
.drop-inner {
  display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 46px 70px; border-radius: var(--r-4);
  border: 2px dashed color-mix(in oklab, var(--accent) 70%, transparent); color: var(--text);
  font-size: 22px; font-weight: 600; background: color-mix(in oklab, var(--bg-1) 40%, transparent);
  animation: pop var(--d-2) var(--ease);
}
.drop-inner span { font-size: 12.5px; color: var(--text-3); font-weight: 400; font-family: var(--font-mono); }

.loader { position: fixed; inset: 0; z-index: 100; background: var(--bg-0); display: grid; place-items: center; transition: opacity var(--d-3); }
.loader.hide { opacity: 0; pointer-events: none; }
.loader-mark { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--hairline-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 0 24px; max-width: 460px; }
.fatal b { font-size: 17px; }
.fatal p { font-size: 13px; color: var(--text-3); line-height: 1.7; font-family: var(--font-mono); word-break: break-word; }

/* ---------------------------------------------------------- misc */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--hairline); letter-spacing: .04em; }
.tag.acc { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 70px 20px; text-align: center; color: var(--text-3); }
.empty h3 { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; max-width: 420px; line-height: 1.7; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-1); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* solid glyphs (play, star) are shapes, not strokes; last so context rules cannot mute them */
svg.i-fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------- login gate · profiles */
/* author rules above beat the UA [hidden] rule, so re-assert it: the gate is toggled by attribute */
[hidden] { display: none !important; }

.gate { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 26px 18px; overflow: auto; }
.gate-veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(110% 80% at 50% -10%, color-mix(in oklab, var(--accent) 20%, transparent), transparent 62%),
    radial-gradient(90% 70% at 85% 110%, color-mix(in oklab, var(--accent-2) 16%, transparent), transparent 60%),
    var(--bg-0);
}
.gate-card {
  position: relative; width: min(620px, 100%); padding: 30px 32px 24px; border-radius: var(--r-4);
  border: 1px solid var(--hairline); background: color-mix(in oklab, var(--bg-1) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--shadow);
  animation: gateIn .5s var(--spring);
}
@keyframes gateIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--text); }
.gate-mark { display: inline-flex; width: 30px; height: 30px; color: var(--accent); }
.gate-mark svg { width: 30px; height: 30px; }
.gate-word { font-size: 13px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.gate-card h1 { margin: 0 0 8px; font-size: 27px; font-weight: 680; letter-spacing: -.015em; }
.gate-sub { margin: 0 0 22px; font-size: 13px; line-height: 1.7; color: var(--text-3); }
.gate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.gate-avatar {
  display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 12px 6px 10px;
  border: 1px solid transparent; border-radius: var(--r-3); background: transparent; color: var(--text);
  cursor: pointer; transition: transform var(--d-1) var(--ease), background var(--d-1), border-color var(--d-1);
}
.gate-avatar:hover { background: var(--surface); border-color: var(--hairline); transform: translateY(-2px); }
.gate-avatar:active { transform: scale(.97); }
.gate-name { font-size: 12.5px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-add { border: 1px dashed var(--hairline-2); }
.gate-add:hover { border-color: color-mix(in oklab, var(--accent) 60%, transparent); }
.gate-plus {
  display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%;
  font-size: 30px; font-weight: 300; color: var(--text-3); background: var(--surface);
}
.gate-chip {
  margin: 20px 0 0; font-size: 11.5px; line-height: 1.6; padding: 8px 12px; border-radius: var(--r-1);
  background: var(--surface); border: 1px solid var(--hairline); color: var(--text-3);
}
.gate-chip.ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 34%, transparent); background: color-mix(in oklab, var(--ok) 9%, transparent); }
.gate-chip.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 38%, transparent); background: color-mix(in oklab, var(--warn) 9%, transparent); }
.gate-tip { margin: 12px 0 0; font-size: 11px; color: var(--text-4); text-align: center; }

/* avatar bubble (shared by the gate, the form preview and the topbar chip) */
.av { position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; color: #fff; box-shadow: var(--shadow-soft); }
.av-i { font-weight: 650; line-height: 1; letter-spacing: .01em; text-shadow: 0 1px 6px rgba(0, 0, 0, .28); transition: opacity var(--d-2); }
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av-ring { box-shadow: 0 0 0 2px color-mix(in oklab, var(--text) 70%, transparent), var(--shadow-soft); }

/* create / edit form */
.pf-row { display: flex; align-items: center; gap: 20px; }
.pf-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pf-label { font-size: 11.5px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.gate input[type="text"] {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-1);
  padding: 10px 12px; color: var(--text); font-size: 14px; width: 100%;
}
.gate input[type="text"]:focus { outline: none; border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
.pf-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-files { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.pf-file-text { font-size: 12px; color: var(--text-3); margin-right: auto; }
.pf-err { margin: 12px 0 0; font-size: 12.5px; color: var(--danger); }

/* topbar identity chip */
.who-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 3px 12px 3px 3px;
  border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface); color: var(--text);
  font-size: 12.5px; cursor: pointer; transition: background var(--d-1), border-color var(--d-1);
}
.who-chip:hover { background: var(--surface-2); border-color: var(--hairline-2); }
.who-chip.who-empty { padding: 3px; }
.who-plus { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 17px; color: var(--text-3); background: var(--surface-2); }
.who-name { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .gate-card { padding: 22px 18px 18px; }
  .gate-card h1 { font-size: 22px; }
  .gate-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
  .pf-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .who-name { display: none; }
  .who-chip { padding: 3px; }
}
