:root {
  --sky: #3a9ee0;
  --sky-l: #7cc4f0;
  --sky-xl: rgba(58, 158, 224, 0.1);
  --ink: #1d3247;
  --ink-2: #5b7085;
  --glass: rgba(255, 255, 255, 0.74);
  --glass-line: rgba(255, 255, 255, 0.6);
  --line: rgba(58, 158, 224, 0.18);
  --shadow: 0 18px 50px rgba(28, 74, 120, 0.18);
  --veil: linear-gradient(180deg, rgba(230, 245, 255, 0.5), rgba(214, 236, 252, 0.8));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky: #6cbcee;
    --sky-l: #9fd6f6;
    --sky-xl: rgba(124, 196, 240, 0.12);
    --ink: #e4eef7;
    --ink-2: #9db1c4;
    --glass: rgba(16, 24, 36, 0.72);
    --glass-line: rgba(255, 255, 255, 0.08);
    --line: rgba(124, 196, 240, 0.18);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --veil: linear-gradient(180deg, rgba(10, 16, 26, 0.6), rgba(10, 16, 26, 0.85));
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bg { position: fixed; inset: 0; z-index: -1; background: url(/img/site_header_1920.webp) center 30% / cover no-repeat; }
.bg::after { content: ""; position: absolute; inset: 0; background: var(--veil); }

.topbar { display: flex; align-items: center; gap: 12px; max-width: 1120px; margin: 0 auto; padding: 18px 20px 0; }
.home, .brand { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-line); border-radius: 999px; }
.home { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.92rem; padding: 8px 16px; white-space: nowrap; }
.home:hover { color: var(--sky); }
.brand { display: flex; align-items: center; gap: 8px; margin: 0 auto; padding: 2px 18px 2px 6px; font-weight: 800; font-size: 1.05rem; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.topbar-spacer { width: 118px; flex: none; }

.player { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 22px; max-width: 1120px; margin: 18px auto 32px; padding: 0 20px; }
.player > * { min-width: 0; }
.now, .library {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.now { position: sticky; top: 18px; align-self: start; display: flex; flex-direction: column; gap: 16px; padding: 22px; }
.art { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--sky-xl); box-shadow: 0 12px 30px rgba(58, 158, 224, 0.25); }
.art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.is-playing .art img { transform: scale(1.03); }
#viz { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34%; pointer-events: none; }
.meta h1 { margin: 0 0 4px; font-size: 1.3rem; line-height: 1.35; }
.meta p { margin: 0; font-size: 0.92rem; color: var(--ink-2); }

.progress { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress span:last-child { text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 0;
  border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--sky) var(--p, 0%), var(--line) var(--p, 0%));
}
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--sky); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 3px solid var(--sky); }
input[type="range"]:focus-visible { box-shadow: 0 0 0 3px var(--line); }

.controls { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--ink-2); transition: background 0.2s, color 0.2s; }
.icon-btn:hover { background: var(--sky-xl); color: var(--sky); }
.icon-btn[aria-pressed="true"] { color: var(--sky); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.small svg { width: 20px; height: 20px; }
#btn-fav svg, .fav svg { fill: none; }
#btn-fav[aria-pressed="true"] svg, .fav[aria-pressed="true"] svg { fill: currentColor; }
.play-btn { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--sky-l), var(--sky)); box-shadow: 0 10px 24px rgba(58, 158, 224, 0.4); transition: transform 0.15s; }
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 28px; height: 28px; fill: currentColor; }
button:focus-visible { outline: 3px solid var(--line); outline-offset: 2px; }

.extras { display: flex; align-items: center; gap: 8px; }
.vol { flex: 1; display: flex; align-items: center; gap: 4px; }
select { font: inherit; font-size: 0.82rem; color: var(--ink); background: var(--sky-xl); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; cursor: pointer; }

.library { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 112px); padding: 18px 16px 12px; }
.lib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 2px; }
.tabs { display: flex; padding: 4px; border-radius: 999px; background: var(--sky-xl); }
.tabs button { padding: 6px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; color: var(--ink-2); }
.tabs button[aria-selected="true"] { color: #fff; background: linear-gradient(135deg, var(--sky-l), var(--sky)); box-shadow: 0 4px 12px rgba(58, 158, 224, 0.3); }
#search { flex: 1; min-width: 160px; font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--sky-xl); border: 1px solid transparent; border-radius: 999px; padding: 8px 14px; outline: none; }
#search:focus { border-color: var(--sky); }

.crumb { display: flex; flex-direction: column; gap: 8px; margin: 12px 2px 0; }
.crumb[hidden] { display: none; }
.crumb button { align-self: flex-start; font-weight: 700; color: var(--sky); padding: 4px 0; }
.crumb .note { margin: 0; padding: 8px 12px; border-radius: 12px; font-size: 0.82rem; color: var(--ink-2); background: var(--sky-xl); }

.list { flex: 1; list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 34px; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 14px; cursor: pointer; outline: none; transition: background 0.15s; }
.row:hover, .row:focus-visible, .row.active { background: var(--sky-xl); }
.row.folder { grid-template-columns: 36px minmax(0, 1fr) auto; margin-bottom: 6px; border: 1px dashed var(--line); }
.row .no { display: grid; place-items: center; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row .no svg { width: 22px; height: 22px; color: var(--sky); fill: none; }
.row .name { display: block; font-size: 0.94rem; font-weight: 700; }
.row .artist { display: block; font-size: 0.78rem; color: var(--ink-2); }
.row.active .name { color: var(--sky); }
.row .time { font-size: 0.78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row .time svg { display: block; width: 18px; height: 18px; fill: none; }
.row .fav { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink-2); opacity: 0.5; }
.row .fav:hover { opacity: 1; color: var(--sky); }
.row .fav[aria-pressed="true"] { opacity: 1; color: var(--sky); }
.row .fav svg { width: 18px; height: 18px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; height: 40%; border-radius: 2px; background: var(--sky); }
.is-playing .eq i { animation: eq 0.9s ease-in-out infinite; }
.is-playing .eq i:nth-child(2) { animation-delay: -0.3s; }
.is-playing .eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.empty { padding: 36px 12px; text-align: center; font-size: 0.9rem; color: var(--ink-2); }
.hint { margin: 8px 0 0; text-align: center; font-size: 0.74rem; color: var(--ink-2); }

@media (hover: none) { .hint { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .is-playing .eq i { animation: none; height: 80%; }
  .art img { transition: none; }
}
@media (max-width: 820px) {
  .player { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 0 14px; margin-top: 14px; }
  .topbar { padding: 14px 14px 0; }
  .topbar-spacer { display: none; }
  .brand { margin: 0 0 0 auto; }
  .now { position: static; padding: 18px; }
  .art { width: 100%; max-width: 320px; margin: 0 auto; }
  .library { max-height: 72vh; }
}
