/* ==========================================================================
   Lord Fed's Gazette — 学习站设计系统
   定位：报纸编辑性 × 终端数据密度
   理由：来源刊名就是 "Gazette"（公报/报纸），作者是宏观交易员。
        正文需要长文阅读质感（衬线），数据与控件需要终端密度（等宽）。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  /* 色板：暖调纸墨，而非冷调 GitHub 黑 */
  --paper:      oklch(98.5% 0.004 85);
  --paper-2:    oklch(96.5% 0.006 85);
  --paper-3:    oklch(93.5% 0.008 85);
  --rule:       oklch(87% 0.008 85);
  --rule-soft:  oklch(91% 0.006 85);
  --ink:        oklch(22% 0.012 60);
  --ink-2:      oklch(38% 0.010 60);
  --ink-3:      oklch(55% 0.008 60);
  --ink-4:      oklch(68% 0.006 60);

  /* 品牌橙：取自 Lord Fed 的官方徽标 #FF6719 */
  --accent:     oklch(66% 0.196 42);
  --accent-ink: oklch(48% 0.170 40);
  --accent-bg:  oklch(96% 0.030 55);
  --accent-rule:oklch(85% 0.070 50);

  /* 语义色（数据方向，非装饰） */
  --up:         oklch(55% 0.130 150);
  --up-bg:      oklch(96% 0.030 150);
  --down:       oklch(55% 0.180 25);
  --down-bg:    oklch(96% 0.030 25);
  --warn:       oklch(62% 0.140 75);
  --warn-bg:    oklch(96% 0.040 80);
  --info:       oklch(55% 0.110 245);
  --info-bg:    oklch(96% 0.026 245);

  /* 字体：衬线负责阅读，等宽负责数据，Plex 负责界面 */
  --serif: "Newsreader", "Source Serif 4", Georgia, "Songti SC", serif;
  --sans:  "IBM Plex Sans", "Segoe UI", system-ui, "PingFang SC", sans-serif;
  --mono:  "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* 间距：4px 基准 */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* 圆角：报纸/终端质感，克制 */
  --r1: 2px; --r2: 4px; --r3: 6px;

  /* 阴影：几乎不用，靠细线分层 */
  --shadow-1: 0 1px 2px oklch(20% 0.01 60 / 0.06);
  --shadow-2: 0 4px 16px oklch(20% 0.01 60 / 0.08);

  --rail: 232px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 深色：交易台的夜间读法 */
[data-theme="dark"] {
  --paper:      oklch(17% 0.008 70);
  --paper-2:    oklch(20.5% 0.009 70);
  --paper-3:    oklch(24% 0.010 70);
  --rule:       oklch(30% 0.010 70);
  --rule-soft:  oklch(26% 0.009 70);
  --ink:        oklch(94% 0.006 85);
  --ink-2:      oklch(80% 0.008 85);
  --ink-3:      oklch(64% 0.008 85);
  --ink-4:      oklch(50% 0.008 85);

  --accent:     oklch(72% 0.180 45);
  --accent-ink: oklch(78% 0.170 48);
  --accent-bg:  oklch(26% 0.045 45);
  --accent-rule:oklch(38% 0.090 48);

  --up:         oklch(70% 0.140 150);
  --up-bg:      oklch(26% 0.040 150);
  --down:       oklch(70% 0.170 25);
  --down-bg:    oklch(26% 0.045 25);
  --warn:       oklch(76% 0.130 80);
  --warn-bg:    oklch(27% 0.045 80);
  --info:       oklch(72% 0.110 245);
  --info-bg:    oklch(26% 0.040 245);

  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.35);
  --shadow-2: 0 6px 20px oklch(0% 0 0 / 0.45);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.011em;
  margin: 0;
  text-wrap: pretty;
}

p { text-wrap: pretty; }

::selection { background: var(--accent-bg); color: var(--accent-ink); }

