/* ============================================================================
   珠峰工作台 · 数据年鉴版式
   ----------------------------------------------------------------------------
   方向：一张连续的纸（纸与墨 / editorial almanac）。
   · 报头 + 分节目录（编号 01–09），像年鉴的目录页
   · 用发丝线与留白分区，不再「万物皆卡片」
   · 数字是主角：账目条（ledger）里的 40px 等宽数字
   · 唯一品牌色是一支沉静蓝，只出现在分节短划线、当前目录项与链接
   主题：dark（默认，:root）/ light（[data-theme="light"]），跟随系统
   ========================================================================== */

/* ---------- 字体 ----------
   拉丁与数字用 Instrument Sans（jsDelivr，30KB 可变字体）；中文回落系统栈。
   拉丁字体放最前且不含通用族，否则 system-ui 会抢走中文优化。
   加载失败整栈回落，font-display: swap，不阻塞首屏。 */
@font-face {
  font-family: "Instrument Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/instrument-sans@5.2.5/files/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
    U+2190-21FF, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== 主题变量 =====
   -rgb 变量给 rgba() 用；--border / --bg-hover 同时被 ECharts 读取（轴线、网格），
   所以它们必须是可解析的具体色值，不能用透明色。 */
:root {
  --font-latin: "Instrument Sans Variable", "Instrument Sans";
  --font-cn: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC",
    "Noto Sans CJK SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* 墨 */
  --bg: #0c0c0b;
  --bg-card: #111110;
  --bg-hover: #1b1a17;
  --bg-sunken: #141311;

  --border: #2a2825;          /* 图表轴线 */
  --border-strong: #3a3733;
  --rule: rgba(240, 238, 232, 0.085);
  --rule-strong: rgba(240, 238, 232, 0.16);

  --text: #f0eee8;
  --text-dim: #b6b1a7;
  --text-faint: #868279;

  --accent: #7ba3f5;
  --accent-rgb: 123, 163, 245;
  --accent-grad-b: #7ba3f5;
  --accent2: #63bd94;
  --accent2-rgb: 99, 189, 148;
  --red: #e0675c;
  --warn: #d5a24a;
  --warn-rgb: 213, 162, 74;

  --topbar-bg: #0c0c0b;
  --on-accent: #0c0c0b;

  --radius: 3px;
  --radius-sm: 2px;
  --radius-lg: 5px;

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.25);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px -30px rgba(0, 0, 0, 0.9);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --measure: 1200px;
  --gutter: 40px;
  color-scheme: dark;
}

[data-theme="light"] {
  /* 纸 */
  --bg: #f5f2ea;
  --bg-card: #fffdf8;
  --bg-hover: #ece7dc;
  --bg-sunken: #efeae0;

  --border: #ddd7ca;
  --border-strong: #c3bcac;
  --rule: rgba(26, 25, 21, 0.10);
  --rule-strong: rgba(26, 25, 21, 0.19);

  --text: #1a1915;
  --text-dim: #575349;
  --text-faint: #7c776b;

  --accent: #2b57a8;
  --accent-rgb: 43, 87, 168;
  --accent-grad-b: #2b57a8;
  --accent2: #1c7a5a;
  --accent2-rgb: 28, 122, 90;
  --red: #b3382c;
  --warn: #8a5f0f;
  --warn-rgb: 138, 95, 15;

  --topbar-bg: #f5f2ea;
  --on-accent: #fffdf8;

  --shadow-sm: 0 1px 0 rgba(26, 25, 21, 0.04);
  --shadow: 0 1px 2px rgba(26, 25, 21, 0.06), 0 24px 60px -34px rgba(26, 25, 21, 0.35);
  color-scheme: light;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-color: var(--border-strong) transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-latin), var(--font-cn);
  font-kerning: normal;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

::selection { background: rgba(var(--accent-rgb), 0.24); color: var(--text); }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

/* 数字一律等宽，刷新不跳列宽 */
.num, .price, .chg, .temp, .countdown, .stat .num, .kb-stats span:last-child,
.edition-issue, .stat .extra, .list.numbered li::before {
  font-variant-numeric: tabular-nums;
}

