/* =============================================================
   拾音集 SHIXINJI · 独立音乐精选与分享合集
   · 配色取「黑胶唱片内衬紫 + 烫金标签琥珀」
   · 支持浅色 / 深色 用户自主切换（记忆偏好）
   · 布局：左侧栏 + 主内容（全宽）
   ============================================================= */

/* ---------- 字体 ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700;9..144,800;9..144,900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

/* ============================================================
   Design Tokens — 浅色（默认）
   ============================================================ */
:root,
:root[data-theme="light"] {
  /* 品牌主色：紫罗兰 + 琥珀金（黑胶唱片内衬 + 烫金标签） */
  --brand:      #7C3AED;  /* violet-600 — 音乐主题主色 */
  --brand-600:  #6D28D9;
  --brand-500:  #8B5CF6;  /* 按钮高亮 */
  --brand-100:  #EDE9FE;
  --brand-50:   #F5F3FF;

  --accent:     #F59E0B;  /* amber-500 — 确认/直达 CTA 色（收听语义） */
  --accent-400: #FBBF24;
  --accent-600: #D97706;
  --accent-50:  #FFFBEB;

  --amber:      #CA8A04;  /* yellow-600 — 精选/提醒 */
  --amber-50:   #FFFBEB;
  --rose:       #E11D48;
  --rose-50:    #FFF1F2;

  /* 中性色：暖灰纸张 + 近墨文字（柔和高对比） */
  --bg:         #F6F7FB;
  --bg-alt:     #EEF1F7;
  --surface:    #FFFFFF;
  --surface-2:  #FAFBFE;
  --ink-900:    #0C1222;
  --ink-800:    #1E2640;
  --ink-700:    #334155;
  --ink-600:    #475569;
  --ink-500:    #64748B;
  --ink-400:    #94A3B8;
  --ink-300:    #CBD5E1;
  --ink-200:    #E2E8F0;
  --ink-100:    #F1F5F9;
  --ink-50:     #F8FAFC;

  /* 分割线 / 边框 */
  --line:         rgba(12, 18, 34, 0.07);
  --line-strong:  rgba(12, 18, 34, 0.13);
  --ring:         rgba(124, 58, 237, 0.18);

  /* 阴影：收敛、更有"点击感"、少脏污 */
  --s-xs: 0 1px 2px rgba(12, 18, 34, 0.04), 0 1px 1px rgba(12, 18, 34, 0.03);
  --s-sm: 0 2px 6px rgba(12, 18, 34, 0.05), 0 10px 30px -14px rgba(12, 18, 34, 0.14);
  --s-md: 0 4px 12px rgba(12, 18, 34, 0.06), 0 22px 56px -22px rgba(12, 18, 34, 0.20);
  --s-lg: 0 26px 72px -24px rgba(12, 18, 34, 0.28), 0 10px 30px -14px rgba(12, 18, 34, 0.18);
  --s-card-h: 0 16px 52px -22px rgba(124, 58, 237, 0.30), 0 6px 14px -6px rgba(12, 18, 34, 0.08);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,0.7);

  /* 圆角：下载市场偏"方·稳"，整体略微缩小 — 但卡片保留较大圆角 */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 26px;
  --pill: 999px;

  /* 动效 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 400ms;

  /* 字体 */
  --f-display:  "Fraunces", "Noto Serif SC", "PingFang SC", "Microsoft YaHei", Georgia, serif;
  --f-sans:     "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --f-mono:     "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ============================================================
   Design Tokens — 深色
   ============================================================ */
:root[data-theme="dark"] {
  --brand:      #C4B5FD;  /* violet-300 高亮 */
  --brand-600:  #DDD6FE;
  --brand-500:  #A78BFA;
  --brand-100:  rgba(167, 139, 250, 0.18);
  --brand-50:   rgba(167, 139, 250, 0.10);

  --accent:     #FBBF24;
  --accent-400: #FCD34D;
  --accent-600: #F59E0B;
  --accent-50:  rgba(251, 191, 36, 0.14);

  --amber:      #FACC15;
  --amber-50:   rgba(250, 204, 21, 0.12);
  --rose:       #FB7185;
  --rose-50:    rgba(251, 113, 133, 0.12);

  --bg:         #0A0F1F;
  --bg-alt:     #0D142A;
  --surface:    #121935;
  --surface-2:  #172142;
  --ink-900:    #F3F6FC;
  --ink-800:    #E3E9F5;
  --ink-700:    #CBD5E1;
  --ink-600:    #94A3B8;
  --ink-500:    #64748B;
  --ink-400:    #475569;
  --ink-300:    #334155;
  --ink-200:    #1E293B;
  --ink-100:    #162043;
  --ink-50:     #121935;

  --line:         rgba(255, 255, 255, 0.08);
  --line-strong:  rgba(255, 255, 255, 0.16);
  --ring:         rgba(167, 139, 250, 0.28);

  --s-xs: 0 1px 2px rgba(0,0,0,0.40), 0 1px 1px rgba(0,0,0,0.32);
  --s-sm: 0 2px 10px rgba(0,0,0,0.45), 0 12px 36px -16px rgba(0,0,0,0.60);
  --s-md: 0 6px 18px rgba(0,0,0,0.50), 0 28px 64px -26px rgba(0,0,0,0.70);
  --s-lg: 0 34px 90px -28px rgba(0,0,0,0.75), 0 12px 36px -16px rgba(0,0,0,0.60);
  --s-card-h: 0 18px 60px -26px rgba(167, 139, 250, 0.36), 0 8px 18px -8px rgba(0,0,0,0.45);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ---------- 全局基础 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-sans);
  color: var(--ink-800);
  background: var(--bg);
  line-height: 1.6;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
  transition: background var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}

/* ============================================================
   背景：下载蓝的柔和辉光（Downloadery glow）— 随主题换色
   ============================================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 560px at 100% -10%, rgba(124, 58, 237, 0.18), transparent 62%),
    radial-gradient(820px 560px at -10% 30%, rgba(245, 158, 11, 0.10), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(217, 119, 6, 0.08), transparent 62%);
  filter: saturate(1.05);
}
:root[data-theme="dark"] body::before {
  background:
    radial-gradient(920px 620px at 100% 0%, rgba(196, 181, 253, 0.26), transparent 62%),
    radial-gradient(820px 560px at -10% 30%, rgba(251, 191, 36, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(251, 191, 36, 0.08), transparent 62%);
  filter: saturate(1.15);
}

/* 细粒噪点，营造纸质感 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
:root[data-theme="dark"] body::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.03 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.app { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 276px;
  flex-shrink: 0;
  padding: 28px 22px 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: background var(--t-slow) var(--ease), border-color var(--t-slow) var(--ease);
  overflow-y: auto;
}
/* 玻璃态内发光边缘 */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 12%, transparent) 0%, transparent 35%);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar-brand {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  grid-row: 1 / span 2;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  box-shadow: var(--s-sm), 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent), var(--inset-hi);
  position: relative;
}
.brand-logo::after {
  content: "";
  position: absolute;
  right: -3px; bottom: -3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--surface);
}
.brand-title {
  grid-column: 2; grid-row: 1;
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 17px;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  grid-column: 2; grid-row: 2;
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: 0.01em;
}

/* 视图 Tab 胶囊 */
.side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: var(--bg-alt);
  border-radius: var(--pill);
  border: 1px solid var(--line);
  margin-bottom: 18px;
  position: relative;
}
.side-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-600);
  border-radius: var(--pill);
  cursor: pointer;
  z-index: 1;
  transition: color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.side-tab svg { width: 14px; height: 14px; }
.side-tab:hover { color: var(--ink-800); }
.side-tab.active { color: #fff; }
.side-tabs::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 4px;
  width: calc(50% - 4px);
  left: 4px;
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  border-radius: var(--pill);
  box-shadow: 0 6px 20px -10px var(--brand), var(--inset-hi);
  transition: transform var(--t-base) var(--ease);
  z-index: 0;
}
.side-tabs:has(.side-tab:nth-child(2).active)::before { transform: translateX(100%); }

/* 导航 */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-700);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all var(--t-fast) var(--ease);
}
.nav-item:hover {
  background: var(--bg-alt);
  color: var(--ink-900);
  transform: translateX(1px);
}
.nav-item.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 14%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--brand-600);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 20%, transparent);
}
:root[data-theme="dark"] .nav-item.active { color: var(--brand); }
.nav-item .count {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-500);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  font-weight: 600;
}
.nav-item.active .count {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand-600);
  border-color: color-mix(in srgb, var(--brand) 22%, transparent);
}
:root[data-theme="dark"] .nav-item.active .count { color: var(--brand); }

