/* 黑客书架 · 报纸版式, following www.qiaomu.ai DESIGN.md (same language as HackerPapers / HackerURLs / HN 写作课):
   black and white, serif headlines, 1px rules, square corners, no cards, no shadows, no decorative motion.
   Class names are the ones app.js renders; the previous palette is kept in artifacts/pre-press-20261102/. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f3;
  --text: #121212;
  --text-2: #4a4a4a;
  --muted: #767676;
  --faint: #b4b4b4;
  --border: #e2e2e2;
  --rule: #121212;
  /* 弱分割线（最佳实践：亮色背景 8-12% 黑，如 Material rgba(0,0,0,.12)、Ant #f0f0f0、Tailwind gray-200） */
  --divider: #e5e5e2;
  --accent: #121212;
  --accent-ink: #ffffff;
  --accent-soft: #f5f5f3;
  --focus: #121212;
  --mark: transparent;
  /* reader stance: ink for recommends, mid grey for critical, light grey for plain mentions */
  --st-r: #121212; --st-n: #c9c9c6; --st-c: #767676;
  /* trend lines stay distinguishable but muted */
  --tr-1: #121212; --tr-2: #8a5a2b; --tr-3: #3d6b5a; --tr-4: #6b6b9a; --tr-5: #9a4a5a;
  --shadow: none;
  --topbar-h: 60px;
  --side-w: 232px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "HP Serif", "HP Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  --latin: "Newsreader", "HP Serif", "HP Serif SC", "Songti SC", Georgia, serif;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212; --surface: #121212; --surface-2: #1c1c1c; --text: #ececea; --text-2: #b9b9b6; --muted: #8a8a87; --faint: #555553;
    --border: #2c2c2c; --rule: #ececea; --divider: #2c2c2c; --accent: #ececea; --accent-ink: #121212; --accent-soft: #1c1c1c; --focus: #ececea;
    --st-r: #ececea; --st-n: #444442; --st-c: #8a8a87;
    --tr-1: #ececea; --tr-2: #d29a62; --tr-3: #7fb39e; --tr-4: #a3a3d6; --tr-5: #d68a9a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --surface: #121212; --surface-2: #1c1c1c; --text: #ececea; --text-2: #b9b9b6; --muted: #8a8a87; --faint: #555553;
  --border: #2c2c2c; --rule: #ececea; --divider: #2c2c2c; --accent: #ececea; --accent-ink: #121212; --accent-soft: #1c1c1c; --focus: #ececea;
  --st-r: #ececea; --st-n: #444442; --st-c: #8a8a87;
  --tr-1: #ececea; --tr-2: #d29a62; --tr-3: #7fb39e; --tr-4: #a3a3d6; --tr-5: #d68a9a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 var(--sans); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 100; top: 8px; left: 8px; background: var(--text); color: var(--bg); padding: 6px 12px; }
.noscript { padding: 24px 16px; }
kbd { font: 13px var(--latin); color: var(--muted); border: 1px solid var(--border); padding: 0 7px; line-height: 20px; }

