/* ==========================================================================
   音乐库 · 视觉层
   暗色克制风：低饱和主色、发丝级描边、细线图标、克制的动效
   ========================================================================== */

:root {
  --accent: hsl(210 38% 64%);
  --bg: #08090b;
  --bg-raise: #101216;
  --bg-card: #14161b;
  --ink: #f2f3f5;
  --ink-2: #a4a9b3;
  --ink-3: #838894;
  --hair: rgba(255, 255, 255, .07);
  --hair-2: rgba(255, 255, 255, .12);
  --fill: rgba(255, 255, 255, .045);
  --fill-2: rgba(255, 255, 255, .085);
  --mini-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans SC',
    'Noto Sans SC', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

svg { width: 20px; height: 20px; display: block; fill: none; }

/* ------------------------------------------------------------- 背景色晕 */
.wash {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -18%, color-mix(in oklab, var(--accent) 26%, transparent) 0%, transparent 62%),
    radial-gradient(90% 45% at 50% 108%, color-mix(in oklab, var(--accent) 14%, transparent) 0%, transparent 68%);
  opacity: .5;
  transition: background 1.4s var(--ease);
}

/* ================================================================ 主列表 */
#app {
  position: relative; z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--mini-h) + var(--safe-b) + 40px);
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--fill);
  border: 1px solid var(--hair);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: color .8s var(--ease);
}
.mark svg { width: 17px; height: 17px; }

.brand h1 {
  font-size: 17px; font-weight: 600; letter-spacing: .02em;
}
.brand p {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
  letter-spacing: .04em;
}

/* 图标按钮 */
.icon-btn {
  position: relative;
  border: 0; padding: 0;
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color .18s, background .18s, transform .12s;
}
.icon-btn:hover { color: var(--ink); background: var(--fill); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.lg svg { width: 25px; height: 25px; }

.icon-btn.primary {
  width: 62px; height: 62px;
  background: var(--ink);
  color: #0a0b0d;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .9);
}
.icon-btn.primary:hover { background: #fff; }
.icon-btn.primary svg { width: 24px; height: 24px; }

.icon-btn.solid { background: var(--fill); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent); }

/* 播放/暂停、循环、音量、收藏的图标切换 */
.ico-pause, .ico-repeat1, .ico-vol1, .ico-mute, .ico-heart-on { display: none; }
.is-playing .ico-play { display: none; }
.is-playing .ico-pause { display: block; }
.repeat-one .ico-repeat { display: none; }
.repeat-one .ico-repeat1 { display: block; }
.vol-low .ico-vol { display: none; }
.vol-low .ico-vol1 { display: block; }
.vol-off .ico-vol, .vol-off .ico-vol1 { display: none; }
.vol-off .ico-mute { display: block; }
.on .ico-heart { display: none; }
.on .ico-heart-on { display: block; }

/* 搜索 */
.search {
  position: relative;
  display: flex; align-items: center;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--fill);
  border: 1px solid var(--hair);
  transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--hair-2); background: rgba(255, 255, 255, .06); }
.s-ico { color: var(--ink-3); width: 18px; height: 18px; flex: 0 0 18px; }
#search {
  flex: 1; min-width: 0;
  margin-left: 10px;
  border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: 15px;
  font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
#search::placeholder { color: var(--ink-3); }
#search::-webkit-search-cancel-button { display: none; }
.clear {
  border: 0; background: transparent; color: var(--ink-3);
  width: 26px; height: 26px; display: grid; place-items: center;
  cursor: pointer; border-radius: 50%;
}
.clear svg { width: 14px; height: 14px; }

/* 分类 */
.chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 16px 0 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 13px;
  border-radius: 15px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px; font-family: inherit;
  letter-spacing: .02em;
  white-space: nowrap; cursor: pointer;
  transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--hair-2); color: var(--ink); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #0a0b0d;
  font-weight: 500;
}

/* 歌曲列表 */
.list { display: flex; flex-direction: column; }

.row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .16s var(--ease);
}
.row:hover { background: var(--fill); }
.row:active { background: var(--fill-2); }
.row.active { background: color-mix(in oklab, var(--accent) 11%, transparent); }

.row-cover {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--bg-raise);
  box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .05) inset;
}

