/* 游泳歌单：手机优先，960px 以上切换成「列表 + 详情」两栏。
   形状规则：封面 8-10px 圆角，面板 16px，所有可点的按钮/标签都是胶囊或圆形。
   只有一个强调色（池水青），喜欢、播放、选中状态都用它。
   层级：详情页 20 < 播放条 30 < 提示 40 < 登录 50 */

:root {
  color-scheme: light dark;
  --bg: #eef3f3;
  --surface: #f8fbfb;
  --surface-2: #e2ebeb;
  --line: #d2dedf;
  --text: #0f1c1f;
  --text-2: #4b6065;
  --text-3: #6f8489;
  --accent: #0b7a70;
  --accent-ink: #f4fbfa;
  --accent-soft: rgb(11 122 112 / 0.12);
  --shadow: 0 10px 30px rgb(15 50 55 / 0.14);
  --player-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "MiSans",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1417;
    --surface: #121d21;
    --surface-2: #1a282d;
    --line: #22353b;
    --text: #e4eef0;
    --text-2: #93a8ad;
    --text-3: #6c8288;
    --accent: #4cc3b5;
    --accent-ink: #062521;
    --accent-soft: rgb(76 195 181 / 0.14);
    --shadow: 0 10px 30px rgb(0 0 0 / 0.45);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.icon-sprite { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 22px; border-radius: 999px; font-weight: 600; white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  color: var(--text-2); transition: transform 0.15s var(--ease), color 0.2s, background-color 0.2s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.is-on { color: var(--accent); }

.play-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); transition: transform 0.15s var(--ease);
}
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 22px; height: 22px; }

/* ---------- 登录 ---------- */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(100%, 340px); display: grid; gap: 10px; }
.login-mark { width: 40px; height: 40px; color: var(--accent); }
.login-card h1 { font-size: 26px; font-weight: 700; margin-bottom: 18px; }
.login-card label { font-size: 14px; color: var(--text-2); }
.login-card input {
  height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 16px;
}
.login-card .btn { margin-top: 8px; height: 48px; }
.field-error { min-height: 20px; font-size: 14px; color: var(--text); }
.field-error:not(:empty)::before { content: "! "; color: var(--accent); font-weight: 700; }

/* ---------- 列表 ---------- */
.library { min-height: 100dvh; padding-bottom: calc(var(--player-h) + var(--safe-b) + 24px); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 6px;
}
.topbar h1 { font-size: 24px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-actions .btn-sm { padding: 0 12px; }
.topbar-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.toolbar { position: sticky; top: 0; z-index: 5; padding: 10px 16px 10px; background: var(--bg); }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color 0.2s, color 0.2s;
}
.chip .count { font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 13px; }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); }
.chip[aria-selected="true"] .count { color: inherit; opacity: 0.7; }

