/* ==========================================================================
   Leo 的学习站 — 视觉系统
   暖纸底色 + 墨绿主色 + 衬线标题，阅读优先。
   ========================================================================== */

:root {
  --paper: #fbf9f4;
  --paper-2: #f4efe4;
  --surface: #ffffff;
  --surface-2: #f7f3ea;
  --ink: #1c1b17;
  --ink-2: #3a3833;
  --muted: #6f6a5f;
  --faint: #9a9488;
  --line: #e6e0d3;
  --line-strong: #d6cfbf;
  --accent: #12594d;
  --accent-2: #0d443b;
  --accent-soft: #e4efeb;
  --warm: #b0522a;
  --warm-soft: #f6e8de;
  --danger: #b03a2e;
  --shadow-sm: 0 1px 2px rgba(35, 30, 20, 0.04), 0 2px 8px rgba(35, 30, 20, 0.03);
  --shadow-md: 0 12px 32px rgba(35, 30, 20, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --maxw: 1120px;
  --nav-h: 68px;
}

[data-theme="dark"] {
  --paper: #121310;
  --paper-2: #191a16;
  --surface: #1b1c17;
  --surface-2: #20211c;
  --ink: #ece7db;
  --ink-2: #d5cfc1;
  --muted: #a49d8e;
  --faint: #7e786b;
  --line: #2c2d26;
  --line-strong: #3b3c33;
  --accent: #78c3b1;
  --accent-2: #9bd6c7;
  --accent-soft: #1c2b26;
  --warm: #e0915f;
  --warm-soft: #2c211a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

::selection { background: var(--accent); color: #fff; }

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

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }

p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }

.shell { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.narrow-shell { max-width: 800px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; height: var(--nav-h); }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: 0 0 36px;
  background: var(--accent); color: #f7f2e6;
  border-radius: 10px;
  font-family: var(--serif); font-size: 20px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.brand-mark.small { width: 26px; height: 26px; flex-basis: 26px; font-size: 15px; border-radius: 7px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--serif); font-size: 16px; letter-spacing: 0.01em; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 11.5px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-size: 14.5px; transition: color 0.18s, background 0.18s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.on { color: var(--ink); font-weight: 600; }
.nav a.on::after {
  content: ""; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  width: 18px; height: 2px; border-radius: 2px; background: var(--accent);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; color: var(--muted); transition: 0.18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--line-strong); }
.icon-btn .ico svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-btn .ico svg { transform: rotate(180deg); }
.admin-link {
  font-size: 13px; color: var(--muted); border-bottom: 1px dashed var(--line-strong);
  padding-bottom: 1px;
}
.admin-link:hover { color: var(--accent); }

/* ---------- 通用元素 ---------- */
.ico { display: inline-flex; align-items: center; }
.ico svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.eyebrow, .kicker {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
[data-theme="dark"] .kicker, [data-theme="dark"] .eyebrow { color: var(--accent-2); }

.lede { color: var(--muted); font-size: 17px; line-height: 1.8; max-width: 56ch; text-wrap: pretty; }
.lede.narrow { max-width: 62ch; }
.empty { color: var(--faint); font-style: italic; padding: 24px 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  font-size: 14.5px; font-weight: 500; line-height: 1.2;
  transition: transform 0.15s, background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap; flex: 0 0 auto;
}
.btn .ico svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #f8f4e9; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
[data-theme="dark"] .btn-primary { color: #0d1a16; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 正文里的按钮不能被 .prose a 的链接样式覆盖 */
.prose .btn { border-bottom: 0; text-decoration: none; }
.prose .btn-primary { color: #f8f4e9; }
.prose .btn-ghost { color: var(--ink); }
[data-theme="dark"] .prose .btn-primary { color: #0d1a16; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.6;
  border: 1px solid transparent;
}
.badge .ico svg { width: 12px; height: 12px; }
.badge-link { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.badge-file { color: var(--warm); background: var(--warm-soft); border-color: color-mix(in srgb, var(--warm) 22%, transparent); }
.badge-cat { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 18%, transparent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}

/* ---------- 首页 Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(900px 420px at 82% 8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 65%),
    radial-gradient(700px 380px at 4% 100%, color-mix(in srgb, var(--warm) 7%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 64px; align-items: end; padding-top: 88px; padding-bottom: 76px;
}
.hero h1 {
  font-size: clamp(38px, 5.6vw, 66px); line-height: 1.14; letter-spacing: -0.025em;
  margin: 0 0 24px; color: var(--ink);
}
.hero h1 em {
  font-style: italic; color: var(--accent);
  position: relative; white-space: nowrap;
}
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 8px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); z-index: -1; border-radius: 2px;
}
.hero .lede { max-width: 48ch; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-panel {
  border: 1px solid var(--line); border-radius: 20px; padding: 26px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 4px;
}
.hero-panel .stat {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 2px; border-bottom: 1px dashed var(--line);
}
.hero-panel .stat:last-of-type { border-bottom: 0; }
.hero-panel .stat strong { font-family: var(--serif); font-size: 34px; color: var(--accent); line-height: 1; }
.hero-panel .stat span { color: var(--muted); font-size: 13.5px; }
.panel-note { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; letter-spacing: 0.02em; }

/* ---------- 区块 ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); }
.more { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; padding-bottom: 4px; border-bottom: 1px solid var(--line-strong); }
.more:hover { color: var(--accent); border-color: var(--accent); }
.more .ico svg { width: 14px; height: 14px; }

.page-head { padding: 64px 0 28px; }
.page-head h1 { font-size: clamp(34px, 4.4vw, 52px); margin-bottom: 18px; letter-spacing: -0.02em; }
.page-head .lede { margin-bottom: 28px; }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; gap: 20px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex; flex-direction: column; gap: 12px;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-top time { color: var(--faint); font-size: 12px; font-family: var(--mono); letter-spacing: 0.02em; }
.card-title { font-size: 21px; line-height: 1.4; letter-spacing: -0.01em; }
.card-summary { color: var(--muted); font-size: 14px; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.go { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; opacity: 0; transform: translateX(-4px); transition: 0.2s; }
.card:hover .go { opacity: 1; transform: none; }
.go .ico svg { width: 14px; height: 14px; }

.mini-file { display: inline-flex; align-items: center; gap: 5px; color: var(--warm); font-size: 11.5px; }
.mini-file .ico svg { width: 13px; height: 13px; }

/* ---------- 筛选器 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13px; cursor: pointer; transition: 0.18s;
}
.chip span { font-family: var(--mono); font-size: 10.5px; opacity: 0.65; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #f8f4e9; }
[data-theme="dark"] .chip.on { color: #0e1512; }

.hidden { display: none !important; }

/* ---------- 文章详情 ---------- */
.article { padding: 40px 0 72px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.back:hover { color: var(--accent); }
.article-head { padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.article-head h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.25; margin: 16px 0 16px; letter-spacing: -0.02em; }
.article-head .lede { font-size: 16.5px; }
.article-head .tags { margin-top: 18px; }
.article-body { min-height: 80px; }
.article-foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }

.prose { font-size: 17px; line-height: 1.95; color: var(--ink-2); min-width: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h3, .prose h4, .prose h5 { color: var(--ink); margin: 1.8em 0 0.6em; }
.prose h3 { font-size: 23px; }
.prose h4 { font-size: 20px; }
.prose h5 { font-size: 20px; margin-top: 2em; }
.prose h6 { font-size: 17px; color: var(--ink); margin: 1.6em 0 0.5em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { color: var(--ink); }
.prose code {
  font-family: var(--mono); font-size: 0.88em; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
.prose blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent);
  color: var(--muted); font-style: italic;
}
.prose a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.2em 0; }

/* 表格 */
.prose .table-wrap {
  margin: 1.2em 0 1.7em; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); overflow-x: auto; -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.7; min-width: 480px; }
.prose thead th {
  background: var(--surface-2); color: var(--ink); font-weight: 600; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.prose tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.prose .ta-right { text-align: right; }
.prose .ta-center { text-align: center; }
.prose .ta-left { text-align: left; }
.prose th.ta-right, .prose td.ta-right { white-space: nowrap; }
@media (max-width: 640px) {
  .prose th.ta-right, .prose td.ta-right { min-width: 54px; }
}

/* 任务清单 */
.prose li.task { list-style: none; display: flex; align-items: flex-start; gap: 9px; margin-left: -1.25em; }
.prose li.task input { margin-top: 0.42em; accent-color: var(--accent); width: 15px; height: 15px; }
.prose li.task.done span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

/* 本页目录 */
.toc {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 22px; margin: 0 0 34px;
}
.toc-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc-list { columns: 2; column-gap: 32px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; line-height: 1.95; }
.toc-list a { color: var(--ink-2); border-bottom: 1px dashed transparent; display: block; }
.toc-list a::before { content: "·"; color: var(--accent); margin-right: 8px; }
.toc-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* 得分 */
.head-row { display: flex; align-items: flex-start; gap: 28px; justify-content: space-between; }
.head-row h1 { flex: 1; }
.score-hero {
  flex: 0 0 auto; width: 104px; height: 104px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--accent-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 16px;
}
.score-hero strong { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--accent); }
.score-hero span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.score-hero small { font-size: 10px; color: var(--faint); margin-top: 4px; letter-spacing: 0.06em; }

.score-mini {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
.score-mini strong { font-size: 12.5px; }

.score-strip {
  display: inline-flex; align-items: baseline; gap: 4px; margin: 0 0 22px;
  padding: 8px 14px; border-radius: 10px; background: var(--accent-soft);
  color: var(--muted); font-size: 13px;
}
.score-strip strong { font-family: var(--serif); font-size: 22px; color: var(--accent); }
.score-strip span { font-family: var(--mono); font-size: 11px; }

.card-top time { margin-left: auto; }

.attach-title { font-size: 15px !important; letter-spacing: 0.08em; text-transform: uppercase; font-family: var(--mono); color: var(--faint) !important; margin: 2em 0 0.9em !important; }

/* ---------- 链接卡 / 文件卡 ---------- */
.link-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 22px; margin: 8px 0 28px;
}
.link-ico, .file-ico {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.link-ico .ico svg { width: 22px; height: 22px; }
.link-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; gap: 2px; }
.link-meta small { color: var(--faint); font-size: 11px; font-family: var(--mono); letter-spacing: 0.06em; }
.link-meta strong { font-size: 15px; }
.link-meta span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 18px 20px; margin: 8px 0 20px;
}
.file-ico {
  width: 50px; height: 58px; border-radius: 8px;
  background: var(--warm-soft); color: var(--warm);
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
}
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; }
.file-meta strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { color: var(--faint); font-size: 12.5px; }
.file-actions { display: flex; gap: 8px; }

.preview { margin: 6px 0 24px; }
.preview img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.preview.pdf iframe { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.preview.audio { width: 100%; margin: 4px 0 18px; }

.neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 44px 0 0; }
.neighbor {
  display: flex; flex-direction: column; gap: 5px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  transition: 0.18s; min-height: 74px;
}
.neighbor:hover { border-color: var(--accent); background: var(--accent-soft); }
.neighbor small { color: var(--faint); font-size: 11.5px; letter-spacing: 0.04em; }
.neighbor span { font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.neighbor.is-empty { border: 0; background: transparent; justify-content: center; color: var(--faint); font-style: italic; }
.neighbors .neighbor:last-child { text-align: right; }
.neighbors .neighbor:last-child span { justify-self: end; }

/* ---------- 英语时间线 ---------- */
.month { margin-bottom: 46px; }
.month-label { font-size: 15px; font-family: var(--mono); letter-spacing: 0.06em; color: var(--muted); margin-bottom: 18px; font-weight: 500; }
.month-label span { color: var(--ink); font-size: 20px; }
.timeline { position: relative; padding-left: 64px; }
.timeline::before { content: ""; position: absolute; left: 50px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 26px; }
.tl-date { position: absolute; left: -64px; top: 2px; width: 44px; text-align: right; color: var(--faint); font-family: var(--mono); font-size: 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -9px; top: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line-strong); transition: 0.2s;
}
.tl-item:hover::before { border-color: var(--accent); background: var(--accent); }
.tl-body {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 18px 20px; transition: 0.2s; position: relative;
}
.tl-item:hover .tl-body { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.tl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tl-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-body h3 { font-size: 17.5px; line-height: 1.45; margin-bottom: 6px; }
.tl-body p { color: var(--muted); font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.tl-body .mini-file { margin-top: 10px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); padding: 40px 0 48px; background: var(--paper-2); }
.footer-inner { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 15px; }
.footer-note { color: var(--muted); font-size: 13px; }
.footer-copy { color: var(--faint); font-size: 12px; font-family: var(--mono); letter-spacing: 0.02em; }

/* 阅读进度条 */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: var(--accent); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 0.08s linear; pointer-events: none;
}

.notfound { padding: 80px 0; }
.notfound h1 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 14px; }
.notfound .btn { margin-top: 26px; }

/* ==========================================================================
   管理后台
   ========================================================================== */
.admin-page main { padding: 32px 0 80px; min-height: 60vh; }
.admin-app { max-width: 1080px; margin: 0 auto; padding: 0 28px; }
.admin-loading { color: var(--muted); padding: 60px 0; text-align: center; }

.login-card {
  max-width: 400px; margin: 60px auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 36px; box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 28px; margin-bottom: 8px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 16px; }

.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 32px; }
.admin-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.admin-head-actions { display: flex; gap: 10px; align-items: center; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tab {
  padding: 11px 18px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.panel { display: none; }
.panel.on { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
@media (min-width: 980px) { .admin-grid.split { grid-template-columns: 380px minmax(0, 1fr); align-items: start; } }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.box h2 { font-size: 18px; margin-bottom: 4px; }
.box .box-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }
.field .hint { font-size: 11.5px; color: var(--faint); }
input[type="text"], input[type="url"], input[type="password"], input[type="date"], input[type="email"], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 130px; line-height: 1.7; font-family: var(--sans); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--paper); gap: 3px; }
.seg button {
  padding: 7px 14px; border: 0; background: none; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px;
}
.seg button.on { background: var(--accent); color: #f8f4e9; }
[data-theme="dark"] .seg button.on { color: #0e1512; }

.upload-zone {
  border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: 0.18s;
  background: var(--paper);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.upload-zone strong { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 3px; }
.upload-zone input { display: none; }
.upload-current { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--accent); flex-wrap: wrap; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: flex-start; padding: 15px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--faint); font-size: 11.5px; font-family: var(--mono); }
.list-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mini-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 7px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--muted);
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.stat-box strong { display: block; font-family: var(--serif); font-size: 30px; color: var(--accent); line-height: 1.1; }
.stat-box span { color: var(--muted); font-size: 12.5px; }