.nav-topic .topic-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 18%, transparent);
}
.nav-topic .topic-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.nav-divider {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 14px 12px 6px;
  font-weight: 700;
}

.side-empty {
  padding: 24px 12px;
  color: var(--ink-500);
  font-size: 13px;
  text-align: center;
  background: var(--bg-alt);
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
}

/* 侧栏 Footer */
.sidebar-footer {
  margin-top: 16px;
  padding: 16px 12px 4px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-500);
}
.sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 700;
  margin-top: 6px;
}
.sidebar-footer a:hover { color: var(--accent-600); }

/* 主题切换按钮 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: var(--pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: 12.5px;
  transition: all var(--t-base) var(--ease);
  box-shadow: var(--s-xs), var(--inset-hi);
}
.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line-strong));
  box-shadow: var(--s-sm), var(--inset-hi);
  color: var(--brand-600);
}
:root[data-theme="dark"] .theme-toggle:hover { color: var(--brand); }
.theme-toggle svg {
  width: 15px; height: 15px;
  transition: transform var(--t-base) var(--ease);
}
.theme-toggle:hover svg { transform: rotate(-12deg) scale(1.05); }
.theme-toggle .tt-track {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  width: 40px; height: 22px;
  padding: 2px;
  border-radius: var(--pill);
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
  position: relative;
}
.theme-toggle .tt-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
:root[data-theme="dark"] .theme-toggle .tt-thumb {
  transform: translateX(18px);
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

/* ============================================================
   主内容
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 32px 80px;
  position: relative;
  z-index: 1;
}

/* Hero：极窄标题 + 横向巨搜 + 统计磁贴（Downloadery 风格） */
.hero {
  padding: 26px 8px 20px;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--brand-600);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  font-family: var(--f-mono);
}
:root[data-theme="dark"] .hero-eyebrow { color: var(--brand); }
.hero-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.hero-title {
  margin: 14px 0 6px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.022em;
  color: var(--ink-900);
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  font-weight: 900;
}
.hero-sub {
  margin: 0 0 22px;
  color: var(--ink-500);
  font-size: 15px;
  max-width: 720px;
  line-height: 1.75;
}

/* Hero-meta —— Downloadery "下载中心控制面板" 整体容器卡
   —— 搜索框主区 + 4 个横向统计磁贴，表面带渐变与顶部极光条 */
.hero-meta {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
  padding: 16px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand) 7%, var(--surface)) 0%,
      var(--surface) 40%,
      color-mix(in srgb, var(--accent) 6%, var(--surface)) 100%);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--r-2xl) + 2px);
  box-shadow: var(--s-sm), var(--inset-hi);
  overflow: hidden;
}
.hero-meta::before {
  /* 顶部极光条（蓝→青绿渐变） */
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-500) 40%, var(--accent) 80%, var(--accent-400) 100%);
  opacity: 0.9;
  pointer-events: none;
}
.hero-meta::after {
  /* 左下柔光：品牌色弥散光点 */
  content: "";
  position: absolute;
  left: -80px; bottom: -90px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent) 0%, transparent 60%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.hero-meta > * { position: relative; z-index: 1; }

/* ======= 搜索框（Download Control 主控件）：左侧渐变描边 + ⌘K 快捷键 + 图标发光容器 ======= */
.search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 18px;
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--r-xl) + 2px);
  box-shadow: var(--s-xs), var(--inset-hi);
  transition: all var(--t-base) var(--ease);
  position: relative;
  isolation: isolate;
}
.search-box::before {
  /* 渐变描边底层（聚焦/悬浮显现） */
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
  z-index: -1;
  pointer-events: none;
}
.search-box::after {
  /* 聚焦时的外发光环 */
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--r-xl) + 6px);
  background: radial-gradient(120% 200% at 20% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
              radial-gradient(120% 200% at 100% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
  z-index: -2;
  pointer-events: none;
}
.search-box:hover::before,
.search-box:focus-within::before { opacity: 1; }
.search-box:focus-within::after  { opacity: 0.9; }
.search-box:focus-within {
  transform: translateY(-1.5px);
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--brand) 70%, transparent),
              0 0 0 4px var(--ring), var(--inset-hi);
  border-color: transparent;
}
.search-box > .sb-icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--brand) 55%, #fff) 0%, var(--brand) 55%, var(--brand-600) 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 22px -12px var(--brand),
              inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
  overflow: hidden;
}
.search-box > .sb-icon::after {
  content: "";
  position: absolute;
  inset: auto auto -30% -30%;
  width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(255,255,255,0.5), transparent 60%);
}
.search-box > .sb-icon svg { width: 18px; height: 18px; }

.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat left 14px center / 16px;
  padding-left: 40px;
  font-size: 15.5px;
  color: var(--ink-800);
  font-weight: 600;
  font-family: var(--f-sans);
  letter-spacing: 0.002em;
}
.search-box input::placeholder { color: var(--ink-400); font-weight: 400; }

.search-box .sb-kbd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink-500);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, #000 5%, transparent);
  flex-shrink: 0;
  user-select: none;
}
.search-box .sb-kbd kbd {
  all: unset;
  display: inline;
  font-family: inherit;
  font-weight: inherit;
  color: inherit;
  font-size: 10.5px;
}
:root[data-theme="dark"] .search-box .sb-kbd {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink-400);
}
.search-box:focus-within .sb-kbd {
  background: color-mix(in srgb, var(--brand) 10%, var(--bg-alt));
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  color: var(--brand-600);
}
:root[data-theme="dark"] .search-box:focus-within .sb-kbd { color: var(--brand); }

/* ======= 4 个统计磁贴：1 横排 4 格（下载站的"数据概览带"） ======= */
.hero-meta .meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
.meta-stat {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 11px;
  border-radius: calc(var(--r-lg) + 1px);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  color: var(--ink-700);
  box-shadow: var(--s-xs);
  min-width: 0;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base) var(--ease),
              box-shadow var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease),
              background var(--t-base) var(--ease);
  isolation: isolate;
}
.meta-stat::before {
  /* 左上 4 像素的品牌色指示条（data-accent） */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3.5px;
  background: var(--meta-accent, var(--brand));
  opacity: 0.92;
  pointer-events: none;
}
.meta-stat::after {
  /* 右下角柔光（data-accent） */
  content: "";
  position: absolute;
  right: -50%; bottom: -60%;
  width: 180px; height: 180px;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--meta-accent, var(--brand)) 22%, transparent) 0%,
    transparent 60%);
  opacity: 0.75;
  pointer-events: none;
  z-index: -1;
}
.meta-stat:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--meta-accent, var(--brand)) 35%, transparent);
  box-shadow: var(--s-sm),
              0 10px 24px -14px color-mix(in srgb, var(--meta-accent, var(--brand)) 60%, transparent);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--meta-accent, var(--brand)) 5%, var(--surface)) 0%,
      var(--surface) 100%);
}
.meta-stat .ms-icon {
  width: 34px; height: 34px;
  border-radius: 11px;
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--meta-accent, var(--brand)) 14%, var(--surface)) 0%,
      color-mix(in srgb, var(--meta-accent, var(--brand)) 22%, var(--bg-alt)) 100%);
  border: 1px solid color-mix(in srgb, var(--meta-accent, var(--brand)) 24%, transparent);
  color: var(--meta-accent, var(--brand-600));
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  align-self: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform var(--t-fast) var(--ease);
}
:root[data-theme="dark"] .meta-stat .ms-icon {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.meta-stat:hover .ms-icon { transform: rotate(-6deg) scale(1.06); }
.meta-stat .ms-icon svg { width: 16px; height: 16px; }

.meta-stat .stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.meta-stat .label-text {
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--f-mono);
  line-height: 1;
}
.meta-stat .num {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--ink-900);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.meta-stat .ms-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-600);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  line-height: 1.1;
}
:root[data-theme="dark"] .meta-stat .ms-delta { color: var(--accent); }
.meta-stat .ms-delta svg { width: 9px; height: 9px; }