/* ---- 顶栏：刊头 ---- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 6px; padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--border); }
.icon-btn { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: color 160ms var(--ease); }
.icon-btn:hover { color: var(--text); }
.icon-btn svg, .search-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.logo { display: flex; align-items: center; flex: none; margin: 0 14px 0 4px; }
.logo:hover { text-decoration: none; }
.logo-text { font: 700 24px/1 var(--serif); letter-spacing: 0.06em; }
/* 搜索框平时无下划线，聚焦时出现黑色下划线（用透明 border 占位避免 1px 跳动） */
.search { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; min-width: 0; border-bottom: 1px solid transparent; }
.search:focus-within { border-bottom-color: var(--text); }
.search input { flex: 1; min-width: 0; height: 36px; padding: 0 4px; font: inherit; font-size: 15.5px; color: var(--text); background: transparent; border: 0; border-radius: 0; outline: none; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.search-btn:hover { color: var(--text); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---- 布局与侧栏：栏目目录 ---- */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-h) - 120px); }
.sidebar { position: sticky; top: var(--topbar-h); flex: none; width: var(--side-w); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 22px 16px 28px 24px; border-right: 1px solid var(--border); scrollbar-width: thin; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--text-2); font-size: 15px; font-weight: 500; transition: color 160ms var(--ease); }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a:focus-visible { outline: none; }
.nav a.active { color: var(--text); font-weight: 700; }
.nav a svg, .nav-more svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; transition: stroke 160ms var(--ease); }
.nav a:hover svg, .nav a.active svg, .nav-more:hover svg { stroke: var(--text); }
.nav-more { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 0; border: 0; background: none; color: var(--text-2); font: 500 15px var(--sans); cursor: pointer; text-align: left; transition: color 160ms var(--ease); }
.nav-more:hover { color: var(--text); }
.nav-more:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.nav-more .chev { width: 14px; height: 14px; margin-left: auto; transition: transform 200ms var(--ease); }
.nav-more[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav-extra { margin-top: 2px; }
.nav.topics a { justify-content: space-between; font-size: 14px; font-weight: 400; padding: 4px 0; }
.nav.topics a.active { font-weight: 700; }
.nav.topics .count { color: var(--muted); font: 13px var(--latin); }
/* 分割线在「关于本站」与「话题分类」正中间：上方间距 = 导航项 padding 6 + margin 26 = 32 */
.nav-h { margin: 26px 0 8px; padding-top: 32px; border-top: 1px solid var(--divider); font: 15px/1 var(--latin); letter-spacing: 0.04em; color: var(--muted); }
.main, main { flex: 1; min-width: 0; padding: 32px 40px 56px; }
body.side-collapsed .sidebar { display: none; }

.scrim { display: none; }
@media (max-width: 899px) {
  .topbar { padding: 0 10px; }
  .sidebar { position: fixed; z-index: 40; top: var(--topbar-h); bottom: 0; left: 0; background: var(--bg); transform: translateX(-102%); transition: transform .22s var(--ease); border-right: 1px solid var(--rule); }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 35; background: rgba(0, 0, 0, .45); }
  .main, main { padding: 22px 16px 44px; }
  .logo { margin: 0 6px 0 0; }
  .logo-text { font-size: 19px; }
  .hide-sm { display: none; }
  .search { max-width: none; }
}

/* ---- 页头 / 筛选：文字切换，不用胶囊 ---- */
.page-h { margin-bottom: 6px; padding-top: 10px; }
.page-h h1 { font: 700 clamp(30px, 3.4vw, 42px)/1.25 var(--serif); letter-spacing: 0.02em; }
.sub { color: var(--text-2); margin: 10px 0 0; max-width: 46em; font-size: 15.5px; }
.sub a { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 0.22em; }
.sub a:hover { text-decoration-color: currentColor; }
.chips { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin: 16px 0 4px; }
.chips .lbl { color: var(--muted); font-size: 14px; margin-right: 2px; }
.chip { display: inline-block; padding: 2px 0; border: 0; background: none; font-size: 14px; color: var(--text-2); transition: color 160ms var(--ease); }
.chip:hover { color: var(--text); text-decoration: none; }
.chip.on { color: var(--text); font-weight: 700; }
.chip.topic { color: var(--text); border: 1px solid var(--border); padding: 0 8px; font-size: 13px; }
.empty { padding: 40px 0; color: var(--muted); text-align: center; }
.empty h2 { font: 700 22px var(--serif); color: var(--text); margin-bottom: 8px; }
.skel { padding: 56px 0; color: var(--muted); text-align: center; }