.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 12px; font-size: 13px;
  background: var(--warm-soft); color: var(--warm); border: 1px solid color-mix(in srgb, var(--warm) 25%, transparent);
  margin-bottom: 22px;
}
.notice .btn { margin-left: auto; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 200;
  box-shadow: var(--shadow-md); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

.admin-foot { margin-top: 40px; color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; padding-top: 56px; padding-bottom: 52px; align-items: start; }
  .hero-panel { flex-direction: row; flex-wrap: wrap; gap: 0; }
  .hero-panel .stat { flex: 1 1 30%; flex-direction: column; align-items: flex-start; border-bottom: 0; padding: 8px 10px; }
  .hero-panel .stat strong { font-size: 28px; }
  .panel-note { flex-basis: 100%; margin-top: 8px; }
  .brand-text small { display: none; }
  .section { padding: 52px 0; }
  .timeline { padding-left: 52px; }
  .timeline::before { left: 38px; }
  .tl-date { left: -52px; width: 34px; }
}

@media (max-width: 640px) {
  .shell { padding: 0 18px; }
  .admin-app { padding: 0 18px; }
  .prose .table-wrap { max-width: 100%; }
  .prose table { font-size: 13px; min-width: 0; width: 100%; }
  .prose thead th { white-space: normal; }
  .prose tbody td { overflow-wrap: anywhere; }
  .toc-list { columns: 1; }
  .head-row { gap: 14px; }
  .score-hero { width: 78px; height: 78px; margin-top: 6px; }
  .score-hero strong { font-size: 26px; }
  .score-hero small { font-size: 9px; }
  .topbar-inner { gap: 10px; }
  .brand-text { display: none; }
  .nav { gap: 0; margin-left: 0; }
  .nav a { padding: 8px 10px; font-size: 13.5px; }
  .topbar-actions { margin-left: auto; }
  .admin-link { display: none; }
  .hero h1 { font-size: clamp(32px, 9vw, 44px); }
  .cards { grid-template-columns: 1fr; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .neighbors { grid-template-columns: 1fr; }
  .neighbors .neighbor:last-child { text-align: left; }
  .file-card, .link-card { padding: 16px; }
  .file-actions { width: 100%; }
  .preview.pdf iframe { height: 460px; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .footer, .back, .neighbors, .article-foot, .hero-actions { display: none; }
  body { background: #fff; color: #000; }
  .article { padding: 0; }
  .prose { font-size: 12pt; }
  .preview.pdf iframe { height: auto; }
}