/* 4 个统计项的 data-accent 差异化着色 */
.meta-stat[data-accent="cat"]    { --meta-accent: #8B5CF6; }  /* brand-500 紫 */
.meta-stat[data-accent="topic"]  { --meta-accent: #F59E0B; }  /* accent 琥珀 */
.meta-stat[data-accent="work"]   { --meta-accent: #6366F1; }  /* indigo-500 作品紫 */
.meta-stat[data-accent="star"]   { --meta-accent: #F59E0B; }  /* amber-500 精选金 */

/* 筛选胶囊行 */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--f-mono);
  margin-right: 2px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-600);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  user-select: none;
}
.pill:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line-strong));
  color: var(--brand-600);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .pill:hover { color: var(--brand); }
.pill.active {
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 22px -10px var(--brand);
}
.pill svg { width: 13px; height: 13px; }

/* 分隔头：如「全部作品 · 共 N 个」 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 4px 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 10px;
}
.section-head h2::before {
  content: "";
  width: 4px; height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}
.section-head .meta {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-500);
}

/* ============================================================
   作品卡片：现代卡片（封面 + 标题 + 标签 + 悬浮交互）
   class 约定来自 app.js -> workCardEl()
   ============================================================ */
.cards-grid,
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* -------- 作品卡片（默认卡片视图） -------- */
.work-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
  box-shadow: var(--s-xs);
}
/* 书墙卡片有自己的 3:4 比例与方角，不吃这里的 min-height 与大圆角 */
.work-card:not(.shelf-card) { min-height: 338px; }
.work-card::before {
  /* 顶部极光细条 —— hover 显现（Downloadery：蓝→绿渐变） */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-500), var(--accent));
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
  z-index: 2;
  pointer-events: none;
}
.work-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  box-shadow: var(--s-card-h);
}
.work-card:hover::before { opacity: 1; }

.work-code {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 5;
  padding: 3px 9px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink-800);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--ink-900) 10%, transparent);
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--f-mono);
  letter-spacing: 0.03em;
}

/* 缩略图区（卡片模式：封面大图；列表模式：左方小图） */
.work-head {
  position: relative;
}
.work-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--bg-alt), var(--ink-100));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 44px;
  color: color-mix(in srgb, var(--brand) 55%, var(--ink-300));
}
:root[data-theme="dark"] .work-thumb {
  background: linear-gradient(135deg, var(--surface-2), var(--ink-200));
  color: color-mix(in srgb, var(--brand) 70%, var(--ink-300));
}
.work-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow) var(--ease-out);
}
.work-card:hover .work-thumb img { transform: scale(1.05); }

/* 覆盖在缩略图上的角标（沿用原有 class 约定，在 work-thumb 父级下用绝对定位） */
.work-card > .work-featured-pin,
.work-card .work-featured-pin { display: none; }