/* 焦点可见性：键盘可达 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 10px;
  border: 2px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ---------- 版式：小标签 / 眉标 ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 应用骨架 ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

/*
 * 遮罩在桌面端必须彻底移出布局。
 * 它是 .app 网格的直接子元素 —— 若桌面端仍有 display，就会占掉一个网格单元，
 * 把 .main 挤到第二行（内容整体落到 100vh 之下，表现为整页空白）。
 * 因此只在移动端媒体查询内启用。
 */
.rail-scrim { display: none; }

/* 左栏导航 */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--rule);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rail-head {
  padding: var(--s5) var(--s4) var(--s4);
  border-bottom: 1px solid var(--rule);
}

.masthead {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}

.masthead-mark {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.masthead-title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.masthead-sub {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.rail-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4) var(--s3);
}

.nav-group + .nav-group { margin-top: var(--s5); }

.nav-group-label {
  padding: 0 var(--s2) var(--s2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: 7px var(--s2);
  border: 0;
  background: none;
  border-radius: var(--r2);
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.nav-item:hover { background: var(--paper-3); color: var(--ink); }

.nav-item[aria-current="true"] {
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-weight: 500;
}

.nav-item-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
}

.nav-item[aria-current="true"] .nav-item-count { color: var(--accent-ink); opacity: 0.75; }

.nav-glyph {
  flex: none;
  width: 16px; height: 16px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
}

.rail-foot {
  border-top: 1px solid var(--rule);
  padding: var(--s3) var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.rail-foot .eyebrow { flex: 1; }

/* 主题切换 */
.theme-toggle {
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: var(--r2);
  padding: 4px 7px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}
.theme-toggle:hover { border-color: var(--ink-4); color: var(--ink); }

/* 主区域 */
.main { min-width: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: var(--s7) var(--s6) var(--s9); }
.wrap-narrow { max-width: 740px; }

/* ---------- 顶部页头 ---------- */
.page-head { margin-bottom: var(--s6); }

.page-title {
  font-size: clamp(30px, 4.2vw, 46px);
  letter-spacing: -0.028em;
  margin-top: var(--s3);
}

.page-lede {
  margin-top: var(--s4);
  max-width: 62ch;
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink-2);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.stat-n {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat-l {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ---------- 分区 ---------- */
.section { margin-top: var(--s8); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--s5);
}

.section-title { font-size: 21px; letter-spacing: -0.018em; }

.section-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ---------- 课程路径 ---------- */
.stage {
  border: 1px solid var(--rule);
  border-radius: var(--r3);
  background: var(--paper-2);
  overflow: hidden;
}

.stage + .stage { margin-top: var(--s4); }

.stage-head {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--paper-3);
  border-bottom: 1px solid var(--rule);
}

.stage-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
  background: var(--accent-bg);
  border: 1px solid var(--accent-rule);
  border-radius: var(--r1);
  padding: 2px 7px;
  flex: none;
}

.stage-name { font-size: 18px; }

.stage-goal {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
  max-width: 46ch;
}

.stage-body { padding: var(--s2) var(--s3) var(--s3); }

/* 文章行 */
.post-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  padding: var(--s3);
  border: 0;
  background: none;
  border-radius: var(--r2);
  cursor: pointer;
  text-align: left;
  transition: background 130ms var(--ease);
}

.post-row:hover { background: var(--paper); }

.post-row + .post-row { border-top: 1px solid var(--rule-soft); }

.post-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  /* 日期是原子单元：列宽不足时不能断成两行 */
  white-space: nowrap;
}

.post-title {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -0.008em;
}

.post-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-tags { display: flex; gap: var(--s2); align-items: center; flex: none; }

.tag-words {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--r1);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-full  { background: var(--up-bg);     color: var(--up);     border-color: color-mix(in oklab, var(--up) 30%, transparent); }
.badge-prev  { background: var(--paper-3);   color: var(--ink-3);  border-color: var(--rule); }
.badge-locked{ background: var(--warn-bg);   color: var(--warn);   border-color: color-mix(in oklab, var(--warn) 30%, transparent); }
.badge-new   { background: var(--accent-bg); color: var(--accent-ink); border-color: var(--accent-rule); }