/* ---------- 报头 ---------- */
/* 同一条排版基线：报头、目录、正文、页脚共用同样的最大宽度与左右留白 */
.masthead, .tabs, main, footer {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--rule-strong);
  padding: 0;
}

.masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding-top: 26px; padding-bottom: 18px;
}

.brand { display: flex; align-items: center; gap: 14px; }

/* 珠峰峰形标记：单色、镂空雪帽，currentColor 随主题 */
.mark { width: 30px; height: 24px; flex-shrink: 0; display: block; color: var(--text); fill: currentColor; }

.brand-text { border-left: 1px solid var(--rule-strong); padding-left: 14px; }
.brand h1 {
  display: flex; align-items: baseline; gap: 0.34em;
  font-size: 21px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.1;
}
.brand h1 b { font-weight: 600; }
.brand h1 span {
  font-size: 12px; font-weight: 400; letter-spacing: 0.26em;
  color: var(--text-faint); text-transform: none;
}
.sub {
  font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.12em; margin-top: 5px;
}

.masthead-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }

.edition { display: flex; align-items: baseline; gap: 12px; }
.edition-date {
  font-size: 11.5px; letter-spacing: 0.1em; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.edition-issue {
  font-size: 10px; letter-spacing: 0.14em; color: var(--text-faint);
  padding-left: 12px; border-left: 1px solid var(--rule);
}

.refresh-bar {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; letter-spacing: 0.03em; color: var(--text-faint);
}
.refresh-bar .sep { opacity: 0.5; }

.live-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent2);
  box-shadow: 0 0 0 3px rgba(var(--accent2-rgb), 0.12);
  animation: pulse 2.6s ease-in-out infinite;
}
.live-dot.paused { background: var(--text-faint); box-shadow: none; animation: none; }
.live-dot.updated { animation: flash 0.8s var(--ease); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.28; } }
@keyframes flash {
  0% { transform: scale(2.6); background: var(--text); box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.22); }
  100% { transform: scale(1); }
}

.countdown {
  color: var(--text-dim); min-width: 44px; text-align: center;
  padding: 1px 6px; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  font-size: 10.5px; letter-spacing: 0.08em;
}