/* 标题行 + 标签 主体区 */
.work-title-row {
  padding: 16px 18px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.work-title {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 16.5px;
  line-height: 1.4;
  color: var(--ink-900);
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.work-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--ink-600);
  border: 1px solid var(--line);
  font-family: var(--f-sans);
  letter-spacing: 0.01em;
}
/* 人声类型（两档：人声 / 纯音乐。原 Scratch 站的简单/中等/困难已作废） */
.tag.tag-diff-vocal        { background: var(--brand-50);  color: var(--brand-600); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.tag.tag-diff-instrumental { background: var(--amber-50);  color: var(--amber);     border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.tag.tag-disk         { font-family: var(--f-mono); font-weight: 600; }
.tag.tag-disk[data-d="baidu"]  { background: color-mix(in srgb, #3371c8 10%, var(--surface)); color: #3371c8; border-color: color-mix(in srgb, #3371c8 25%, transparent); }
.tag.tag-disk[data-d="aliyun"] { background: color-mix(in srgb, #FF8C1A 10%, var(--surface)); color: var(--amber); border-color: color-mix(in srgb, #FF8C1A 25%, transparent); }
.tag.tag-disk[data-d="quark"]  { background: color-mix(in srgb, #6366F1 12%, var(--surface)); color: var(--accent-600); border-color: color-mix(in srgb, #6366F1 25%, transparent); }
.tag.tag-disk[data-d="other"]  { background: var(--bg-alt); color: var(--ink-500); }

/* ---------- 资源渠道标签（音乐平台外链 + 网盘） ----------
   渠道定义表见 server/src/dto.js 的 CHANNELS，改那里时这里也要同步。
   class 名由 admin.js 的 channelMeta() 拼出：tag tag-<key>            */
.tag-netease  { background: color-mix(in srgb, #C20C0C 10%, var(--surface)); color: #C20C0C; border-color: color-mix(in srgb, #C20C0C 25%, transparent); }
.tag-spotify  { background: color-mix(in srgb, #1DB954 12%, var(--surface)); color: #12833C; border-color: color-mix(in srgb, #1DB954 28%, transparent); }
.tag-apple    { background: color-mix(in srgb, #FA243C 10%, var(--surface)); color: #C41230; border-color: color-mix(in srgb, #FA243C 25%, transparent); }
.tag-qq       { background: color-mix(in srgb, #31C27C 12%, var(--surface)); color: #14875A; border-color: color-mix(in srgb, #31C27C 28%, transparent); }
.tag-youtube  { background: color-mix(in srgb, #FF0033 10%, var(--surface)); color: #CC0029; border-color: color-mix(in srgb, #FF0033 25%, transparent); }
.tag-bandcamp { background: color-mix(in srgb, #629AA9 14%, var(--surface)); color: #447583; border-color: color-mix(in srgb, #629AA9 28%, transparent); }
.tag-baidu    { background: color-mix(in srgb, #2460E4 10%, var(--surface)); color: #2460E4; border-color: color-mix(in srgb, #2460E4 25%, transparent); }
.tag-aliyun   { background: color-mix(in srgb, #D15900 10%, var(--surface)); color: var(--amber); border-color: color-mix(in srgb, #D15900 25%, transparent); }
.tag-quark    { background: color-mix(in srgb, #1D4FD8 12%, var(--surface)); color: var(--accent-600); border-color: color-mix(in srgb, #1D4FD8 28%, transparent); }
.tag-other    { background: var(--bg-alt); color: var(--ink-500); }

/* 深色态：品牌色底偏暗，前景色要提亮才够对比 */
:root[data-theme="dark"] .tag-netease  { color: #FF8A8A; }
:root[data-theme="dark"] .tag-spotify  { color: #4ADE80; }
:root[data-theme="dark"] .tag-apple    { color: #FF8095; }
:root[data-theme="dark"] .tag-qq       { color: #6EE7B7; }
:root[data-theme="dark"] .tag-youtube  { color: #FF8095; }
:root[data-theme="dark"] .tag-bandcamp { color: #90C4D4; }
:root[data-theme="dark"] .tag-baidu    { color: #93C5FD; }
:root[data-theme="dark"] .tag-aliyun   { color: var(--amber); }
:root[data-theme="dark"] .tag-quark    { color: var(--accent); }

/* 作品描述 */
.work-desc {
  margin: 0;
  padding: 2px 18px 0;
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 元信息行（难度+网盘）：默认隐藏，仅移动端列表模式显示在描述行前 */
.work-meta { display: none; }
.work-meta .wm-size { font-family: var(--f-mono); }

/* 标题行内联文件大小 */
.work-size-inline {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-400);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 2px;
}

/* 底部：信息 + 获取按钮 */
.work-footer {
  margin-top: auto;
  padding: 14px 18px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.work-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-400);
}
.work-info > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--pill);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink-500);
  white-space: nowrap;
}
.work-info svg { width: 12px; height: 12px; color: var(--ink-400); }

/* 直达提示 */
.direct-tip {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  color: var(--accent-600) !important;
  background: var(--accent-50) !important;
  border-color: color-mix(in srgb, var(--accent) 22%, transparent) !important;
  font-weight: 700;
}
:root[data-theme="dark"] .direct-tip { color: var(--accent) !important; }
.direct-tip svg { color: var(--accent) !important; }

/* 下载按钮：直角实心主色。
   改成方形是有意的 —— 圆角胶囊会和书脊封面抢视觉，方的才像「书脊上贴的标签」。 */
.btn-get {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--brand);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--brand) 55%, transparent);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-get:hover {
  background: var(--brand-600);
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 60%, transparent);
}
/* 直达（单网盘无提取码）：换青绿，一眼区分「点了直接开」和「点了弹选择」 */
.btn-get.free.is-direct {
  background: var(--accent-600);
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn-get.free.is-direct:hover { background: var(--accent-400); }
.btn-get svg { width: 15px; height: 15px; }

/* 专题详情：头部横幅 */
.topic-hero {
  padding: 28px 30px;
  border-radius: var(--r-2xl);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent, #6366F1) 18%, var(--surface)) 0%, var(--surface) 60%),
    var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--s-sm);
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 26px;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.topic-hero::after {
  content: "";
  position: absolute;
  right: -80px; top: -80px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 26%, transparent), transparent 60%);
  filter: blur(10px);
  opacity: 0.6;
}
.topic-cover {
  position: relative;
  z-index: 1;
  width: 180px; height: 120px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-alt), var(--ink-100));
  border: 1px solid var(--line-strong);
  box-shadow: var(--s-sm);
}
.topic-cover img { width: 100%; height: 100%; object-fit: cover; }
.topic-info { position: relative; z-index: 1; min-width: 0; }
.topic-info h1 {
  margin: 0 0 8px;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 30px;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.topic-info p {
  margin: 0 0 10px;
  color: var(--ink-500);
  font-size: 13.5px;
  line-height: 1.75;
}
.topic-info .ti-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-500);
}
.topic-info .ti-meta .chip {
  padding: 3px 10px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-weight: 600;
}

/* 专题集合：卡片网格 + 列表视图（class 来自 app.js 专题集合渲染） */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.topic-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
  box-shadow: var(--s-xs);
  display: flex;
  flex-direction: column;
}
.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--s-card-h);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}

.topic-card .topic-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: linear-gradient(135deg, var(--bg-alt), var(--ink-100));
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topic-card .topic-cover::after {
  /* 顶部色条 */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent, linear-gradient(90deg, var(--brand), var(--accent)));
}
.topic-card .topic-cover.topic-cover-color {
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent, var(--brand)) 42%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent, var(--brand)) 22%, var(--surface)) , var(--bg-alt));
}
.topic-card .topic-cover img { width: 100%; height: 100%; object-fit: cover; }
.topic-card .topic-cover-emoji {
  font-size: 46px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.1));
}
.topic-card .topic-featured-badge {
  position: absolute;
  top: 12px; right: 12px;
  padding: 4px 10px;
  border-radius: var(--pill);
  background: linear-gradient(145deg, var(--amber), #b45309);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  z-index: 3;
  display: inline-flex; align-items: center; gap: 4px;
  box-shadow: 0 6px 14px -4px rgba(217, 119, 6, 0.6);
}
.topic-card .topic-featured-badge svg { width: 12px; height: 12px; }

.topic-card .topic-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.topic-card .topic-title {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 17px;
  color: var(--ink-900);
  line-height: 1.35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topic-card .topic-title .topic-code {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent-600);
  background: var(--accent-50);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  flex-shrink: 0;
}
.topic-card .topic-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.65;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.topic-card .topic-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--ink-500);
  font-family: var(--f-mono);
}
.topic-card .topic-meta > span:first-child {
  display: inline-flex; align-items: center; gap: 6px;
}
.topic-card .topic-meta svg { width: 13px; height: 13px; color: var(--ink-400); }
.topic-card .topic-enter {
  font-weight: 700;
  color: var(--brand-600);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
:root[data-theme="dark"] .topic-card .topic-enter { color: var(--brand); }
.topic-card .topic-enter svg { color: inherit; width: 13px; height: 13px; }

/* 空态 */
.empty-state {
  padding: 80px 20px;
  text-align: center;
  color: var(--ink-500);
}
.empty-state .es-icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 24px;
  background: var(--bg-alt);
  border: 1px dashed var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 32px;
  color: var(--ink-400);
}
.empty-state h3 {
  margin: 0 0 6px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--ink-800);
}
.empty-state p { margin: 0; font-size: 13px; line-height: 1.7; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-top: 32px;
  padding: 14px 20px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--s-xs), var(--inset-hi);
  flex-wrap: wrap;
}
/* 左：区间信息 */
.pg-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-500);
  white-space: nowrap;
}
.pg-meta .pg-range {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.pg-meta .pg-sep { opacity: 0.4; }
/* 右：控件组 */
.pg-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pg-pages {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pg-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-700);
  cursor: pointer;
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: 13px;
  transition: transform var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: var(--inset-hi);
}
.pg-btn svg { width: 14px; height: 14px; }
.pg-btn:hover:not(:disabled):not(.active) {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line-strong));
  color: var(--brand-600);
  background: var(--brand-50);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .pg-btn:hover:not(:disabled):not(.active) {
  color: var(--brand);
  background: var(--brand-50);
}
.pg-btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}
.pg-btn.active {
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px -8px var(--brand);
  font-weight: 800;
}
.pg-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}
.pg-ellipsis {
  min-width: 28px;
  text-align: center;
  color: var(--ink-400);
  font-family: var(--f-mono);
  font-size: 13px;
  user-select: none;
}

/* 跳页输入框：宽窄都顺手，聚焦时用主色描边提示「可以打字了」 */
.pg-jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.pg-jump-label { font-size: 12px; color: var(--ink-500); }
.pg-jump-input {
  width: 48px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-alt);
  color: var(--ink-900);
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.pg-jump-input::placeholder { color: var(--ink-400); font-weight: 500; }
.pg-jump-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--ring);
}
/* 去掉 number 输入框的上下箭头：页码用键盘输入更顺手 */
.pg-jump-input::-webkit-outer-spin-button,
.pg-jump-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pg-jump-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.pg-jump-input:focus-visible { outline: none; }

/* 移动端：堆叠居中、放大触控、隐藏首末页跳转节省空间 */
@media (max-width: 640px) {
  .pagination {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 14px;
  }
  .pg-meta { font-size: 11.5px; gap: 6px; }
  .pg-meta .pg-range { font-size: 13px; }
  .pg-btn {
    min-width: 40px;
    height: 40px;
    font-size: 13.5px;
  }
  .pg-first, .pg-last { display: none; }
  /* 跳页整块独占一行，不挤在页码按钮里 */
  .pg-jump {
    margin-left: 0;
    padding-left: 0;
    padding-top: 10px;
    border-left: none;
    border-top: 1px solid var(--line);
    width: 100%;
    justify-content: center;
  }
  .pg-jump-input { width: 56px; height: 36px; font-size: 14px; }
}
/* 尊重「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  .pg-btn { transition: none; }
  .pg-btn:hover:not(:disabled):not(.active) { transform: none; }
}

/* ============================================================
   模态框：获取链接
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--t-base) var(--ease-out);
}
:root[data-theme="dark"] .modal-mask { background: rgba(5, 8, 20, 0.72); }
.modal-mask.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  border-radius: var(--r-2xl);
  box-shadow: var(--s-lg);
  overflow: hidden;
  animation: popIn 360ms var(--ease-out);
  border: 1px solid var(--line-strong);
  position: relative;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--amber));
}
.modal-head {
  padding: 22px 26px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.modal-head h3 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 19px;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  min-width: 0;
  line-height: 1.3;
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 18px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--t-fast) var(--ease);
}
.modal-close:hover {
  background: var(--rose-50);
  color: var(--rose);
  border-color: color-mix(in srgb, var(--rose) 25%, transparent);
  transform: rotate(90deg);
}

.modal-body { padding: 24px 26px; display: flex; flex-direction: column; gap: 16px; }
.modal-meta {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--bg-alt);
  border: 1px solid var(--line);
}
.modal-meta .mm-cover {
  width: 68px; height: 68px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--accent-600));
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-display);
  font-weight: 900;
  color: #fff;
  font-size: 24px;
}
.modal-meta .mm-cover img { width: 100%; height: 100%; object-fit: cover; }
.modal-meta .mm-info { min-width: 0; flex: 1; }
.modal-meta .mm-info .mm-t {
  font-weight: 700; color: var(--ink-900); font-size: 14.5px; line-height: 1.4; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.modal-meta .mm-info .mm-d {
  font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-500);
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* ============================================================
   曲目资源渠道卡（js/app.js openWorkModal 渲染）
   ------------------------------------------------------------
   ⚠️ 这套类名（netdisk-card / copy-btn / modal-tips / nd-link-row …）
   此前在 CSS 里**完全没有定义**，只有更早版本的旧结构
   （.nd-list / .nd-item / .nd-btn，见下）。结果是前台点开曲目的
   「资源链接」弹窗会渲染成无样式的裸 HTML。
   本次改造补齐，两个结构并存互不影响。
   ============================================================ */
.netdisk-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.nd-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nd-link {
  flex: 1;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--f-sans);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.copy-btn:hover { border-color: var(--brand); color: var(--brand-600); }
.copy-btn.copied {
  background: var(--accent-50);
  border-color: var(--accent);
  color: var(--accent-600);
}
.nd-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nd-code-label {
  font-size: 11.5px;
  color: var(--ink-400);
  flex-shrink: 0;
}
.nd-code {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-600);
  letter-spacing: 0.08em;
}
.modal-tips {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-600);
}
.modal-tips ol { margin: 6px 0 0; padding-left: 20px; }
.modal-tips li { margin-top: 3px; }
:root[data-theme="dark"] .nd-code { color: var(--brand); }

