/* ═══════════════════════════════════════════════════════════════
   SONAR · 设计令牌与基础元素
   配色思路：暖纸底 + 墨黑字 + 朱砂点色。避免纯白刺眼，
   也让「唱片/纸感」的气质和常见音乐 App 的深色霓虹区分开。
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* 底色 */
  --bg: #f7f5f1;
  --bg-deep: #efece5;
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --surface-3: #e8e4dc;
  --elev: #fffdf9;

  /* 文字 */
  --ink: #14161a;
  --ink-2: #565c64;
  --ink-3: #8b9099;
  --ink-inv: #fbfaf7;

  /* 线 */
  --line: rgba(20, 22, 26, 0.09);
  --line-strong: rgba(20, 22, 26, 0.16);

  /* 点色 */
  --accent: #e2452d;
  --accent-hover: #c93721;
  --accent-soft: rgba(226, 69, 45, 0.1);
  --accent-ink: #ffffff;
  --teal: #14655e;
  --teal-soft: rgba(20, 101, 94, 0.1);
  --gold: #a97c2f;

  /* 阴影 */
  --shadow-s: 0 1px 2px rgba(20, 22, 26, 0.05), 0 2px 8px rgba(20, 22, 26, 0.04);
  --shadow-m: 0 4px 12px rgba(20, 22, 26, 0.06), 0 12px 32px rgba(20, 22, 26, 0.07);
  --shadow-l: 0 8px 24px rgba(20, 22, 26, 0.1), 0 32px 64px rgba(20, 22, 26, 0.12);
  --shadow-accent: 0 8px 24px rgba(226, 69, 45, 0.28);

  /* 尺寸 */
  --r-xs: 6px;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  --sidebar-w: 244px;
  --player-h: 88px;
  --topbar-h: 68px;
  --tabbar-h: 60px;

  /* 字体 */
  --font-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "SF Pro Display", -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 220ms;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0c0e;
  --bg-deep: #08090b;
  --surface: #16181c;
  --surface-2: #1d2025;
  --surface-3: #262a30;
  --elev: #1a1d22;

  --ink: #f2f3f5;
  --ink-2: #a6acb5;
  --ink-3: #6f757e;
  --ink-inv: #14161a;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --accent: #ff5c3f;
  --accent-hover: #ff7457;
  --accent-soft: rgba(255, 92, 63, 0.14);
  --teal: #4fb8ac;
  --teal-soft: rgba(79, 184, 172, 0.12);
  --gold: #d9a860;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-m: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-l: 0 16px 56px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 8px 28px rgba(255, 92, 63, 0.3);
}

/* ── reset ── */
[hidden] { display: none !important; }
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-clip: content-box; background-color: var(--ink-3); }

/* ── 基础控件 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-full);
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    transform 120ms var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-accent);
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--solid {
  background: var(--ink);
  color: var(--bg);
}
.btn--solid:hover { opacity: 0.86; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }

.btn--quiet {
  background: var(--surface-2);
  color: var(--ink);
}
.btn--quiet:hover { background: var(--surface-3); }

.btn--danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}
.btn--danger:hover { background: var(--accent-soft); }

.btn--sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn--lg { height: 46px; padding: 0 26px; font-size: 14.5px; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  color: var(--ink-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 120ms var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn[disabled] { opacity: 0.4; pointer-events: none; }
.icon-btn.is-on { color: var(--accent); }
.icon-btn.is-on::after {
  content: "";
  position: absolute;
  transform: translateY(13px);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.icon-btn--xs { width: 26px; height: 26px; }
.icon-btn--xs svg { width: 15px; height: 15px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip--accent.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.field {
  display: block;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field::placeholder { color: var(--ink-3); }
textarea.field { height: auto; min-height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.6; }
select.field { appearance: none; background-image: none; cursor: pointer; }

.label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }

.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 骨架屏 */
.ph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-s);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.5s infinite;
}
html[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseRing {
  0% { transform: scale(0.7); opacity: 0.55; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes bar {
  0%, 100% { transform: scaleY(0.28); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