.refresh-btn, .theme-btn {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  background: transparent; border: 1px solid transparent; color: var(--text-faint);
  padding: 2px 0; cursor: pointer; font-family: inherit; font-size: 11.5px;
  line-height: 1.4; white-space: nowrap; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.refresh-btn:hover, .theme-btn:hover { color: var(--text); border-bottom-color: var(--text); }
.refresh-btn.off { opacity: 0.45; }
.theme-btn { margin-left: 4px; }
.theme-btn .t-icon { font-size: 11px; line-height: 1; opacity: 0.8; }
.theme-btn .t-label { font-size: 11.5px; }

/* ---------- 目录（分节导航） ---------- */
.tabs {
  position: relative;
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::before {
  content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter);
  height: 1px; background: var(--rule);
}
.tabs::-webkit-scrollbar { height: 0; }

.tabs button {
  position: relative; isolation: isolate;
  background: none; border: 0; cursor: pointer;
  color: var(--text-faint); font-family: inherit;
  padding: 12px 22px 13px; font-size: 13px; letter-spacing: 0.06em;
  white-space: nowrap; flex-shrink: 0;
  transition: color 0.18s ease;
}
.tabs button:first-child { padding-left: 0; }
.tabs button i {
  font-style: normal; font-size: 9.5px; letter-spacing: 0.08em;
  color: var(--text-faint); opacity: 0.75; margin-right: 8px;
  vertical-align: 1px; font-variant-numeric: tabular-nums;
}
.tabs button::after {
  content: ""; position: absolute; left: 22px; right: 22px; bottom: -1px;
  height: 2px; background: var(--text); z-index: 1;
  opacity: 0; transform: scaleX(0.4); transform-origin: left center;
  transition: opacity 0.2s ease, transform 0.32s var(--ease);
}
.tabs button:first-child::after { left: 0; }
.tabs button.active { color: var(--text); }
.tabs button.active i { color: var(--accent); opacity: 1; }
.tabs button.active::after { opacity: 1; transform: scaleX(1); }

/* 悬停 / 键盘聚焦：整块填成链接蓝、文字反白。
   目录原本只有字色变化，看不出「能点」；这一块是整页唯一的大面积品牌色，只在指针停留时出现。 */
.tabs button::before {
  content: ""; position: absolute; z-index: -1;
  left: -11px; right: -11px; top: 4px; bottom: 6px;
  border-radius: 2px; background: var(--accent);
  opacity: 0; transform: scale(0.96);
  transition: opacity 0.16s ease, transform 0.2s var(--ease);
}
.tabs button:first-child::before { left: 0; }
.tabs button:hover::before,
.tabs button:focus-visible::before { opacity: 1; transform: none; }
.tabs button:hover,
.tabs button:focus-visible,
.tabs button.active:hover { color: var(--on-accent); }
.tabs button:hover i,
.tabs button:focus-visible i { color: var(--on-accent); opacity: 0.75; }

/* ---------- 版面 ---------- */
main {
  padding-top: 6px; padding-bottom: 0;
}

.panel { display: none; }
.panel.active { display: block; animation: rise 0.36s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 版块：没有卡片，只有标题下的一道发丝线 */
.card {
  padding: 34px 0 8px;
  background: none; border: 0; border-radius: 0;
  box-shadow: none;
}
.card.full { width: 100%; }

.card h2 {
  display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap;
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.12em;
  padding-bottom: 11px; margin-bottom: 4px;
  border-bottom: 1px solid var(--rule-strong);
}
/* 分节标记：页面上唯一的品牌色落点 */
.card h2::before {
  content: ""; width: 1px; height: 11px; background: var(--accent);
  flex: 0 0 1px; align-self: center;
}
.card h2.stack { margin-top: 30px; }

.badge {
  margin-left: auto;
  font-size: 10.5px; font-weight: 400; letter-spacing: 0.08em;
  color: var(--text-faint); background: none; border: 0; padding: 0;
  white-space: nowrap;
}
/* 版块标题右侧的外链（数据源） */
.badge-link {
  font-size: 10.5px; font-weight: 400; letter-spacing: 0.08em;
  color: var(--text-faint); text-decoration: none; white-space: nowrap;
  border-bottom: 1px solid var(--rule-strong); padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.badge-link:hover { color: var(--text); border-bottom-color: var(--text); }

.hint {
  font-size: 11.5px; line-height: 1.75; color: var(--text-faint);
  letter-spacing: 0.03em; margin: 14px 0 20px; max-width: 62ch;
}

/* ---------- 账目条（总览统计） ---------- */
.ledger {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  margin-top: 10px;
}
.stat {
  display: flex; flex-direction: column;
  padding: 20px 24px 22px;
  border-left: 1px solid var(--rule);
  position: relative;
}
.stat:first-child { border-left: 0; padding-left: 0; }
.stat:last-child { padding-right: 0; }

.stat .label {
  order: -1;
  font-size: 10px; letter-spacing: 0.16em; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat .num {
  font-size: 40px; font-weight: 500; line-height: 1.02;
  letter-spacing: -0.045em; margin: 9px 0 6px;
}
.stat .extra {
  font-size: 11px; color: var(--text-dim); line-height: 1.5;
  letter-spacing: 0.01em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ---------- 天气带 ---------- */
.weather-band {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.weather-band .mini-city { padding: 20px 22px 6px; border-left: 1px solid var(--rule); }
.weather-band .mini-city:first-child { border-left: 0; padding-left: 0; }

/* 天气格 = 数据源链接：默认完全看不出是链接，悬停才给「城市名 + 箭头」的反馈 */
.weather-band a.mini-city {
  display: block; color: inherit; text-decoration: none;
  transition: background 0.18s ease;
}
.weather-band a.mini-city:hover { background: rgba(var(--accent-rgb), 0.04); }
.weather-band a.mini-city:hover .city {
  color: var(--text);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.weather-band a.mini-city:hover .city::after {
  content: " \2197"; color: var(--accent); text-decoration: none; font-size: 0.9em;
}
.weather-band a.mini-city:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.mini-city .city {
  font-size: 10.5px; letter-spacing: 0.18em; color: var(--text-faint);
}
.mini-city .temp {
  font-size: 34px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.15;
  margin: 7px 0 3px;
}
.mini-city .desc { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.02em; }

/* ---------- 双栏（竖排分隔线） ---------- */
.cols { display: grid; grid-template-columns: 1.5fr 1fr; column-gap: 0; }
.cols.even { grid-template-columns: 1fr 1fr; }
.cols > .card:first-child { padding-right: 44px; }
.cols > .card:last-child { padding-left: 44px; border-left: 1px solid var(--rule); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; }
.grid-kb { display: grid; grid-template-columns: 296px 1fr; column-gap: 0; }
.chart { width: 100%; height: 360px; }
.chart.tall { height: 520px; }

/* ---------- 列表 ---------- */
.list { list-style: none; }
.list li {
  display: flex; flex-direction: column; gap: 0;
  padding: 15px 0 14px;
  border-bottom: 1px solid var(--rule);
}
.list li:last-child { border-bottom: 0; }
.list a {
  color: var(--text); text-decoration: none;
  font-size: 14.5px; font-weight: 500; line-height: 1.55;
  letter-spacing: 0.005em;
  transition: color 0.14s ease;
}
.list a:hover { color: var(--accent); }
.list .meta {
  margin-top: 6px;
  font-size: 11px; color: var(--text-faint);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  letter-spacing: 0.02em;
}
.source-chip { color: var(--text-faint); }

/* 编号列表：新闻类内容用 01/02/03 的序号建立秩序 */
.list.numbered { counter-reset: entry; }
.list.numbered li { position: relative; padding-left: 42px; }
.list.numbered li::before {
  counter-increment: entry;
  content: counter(entry, decimal-leading-zero);
  position: absolute; left: 0; top: 18px;
  font-size: 10px; letter-spacing: 0.08em; color: var(--text-faint);
}

@media (min-width: 1120px) {
  .list.two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 56px; align-items: start; }
}

/* ---------- 标签 ---------- */
.tag {
  font-size: 10.5px; padding: 0 7px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--rule-strong);
  line-height: 1.75; cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tag:hover { color: var(--text); border-color: var(--border-strong); }
.tag.hit { color: var(--accent2); border-color: rgba(var(--accent2-rgb), 0.34); }
.tag.domain { color: var(--text-dim); border-color: var(--rule-strong); }
.tag.level { color: var(--text-faint); border-color: var(--rule); }

/* ---------- 行情 ---------- */
.quote-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border-top: 1px solid var(--rule);
}
.quote { padding: 18px 22px 16px; border-left: 1px solid var(--rule); }
.quote:first-child { border-left: 0; padding-left: 0; }
.quote .name { font-size: 10px; letter-spacing: 0.14em; color: var(--text-faint); }
.quote .price { font-size: 28px; font-weight: 500; letter-spacing: -0.035em; margin: 7px 0 3px; line-height: 1.1; }
.quote .chg { font-size: 12px; font-weight: 600; letter-spacing: 0.01em; }
.up { color: var(--red); }        /* A 股习惯：红涨 */
.down { color: var(--accent2); }

/* ---------- 天气（详情页） ---------- */
#weather-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.weather-city {
  padding: 28px 0 22px;
  border-top: 1px solid var(--rule-strong);
  text-align: left;
  border-radius: 0; background: none; box-shadow: none;
}
.weather-city .city { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; }
.weather-city .city-link {
  color: inherit; text-decoration: none;
  transition: color 0.18s ease;
}
.weather-city .city-link .arrow {
  font-style: normal; font-size: 9px; color: var(--text-faint);
  margin-left: 5px; vertical-align: 2px;
  transition: color 0.18s ease;
}
.weather-city .city-link:hover { color: var(--text); }
.weather-city .city-link:hover .arrow { color: var(--accent); }
.weather-city .note { font-size: 10.5px; font-weight: 400; color: var(--text-faint); letter-spacing: 0.06em; margin-left: 7px; }
.weather-city .temp {
  font-size: 56px; font-weight: 300; line-height: 1;
  letter-spacing: -0.05em; margin: 14px 0 8px;
}
.weather-city .desc { color: var(--text-faint); font-size: 11.5px; line-height: 1.7; letter-spacing: 0.02em; }
.weather-city .aqi { display: inline-block; margin-top: 14px; font-size: 10.5px; }

.weather-daily {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-top: 20px; border-top: 1px solid var(--rule);
}
.wd {
  padding: 10px 4px 0; text-align: center;
  font-size: 10px; color: var(--text-faint);
  border-left: 1px solid var(--rule);
}
.wd:first-child { border-left: 0; }
.wd .d { color: var(--text-dim); font-size: 10px; margin-bottom: 5px; letter-spacing: 0.04em; }
.wd .t { color: var(--text-dim); margin-top: 3px; }

/* ---------- 筛选 ---------- */
.filter-bar { display: flex; gap: 7px; flex-wrap: wrap; }
.filter-bar button {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: 4px 11px; font-size: 12px; font-family: inherit; cursor: pointer;
  letter-spacing: 0.03em; line-height: 1.7;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.filter-bar button:hover { color: var(--text); border-color: var(--border-strong); }
/* 选中态：满对比填充（浅色=墨底纸字，深色=纸底墨字） */
.filter-bar button.active {
  background: var(--text); border-color: var(--text); color: var(--bg);
}
.filter-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.filter-label {
  flex: 0 0 34px; padding-top: 6px;
  font-size: 10px; letter-spacing: 0.16em; color: var(--text-faint);
}

/* ---------- 知识库 ---------- */
.search {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong);
  border-radius: 0; padding: 9px 0; color: var(--text);
  font-family: inherit; font-size: 14px; margin-bottom: 22px; outline: none;
  transition: border-color 0.18s ease;
}
.search::placeholder { color: var(--text-faint); letter-spacing: 0.02em; }
.search:focus { border-bottom-color: var(--accent); }

.note-card {
  border: 0; border-bottom: 1px solid var(--rule);
  border-radius: 0; padding: 20px 0 22px; background: transparent;
  transition: background 0.18s ease;
}
.note-card.open { background: transparent; }
.note-card h3 {
  font-size: 15px; font-weight: 600; cursor: pointer; letter-spacing: 0.01em;
  display: flex; align-items: baseline; gap: 10px; line-height: 1.55;
}
.note-card h3 .chev {
  font-size: 8px; color: var(--text-faint); flex-shrink: 0;
  transition: transform 0.22s var(--ease), color 0.18s ease;
}
.note-card h3:hover .chev { color: var(--accent); }
.note-card.open h3 .chev { transform: rotate(90deg); color: var(--accent); }
.note-card .tags { margin: 10px 0 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.note-card .summary { font-size: 13px; color: var(--text-dim); line-height: 1.85; margin-top: 9px; max-width: 72ch; }
.note-card .meta-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-size: 10.5px; color: var(--text-faint); margin-top: 9px; letter-spacing: 0.05em;
}
.note-card .rel-box { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 14px; }
.note-card .rel-box h4 {
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--text-faint); margin-bottom: 10px;
}
.note-card .body {
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule);
  font-size: 14px; line-height: 1.95; color: var(--text); display: none;
  max-width: 72ch;
}
.note-card.open .body { display: block; }
.note-card .body p { margin: 0 0 14px; }
.note-card .body h1, .note-card .body h2, .note-card .body h3 {
  font-size: 15px; margin: 22px 0 10px; cursor: default; display: block;
  letter-spacing: 0.02em;
}
.note-card .body ul, .note-card .body ol { margin: 0 0 14px 22px; }
.note-card .body li { margin-bottom: 5px; }
.note-card .body blockquote {
  border-left: 1px solid var(--border-strong); margin: 16px 0;
  padding: 2px 16px; color: var(--text-dim);
}
.note-card .body .source-link {
  display: inline-block; margin-top: 16px; font-size: 11px; color: var(--text-faint);
  letter-spacing: 0.05em; border-bottom: 1px solid var(--rule-strong);
}
.note-card .kw-pill {
  font-size: 10.5px; padding: 0 7px; border-radius: var(--radius-sm);
  background: transparent; color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.26); cursor: pointer;
  line-height: 1.75; letter-spacing: 0.04em;
  transition: border-color 0.15s ease;
}
.note-card .kw-pill:hover { border-color: rgba(var(--accent-rgb), 0.6); }
.note-card .body .kw {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.4);
  padding: 0 1px; cursor: pointer;
}
.note-card .body .kw:hover { background: rgba(var(--accent-rgb), 0.1); }
.note-card .body .wikilink {
  color: var(--accent2); text-decoration: none; cursor: pointer;
  border-bottom: 1px solid rgba(var(--accent2-rgb), 0.36); padding: 0 1px;
}
.note-card .body .wikilink:hover { background: rgba(var(--accent2-rgb), 0.1); }
.note-card .body strong { font-weight: 650; color: var(--text); }
.note-card .body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; padding: 1px 5px; border-radius: 2px;
  background: var(--bg-hover); color: var(--text-dim);
}
.note-card .body pre {
  margin: 0 0 14px; padding: 14px 16px; overflow-x: auto;
  background: var(--bg-sunken); border-left: 1px solid var(--border-strong);
  line-height: 1.7;
}
.note-card .body pre code { background: none; padding: 0; color: var(--text-dim); white-space: pre; }