/* ---------- 旧结构：.nd-list / .nd-item / .nd-btn（保留，勿删） ---------- */
.nd-list {
  display: flex; flex-direction: column; gap: 10px;
}
.nd-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--s-xs);
  transition: all var(--t-fast) var(--ease);
}
.nd-item:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line-strong));
  transform: translateY(-1px);
}
.nd-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.nd-type[data-d="baidu"]  { background: color-mix(in srgb, #3371c8 12%, var(--surface)); color: #3371c8; border: 1px solid color-mix(in srgb, #3371c8 25%, transparent); }
.nd-type[data-d="aliyun"] { background: color-mix(in srgb, #FF8C1A 12%, var(--surface)); color: var(--amber); border: 1px solid color-mix(in srgb, #FF8C1A 25%, transparent); }
.nd-type[data-d="quark"]  { background: color-mix(in srgb, #6366F1 14%, var(--surface)); color: var(--accent-600); border: 1px solid color-mix(in srgb, #6366F1 25%, transparent); }
.nd-type[data-d="other"]  { background: var(--bg-alt); color: var(--ink-600); border: 1px solid var(--line-strong); }
.nd-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.nd-info .nd-url {
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nd-info .nd-code {
  font-size: 11.5px; color: var(--ink-500);
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.nd-info .nd-code code {
  font-family: var(--f-mono);
  padding: 2px 8px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--brand-600);
  font-weight: 700;
  letter-spacing: 0.05em;
}
:root[data-theme="dark"] .nd-info .nd-code code { color: var(--brand); }
.nd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--pill);
  border: none;
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  box-shadow: 0 8px 22px -10px var(--brand);
  white-space: nowrap;
  font-family: var(--f-sans);
}
.nd-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px var(--brand); }
.nd-btn svg { width: 13px; height: 13px; }

.toast {
  padding: 8px 16px;
  border-radius: var(--pill);
  background: var(--ink-900);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--s-lg);
  animation: fadeIn 200ms var(--ease-out);
}
:root[data-theme="dark"] .toast { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-900); }

/* ============================================================
   返回顶部
   ============================================================ */
.to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 46px; height: 46px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--brand-600);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all var(--t-base) var(--ease);
  z-index: 50;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--s-sm), var(--inset-hi);
}
:root[data-theme="dark"] .to-top { color: var(--brand); }
.to-top:hover {
  background: linear-gradient(145deg, var(--brand), var(--accent-600));
  color: #fff;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 14px 34px -12px var(--brand);
}
.to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ============================================================
   移动端
   ============================================================ */
/* 移动端置顶栏：横跨全宽 fixed，菜单 + 标题 + 主题切换 */
.top-nav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  height: 52px;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--s-xs);
}
.mobile-nav-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  box-shadow: var(--s-sm), var(--inset-hi);
}
.nav-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink-600);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.nav-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.nav-btn:hover { background: var(--bg-alt); color: var(--ink-900); }
.nav-btn:active { transform: scale(0.94); }
.nav-btn.active { background: var(--bg-alt); color: var(--ink-900); }
.nav-theme-icon, .nav-view-icon, .nav-sort-icon { display: inline-flex; align-items: center; }
.nav-search {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
}
.nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--bg-alt);
  color: var(--ink-900);
  font-size: 14px;
  font-family: var(--f-sans);
  outline: none;
}
.nav-search input:focus { border-color: var(--brand); background: var(--surface); }
/* 搜索激活：标题隐藏，搜索条显示 */
.top-nav.search-active .nav-title { display: none; }
.top-nav.search-active .nav-search { display: flex; }
.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 25;
}
.sidebar-mask.visible { display: block; }

/* ======= Hero-meta 响应式 =======
   ≥1280 ：默认 —— 左搜索（1.45fr）+ 右 4 格（1fr）
   ≤1280 ：搜索框在上独占一行，下排 4 格横向 1×4
   ≤980  ：下排 2×2 更宽松
   ≤720  ：hero-meta padding 收窄；搜索框 sb-kbd 隐藏；下排 2×2；字体略缩
*/
@media (max-width: 1280px) {
  .hero-meta {
    grid-template-columns: 1fr;
  }
  .hero-meta .meta-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .hero-meta .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-stat .num { font-size: 20px; }
}
@media (max-width: 720px) {
  .hero-meta { padding: 12px; gap: 12px; }
  .search-box { padding: 12px 12px 12px 14px; gap: 10px; }
  .search-box > .sb-icon { width: 36px; height: 36px; border-radius: 11px; }
  .search-box > .sb-icon svg { width: 16px; height: 16px; }
  .search-box input { font-size: 14.5px; }
  .search-box .sb-kbd { display: none; }
  .meta-stat { padding: 9px 10px; gap: 8px; }
  .meta-stat .ms-icon { width: 32px; height: 32px; border-radius: 10px; }
  .meta-stat .ms-icon svg { width: 14px; height: 14px; }
  .meta-stat .num { font-size: 19px; }
  .meta-stat .label-text { font-size: 10.5px; }
  .meta-stat .ms-delta { font-size: 9.5px; }
}
@media (max-width: 960px) {
  /* 移除 .app 的层叠上下文，让 sidebar(z=20) 能高于 mask(z=15) */
  .app { z-index: auto; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-105%);
    transition: transform var(--t-base) var(--ease);
    width: 88%;
    max-width: 320px;
    box-shadow: var(--s-lg);
    /* 抽屉模式改用实心底色 —— 桌面毛玻璃在移动端抽屉会被遮挡层双重模糊，
       菜单项文字可读性严重下降，且部分浏览器不支持 backdrop-filter */
    background: var(--surface) !important;
    background-color: var(--surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-right: 1px solid var(--line);
    z-index: 30;
  }
  .sidebar::before { display: none; }
  .sidebar.mobile-open { transform: translateX(0); }
  .top-nav { display: flex; }
  .sidebar-mask {
    background: rgba(11, 18, 32, 0.5);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .main { padding: 10px 18px 80px; }
  .hero { padding: 14px 2px 16px; }
  .hero-title { display: none; }
  /* 移动端移除 category-header（搜索/视图/主题已并入置顶栏） */
  .category-header { display: none !important; }
  /* hero 内的搜索框在移动端不再显示，改用置顶栏搜索按钮 */
  .top-bar > .search-box { display: none; }
  .topic-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }
  .topic-cover { width: 100%; height: 160px; }
}

/* ============================================================
   手机端随机推荐滑块（仅 ≤960px 显示）
   设计：单卡聚焦 + 两侧 peek + transform 翻页 + 自动轮播
   ============================================================ */