/* 下载到这台设备 */
.dl-bar {
  margin: 8px 16px 0; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
}
.dl-text { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); min-width: 0; }
.dl-text svg { width: 18px; height: 18px; color: var(--text-3); }
.dl-bar.is-done .dl-text svg { color: var(--accent); }
.dl-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-bar .btn-sm { padding: 0 12px; }
.dl-track { grid-column: 1 / -1; height: 3px; margin-right: 6px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.dl-track span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 0.3s linear; }
.dl-mark { width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-3); }
.dl-mark:empty { display: none; }
.dl-mark svg { width: 16px; height: 16px; }
.dl-ring {
  width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(var(--accent) var(--p, 0%), var(--surface-2) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent 55%, #000 58%); mask: radial-gradient(farthest-side, transparent 55%, #000 58%);
}
.dl-line { margin-top: 14px; min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.dl-line svg { width: 16px; height: 16px; }
.dl-line .is-ready { color: var(--accent); }

.day { padding: 18px 16px 6px; display: flex; align-items: baseline; justify-content: space-between; }
.day h2 { font-size: 15px; font-weight: 600; }
.day span { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rows { list-style: none; margin: 0; padding: 0 8px; }

.row { display: flex; align-items: center; border-radius: 12px; transition: background-color 0.2s; }
.row:hover { background: var(--surface); }
.row.is-selected { background: var(--surface); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; text-align: left; }
.row-text { min-width: 0; display: grid; gap: 1px; }
.row-title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub .tag-explore { color: var(--accent); margin-left: 6px; }
.row.is-current .row-title { color: var(--accent); }
.row-side { display: flex; align-items: center; gap: 2px; padding-right: 2px; color: var(--text-3); }
.row-side .mark { width: 16px; height: 16px; }
.row-side .mark.is-like { color: var(--accent); }
.row-side .dur { font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 6px; display: none; }
.row-more { width: 40px; height: 44px; display: grid; place-items: center; color: var(--text-3); border-radius: 999px; }
.row-more svg { width: 18px; height: 18px; }
.row.is-disliked .row-title, .row.is-disliked .cover { opacity: 0.5; }

.cover {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-2); color: var(--text-3); border-radius: 8px;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-sm { width: 44px; height: 44px; }
.cover-row { width: 48px; height: 48px; }
.cover svg { width: 45%; height: 45%; }

/* 正在播放的小动效：只在播放时动，表示「是这首在响」 */
.eq { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  padding-bottom: 12px; background: rgb(6 20 22 / 0.45); }
.eq i { width: 4px; height: 18px; border-radius: 2px; background: #e9f6f4; transform-origin: bottom; transform: scaleY(0.4); }
.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% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.skeleton { display: flex; gap: 12px; align-items: center; padding: 8px 16px; }
.skeleton .sk-cover { width: 48px; height: 48px; border-radius: 8px; background: var(--surface-2); }
.skeleton .sk-lines { flex: 1; display: grid; gap: 8px; }
.skeleton .sk-lines span { height: 12px; border-radius: 6px; background: var(--surface-2); width: 70%; }
.skeleton .sk-lines span + span { width: 40%; }

.empty { padding: 56px 24px; text-align: center; color: var(--text-2); display: grid; gap: 14px; justify-items: center; }
.empty svg { width: 36px; height: 36px; color: var(--text-3); }

/* ---------- 详情 ---------- */
.detail {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--bg);
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0s linear 0.32s;
}
.detail.is-open { transform: none; visibility: visible; transition: transform 0.32s var(--ease); }
.detail-bar { display: flex; align-items: center; padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 0; }
.detail-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.detail-body { max-width: 640px; margin: 0 auto; padding: 4px 20px calc(var(--player-h) + var(--safe-b) + 40px); }
.has-current-open .detail-body { padding-bottom: calc(var(--safe-b) + 40px); }

.hero { display: grid; justify-items: center; text-align: center; gap: 6px; }
.hero .cover { width: min(66vw, 300px); aspect-ratio: 1; height: auto; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 14px; }
.hero .cover svg { width: 30%; height: 30%; }
.hero h2 { font-size: 23px; font-weight: 700; line-height: 1.3; }
.hero .artist { font-size: 16px; color: var(--text-2); }
.hero .meta { font-size: 13px; color: var(--text-3); }
.hero .meta .tag-explore { color: var(--accent); }

.now { margin-top: 18px; display: grid; gap: 6px; }
.now .transport { justify-content: space-between; padding: 0 4px; }
.now .play-btn { width: 64px; height: 64px; }
.now .play-btn svg { width: 28px; height: 28px; }
.now .icon-btn svg { width: 26px; height: 26px; }
.now .icon-btn[data-act="shuffle"] svg, .now .icon-btn[data-act="repeat"] svg { width: 22px; height: 22px; }
.play-this { margin-top: 18px; display: flex; justify-content: center; }

.transport { display: flex; align-items: center; gap: 8px; }
.seek { display: flex; align-items: center; gap: 10px; }
.time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 36px; }
.seek .time:last-child { text-align: right; }

input[type="range"] {
  --p: 0%;
  flex: 1; height: 24px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--surface-2) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--text); border: 0;
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }

.rate { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rate-btn {
  height: 48px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); color: var(--text); font-weight: 600; transition: transform 0.15s var(--ease), background-color 0.2s, color 0.2s;
}
.rate-btn:active { transform: scale(0.97); }
.rate-btn[aria-pressed="true"].like { background: var(--accent); color: var(--accent-ink); }
.rate-btn[aria-pressed="true"].dislike { background: var(--text); color: var(--bg); }
.rate-hint { margin-top: 8px; font-size: 13px; color: var(--text-3); text-align: center; }