/* 关键词云 */
.kw-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-cloud .kw-chip {
  display: inline-block; padding: 2px 9px; border-radius: var(--radius-sm); cursor: pointer;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--rule); font-size: 11.5px; letter-spacing: 0.02em;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.kw-cloud .kw-chip:hover { color: var(--text); border-color: var(--border-strong); }
.kw-cloud .kw-chip.lg {
  font-size: 13.5px; padding: 3px 11px; font-weight: 600; color: var(--text);
  border-color: var(--border-strong);
}
.kw-cloud .kw-chip.md { font-size: 12px; padding: 2px 10px; }
.kw-cloud .kw-chip.sm { font-size: 10.5px; color: var(--text-faint); }

/* 关键词弹层 */
.kw-popover {
  position: fixed; z-index: 50; min-width: 240px; max-width: 360px;
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 16px 18px 14px;
  box-shadow: var(--shadow); animation: rise 0.18s var(--ease);
}
.kw-popover .pop-title { font-size: 10px; letter-spacing: 0.14em; color: var(--text-faint); margin-bottom: 4px; }
.kw-popover .pop-kw { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; letter-spacing: 0.02em; }
.kw-popover .pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.kw-popover .pop-list a {
  display: flex; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 2px;
  font-size: 12.5px; background: transparent; color: var(--text); text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.kw-popover .pop-list a:hover { background: var(--bg-hover); color: var(--accent); }
.kw-popover .pop-list .ct { font-size: 10.5px; color: var(--text-faint); margin-left: auto; }
.kw-popover .pop-empty { font-size: 12px; color: var(--text-faint); padding: 8px 0; }

.rel-item {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}
.rel-item:last-child { border-bottom: 0; }
.rel-item .score {
  font-size: 10px; color: var(--text-faint); flex-shrink: 0;
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.rel-item .reason { font-size: 10.5px; color: var(--text-faint); margin-left: auto; text-align: right; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud .tag { font-size: 11px; padding: 1px 9px; }
.kb-stats div {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; padding: 9px 0; color: var(--text-faint);
  border-bottom: 1px solid var(--rule);
}
.kb-stats div:last-child { border-bottom: 0; }
.kb-stats span:last-child { color: var(--text); font-weight: 600; font-size: 13px; }

/* ---------- 剧集 ---------- */
.drama-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 24px 18px; margin-top: 6px; }
.drama-card {
  display: flex; flex-direction: column;
  background: none; border: 0; border-radius: 0; overflow: visible;
  text-decoration: none; color: inherit;
}
.drama-poster {
  position: relative; aspect-ratio: 2 / 3; background: var(--bg-sunken);
  overflow: hidden; border: 1px solid var(--rule);
  transition: border-color 0.25s var(--ease);
}
.drama-card:hover .drama-poster { border-color: var(--border-strong); }
.drama-cover {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.6s var(--ease);
}
.drama-card:hover .drama-cover { transform: scale(1.03); }
.drama-cover-ph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 11px; color: var(--text-faint);
  letter-spacing: 0.08em;
}
.drama-rating {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(10, 10, 9, 0.8); color: #f0c96a;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 1px 6px; border-radius: 1px;
  font-variant-numeric: tabular-nums;
}
.drama-rating-none { color: #b8b2a6; font-weight: 400; }
.drama-info { padding: 10px 0 0; display: flex; flex-direction: column; gap: 0; }
.drama-title {
  font-size: 13px; font-weight: 500; line-height: 1.45; letter-spacing: 0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drama-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drama-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; align-items: baseline; }
.drama-plat {
  font-size: 10px; color: var(--pc, #888); letter-spacing: 0.06em;
  border-bottom: 1px solid var(--pc, #888); padding-bottom: 1px;
  opacity: 0.9;
}
.drama-tag { font-size: 10px; color: var(--text-faint); letter-spacing: 0.04em; }

/* ---------- 私有笔记解锁 ---------- */
.lock-box { display: flex; gap: 8px; }
.lock-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong);
  border-radius: 0; padding: 7px 2px; color: var(--text);
  font-family: inherit; font-size: 12px; outline: none;
  transition: border-color 0.15s ease;
}
.lock-box input::placeholder { color: var(--text-faint); }
.lock-box input:focus { border-bottom-color: var(--accent); }
.lock-box button {
  flex-shrink: 0; background: transparent; border: 1px solid var(--rule-strong);
  color: var(--text-dim); border-radius: var(--radius-sm); padding: 5px 12px;
  font-family: inherit; font-size: 11.5px; letter-spacing: 0.06em; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.lock-box button:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.lock-box button:disabled { opacity: 0.4; cursor: default; background: transparent; color: var(--text-dim); border-color: var(--rule); }
.lock-msg { font-size: 10.5px; line-height: 1.8; color: var(--text-faint); margin-top: 10px; letter-spacing: 0.02em; }
.lock-msg b { color: var(--text); font-weight: 600; }
.lock-msg.ok { color: var(--accent2); }
.lock-msg.err { color: var(--red); }
.lock-clear {
  font-size: 10.5px; color: var(--text-faint); margin-top: 9px; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.lock-clear:hover { color: var(--text); }

/* 知识库左右分栏 */
.card.side { border-right: 1px solid var(--rule); padding-right: 36px; }
.card.main-col { padding-left: 40px; }

/* ---------- 风向（热榜解读） ---------- */
.insight-list { list-style: none; counter-reset: ins; padding-top: 2px; }
.insight-list li {
  position: relative; padding: 13px 0 13px 42px;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px; line-height: 1.85; color: var(--text-dim);
  letter-spacing: 0.01em;
}
.insight-list li:last-child { border-bottom: 0; }
.insight-list li::before {
  counter-increment: ins; content: counter(ins, decimal-leading-zero);
  position: absolute; left: 0; top: 16px;
  font-size: 10px; letter-spacing: 0.08em; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.insight-list b { color: var(--text); font-weight: 600; }

.card-note { padding: 12px 0 2px; font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.02em; }
.card-note a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.35);
  transition: border-color 0.15s ease;
}
.card-note a:hover { border-bottom-color: var(--accent); }

.dist { padding: 16px 0 6px; }
.dist-row {
  display: grid; grid-template-columns: 98px minmax(0, 1fr) 30px;
  align-items: center; gap: 12px; padding: 7px 0;
}
.dist-name {
  font-size: 12px; color: var(--text-dim); letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dist-bar { height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--text-faint); }
.dist-row.lead .dist-bar i { background: var(--accent); }
.dist-num {
  font-size: 12px; color: var(--text); text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-list { list-style: none; counter-reset: rk; padding-top: 4px; }
.rank-list li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before {
  counter-increment: rk; content: counter(rk, decimal-leading-zero);
  font-size: 10px; letter-spacing: 0.06em; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.rank-list a {
  font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.14s ease;
}
.rank-list a:hover { color: var(--accent); }
.rank-list .val {
  font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* 榜单里的纵向标记（新上榜 / 连续在榜） */
.trend-badge {
  font-size: 10px; letter-spacing: 0.06em; line-height: 1.8;
  padding: 0 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule-strong); color: var(--text-dim);
}
.trend-badge.new {
  color: var(--accent); border-color: rgba(var(--accent-rgb), 0.38);
}

/* ---------- 空态 / 页脚 ---------- */
.empty {
  color: var(--text-faint); font-size: 12px; padding: 32px 0;
  text-align: left; letter-spacing: 0.06em;
}
.empty::before {
  content: ""; display: block; width: 22px; height: 1px;
  background: var(--border-strong); margin-bottom: 12px;
}

footer {
  position: relative;
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 10px;
  color: var(--text-faint); font-size: 10.5px; letter-spacing: 0.08em;
  padding-block: 40px 56px;
  margin-top: 48px;
}
footer::before {
  content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter);
  height: 1px; background: var(--rule);
}
footer .sep { opacity: 0.45; }

/* ---------- 数据变更高亮 ---------- */
.stat.updated, .quote.updated { animation: halo 1.6s var(--ease); }
@keyframes halo {
  0% { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5); }
  100% { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger .stat:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
  .ledger .stat:nth-child(n + 4) { border-top: 1px solid var(--rule); }
  .cols { grid-template-columns: 1fr; }
  .cols.even { grid-template-columns: 1fr; }
  .cols > .card:first-child { padding-right: 0; }
  .cols > .card:last-child {
    padding-left: 0; border-left: 0; border-top: 1px solid var(--rule-strong);
    margin-top: 6px;
  }
  .grid-kb { grid-template-columns: 1fr; }
  .card.side { border-right: 0; padding-right: 0; border-bottom: 1px solid var(--rule-strong); padding-bottom: 26px; }
  .card.main-col { padding-left: 0; }
}

@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .masthead { flex-wrap: wrap; align-items: flex-start; gap: 16px; padding-top: 20px; padding-bottom: 14px; }
  .masthead-side { align-items: flex-start; width: 100%; }
  .edition { order: 2; }
  .refresh-bar { order: 1; }
  .tabs {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  .grid-2 { grid-template-columns: 1fr; }
  .weather-band { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
  .weather-band .mini-city:nth-child(odd) { border-left: 0; padding-left: 0; }
  .weather-band .mini-city { padding: 16px 0 4px; border-top: 1px solid var(--rule); }
  .weather-band .mini-city:nth-child(-n + 2) { border-top: 0; }
  .weather-city .temp { font-size: 46px; }
  footer { padding-block: 32px 44px; }
}

@media (max-width: 640px) {
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger .stat:nth-child(3n + 1) { border-left: 1px solid var(--rule); padding-left: 24px; }
  .ledger .stat:nth-child(2n + 1) { border-left: 0; padding-left: 0; }
  .ledger .stat:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .ledger .stat:nth-child(3) { border-top: 1px solid var(--rule); }
  .stat .num { font-size: 32px; }
  .tabs button { padding: 11px 15px 12px; font-size: 12.5px; }
  .tabs button::after { left: 15px; right: 15px; }
  .tabs button i { margin-right: 6px; }
  .drama-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 20px 12px; }
  .filter-row { flex-direction: column; gap: 7px; }
  .filter-label { padding-top: 0; }
  .note-card .body { font-size: 13.5px; }
  .list.numbered li { padding-left: 30px; }
  .list.numbered li::before { top: 17px; }
  .rel-item { flex-wrap: wrap; }
  .rel-item .reason { margin-left: 0; text-align: left; width: 100%; }
  footer { flex-direction: column; align-items: center; gap: 6px; text-align: center; }
  footer .sep { display: none; }
  .weather-city .temp { font-size: 40px; }
  .weather-daily { grid-template-columns: repeat(7, 1fr); }
  .wd { font-size: 9px; padding: 8px 2px 0; }
  .wd .d, .wd .t { font-size: 9px; }
}

/* ---------- 无障碍：尊重减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