.mobile-slider {
  display: none;
}
@media (max-width: 960px) {
  .mobile-slider {
    display: block;
    position: relative;
    z-index: 5;
    margin-top: calc(52px + env(safe-area-inset-top));
    padding: 14px 0 16px;
  }

  /* —— 视口 + 轨道 —— */
  .ms-viewport {
    overflow: hidden;
    border-radius: 0;
  }
  .ms-track {
    display: flex;
    gap: 0;
    will-change: transform;
    transition: transform 320ms cubic-bezier(0.25, 1, 0.5, 1);
  }
  .ms-track.no-transition {
    transition: none;
  }

  /* —— 单张 slide：85% 视口宽，两侧露出 peek —— */
  .ms-slide {
    flex: 0 0 85%;
    max-width: 340px;
    min-width: 240px;
    padding: 0 6px;
    box-sizing: border-box;
    cursor: pointer;
  }
  .ms-slide-inner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--s-sm);
    overflow: hidden;
    transition: transform 200ms cubic-bezier(0.25, 1, 0.5, 1),
                box-shadow 200ms cubic-bezier(0.25, 1, 0.5, 1);
  }
  .ms-slide.is-active .ms-slide-inner {
    transform: scale(1.015);
    box-shadow: 0 4px 20px -4px rgba(12, 18, 34, 0.12), var(--s-sm);
  }

  /* —— 渐变横幅 —— */
  .ms-banner {
    position: relative;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 55%, #000) 100%);
    overflow: hidden;
  }
  .ms-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
  }
  .ms-banner-title {
    position: relative;
    z-index: 1;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    padding: 0 10px;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .ms-banner-code {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 10px;
    font-family: var(--f-mono);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.18);
    padding: 2px 7px;
    border-radius: 6px;
    z-index: 1;
  }
  .ms-banner-featured {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 9.5px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 8px;
    border-radius: 6px;
    z-index: 1;
  }

  /* —— 正文区 —— */
  .ms-slide-body {
    padding: 10px 14px 12px;
  }
  .ms-slide-desc {
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-600, var(--ink-700));
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
  }

  /* —— 底部操作行 —— */
  .ms-slide-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .ms-slide-chips {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .ms-chip {
    font-size: 10.5px;
    padding: 3px 8px;
    border-radius: 7px;
    background: var(--bg-alt);
    color: var(--ink-700);
    border: 1px solid var(--line);
    white-space: nowrap;
  }
  /* 与书墙卡片的 .btn-get 保持同一套视觉：方角、实心、直达用青绿区分 */
  .ms-slide-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--r-md);
    border: none;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--brand) 55%, transparent);
    cursor: pointer;
    transition: transform 100ms ease-out;
  }
  .ms-slide-btn.is-direct {
    background: var(--accent-600);
    box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent);
  }
  .ms-slide-btn svg { width: 14px; height: 14px; }
  .ms-slide-btn:active {
    transform: scale(0.95);
  }

  /* —— 进度条指示器 —— */
  .ms-progress {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 10px 14px 0;
  }
  .ms-bar {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    background: var(--line-strong, var(--line));
    overflow: hidden;
    position: relative;
    cursor: pointer;
  }
  .ms-bar-fill {
    position: absolute;
    inset: 0;
    transform: scaleX(0);
    transform-origin: left center;
    background: var(--brand);
    transition: transform 100ms linear;
  }
  .ms-bar.is-active {
    width: 36px;
  }
  .ms-bar.is-active .ms-bar-fill {
    transition: transform 4000ms linear;
    transform: scaleX(1);
  }
  .ms-bar.is-done .ms-bar-fill {
    transform: scaleX(1);
    transition: none;
  }

  /* —— 翻页箭头 —— */
  .ms-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-700);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--s-sm);
    transition: opacity 200ms ease, transform 100ms ease-out;
  }
  .ms-arrow:active {
    transform: translateY(-50%) scale(0.92);
  }
  .ms-arrow.is-prev {
    left: 8px;
  }
  .ms-arrow.is-next {
    right: 8px;
  }
  .ms-arrow.is-hidden {
    opacity: 0;
    pointer-events: none;
  }
  .ms-arrow svg {
    width: 14px;
    height: 14px;
  }

  /* —— 入场动效 —— */
  .ms-slide-inner {
    animation: msFadeIn 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .ms-slide:nth-child(2) .ms-slide-inner { animation-delay: 80ms; }
  .ms-slide:nth-child(3) .ms-slide-inner { animation-delay: 160ms; }
  @keyframes msFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* —— reduced motion —— */
  @media (prefers-reduced-motion: reduce) {
    .ms-track { transition: none; }
    .ms-slide-inner { animation: none; }
    .ms-bar.is-active .ms-bar-fill { transition: none; }
  }
}

/* 入场动效 —— 卡片错峰淡入 */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.work-card, .topic-card, .stat-card, .panel, .modal { animation: riseIn 460ms var(--ease-out) both; }
.work-card:nth-child(4n+1), .topic-card:nth-child(4n+1) { animation-delay: 0.02s; }
.work-card:nth-child(4n+2), .topic-card:nth-child(4n+2) { animation-delay: 0.06s; }
.work-card:nth-child(4n+3), .topic-card:nth-child(4n+3) { animation-delay: 0.10s; }
.work-card:nth-child(4n+4), .topic-card:nth-child(4n+4) { animation-delay: 0.14s; }

/* ============================================================
   顶部工具条 / 分类头 / 筛选栏 / 视图切换控件（Downloadery 体系）
   ============================================================ */
.top-bar {
  padding: 6px 2px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 5%, transparent), transparent 80%);
  border-radius: var(--r-2xl);
  position: relative;
}
.top-bar > .hero-title {
  margin: 4px 0 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.15;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}
.top-bar > .hero-title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.top-bar > .hero-sub { margin: 2px 0 0; }

/* 旧的 meta-stat 单行样式兜底（防别处用到） */
.hero-meta .meta-stat { margin: 0; }

/* 筛选栏（难度 + 网盘） */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xs);
}
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--pill);
}
.filter-group .filter-label {
  padding: 0 6px 0 12px;
  margin: 0;
  font-size: 11px;
}
.filter-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: calc(var(--pill) - 4px);
  color: var(--ink-600);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--f-sans);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  user-select: none;
}
.filter-btn:hover { color: var(--brand-600); }
:root[data-theme="dark"] .filter-btn:hover { color: var(--brand); }
.filter-btn.active {
  background: linear-gradient(145deg, var(--brand), var(--brand-500));
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--brand);
}

/* 分类 / 专题详情头（与 .filter-bar 样式一致） */
.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px;
  margin: 2px 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xs);
}
.category-header h3 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18.5px;
  color: var(--ink-900);
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; gap: 12px;
}
.category-header .cat-desc {
  font-size: 13px;
  color: var(--ink-500);
  margin-left: 2px;
}
.category-header .cat-right {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  justify-content: flex-end;
}
.cat-count {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-500);
  padding: 5px 12px;
  border-radius: var(--pill);
  background: var(--bg-alt);
  border: 1px solid var(--line);
}
.cat-back-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-600);
  background: var(--brand-50);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
:root[data-theme="dark"] .cat-back-link { color: var(--brand); }
.cat-back-link:hover { transform: translateY(-1px); }
.cat-back-link svg { width: 13px; height: 13px; }

/* ============================================================
   作品卡（仿书本）—— .shelf-mode
   卡面 3:4（竖版书本轮廓），上部封面图 4:3（截图原比例，完整不裁切）
   下部文字区放标题 / 标签 / 简介 / 属性；整卡是一个链接，无按钮
   方角、无圆角：书本的硬边比圆角卡片更像「一册在架上的书」
   所有颜色走 var(--*)，随深浅色切换
   ============================================================ */
.works-grid.shelf-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 22px 20px;
  align-items: stretch;
}

.shelf-card {
  display: flex;
  flex-direction: column;
  aspect-ratio: 3 / 4;
  min-height: 0;
  /* 方角 —— 书本没有圆角 */
  border-radius: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--s-xs);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}
.shelf-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 28%, transparent);
  box-shadow: var(--s-card-h);
}
/* 键盘焦点必须看得见 —— 整卡是链接，没有按钮可以兜底 */
.shelf-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* —— 上部封面图区：4:3，截图原比例完整保留 —— */
.cover-art {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 浅灰底：既是无图时的占位色板，也顺手接住少数非 4:3 图 letterbox 出的细边 */
  background: #eef0f2;
}
:root[data-theme="dark"] .cover-art { background: #161c24; }
/* 细网格纹理：占位封面才显示，给「未拆封的教材」一点纸感 */
.cover-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, currentColor 1px, transparent 1px),
    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 22px 22px;
  color: hsl(var(--cover-hue, 210) 40% 62%);
  opacity: 0;
}
:root[data-theme="dark"] .cover-art::before {
  color: hsl(var(--cover-hue, 210) 45% 60%);
}
.cover-art.no-cover::before { opacity: 0.16; }

/* 截图按原比例完整呈现：contain 而不是 cover，避免裁掉画面文字 */
.cover-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--t-slow) var(--ease-out);
}
.shelf-card:hover .cover-art img { transform: scale(1.03); }

.cover-first {
  position: absolute;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 62px;
  line-height: 1;
  color: hsl(var(--cover-hue, 210) 38% 55%);
  opacity: 0;
  pointer-events: none;
  user-select: none;
}
:root[data-theme="dark"] .cover-first { color: hsl(var(--cover-hue, 210) 45% 62%); }
.cover-art.no-cover .cover-first { opacity: 1; }