/* ---------- 模块卡网格 ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--s4);
}

.module-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s5);
  border: 1px solid var(--rule);
  border-radius: var(--r3);
  background: var(--paper-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
  min-height: 172px;
}

.module-card:hover {
  border-color: var(--accent-rule);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.module-card-title {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.module-card-source {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.module-card-thesis {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}

.module-card-foot {
  margin-top: auto;
  padding-top: var(--s3);
  border-top: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ---------- 交互模块容器 ---------- */
.mod-head {
  padding-bottom: var(--s5);
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--s6);
}

.mod-title { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.026em; margin-top: var(--s3); }
.mod-thesis {
  margin-top: var(--s4);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--accent-ink);
  max-width: 46ch;
  font-style: italic;
}

.mod-section { margin-top: var(--s7); }

.mod-section-title {
  font-size: 22px;
  letter-spacing: -0.018em;
  margin-bottom: var(--s2);
}

.mod-section-intro {
  font-size: 15px;
  color: var(--ink-2);
  max-width: 68ch;
  margin-bottom: var(--s5);
}

/* 实验台：控件 + 画布 */
.lab {
  border: 1px solid var(--rule);
  border-radius: var(--r3);
  background: var(--paper-2);
  overflow: hidden;
}

.lab-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-3);
}

.lab-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.lab-body { padding: var(--s5); }

.lab-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: var(--s5);
  align-items: start;
}

@media (max-width: 860px) {
  .lab-split { grid-template-columns: minmax(0, 1fr); }
}

.plot { width: 100%; display: block; overflow: visible; }

/* 分段控件 */
.seg {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  overflow: hidden;
  background: var(--paper);
}

.seg button {
  border: 0;
  background: none;
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 130ms var(--ease), color 130ms var(--ease);
}

.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--paper-3); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* 滑块 */
.field { margin-bottom: var(--s4); }

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
}

.field-name {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--rule);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: grab;
  transition: transform 120ms var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.14); }
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--paper); cursor: grab;
}

/* 读数面板 */
.readout {
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: var(--paper);
  overflow: hidden;
}

.readout-row {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  padding: 7px var(--s3);
  font-size: 13px;
}

.readout-row + .readout-row { border-top: 1px solid var(--rule-soft); }

.readout-k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
  flex: none;
}

.readout-v {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.v-up { color: var(--up); }
.v-down { color: var(--down); }
.v-flat { color: var(--ink-2); }

.readout-row.is-hero { padding: var(--s3); background: var(--paper-2); }
.readout-row.is-hero .readout-v { font-size: 19px; }

/* 判定横幅 */
.verdict {
  padding: var(--s4) var(--s5);
  border-radius: var(--r3);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
}

.verdict-mark {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.verdict-title { font-family: var(--serif); font-size: 17px; margin-bottom: 3px; }
.verdict-text { font-size: 13.5px; line-height: 1.55; }

.verdict-ok   { background: var(--up-bg);   border-color: color-mix(in oklab, var(--up) 32%, transparent); }
.verdict-ok   .verdict-mark { background: var(--up); }
.verdict-ok   .verdict-title { color: var(--up); }

.verdict-warn { background: var(--warn-bg); border-color: color-mix(in oklab, var(--warn) 32%, transparent); }
.verdict-warn .verdict-mark { background: var(--warn); }
.verdict-warn .verdict-title { color: var(--warn); }

.verdict-bad  { background: var(--down-bg); border-color: color-mix(in oklab, var(--down) 32%, transparent); }
.verdict-bad  .verdict-mark { background: var(--down); }
.verdict-bad  .verdict-title { color: var(--down); }

/* 勾选清单 */
.check-list { display: flex; flex-direction: column; gap: 1px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  width: 100%;
  padding: var(--s3);
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--r2);
  transition: background 130ms var(--ease);
}

.check:hover { background: var(--paper-3); }

.check-box {
  flex: none;
  width: 16px; height: 16px;
  margin-top: 2px;
  border: 1.5px solid var(--ink-4);
  border-radius: var(--r1);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: transparent;
  transition: all 140ms var(--ease);
}

.check[aria-pressed="true"] .check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.check-text { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.check[aria-pressed="true"] .check-text { color: var(--ink); }

.check-note {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-4);
}

/* 阶梯（仓位桶） */
.ladder { display: flex; flex-direction: column; gap: var(--s2); }

.rung {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--s4);
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: var(--paper);
  overflow: hidden;
  transition: border-color 150ms var(--ease);
}