/* ---- 书籍网格：封面墙 ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 20px; margin-top: 20px; }
/* 相关书籍：自适应换行网格，数据给的 7-8 本全部展示（原来是 150px 横向滚动条，卡片被裁切） */
.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; padding: 4px 0 12px; }
.card { display: flex; flex-direction: column; min-width: 0; }
/* 书单收藏角标（触屏常显，桌面悬停出现） */
.card { position: relative; }
.wl { position: absolute; z-index: 2; top: 8px; left: 8px; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--bg); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 160ms var(--ease), color 160ms var(--ease); }
.card:hover .wl, .wl.on, .wl:focus-visible { opacity: 1; }
.wl:hover { color: var(--text); }
.wl.on { color: var(--text); border-color: var(--text); }
.wl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.wl.on svg { fill: currentColor; }
@media (hover: none) { .wl { opacity: 1; } }
/* 分享图弹窗 */
dialog.share-box { border: 1px solid var(--border); padding: 12px; background: var(--bg); max-width: min(92vw, 560px); }
dialog.share-box canvas { width: 100%; height: auto; display: block; border: 1px solid var(--border); }
.share-actions { display: flex; gap: 12px; margin-top: 12px; }
.card:hover { text-decoration: none; }
.card h3 { font: 500 16.5px/1.35 var(--latin); margin: 10px 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-decoration-line: underline; text-decoration-color: transparent; text-decoration-thickness: 1px; text-underline-offset: 0.2em; transition: text-decoration-color 160ms var(--ease); }
.card:hover h3 { text-decoration-color: currentColor; }
.card .t-en { margin: 0; color: var(--muted); font: 13px/1.35 var(--latin); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .au { margin: 0; color: var(--muted); font: 14px var(--latin); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .rec { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.card .rec b { color: var(--text); font: 500 14px var(--latin); }
.cover { position: relative; aspect-ratio: 2 / 3; width: 100%; overflow: hidden; background: var(--surface-2); outline: 1px solid var(--border); outline-offset: -1px; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; right: 0; bottom: 0; background: var(--text); color: var(--bg); font: 500 12px/1 var(--latin); padding: 5px 7px; letter-spacing: .02em; }
/* 排版占位封面：黑白书脊 */
.cover.ph { display: flex; flex-direction: column; justify-content: center; padding: 10% 9%; background: var(--surface-2); color: var(--text); }
.ph-t { font: 500 clamp(12px, 3.4cqw, 16px)/1.3 var(--latin); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; container-type: inline-size; }
.ph-rule { width: 34%; height: 1px; background: currentColor; margin: 10px 0; }
.ph-a { font: clamp(10px, 2.8cqw, 13px) var(--latin); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sentinel { padding: 24px 0 8px; color: var(--muted); font-size: 13.5px; text-align: center; }
.sentinel.end { padding-bottom: 0; }

/* 立场计数行（多档宽度自适应） */
/* 计数行：按卡片自身宽度二选一（窄卡用短版），不再按视口宽度判断——原来 ≤399px 时长短两版会同时显示 */
.rec .rl, .rec .rm, .rec .rs, .rec .rx { display: none; }
.rec-st .rs { display: inline; }
@container card (min-width: 160px) { .rec-st .rl { display: inline; } .rec-st .rs { display: none; } }
.card { container-type: inline-size; container-name: card; }


/* ---- 书籍详情页 ---- */
.book { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; max-width: 920px; padding-top: 18px; }
/* 封面+信息两栏之后，各区块（历年图表/评论区/相关书籍）通栏铺开 */
.book > .sec, .book > #related { grid-column: 1 / -1; }
.book > div:first-child { align-self: start; }
.book h1 { font: 500 clamp(30px, 3.6vw, 44px)/1.18 var(--latin); letter-spacing: -0.005em; }
.book .st { color: var(--muted); font: 20px/1.4 var(--latin); margin: 8px 0 0; }
.book .t-en { color: var(--muted); font: 15px/1.5 var(--latin); margin: 6px 0 0; max-width: 40em; overflow-wrap: anywhere; }
.book .by { margin: 10px 0 0; color: var(--text-2); font: 17px var(--latin); }
.book .by span { color: var(--muted); font-family: var(--sans); font-size: 14px; }
.book .by a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 0.22em; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 22px 0 4px; padding-top: 16px; border-top: 1px solid var(--border); }
.stat b { display: block; font: 400 32px/1.1 var(--latin); }
.stat span { color: var(--muted); font-size: 13px; }
.stance { margin: 18px 0 0; max-width: 440px; }
.sbar { display: flex; height: 6px; overflow: hidden; background: var(--surface-2); }
.sbar i { display: block; }
.s-r { background: var(--st-r); } .s-n { background: var(--st-n); } .s-c { background: var(--st-c); }
.slg { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.slg .dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }
.desc { margin: 18px 0 0; color: var(--text); max-width: 40em; font-size: 16px; line-height: 1.85; }
/* 双语：英文原文收纳（简介折叠 / 评论弱化展示） */
details.orig { margin: 8px 0 0; max-width: 40em; }
details.orig summary { cursor: pointer; color: var(--muted); font-size: 13.5px; list-style: none; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 0.25em; transition: color 160ms var(--ease); }
details.orig summary::-webkit-details-marker { display: none; }
details.orig summary::before { content: "▸ "; font-size: 11px; }
details.orig[open] summary::before { content: "▾ "; }
details.orig summary:hover { color: var(--text); }
details.orig[open] summary { margin-bottom: 2px; }
details.orig .desc { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
.comment .c-zh { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16.5px; line-height: 1.75; color: var(--text); }
.comment .c-en { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 14.5px/1.6 var(--latin); color: var(--muted); }
.buy-row { display: flex; align-items: center; gap: 10px 12px; margin: 24px 0 2px; flex-wrap: wrap; }
.buy-lbl { color: var(--muted); font-size: 13.5px; }
.nd-rate { margin: 24px 0 -14px; font-size: 13.5px; color: var(--muted); }
.nd-rate b { font: 400 20px/1 var(--latin); color: var(--text); margin: 0 2px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border: 1px solid var(--rule); background: var(--bg); color: var(--text); font: 600 14px var(--sans); cursor: pointer; transition: background 160ms var(--ease), color 160ms var(--ease); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { background: var(--text-2); color: var(--bg); }
.aff-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 16px 0 0; }
.links a, .links .btn { font-weight: 500; }
.sec { margin-top: 48px; max-width: 920px; }
.sec h2 { font: 700 26px var(--serif); letter-spacing: 0.02em; padding-top: 16px; border-top: 1px solid var(--rule); margin-bottom: 14px; }
.chart { width: 100%; max-width: 680px; height: auto; }
.chart text, .tr-bump text, .tr-cmpchart text { font: 12px var(--latin); fill: var(--muted); }
.chart rect.bar { fill: var(--text); }
.chart line { stroke: var(--border); }
.chart line[stroke-dasharray] { stroke: var(--muted); }
.comments { list-style: none; margin: 0; padding: 0; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-h { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.comment-h a { color: var(--text-2); font: 14px var(--latin); }
.comment p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 16.5px/1.65 var(--latin); color: var(--text); }
.comment mark { background: none; color: inherit; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.thread { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; padding: 0 6px; border: 1px solid currentColor; font-size: 11.5px; font-weight: 600; line-height: 1.6; }
.tag-recommends { color: var(--text); }
.tag-mentions { color: var(--muted); }
.tag-critical { color: var(--text-2); border-style: dashed; }
/* 手机：小封面左浮，书名、作者在右侧，首屏就能看到书名和统计 */
@media (max-width: 640px) {
  .book { display: block; padding-top: 8px; }
  .book > div:first-child { float: left; width: 104px; margin: 4px 16px 10px 0; }
  .book h1 { font-size: 24px; line-height: 1.25; }
  .book .st { font-size: 16px; margin-top: 4px; }
  .book .t-en { font-size: 13.5px; }
  .book .by { font-size: 15px; }
  .book .stats, .book > .sec, .book > #related { clear: both; }
  .book .stats { gap: 10px 24px; margin-top: 16px; }
  .book .stat b { font-size: 26px; }
}

/* ---- 趋势页 ---- */
.tr-sec { margin-top: 48px; max-width: 1100px; }
.tr-sec h2 { font: 700 26px var(--serif); letter-spacing: 0.02em; padding-top: 16px; border-top: 1px solid var(--rule); margin-bottom: 8px; }
.tr-gh { font: 600 15px var(--sans); margin: 24px 0 2px; }
.tr-gh span { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.tr-box { position: relative; border: 1px solid var(--border); background: var(--bg); margin-top: 14px; }
.tr-scroll { overflow-x: auto; padding: 8px; }
.tr-tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: auto; background: var(--bg); border: 1px solid var(--rule); padding: 8px 12px; font-size: 13px; max-width: 300px; }
.tr-tip b { font-family: var(--latin); font-weight: 500; }
.tr-tip a { color: var(--text); text-decoration: underline; white-space: nowrap; }
.tr-tip .pin::after { content: ""; }
.tr-bump .bk { cursor: pointer; }
.tr-bump .bk-l { fill: none; stroke: var(--border); stroke-width: 2; }
.tr-bump .bk-d { fill: var(--bg); stroke: var(--muted); stroke-width: 1.4; }
.tr-bump.has-hl .bk:not(.on) { opacity: .9; }
.tr-bump .hl-l { fill: none; stroke: var(--text); stroke-width: 2.5; }
.tr-bump .hl-d { fill: var(--text); stroke: var(--text); }
.tr-bump .cur { fill: none; stroke: var(--text); stroke-width: 1.6; }
.tr-bump .tl { font: 12px var(--latin); fill: var(--text); }
.tr-bump .tl.top { font-weight: 600; fill: var(--text); }
.tr-bump .hl-t { font-weight: 600; }
.tr-bump .ax { fill: var(--muted); }
.spark { width: 100%; height: auto; display: block; }
.spark .ln { fill: none; stroke: var(--text); stroke-width: 1.6; }
.spark .ar { fill: var(--surface-2); stroke: none; }
.spark .pk { fill: var(--text); stroke: var(--bg); stroke-width: 1.5; }
.spark line { stroke: var(--border); }
.spark-x { display: flex; justify-content: space-between; color: var(--muted); font: 12px var(--latin); }
.tr-card .rec { color: var(--text); }
.tr-search { position: relative; max-width: 460px; margin: 14px 0; }
.tr-search input { width: 100%; height: 40px; padding: 0 2px; font: inherit; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; outline: none; }
.tr-search input:disabled { opacity: .55; }
#tr-list { position: absolute; z-index: 10; left: 0; right: 0; top: 44px; margin: 0; padding: 4px 0; list-style: none; background: var(--bg); border: 1px solid var(--rule); max-height: 320px; overflow-y: auto; }
#tr-list li { padding: 8px 12px; cursor: pointer; }
#tr-list li.on, #tr-list li:hover { background: var(--surface-2); }
#tr-list li span { color: var(--muted); font-size: 12.5px; }
#tr-list li.none { color: var(--muted); cursor: default; }
.tr-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 12px 0; padding: 0; }
.tr-legend li { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.tr-legend .sw { width: 14px; height: 3px; background: var(--c, var(--text)); }
.tr-legend .x { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 2px; }
.tr-legend .x:hover { color: var(--text); }
.tr-cmpchart .cl { fill: none; stroke-width: 2; }
.tr-cmpchart line { stroke: var(--border); }
.tr-cmpchart .vl { stroke: var(--muted); stroke-dasharray: 3 3; }
.tr-cmpchart .ax { fill: var(--muted); }
.tr-cmpchart .tl { font: 12px var(--latin); fill: var(--text); }
.tr-empty { padding: 40px 16px; }
.r { display: flex; align-items: center; gap: 6px; }
.r .sw { width: 12px; height: 3px; background: var(--c); }

/* ---- 关于页 / 长文 ---- */
.prose { max-width: 40em; }
.prose h1 { font: 700 clamp(30px, 3.4vw, 42px)/1.25 var(--serif); letter-spacing: 0.02em; padding-top: 18px; border-top: 1px solid var(--rule); margin-bottom: 16px; }
.prose h2 { font: 700 22px var(--serif); margin: 32px 0 10px; }
.prose p, .prose li { color: var(--text-2); font-size: 16px; line-height: 1.85; }
.prose a { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 0.22em; }
.prose a:hover { text-decoration-color: currentColor; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li { margin: 6px 0; }

/* ---- 页脚 ---- */
.footer { border-top: 1px solid var(--divider); padding: 26px 40px 56px; color: var(--muted); font-size: 13.5px; }
.foot-cols { display: flex; flex-wrap: wrap; gap: 18px 56px; max-width: 1100px; }
.foot-about { flex: 1 1 380px; max-width: 46em; }
.foot-about p { margin: 0 0 6px; }
.foot-about a, .foot-links a { color: var(--text-2); font-weight: 500; }
.foot-about a:hover, .foot-links a:hover { color: var(--text); }
.foot-brand { font: 700 18px var(--serif); color: var(--text); letter-spacing: 0.04em; }
.foot-brand span { color: var(--muted); font: 400 13px var(--latin); margin-left: 8px; letter-spacing: 0; }
.foot-links { display: flex; flex-direction: column; gap: 6px; }
#footer-meta { margin: 16px 0 0; font: 13px var(--latin); }
@media (max-width: 899px) { .footer { padding: 22px 16px 44px; } }

/* ---- 弹窗：直角、墨线 ---- */
dialog { border: 1px solid var(--rule); background: var(--bg); color: var(--text); padding: 26px 30px 22px; max-width: min(92vw, 380px); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { font: 700 22px var(--serif); letter-spacing: 0.02em; margin: 0 0 8px; }
dialog img { display: block; margin: 14px auto; background: #fff; }
.keys { margin: 10px 0 16px; }
.keys div { display: flex; align-items: baseline; gap: 12px; margin: 8px 0; }
.keys dt { flex: none; min-width: 72px; }
.keys dd { margin: 0; color: var(--text-2); font-size: 14px; }

@media (pointer: coarse) { .icon-btn { width: 44px; height: 44px; } .nav a, .nav-more { padding: 9px 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media print { .topbar, .sidebar, .footer { display: none; } }

/* Secondary actions read as text links (DESIGN.md: one solid ink button per view) */
.buy-row .btn, .links .btn:not(.primary) { border: 0; padding: 4px 0; background: none; font-weight: 500; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.25em; transition: text-decoration-color 160ms var(--ease); }
.buy-row .btn:hover, .links .btn:not(.primary):hover { background: none; text-decoration-color: currentColor; }
.buy-row .btn[target="_blank"]::after, .links .btn[target="_blank"]:not(.primary)::after { content: " ↗"; }
.buy-row { gap: 6px 22px; }

/* ---- 我的书架 ---- */
.shelf-row { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.shelf-lbl { color: var(--muted); font-size: 13.5px; }
.seg { padding: 7px 16px; border: 1px solid var(--border); background: var(--bg); color: var(--text-2); font: 500 14px var(--sans); cursor: pointer; transition: all 160ms var(--ease); }
.seg:hover { color: var(--text); }
.seg.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.stars { display: inline-flex; gap: 2px; margin-left: 4px; }
.star { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--border); cursor: pointer; transition: color 120ms var(--ease); }
.star svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.stars.on .star { color: var(--muted); }
.stars.on .star:hover, .stars.on .star.on { color: var(--text); }
.stars.on .star.on svg { fill: currentColor; }
.stars:not(.on) .star { opacity: 0.45; cursor: default; }
.wl.read { color: var(--text); border-color: var(--text); }
.shelf-tabs { margin: 14px 0 4px; }
/* 回到顶部 */
.totop { position: fixed; z-index: 40; right: 22px; bottom: 26px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px); transition: all 200ms var(--ease); }
.totop.show { opacity: 1; pointer-events: auto; transform: none; }
.totop:hover { background: var(--surface-2); }
.totop svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- 历年年度书 ---- */
.years .yr { margin: 0 0 44px; }
.years .yr h2 { font: 700 30px var(--serif); padding-top: 14px; border-top: 1px solid var(--divider); margin: 0 0 14px; }
.years .yr:first-of-type h2 { border-top: 0; padding-top: 0; }
/* ---- 被低估的书散点 ---- */
.gem-wrap { max-width: 680px; }
.gem-wrap svg { width: 100%; height: auto; }
.gem-wrap svg circle { cursor: pointer; }
.gem-list { margin: 18px 0 0; }

/* 散点图 tooltip */
.gem-wrap { position: relative; }
.gem-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; font-size: 12.5px; line-height: 1.5; max-width: 200px; }
.gem-tip b { display: block; font-weight: 600; }
.gem-tip span { opacity: 0.75; font-size: 11.5px; }
.gemdot:hover { stroke: var(--text); stroke-width: 1.5; }
/* 浪潮紧凑网格 */
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 18px 16px; margin-top: 12px; }
.wcard { display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: inherit; min-width: 0; }
.wcard:hover { text-decoration: none; }
.wcard img, .wcard .cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; outline: 1px solid var(--border); outline-offset: -1px; background: var(--surface-2); }
.wcard .wt { font: 500 13px/1.35 var(--serif); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wcard:hover .wt { text-decoration: underline; text-underline-offset: 0.2em; }
.wcard .wm { color: var(--muted); font-size: 11.5px; }

/* ---- 值得读：指数、一句话、分项条 ---- */
.card .qv { display: inline-block; min-width: 22px; margin-right: 6px; padding: 0 4px; background: var(--text); color: var(--bg); font: 600 12px/18px var(--latin); text-align: center; }
.card .why1 { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qbox { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin: 18px 0 0; padding: 14px 16px; background: var(--surface-2); max-width: 520px; }
.qn b { display: block; font: 400 40px/1 var(--latin); }
.qn span { color: var(--muted); font-size: 13px; }
.qbars { list-style: none; margin: 0; padding: 0; flex: 1 1 240px; display: grid; gap: 5px; }
.qbars li { display: grid; grid-template-columns: 4em 1fr 2em; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.qbars i { display: block; height: 5px; background: var(--border); }
.qbars em { display: block; height: 100%; background: var(--text); }
.qbars b { font: 500 13px var(--latin); text-align: right; color: var(--text); }
.qhow { font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: .2em; }
.whybox { margin: 22px 0 0; max-width: 560px; }
.whybox h2 { font: 700 19px var(--serif); margin: 0 0 6px; }
.why-lead { font: 500 17px/1.6 var(--serif); margin: 0 0 6px; }
.why-list { margin: 0 0 6px; padding-left: 1.2em; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.why-meta { margin: 2px 0; font-size: 14.5px; color: var(--text-2); }
.why-meta b { display: inline-block; margin-right: 8px; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface-2); }
.why-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.st-chart rect.s-r { fill: var(--st-r); } .st-chart rect.s-n { fill: var(--st-n); } .st-chart rect.s-c { fill: var(--st-c); }
.sec.wide { max-width: none; }

/* ---- 话题页：阅读路径 ---- */
.paths { margin: 22px 0 8px; }
.paths h2 { font: 700 22px var(--serif); padding-top: 14px; border-top: 1px solid var(--rule); margin: 0; }
.path-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 32px; margin-top: 14px; }
.path-col h3 { font: 600 14px var(--sans); color: var(--muted); letter-spacing: .08em; margin: 0 0 6px; }
.path-col ol { list-style: none; margin: 0; padding: 0; }
.path-col li a { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--divider); color: var(--text); }
.path-col li a:hover { text-decoration: none; background: var(--surface-2); }
.path-c .cover { width: 44px; }
.path-c .ph-t { font-size: 8px; -webkit-line-clamp: 3; } .path-c .ph-a, .path-c .ph-rule { display: none; }
.path-t b { display: block; font: 500 15.5px/1.35 var(--latin); }
.path-t span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* ---- /explore ---- */
.ex-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; margin: 20px 0 8px; padding: 16px; background: var(--surface-2); max-width: 1000px; }
.ex-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ex-f select, .ex-f input { font: 14px var(--sans); color: var(--text); background: var(--bg); border: 1px solid var(--border); padding: 7px 8px; border-radius: 0; min-width: 0; }
.ex-cs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; font-size: 14px; color: var(--text-2); }
.ex-c input { accent-color: var(--text); }
.ex-n { margin: 14px 0 4px; font-size: 14px; color: var(--muted); }

/* ---- /map ---- */
.map-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.map-bar input { flex: 1 1 220px; font: 14px var(--sans); padding: 8px 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 0; }
.map-bar .btn { padding: 7px 14px; }
.map-box { position: relative; max-width: 1000px; border: 1px solid var(--border); background: var(--bg); touch-action: none; }
#map-svg { display: block; width: 100%; height: auto; aspect-ratio: 1; cursor: grab; user-select: none; }
#map-svg:active { cursor: grabbing; }
.m-edges line { stroke: var(--border); stroke-width: .8; vector-effect: non-scaling-stroke; }
.m-nodes circle { r: calc(var(--r) * var(--s, 1) * 1px); fill: var(--text); opacity: .72; cursor: pointer; transition: opacity 120ms var(--ease); }
.m-labels text { font: 600 var(--lf, 22px) var(--sans); fill: var(--muted); paint-order: stroke; stroke: var(--bg); stroke-width: calc(var(--lf, 22px) / 4); pointer-events: none; letter-spacing: .06em; }
#map-svg.focus circle { opacity: .14; } #map-svg.focus line { opacity: .25; }
#map-svg.focus circle.on { opacity: 1; } #map-svg.focus line.on { opacity: 1; stroke: var(--text); stroke-width: 1.4; }

/* ---- 趋势：话题冷热 ---- */
.heat-scroll { overflow-x: auto; }
.heat table { border-collapse: separate; border-spacing: 2px; font-size: 12.5px; min-width: 640px; }
.heat th { font-weight: 400; color: var(--muted); font-family: var(--latin); padding: 0 2px; }
.heat tbody th { text-align: right; padding-right: 8px; white-space: nowrap; font-family: var(--sans); }
.heat tbody th a { color: var(--text-2); }
.heat td { width: 26px; height: 20px; background: color-mix(in srgb, var(--text) var(--a), var(--surface-2)); }
.heat td.heat-r { background: none; width: auto; padding-left: 8px; white-space: nowrap; font: 500 12.5px var(--latin); color: var(--text); }
@media (max-width: 520px) { .ex-form { grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 12px; } .qbox { padding: 12px; } }

.nav-h2 { margin-top: 18px; padding-top: 20px; }

/* 侧栏 Lucide 图标与「更多」：2026-11-03 */

/* ---- 手机适配 ---- */
.paths-more { display: none; margin: 4px 0 0; } /* 必须写在下面的媒体查询之前，否则会盖掉手机上的 inline-flex */
@media (max-width: 640px) {
  /* 筛选 chips：每组一行、左右滑动，不再把首屏的书挤下去 */
  .chips:not(.shelf-tabs) { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 0 16px; margin-right: -16px; padding-right: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips:not(.shelf-tabs)::-webkit-scrollbar { display: none; }
  .chips .lbl { flex: none; position: sticky; left: 0; z-index: 1; background: var(--bg); padding-right: 10px; margin-right: -6px; }
  .chip { flex: none; }
  .chips.book-topics, .book .chips { flex-wrap: wrap; overflow: visible; margin-right: 0; padding-right: 0; gap: 8px; }
  /* 图表文字：SVG 等比缩小后 11–12 单位只剩 5–6px，手机上放大到约 11px */
  .chart text, #gem-chart svg text { font-size: 22px; }
  /* 话题路径：默认只展开「入门」 */
  .paths:not(.open) .path-col:not(:first-child) { display: none; }
  .paths-more { display: inline-flex; }
}
/* 触屏：点按目标至少约 40px 高 */
@media (pointer: coarse) {
  .chip { padding: 9px 0; }
  .chip.topic { padding: 6px 10px; }
  .seg { padding: 11px 18px; }
  .star { width: 40px; height: 40px; }
  .logo { padding: 10px 0; }
  .map-bar .btn { padding: 10px 16px; }
}

/* 「读过」兼作长按开关：禁止长按选字和系统菜单；按住 0.5 秒后底色慢慢填满，提示正在计时（普通点按看不到） */
.shelf-row [data-shelf] { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; position: relative; overflow: hidden; }
.shelf-row [data-shelf].holding::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: .14; transform: scaleX(0); transform-origin: left; animation: hold-fill 2.5s linear .5s forwards; pointer-events: none; }
@keyframes hold-fill { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .shelf-row [data-shelf].holding::after { animation: none; } }