/* —— 封面角标：左上分类、右上编号（像书脊上的烫印标记） —— */
.cover-badge {
  position: absolute;
  top: 0;
  z-index: 2;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(12, 18, 34, 0.72);
  pointer-events: none;
  white-space: nowrap;
}
:root[data-theme="dark"] .cover-badge { background: rgba(0, 0, 0, 0.66); }
.cover-badge-cat {
  left: 0;
  font-family: var(--f-sans);
}
.cover-badge-code {
  right: 0;
  font-family: var(--f-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.shelf-card:hover .cover-badge { background: rgba(12, 18, 34, 0.84); }
:root[data-theme="dark"] .shelf-card:hover .cover-badge { background: rgba(0, 0, 0, 0.8); }

/* —— 正文区：标题 / 标签 / 简介 / 属性（属性沉到最底部，像版权页的小字） —— */
.shelf-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 13px 12px;
  flex: 1;
  /* 卡面固定 3:4，窄屏时文字区被压矮；
     min-height:0 + overflow:hidden 让简介可收缩并按行数省略，不会被切出半行 */
  min-height: 0;
  overflow: hidden;
}
.shelf-title {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink-900);
  /* 标题比简介更重要，空间不够时先压简介 */
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shelf-card:hover .shelf-title { color: var(--brand-600); }
.shelf-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}
.shelf-tags:empty { display: none; }
.shelf-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-500);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* 简介是唯一可被压缩的项：窄屏下优先牺牲它，超出按行数省略 */
  flex-shrink: 1;
  min-height: 0;
}
.shelf-desc.is-empty { color: var(--ink-400); font-style: normal; }

/* 属性行：贴在正文底部，上方留一道细分割线 */
.work-attrs {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 9px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-500);
  /* 空间紧张时优先压缩简介，属性行必须保住 */
  flex-shrink: 0;
}
.work-attrs > span { white-space: nowrap; }
.sa-diff { font-weight: 600; }
.sa-diff.tag-diff-vocal        { color: var(--brand-600); }
.sa-diff.tag-diff-instrumental { color: var(--amber); }
.sa-size, .sa-views { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-400); }

/* 尊重「减少动效」偏好：封面不再缩放、卡片不再抬升 */
@media (prefers-reduced-motion: reduce) {
  .shelf-card,
  .shelf-card:hover { transform: none; transition: none; }
  .shelf-card:hover .cover-art img { transform: none; }
}