.rung:hover { border-color: var(--accent-rule); }

.rung-key {
  display: grid;
  place-items: center;
  padding: var(--s4) var(--s2);
  background: var(--paper-3);
  border-right: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink-2);
}

.rung-body { padding: var(--s4); }
.rung-text { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.rung-note {
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px dashed var(--rule);
  font-size: 12.5px;
  color: var(--ink-4);
  font-style: italic;
}

/* 流程 */
.flow { display: flex; flex-direction: column; }

.flow-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: var(--s4);
  position: relative;
  padding-bottom: var(--s4);
}

.flow-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 12.5px; top: 26px; bottom: 0;
  width: 1px;
  background: var(--rule);
}

.flow-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  z-index: 1;
}

.flow-text { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); padding-top: 3px; }

/* 对照双栏 */
.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s3);
}

.compare-col {
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: var(--paper);
  padding: var(--s4);
}

.compare-head {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  padding-bottom: var(--s2);
  margin-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}

.compare-body { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }

/* 结论条 */
.takeaway {
  margin-top: var(--s4);
  padding: var(--s3) var(--s4);
  border-left: 2px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--r2) var(--r2) 0;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--accent-ink);
  line-height: 1.5;
}

/* 四象限 */
.quad {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s3);
}

.quad-cell {
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: var(--paper);
  padding: var(--s4);
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}

.quad-cell:hover { border-color: var(--accent-rule); transform: translateY(-1px); }

.quad-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--s2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.quad-num {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 9.5px;
}

.quad-text { font-size: 13px; line-height: 1.55; color: var(--ink-2); }

/* 堆叠条 */
.stack { display: flex; flex-direction: column; gap: var(--s3); }

.stack-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule-soft);
}

.stack-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.stack-text { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }

/* 强提示块 */
.callout {
  padding: var(--s4) var(--s5);
  border: 1px solid var(--accent-rule);
  border-radius: var(--r3);
  background: var(--accent-bg);
}

.callout-intro {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  color: var(--accent-ink);
  font-style: italic;
}

.callout-body {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--accent-rule);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* 条目列表 */
.item-list { display: flex; flex-direction: column; gap: 1px; }

.item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule-soft);
}

.item + .item { border-top: 0; }

.item-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-ink);
  padding-top: 2px;
}

.item-text { font-size: 13.5px; line-height: 1.58; color: var(--ink-2); }

/* ---------- 阅读器 ---------- */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 244px; gap: var(--s7); align-items: start; }

@media (max-width: 1000px) { .reader { grid-template-columns: minmax(0, 1fr); } }

.article-head { margin-bottom: var(--s6); padding-bottom: var(--s5); border-bottom: 1px solid var(--rule); }

.article-title { font-size: clamp(27px, 3.6vw, 40px); letter-spacing: -0.026em; }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-top: var(--s4);
  align-items: center;
}

.prose {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink);
}

/* 文章标题的中文副题：只在需要中文时出现 */
.article-title-zh {
  margin-top: var(--s2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink-3);
  font-weight: 400;
}

html:not(.show-tr):not(.only-tr) .article-title-zh { display: none; }