.info { margin-top: 30px; display: grid; gap: 26px; }
.info section { display: grid; gap: 8px; }
.info h3 { font-size: 13px; font-weight: 600; color: var(--text-3); }
.info p { font-size: 15.5px; line-height: 1.8; color: var(--text); white-space: pre-line; }
.info .missing { color: var(--text-3); font-size: 14px; }
.info .reason p { padding-left: 12px; border-left: 3px solid var(--accent); }

.feel { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.feel h3 { font-size: 17px; font-weight: 700; }
.feel .hint { font-size: 13px; color: var(--text-3); margin-top: -6px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  height: 34px; padding: 0 14px; border-radius: 999px; font-size: 14px; background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 4px; transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.tag:active { transform: scale(0.96); }
.tag svg { width: 14px; height: 14px; }
.tag[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.feel label { font-size: 14px; color: var(--text-2); }
.feel textarea {
  width: 100%; min-height: 112px; resize: vertical; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; line-height: 1.6;
}
.feel textarea::placeholder { color: var(--text-3); }
.save-state { font-size: 13px; color: var(--text-3); min-height: 18px; }
.save-state.is-error { color: var(--text); }

/* ---------- 播放条（手机：迷你播放器） ---------- */
.player {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 30;
  height: var(--player-h); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px;
  padding: 0 8px 0 10px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
  border: 1px solid var(--line);
}
.player-progress { position: absolute; left: 14px; right: 14px; top: 0; height: 2px; }
.player-progress span { display: block; height: 100%; border-radius: 1px; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.player-now { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; height: 100%; }
.player-text { min-width: 0; display: grid; }
.player-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-rate { order: 2; display: flex; }
.player-center { order: 3; }
.player .desk-only { display: none; }
.player .play-btn { width: 40px; height: 40px; }
.player .play-btn svg { width: 20px; height: 20px; }
.has-current-open .player { transform: translateY(calc(100% + 16px + var(--safe-b))); }
.player { transition: transform 0.3s var(--ease); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 24px + var(--safe-b)); z-index: 40; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; white-space: nowrap;
}
.toast button { color: var(--bg); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 电脑：两栏 + 完整播放条 ---------- */
@media (min-width: 960px) {
  :root { --player-h: 84px; }
  body { overflow: hidden; }
  .app {
    height: 100dvh; display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) var(--player-h);
  }
  .library { grid-row: 1; grid-column: 1; min-height: 0; overflow-y: auto; padding-bottom: 24px; border-right: 1px solid var(--line); }
  .detail {
    position: static; grid-row: 1; grid-column: 2; transform: none; visibility: visible; transition: none; min-height: 0;
  }
  .detail-bar { display: none; }
  .detail-body { padding: 40px 40px 56px; }
  .has-current-open .detail-body { padding-bottom: 56px; }
  .detail .now { display: none; }
  .row-side .dur { display: inline; }
  .hero { grid-template-columns: 220px minmax(0, 1fr); justify-items: start; text-align: left; align-items: end; column-gap: 28px; }
  .hero .cover { width: 220px; grid-row: span 4; margin-bottom: 0; }
  .hero h2 { font-size: 30px; }
  .play-this { justify-content: flex-start; }
  .dl-line { justify-content: flex-start; }

  .player {
    position: static; grid-row: 2; grid-column: 1 / -1; height: auto; border-radius: 0; box-shadow: none; border: 0;
    border-top: 1px solid var(--line); padding: 0 20px; grid-template-columns: minmax(0, 1fr) minmax(360px, 560px) minmax(0, 1fr);
    gap: 24px; transform: none !important;
  }
  .player .desk-only { display: inline-grid; }
  .player .seek.desk-only { display: flex; }
  .player-progress { display: none; }
  .player-now { gap: 14px; }
  .player .cover-sm { width: 52px; height: 52px; }
  .player-center { order: 2; display: grid; gap: 2px; justify-items: center; }
  .player-center .seek { width: 100%; }
  .player-rate { order: 3; justify-content: flex-end; }
  .toast { bottom: calc(var(--player-h) + 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}