/* 专题列表视图 */
.topics-grid.list-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.topics-grid.list-mode .topic-card {
  flex-direction: row;
  align-items: stretch;
  min-height: 116px;
  padding: 10px 18px 10px 10px;
  gap: 18px;
  border-radius: var(--r-lg);
}
.topics-grid.list-mode .topic-card:hover { transform: translateX(2px); }
.topics-grid.list-mode .topic-card .topic-cover::after {
  top: 0; bottom: 0; left: 0; right: auto;
  width: 4px; height: auto;
}
.topics-grid.list-mode .topic-card .topic-cover {
  aspect-ratio: auto;
  width: 168px;
  min-width: 168px;
  height: 96px;
  border-radius: var(--r-md);
  margin-left: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.topics-grid.list-mode .topic-card .topic-body {
  padding: 4px 0;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.topics-grid.list-mode .topic-card .topic-title {
  font-size: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topics-grid.list-mode .topic-card .topic-desc { -webkit-line-clamp: 2; }
.topics-grid.list-mode .topic-card .topic-meta {
  padding: 0 0 0 14px;
  border: none;
  border-left: 1px dashed var(--line);
  margin: 0;
  width: 200px;
  min-width: 200px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  border-top: none;
  margin-top: 0;
}

/* ============================================================
   响应式：手机布局（≤640px）
   —— UICraft adapt 原则：内容优先、触摸友好、安全区适配
   ============================================================ */
@media (max-width: 640px) {
  /* —— 主内容区 —— */
  .main { padding: 8px 14px 90px; }

  /* —— Hero / 顶部工具条 —— */
  .top-bar {
    padding: 4px 0 10px;
    margin-bottom: 10px;
    gap: 10px;
    border-radius: var(--r-lg);
  }
  .top-bar > .hero-title {
    font-size: 24px;
    line-height: 1.18;
  }
  .top-bar > .hero-sub {
    font-size: 13px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
  }

  /* —— 统计磁贴 + hero-meta：移动端隐藏 —— */
  .hero-meta { display: none; }
  /* —— 副标题：移动端隐藏 —— */
  .hero-sub { display: none; }

  /* —— 筛选栏：单行紧凑，隐藏标签 + 弹性分配宽度 —— */
  .filter-bar {
    gap: 6px;
    padding: 4px;
    flex-wrap: nowrap;
    border-radius: var(--r-lg);
  }
  .filter-group {
    flex: 1;
    padding: 2px;
    gap: 2px;
    justify-content: center;
  }
  .filter-label { display: none; }
  .filter-btn {
    flex: 1;
    padding: 6px 2px;
    font-size: 11px;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* —— 分类头：与筛选栏移动端样式一致 —— */
  .category-header {
    gap: 6px;
    padding: 4px;
    flex-wrap: nowrap;
    border-radius: var(--r-lg);
    margin: 0 0 12px;
  }
  .category-header h3 { display: none; }
  .category-header .cat-desc { display: none; }
  .category-header .cat-right { flex-shrink: 0; gap: 8px; }
  .category-header .search-box {
    flex: 1 1 0;
    min-width: 0;
  }

  /* —— 作品书墙：手机两列，封面与文字都收窄 —— */
  .cards-grid,
  .works-grid.shelf-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
  }

  /* —— 作品卡片：紧凑化（书墙卡 .shelf-card 有自己的 3:4 比例与方角，不受此影响） —— */
  .work-card:not(.shelf-card) {
    min-height: 0;
    border-radius: var(--r-lg);
  }
  .work-card::before { height: 2px; }
  .work-info { padding: 10px 12px 12px; gap: 6px; }
  .work-title {
    font-size: 13.5px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .work-tags { gap: 4px; }
  .work-tag {
    font-size: 10px;
    padding: 2px 7px;
  }
  .work-footer {
    padding: 8px 12px 10px;
    gap: 4px;
  }
  .work-difficulty { font-size: 10px; padding: 2px 8px; }
  .work-source-btn {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: var(--pill);
  }

  /* —— 书墙卡片：窄屏收紧内边距，封面角标缩小 —— */
  .shelf-body { padding: 9px 10px 10px; gap: 5px; }
  .shelf-title { font-size: 13px; line-height: 1.38; }
  .shelf-desc {
    font-size: 11.5px;
    line-height: 1.58;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .shelf-tags .tag { font-size: 10px; padding: 2px 7px; }
  .work-attrs { font-size: 10.5px; gap: 2px 7px; padding-top: 7px; }
  .sa-size, .sa-views { font-size: 10px; }
  .cover-first { font-size: 48px; }
  .cover-badge { font-size: 9.5px; padding: 2px 6px; }

  /* —— 列表视图：窄屏隐藏首字方块，其余同桌面端 grid 布局 —— */
  .topics-grid.list-mode .topic-card {
    min-height: 0;
    padding: 8px 10px 8px 8px;
    gap: 4px 10px;
  }
  .topics-grid.list-mode .topic-card:nth-child(even) { background: var(--surface-2); }
  .topics-grid.list-mode .topic-card .topic-cover::after {
    top: 0; bottom: 0; left: 0; right: auto;
    width: 4px; height: auto;
  }
  .topics-grid.list-mode .topic-card .topic-cover {
    width: 84px;
    min-width: 84px;
    aspect-ratio: auto;
    height: 84px;
    margin-left: 0;
    margin-top: 0;
    border-radius: var(--r-md);
  }
  .topics-grid.list-mode .topic-card .topic-meta {
    padding: 0 0 0 8px;
    gap: 6px;
  }

  /* —— 专题卡片 —— */
  .topic-card { border-radius: var(--r-lg); }
  .topic-cover { height: 120px; }
  .topic-title { font-size: 15px; }
  .topic-desc { font-size: 12px; -webkit-line-clamp: 2; }

  /* —— 返回顶部：安全区 + 更大触摸区 —— */
  .to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    width: 48px; height: 48px;
    border-radius: 14px;
  }

  /* —— 置顶栏按钮：小屏 44px 触摸 + 紧凑 padding —— */
  .top-nav { padding: 0 6px; gap: 8px; }
  .mobile-nav-toggle { width: 44px; height: 44px; border-radius: 12px; }
  .nav-btn { width: 44px; height: 44px; border-radius: 12px; }

  /* —— 抽屉侧边栏：安全区适配 —— */
  .sidebar {
    width: min(82vw, 300px);
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  /* —— 入场动画：手机端减少延迟 —— */
  .work-card, .topic-card { animation-duration: 300ms; }
  .work-card:nth-child(4n+1) { animation-delay: 0s; }
  .work-card:nth-child(4n+2) { animation-delay: 0.03s; }
  .work-card:nth-child(4n+3) { animation-delay: 0.06s; }
  .work-card:nth-child(4n+4) { animation-delay: 0.09s; }

  /* —— 搜索框：紧凑 —— */
  .search-box { padding: 8px 10px; gap: 8px; border-radius: var(--r-lg); }
  .search-box input { font-size: 14px; padding-left: 34px; background-position: left 10px center; }
  .search-box .sb-kbd { display: none; }
}

/* ============================================================
   响应式：小屏手机（≤400px）
   —— 极简模式：单列卡片、最小间距
   ============================================================ */
@media (max-width: 400px) {
  .main { padding: 6px 12px 80px; }

  .cards-grid,
  .works-grid.shelf-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .top-bar > .hero-title { font-size: 21px; }
  .top-bar > .hero-sub { font-size: 12px; }

  .work-card:not(.shelf-card) { border-radius: var(--r-md); }
  .work-info { padding: 8px 10px 10px; }
  .work-title { font-size: 13px; }
  .work-footer { padding: 6px 10px 8px; }

  .shelf-body { padding: 8px 9px 9px; }
  .shelf-title { font-size: 12.5px; }
  .cover-first { font-size: 40px; }
  .cover-badge { font-size: 9px; padding: 2px 5px; }
  .work-attrs { font-size: 10px; gap: 2px 6px; padding-top: 6px; }
  /* 书本保持方角，不跟随小屏变圆 */
  .shelf-card { border-radius: 0; }

  .category-header { padding: 10px 12px; }
  .category-header h3 { font-size: 15px; }
  .cat-count { font-size: 10.5px; padding: 4px 10px; }

  .topic-cover { height: 100px; }
  .topic-title { font-size: 14px; }

  .filter-btn { padding: 6px 10px; font-size: 11.5px; }

  .to-top {
    width: 44px; height: 44px;
    right: 12px;
    bottom: 16px;
  }
}

/* =============================================================
   主题层：
   选择器约定：:root[data-theme-group="downloadery"][data-theme-mode="light|dark"]
   作用：只覆写 Design Tokens，不改动布局结构；保证组件样式完全复用。
   —— 机制：
       data-theme-group = downloadery（固定值，保留属性仅为兼容选择器约定）
       data-theme-mode  = light | dark
       （与 legacy [data-theme="light|dark"] 共存；当 data-theme-group 未设置时，
        回退到 :root / [data-theme="light|dark"] 的默认 Downloadery 表现）
   ============================================================= */

/* -------- Theme 01：Downloadery（原工程默认；保持变量一致，兜底用） -------- */
:root[data-theme-group="downloadery"][data-theme-mode="light"] {
  --brand:      #7C3AED;
  --brand-600:  #6D28D9;
  --brand-500:  #8B5CF6;
  --brand-100:  #EDE9FE;
  --brand-50:   #F5F3FF;
  --accent:     #F59E0B;
  --accent-400: #FBBF24;
  --accent-600: #D97706;
  --accent-50:  #FFFBEB;
  --amber:      #CA8A04;
  --amber-50:   #FFFBEB;
  --rose:       #E11D48;
  --rose-50:    #FFF1F2;
  --bg:         #F6F7FB;
  --bg-alt:     #EEF1F7;
  --surface:    #FFFFFF;
  --surface-2:  #FAFBFE;
  --ink-900:    #0C1222;
  --ink-800:    #1E2640;
  --ink-700:    #334155;
  --ink-600:    #475569;
  --ink-500:    #64748B;
  --ink-400:    #94A3B8;
  --ink-300:    #CBD5E1;
  --ink-200:    #E2E8F0;
  --ink-100:    #F1F5F9;
  --ink-50:     #F8FAFC;
  --line:         rgba(12, 18, 34, 0.07);
  --line-strong:  rgba(12, 18, 34, 0.13);
  --ring:         rgba(124, 58, 237, 0.18);
  --s-xs: 0 1px 2px rgba(12, 18, 34, 0.04), 0 1px 1px rgba(12, 18, 34, 0.03);
  --s-sm: 0 2px 6px rgba(12, 18, 34, 0.05), 0 10px 30px -14px rgba(12, 18, 34, 0.14);
  --s-md: 0 4px 12px rgba(12, 18, 34, 0.06), 0 22px 56px -22px rgba(12, 18, 34, 0.20);
  --s-lg: 0 26px 72px -24px rgba(12, 18, 34, 0.28), 0 10px 30px -14px rgba(12, 18, 34, 0.18);
  --s-card-h: 0 16px 52px -22px rgba(124, 58, 237, 0.30), 0 6px 14px -6px rgba(12, 18, 34, 0.08);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,0.7);
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 26px; --pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms; --t-base: 220ms; --t-slow: 400ms;
  --f-display:  "Fraunces", "Noto Serif SC", "PingFang SC", "Microsoft YaHei", Georgia, serif;
  --f-sans:     "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --f-mono:     "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
:root[data-theme-group="downloadery"][data-theme-mode="dark"] {
  --brand:      #60A5FA;
  --brand-600:  #93C5FD;
  --brand-500:  #60A5FA;
  --brand-100:  rgba(167, 139, 250, 0.18);
  --brand-50:   rgba(167, 139, 250, 0.10);
  --accent:     #2DD4BF;
  --accent-400: #5EEAD4;
  --accent-600: #2DD4BF;
  --accent-50:  rgba(251, 191, 36, 0.14);
  --amber:      #FACC15;
  --amber-50:   rgba(250, 204, 21, 0.12);
  --rose:       #FB7185;
  --rose-50:    rgba(251, 113, 133, 0.12);
  --bg:         #0A0F1F;
  --bg-alt:     #0D142A;
  --surface:    #121935;
  --surface-2:  #172142;
  --ink-900:    #F3F6FC;
  --ink-800:    #E3E9F5;
  --ink-700:    #CBD5E1;
  --ink-600:    #94A3B8;
  --ink-500:    #64748B;
  --ink-400:    #475569;
  --ink-300:    #334155;
  --ink-200:    #1E293B;
  --ink-100:    #162043;
  --ink-50:     #121935;
  --line:         rgba(255, 255, 255, 0.08);
  --line-strong:  rgba(255, 255, 255, 0.16);
  --ring:         rgba(167, 139, 250, 0.28);
  --s-xs: 0 1px 2px rgba(0,0,0,0.40), 0 1px 1px rgba(0,0,0,0.32);
  --s-sm: 0 2px 10px rgba(0,0,0,0.45), 0 12px 36px -16px rgba(0,0,0,0.60);
  --s-md: 0 6px 18px rgba(0,0,0,0.50), 0 28px 64px -26px rgba(0,0,0,0.70);
  --s-lg: 0 34px 90px -28px rgba(0,0,0,0.75), 0 12px 36px -16px rgba(0,0,0,0.60);
  --s-card-h: 0 18px 60px -26px rgba(167, 139, 250, 0.36), 0 8px 18px -8px rgba(0,0,0,0.45);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,0.04);
}
:root[data-theme-group="downloadery"][data-theme-mode="light"] body::before {
  background:
    radial-gradient(900px 560px at 100% -10%, rgba(124, 58, 237, 0.18), transparent 62%),
    radial-gradient(820px 560px at -10% 30%, rgba(245, 158, 11, 0.10), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(217, 119, 6, 0.08), transparent 62%);
}
:root[data-theme-group="downloadery"][data-theme-mode="dark"] body::before {
  background:
    radial-gradient(920px 620px at 100% 0%, rgba(196, 181, 253, 0.26), transparent 62%),
    radial-gradient(820px 560px at -10% 30%, rgba(251, 191, 36, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(251, 191, 36, 0.08), transparent 62%);
}


/* =========================================================
   数据降级提示条 —— /api/bootstrap 不可用、展示静态快照时出现
   （app.js 的 showStaleNotice() 插入）
   ========================================================= */
.stale-banner {
  background: #fff4e5;
  color: #8a5a00;
  border: 1px solid #ffd8a8;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}
:root[data-theme="dark"] .stale-banner {
  background: #3a2c10;
  color: #ffcf87;
  border-color: #6b4d1a;
}