/* ---------- 双语对照 ----------
 * 译文以 <div class="lf-tr"> 直接嵌在原文块之后（构建期生成）。
 * 显示/隐藏只切换 <html> 上的 class，因此切换是纯样式行为：
 * 不重排 DOM、不重新渲染，长文里也不会卡。
 *
 * 两种阅读模式：
 *   .show-tr   —— 显示译文（默认，学习用）
 *   .only-tr   —— 只显示译文（隐藏原文，当纯中文版读）
 */
.prose .lf-tr { display: none; }

html.show-tr .prose .lf-tr,
html.only-tr .prose .lf-tr {
  display: block;
  margin: 0 0 var(--s4);
  padding: 7px 0 7px var(--s4);
  border-left: 2px solid var(--accent-rule);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* 列表项里的译文：与列表项文字对齐，且不产生额外缩进 */
.prose li .lf-tr {
  margin: var(--s2) 0 0;
  padding: 5px 0 5px var(--s3);
  font-size: 14px;
}

/* 只显示译文时隐藏原文块（译文自身不受影响） */
html.only-tr .prose > p,
html.only-tr .prose > h1,
html.only-tr .prose > h2,
html.only-tr .prose > h3,
html.only-tr .prose > h4,

html.only-tr .prose > h5,
html.only-tr .prose > ul,
html.only-tr .prose > ol,
html.only-tr .prose > blockquote,
html.only-tr .prose > hr {
  display: none;
}


/* 目录条目：中文译文只在开启中文时显示，避免目录变拥挤 */
.toc-en { display: block; }
.toc-zh { display: none; }

html.show-tr .toc-zh,
html.only-tr .toc-zh {
  display: block;
  font-size: 11.5px;
  color: var(--ink-4);
  margin-top: 1px;
}

html.only-tr .toc-en { display: none; }
/* 原文是块级容器时（li 内），把它的直接文本节点藏起来 */
html.only-tr .prose li > :not(.lf-tr) { display: none; }

/* ---------- 双语切换控件 ---------- */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  overflow: hidden;
  background: var(--paper);
}

.lang-toggle button {
  border: 0;
  background: none;
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 130ms var(--ease), color 130ms var(--ease);
}

.lang-toggle button + button { border-left: 1px solid var(--rule); }
.lang-toggle button:hover { background: var(--paper-3); color: var(--ink); }
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* 侧栏的全局双语开关 */
.lang-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s4) var(--s3);
}

.lang-row .eyebrow { flex: 1; }

.prose p { margin: 0 0 var(--s4); }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5 {
  font-family: var(--serif);
  margin: var(--s6) 0 var(--s3);
  letter-spacing: -0.015em;
}

.prose h1 { font-size: 27px; }
.prose h2 { font-size: 23px; }
.prose h3 { font-size: 19.5px; }
.prose h4 { font-size: 17px; }
.prose h5 { font-size: 15.5px; font-style: italic; }

.prose strong { font-weight: 600; }

.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-rule);
  text-underline-offset: 2px;
}
.prose a:hover { text-decoration-color: var(--accent); }

.prose ul, .prose ol { margin: 0 0 var(--s4); padding-left: 1.3em; }
.prose li { margin-bottom: 7px; }

.prose blockquote {
  margin: var(--s5) 0;
  padding-left: var(--s5);
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-2);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s7) 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r2);
  border: 1px solid var(--rule);
  margin: var(--s4) 0;
  background: var(--paper-2);
}

.prose figure { margin: var(--s5) 0; }
.prose figcaption {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-4);
  text-align: center;
  margin-top: var(--s2);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--paper-3);
  padding: 1px 5px;
  border-radius: var(--r1);
}

/* 文章内目录 */
.toc {
  position: sticky;
  top: var(--s5);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  padding-left: var(--s4);
}

.toc-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: var(--s3);
}

.toc-item {
  display: block;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-3);
  transition: color 130ms var(--ease);
}