.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 14.5px; font-weight: 450; letter-spacing: .005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s;
}
.row.active .row-title { font-weight: 550; color: var(--accent); }
.row-sub {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-3);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden;
}
.row.active .row-sub { color: color-mix(in oklab, var(--accent) 62%, var(--ink-2)); }

.badge {
  font-size: 10px; line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--ink-3);
  border: 1px solid var(--hair);
  flex: 0 0 auto;
  letter-spacing: .04em;
}
.badge.warn {
  color: #d9a05b;
  border-color: rgba(217, 160, 91, .28);
  background: rgba(217, 160, 91, .08);
  display: inline-flex; align-items: center; gap: 3px;
}
.badge.warn svg { width: 10px; height: 10px; }

.row-side { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.row-side .icon-btn { width: 36px; height: 36px; color: var(--ink-3); }
.row-side .icon-btn svg { width: 17px; height: 17px; }
.row-fav.on { color: #e0557d; }
.row-play.on { color: var(--accent); }

/* 加载骨架 */
.skeleton .row-cover { background: var(--fill); }
.sk-line {
  height: 11px; border-radius: 6px; background: var(--fill);
  animation: pulse 1.6s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

.empty { text-align: center; padding: 76px 20px; color: var(--ink-3); }
.empty-ico { width: 34px; height: 34px; margin: 0 auto 14px; opacity: .5; }
.empty p { font-size: 13.5px; }

/* 底部按钮 */
.foot { display: flex; gap: 10px; margin-top: 26px; }
.btn-solid, .btn-ghost {
  flex: 1; height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: transform .12s var(--ease), background .2s, border-color .2s;
}
.btn-solid { border: 0; background: var(--ink); color: #0a0b0d; }
.btn-solid:hover { background: #fff; }
.btn-ghost { border: 1px solid var(--hair); background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--fill); border-color: var(--hair-2); }
.btn-solid:active, .btn-ghost:active { transform: scale(.985); }
.btn-solid svg, .btn-ghost svg { width: 17px; height: 17px; }

/* ========================================================== 迷你播放条 */
.mini {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(var(--safe-b) + 10px);
  z-index: 40;
  border-radius: 18px;
  background: rgba(16, 18, 22, .82);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--hair);
  box-shadow: 0 20px 50px -22px rgba(0, 0, 0, .95);
  overflow: hidden;
  animation: rise .34s var(--ease);
}
@keyframes rise { from { transform: translateY(115%); opacity: 0; } }

.mini-line { height: 1.5px; background: rgba(255, 255, 255, .07); }
.mini-line i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }

.mini-body { display: flex; align-items: center; gap: 8px; padding: 9px 12px 9px 10px; }
.mini-cover {
  width: 44px; height: 44px; border-radius: 8px; flex: 0 0 44px; object-fit: cover;
  box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .8);
  cursor: pointer;
}
.mini-meta { flex: 1; min-width: 0; cursor: pointer; }
.mini-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 12px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { width: 38px; height: 38px; }
.mini .icon-btn.solid { width: 42px; height: 42px; background: var(--ink); color: #0a0b0d; }
.mini .icon-btn.solid:hover { background: #fff; }

/* ========================================================== 全屏播放器 */
.full {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 8px) 24px calc(var(--safe-b) + 18px);
  background: #0a0b0e;
  animation: full-in .4s var(--ease);
}
.full[hidden] { display: none; }
@keyframes full-in { from { transform: translateY(4%); opacity: 0; } }

.full-wash {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(85% 45% at 50% -6%, color-mix(in oklab, var(--accent) 30%, transparent) 0%, transparent 65%),
    radial-gradient(100% 40% at 50% 106%, color-mix(in oklab, var(--accent) 12%, transparent) 0%, transparent 70%);
  opacity: .62;
  transition: background 1.2s var(--ease);
}

.full-head {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 4px;
}
.full-kicker {
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.head-spacer { width: 40px; }

.stage {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0;
}

.sleeve { position: relative; width: min(74vw, 330px); aspect-ratio: 1; }
.art {
  width: 100%; height: 100%;
  border-radius: 6px;
  object-fit: cover;
  box-shadow:
    0 40px 80px -30px rgba(0, 0, 0, 1),
    0 12px 28px -14px rgba(0, 0, 0, .9),
    0 0 0 1px rgba(255, 255, 255, .06) inset;
}

.lyrics {
  position: absolute; inset: 0;
  overflow: hidden; opacity: 0; pointer-events: none;
  transition: opacity .35s var(--ease);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
}
.full.show-lyrics .lyrics { opacity: 1; pointer-events: auto; }
.full.show-lyrics .sleeve { opacity: 0; pointer-events: none; }
.sleeve { transition: opacity .3s var(--ease); }

.lyrics-inner { position: relative; padding: 44% 4px; transition: transform .55s var(--ease); will-change: transform; }
.lrc-line {
  font-size: 15.5px; line-height: 1.6;
  color: var(--ink-3);
  padding: 8px 6px; text-align: center;
  cursor: pointer;
  transition: color .3s var(--ease), transform .3s var(--ease), opacity .3s;
  opacity: .7;
}
.lrc-line.active { color: var(--ink); font-size: 17px; font-weight: 600; opacity: 1; }
.lyrics-empty { text-align: center; color: var(--ink-3); font-size: 13.5px; padding-top: 42%; }

.now { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 10px 0 18px; }
.now-text { flex: 1; min-width: 0; }
.now-title {
  font-size: 21px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-artist { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-note {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: #d9a05b; margin-top: 7px;
  line-height: 1.4;
}
.icon-btn.fav { color: var(--ink-3); }
.icon-btn.fav.on { color: #e0557d; background: transparent; }

/* 时间轴 */
.timeline { position: relative; display: flex; align-items: center; gap: 12px; padding-bottom: 6px; }
.t {
  font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: 0 0 38px; text-align: center;
  letter-spacing: .03em;
}
.rail { position: relative; flex: 1; height: 26px; display: flex; align-items: center; }
.rail::before {
  content: ''; position: absolute; left: 0; right: 0;
  height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .1);
}
.rail-buf { position: absolute; left: 0; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .18); width: 0; }
.rail-fill {
  position: absolute; left: 0; height: 3px; width: 0;
  border-radius: 2px; background: var(--ink);
  pointer-events: none;
}
.rail-fill i {
  position: absolute; right: -5px; top: 50%;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff;
  transform: translateY(-50%) scale(.6);
  opacity: 0;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
#seek-track:hover .rail-fill i, .rail.dragging .rail-fill i { opacity: 1; transform: translateY(-50%) scale(1); }
#seek {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}

/* 传输控制 */
.transport {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 6px 18px;
}
.transport .icon-btn { color: var(--ink-2); }
.transport .icon-btn.lg { color: var(--ink); }

/* 工具行 */
.tools { position: relative; display: flex; align-items: center; gap: 10px; }
.tag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: 17px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px; font-family: inherit;
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.tag-btn:hover { border-color: var(--hair-2); color: var(--ink); background: var(--fill); }
.tag-btn svg { width: 15px; height: 15px; }
.tag-btn.active {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}
.vol { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.vol .icon-btn { width: 30px; height: 30px; }
#volume {
  flex: 1; min-width: 0; height: 22px;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
}
#volume::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .13); }
#volume::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 11px; margin-top: -4px;
  border-radius: 50%; background: var(--ink-2);
  transition: background .18s;
}
#volume:hover::-webkit-slider-thumb { background: var(--ink); }
#volume::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .13); }
#volume::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--ink-2); }

/* Toast */
.toast {
  position: fixed; left: 50%;
  bottom: calc(var(--mini-h) + var(--safe-b) + 30px);
  transform: translateX(-50%);
  z-index: 80;
  max-width: 82vw;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(20, 22, 27, .94);
  backdrop-filter: blur(20px);
  border: 1px solid var(--hair);
  color: var(--ink);
  font-size: 13px;
  text-align: center;
  box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .95);
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ 宽屏适配 */
@media (min-width: 900px) {
  #app { padding-left: 32px; padding-right: 32px; }
  .full { padding: 44px max(48px, calc((100vw - 1000px) / 2)); }
  .sleeve { width: min(42vh, 360px); }
  .full.show-lyrics .sleeve { display: none; }
  .full.show-lyrics .lyrics { max-width: 600px; margin: 0 auto; }
  .mini { left: 50%; right: auto; transform: translateX(-50%); width: min(620px, calc(100vw - 40px)); }
  .row { padding: 10px 12px; }
  .row-cover { width: 52px; height: 52px; flex-basis: 52px; }
  .now-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