.toc-item:hover { color: var(--ink); }
.toc-item.lvl-2 { padding-left: var(--s3); font-size: 12px; }
.toc-item.lvl-3 { padding-left: var(--s5); font-size: 11.5px; color: var(--ink-4); }
.toc-item.is-active { color: var(--accent-ink); font-weight: 500; }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
}

.article-nav button {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  border-radius: var(--r3);
  padding: var(--s3) var(--s4);
  cursor: pointer;
  max-width: 46%;
  text-align: left;
  transition: border-color 140ms var(--ease);
}

.article-nav button:hover { border-color: var(--accent-rule); }
.article-nav .eyebrow { margin-bottom: 3px; }
.article-nav .nav-title { font-family: var(--serif); font-size: 14px; line-height: 1.35; }

/* 付费墙提示 */
.paywall {
  margin-top: var(--s6);
  padding: var(--s6) var(--s5);
  border: 1px dashed var(--accent-rule);
  border-radius: var(--r3);
  background: var(--accent-bg);
  text-align: center;
}

.paywall-title { font-family: var(--serif); font-size: 19px; color: var(--accent-ink); }
.paywall-text { margin-top: var(--s2); font-size: 13.5px; color: var(--ink-2); max-width: 52ch; margin-inline: auto; }
.paywall-link {
  display: inline-block;
  margin-top: var(--s4);
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r2);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: opacity 140ms var(--ease);
}
.paywall-link:hover { opacity: 0.88; }

/* ---------- 归档表 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  padding: var(--s3) 0;
  margin-bottom: var(--s4);
  border-bottom: 1px solid var(--rule);
}

.search {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: var(--paper-2);
  padding: 7px var(--s3);
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 140ms var(--ease);
}
.search:focus { outline: none; border-color: var(--accent); }
.search::placeholder { color: var(--ink-4); }

.archive-list { display: flex; flex-direction: column; }

.year-rule {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s5) 0 var(--s2);
  border-bottom: 1px solid var(--ink);
  margin-bottom: var(--s2);
}

.year-num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.year-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  margin-left: auto;
  letter-spacing: 0.07em;
}

/* ---------- 空状态 ---------- */
.empty {
  padding: var(--s8) var(--s5);
  text-align: center;
  color: var(--ink-4);
}

.empty-title { font-family: var(--serif); font-size: 19px; color: var(--ink-2); margin-bottom: var(--s2); }

/* ---------- 提示气泡 ---------- */
.hint {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin-top: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  background: var(--info-bg);
  border: 1px solid color-mix(in oklab, var(--info) 26%, transparent);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}

.hint-mark {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--info);
  font-weight: 600;
  padding-top: 1px;
}

/* ---------- 图表通用 ---------- */
.axis-line { stroke: var(--rule); stroke-width: 1; }
.axis-text {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.grid-line { stroke: var(--rule-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.ref-line { stroke: var(--ink-4); stroke-width: 1; stroke-dasharray: 3 3; }
.curve { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.curve-accent { stroke: var(--accent); }
.curve-up { stroke: var(--up); }
.curve-down { stroke: var(--down); }
.curve-info { stroke: var(--info); }
.curve-warn { stroke: var(--warn); }
.area-fill { opacity: 0.10; }
.marker-dot { stroke: var(--paper); stroke-width: 2; }
.label-sans { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); }
.label-strong { font-family: var(--mono); font-size: 10.5px; font-weight: 500; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  :root { --rail: 0px; }
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    left: 0; top: 0;
    width: 256px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms var(--ease);
    box-shadow: var(--shadow-2);
  }
  .rail.is-open { transform: translateX(0); }
  /* 桌面端的 display:none 需要在这里显式覆盖，否则遮罩在移动端也不会出现 */
  .rail-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms var(--ease);
  }
  .rail-scrim.is-open { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid !important; }
  .wrap { padding: var(--s5) var(--s4) var(--s8); }
}

.menu-btn {
  display: none;
  position: fixed;
  left: var(--s3); bottom: var(--s3);
  z-index: 45;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  place-items: center;
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
