/* ============================================================
   BlogRainyBread —— 全站样式
   设计风格（页面设计.txt L68-L69）：
     圆框圆角；light mode 多用蓝/白/黑；dark mode 多用橙/白/黑
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg: #ffffff;
  --surface: #f4f7fb;
  --surface-2: #e9eff8;
  --fg: #0b0d10;
  --muted: #5b6472;
  --accent: #1256c8;
  --accent-soft: #dbe7fb;
  --on-accent: #ffffff;          /* 铺在 accent 上的文字色 */
  --border: #dbe3ee;
  --shadow: 0 6px 24px rgba(18, 86, 200, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --maxw: 1080px;
  /* 右侧书签栏（R15，2026-10-19 作者要求放大到两倍）：
     内容列仍 1040px，rail 312 + gap 24 + padding 40 = 1416 */
  --rail-w: 312px;
  --rail-gap: 24px;
  --anchor-offset: 100px;        /* 顶栏约 80px + 20px 余量 */
  /* 标题用黑体；正文用微软雅黑（用户 2026-10-17 两次确认后的口径） */
  --font-head: "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", "Yu Gothic UI",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font: var(--font-head);      /* 兼容旧引用 */
  --font-read: var(--font-body);
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #131417;
  --surface-2: #1c1e22;
  --fg: #ffffff;
  --muted: #b9bec7;
  --accent: #ffd21f;             /* 黑暗模式改为黄色（用户要求） */
  --accent-soft: #3a3410;
  --on-accent: #111111;
  --border: #2a2c31;
  --shadow: 0 6px 24px rgba(255, 210, 31, 0.12);
}

/* 滚动条：黑夜模式下细细一条，不要刺眼的白槽 */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: content-box; }

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* 必须显式声明：下面的 .cards{display:grid} 会盖过浏览器默认的 [hidden]{display:none} */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.75;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.35; margin: 0 0 0.6em; font-family: var(--font-head); }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

code, pre, kbd {
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- 3. 双语切换（L4：两种语言同时写进同一网页）----------
   只负责**隐藏**另一种语言，不强行设定 display ——
   否则会把 `.tagline-line{display:block}` 这类元素自己的排版覆盖掉
   （踩过：中文模式漏出日文、日文模式两行挤成一行）。
   !important 是必须的：隐藏规则会被后面同优先级的 display 规则盖掉。 */
:root[data-lang="zh"] .b-ja,
:root:not([data-lang]) .b-ja { display: none !important; }
:root[data-lang="ja"] .b-zh { display: none !important; }

/* ---------- 4. 顶栏：一条干净的横条，没有按钮边框 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 62%, transparent);   /* 半透明（用户要求） */
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;   /* 菜单居中 */
  flex-wrap: wrap;
}

/* 站点名贴住画面最左边（用户要求） */
.brand {
  position: fixed;
  left: 16px;
  top: 18px;
  z-index: 41;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--fg);
  white-space: nowrap;
  text-shadow: 0 1px 6px color-mix(in srgb, var(--bg) 80%, transparent);
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav {
  display: flex;
  gap: clamp(18px, 3vw, 44px);
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
}

/* 去掉按钮设计：只有文字；悬停/选中用**淡色笼罩**，不下划线（用户要求） */
.nav a {
  color: var(--fg);
  font-family: var(--font-head);
  font-size: 1.84rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* 「高中留存」是纯文字、无按钮边框（L5）；与主菜单之间留一点气口 */
.nav a.nav-plain { margin-left: 1.4em; font-size: 1.45rem; color: var(--muted); }
.nav a.nav-plain:hover, .nav a.nav-plain[aria-current="page"] { color: var(--accent); background: none; }

/* ---------- 5. 右上角胶囊（L4）---------- */
.capsules {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 40;
  display: flex;
  gap: 8px;
}

/* 胶囊本体不加内边距：选中项的颜色要铺满整颗胶囊 */
.capsule {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  color: var(--fg);
  overflow: hidden;        /* 颜色铺满但不溢出圆角 */
}

.capsule button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  min-height: 32px;
  border-radius: 0;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.capsule button:hover { color: var(--accent); }
.capsule button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- 6. 首页头部（L15-L20）---------- */
.hero { position: relative; }

.hero-bg {
  height: 42vh;
  min-height: 240px;
  background-color: var(--surface-2);
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center 30%;
}

/* 色块遮罩：背景图只露一部分，以下用色块盖住（L17）—— 方角矩形（用户要求） */
.hero-mask {
  background: var(--bg);
  margin-top: -28px;
  position: relative;
  padding: 0 20px 26px;
}

.hero-inner { max-width: var(--maxw); margin: 0 auto; text-align: center; }

.avatar {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  box-shadow: var(--shadow);
  margin: -58px auto 12px;
}

.tagline { margin: 0 0 4px; font-family: var(--font-body); font-size: 1.06rem; }
/* 简介两行分开排（用户要求）。
   副标题样式必须用**显式的 class**：用相邻兄弟选择器会把日文版的第一行
   也当成副标题（它前面站着中文那一行）——踩过这个坑。 */
.tagline-line { display: block; }
.tagline-sub { color: var(--muted); font-size: 0.92rem; }
.tagline-sub { color: var(--muted); font-size: 0.9rem; }

.contacts { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* 联系方式图标：不要按钮边框；默认**灰色**笼罩，悬停才变成主题色 */
.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.contact-icon:hover {
  transform: translateY(-2px);
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
}
.contact-icon svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- 7. 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 44px 0 18px;
}

.section-head h2 { margin: 0; font-size: 1.55rem; }

/* 标题后面不再拖一条横线（用户要求） */
.section-head .rule { display: none; }

.section-head .zone-desc { color: var(--muted); font-size: 0.92rem; margin: 4px 0 0; }

/* ---------- 7b. 右侧书签栏（R15 / 用户 2026-10-17 要求）----------
   只在「大标题 + 卡片」竖排页出现；窄屏默认隐藏，≥1260px 才变成
   sticky 的右侧目录。锚点落在 .section-head 本身，避开 margin 与顶栏。 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.section-main { min-width: 0; }
.section-rail { display: none; }
.section-head[id] { scroll-margin-top: var(--anchor-offset); }

/* ---------- 8. 卡片（L25：图 → 标题 → 预览 → 日期）---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease;
  height: 100%;
}

.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card > a { color: inherit; display: flex; flex-direction: column; height: 100%; }
.card > a:hover { text-decoration: none; }

.card-thumb {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}

.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 600; font-size: 1rem; line-height: 1.4; }
.card-desc { color: var(--muted); font-size: 0.88rem; flex: 1; }
.card-date { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.02em; }
.card-zone { color: var(--accent); font-size: 0.76rem; }

/* ---------- 9. 占位（L73：缺图/缺简介时显示占位）---------- */
.placeholder {
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  min-height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 10px;
}

/* 没有封面时，把标题与正文尽量铺进这块区域，能显示多少字就显示多少字 */
.placeholder {
  align-content: center;
  text-align: center;
  gap: 6px;
}
.placeholder-title {
  font-size: 1.3rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--fg);
  opacity: 0.85;
  font-family: var(--font-read);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 100%;
  overflow: hidden;
}
.placeholder-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 100%;
  overflow: hidden;
}

.placeholder-char { font-size: 1.6rem; opacity: 0.55; }

/* ---------- 10. 文章页 ---------- */
.article { max-width: 760px; margin: 30px auto 60px; }

.article-head { margin-bottom: 8px; }
.article-head h1 { font-size: 1.9rem; margin-bottom: 8px; }
.article-meta { color: var(--muted); font-size: 0.88rem; display: flex; gap: 12px; flex-wrap: wrap; }

/* 语言等标记不再是"按钮"，只是安静的一行小字；分区名做成高亮可点（用户要求） */
.badge { color: var(--muted); font-size: 0.84rem; }
a.badge {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 12px;
  border-radius: var(--radius-pill);
}
a.badge:hover { text-decoration: none; filter: brightness(0.96); }

.collection-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 18px;
  margin: 18px 0 26px;
}

.collection-card h2 { font-size: 1.05rem; margin: 0 0 4px; }
.collection-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.prose { font-family: var(--font-body); font-size: 1.06rem; }
.prose p { margin: 0 0 1.15em; }

/* 中文文章首行缩进两格（用户要求；日文与代码不动） */
.prose-zh > p { text-indent: 2em; }
.prose img { border-radius: var(--radius-sm); margin: 1.2em auto; }
.prose h2, .prose h3 { font-family: var(--font); }
/* 数学：公式左对齐（块级公式浏览器默认居中，用户要求左对齐）。
   这里刻意保持最小干预 —— 之前叠加过"禁止断行""按正文缩进"等规则，
   结果越改越乱，已回退。 */
.prose math { font-size: 1.06em; }
.prose math[display="block"] { display: block; text-align: left; margin: 0.9em 0; overflow-x: auto; }
.prose ruby rt { font-size: 0.5em; color: var(--muted); font-weight: 400; }
/* 带振假名的日语正文：字号与假名都要大一点、行距放松（用户要求） */
.prose-ja { font-size: 1.18rem; line-height: 2.05; }
.prose-ja ruby rt { font-size: 0.64em; }
.prose ins { text-decoration: underline; text-underline-offset: 3px; }
.prose del { color: var(--muted); }
/* 表格：学习资料里的大量对照关系（L54 生物复习资料等） */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.3em 0;
  font-family: var(--font);
  font-size: 0.98rem;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}
.prose th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
/* 空表头（排版生成的对照表没有列名）→ 收起成一个细边 */
.prose thead th:empty { padding: 0; border: 0; height: 0; background: none; }
.prose tbody tr:nth-child(even) td { background: var(--surface); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: 0.35em 0; }
.prose h2 { margin: 1.8em 0 0.6em; padding-bottom: 0.25em; border-bottom: 1px solid var(--border); }
.prose h3 { margin: 1.4em 0 0.5em; }

.prose blockquote {
  margin: 1.2em 0;
  padding: 2px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 注音开关：不想看假名时把 ruby 的 rt 藏起来 */
:root[data-furigana="off"] .prose ruby rt { display: none; }

/* 上一篇/下一篇：不要按钮，做成悬挂式的浅色衬托条（用户要求） */
.prev-next { display: flex; gap: 12px; justify-content: space-between; margin: 44px 0 10px; flex-wrap: wrap; }
.prev-next a {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 20px;
  background: var(--surface-2);
  color: var(--fg);
  flex: 1 1 240px;
  min-width: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.prev-next a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.prev-next .dir { color: var(--muted); font-size: 0.78rem; display: block; }
.prev-next .t { font-size: 0.94rem; }
.prev-next .next-link { text-align: right; }

/* ---------- 11. 代码 / 附件 ---------- */
.code-card { position: relative; margin: 22px 0; }
.code-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.88rem;
}
.code-card header .file { margin-right: auto; color: var(--muted); }
.code-card pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  line-height: 1.6;
}
.code-card pre code { white-space: pre; }

.btn {
  all: unset;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.84rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

details.fold {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  margin: 16px 0;
}
details.fold summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details.fold pre { overflow: auto; max-height: 60vh; margin: 12px 0 0; }

/* ---------- 12. 图片集 / 画区 ---------- */
.figures { display: grid; gap: 14px; margin: 22px 0; }
.figures img { border-radius: var(--radius-sm); width: 100%; }

.flip { margin: 26px auto; max-width: 900px; }
.flip-stage {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 320px;
  display: grid;
  place-items: center;
}
.flip-stage img { border-radius: var(--radius-sm); max-height: 76vh; width: auto; margin: 0 auto; }
.flip-info { text-align: center; margin-top: 14px; }
.flip-info h1 { font-size: 1.25rem; margin-bottom: 4px; }
.flip-controls { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 14px; }
.flip-controls .counter { color: var(--muted); font-size: 0.86rem; min-width: 88px; text-align: center; }
.flip-arrow {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--fg);
}
.flip-arrow:hover { border-color: var(--accent); color: var(--accent); }
.flip-arrow:disabled { opacity: 0.35; cursor: default; }

.thumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.thumbs button {
  all: unset;
  cursor: pointer;
  width: 52px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.6;
}
.thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 13. 视频 ---------- */
.video-card { margin: 22px 0; }
.video-card video { width: 100%; border-radius: var(--radius); background: #000; }

/* ---------- 14. /articles/ 的文字背景（L84）---------- */
.articles-bg {
  position: relative;
  isolation: isolate;
}

.articles-bg .bgtext {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.07;
  font-family: var(--font-read);
  font-size: clamp(20px, 4.2vw, 44px);
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  padding: 6vw;
  text-align: center;
}

/* ---------- 15. 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 26px 20px 40px;
  color: var(--muted);
  font-size: 0.86rem;
}
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.footer .contacts { margin: 0; }
.footer .contact-icon { width: 34px; height: 34px; }
.footer .contact-icon svg { width: 17px; height: 17px; }

/* ---------- 16. 杂项 ---------- */
/* ---------- 16b. Tab 条（分区切换）---------- */
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 6px 0 30px;          /* 不要横线（用户要求） */
}
.tabs a {
  padding: 8px 22px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 1.18rem;
  border-radius: var(--radius-pill);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tabs a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.tabs a.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- 16c. 画区左右分栏 ---------- */
.gallery-split { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.gallery-col .col-title { text-align: center; font-size: 1.6rem; margin-bottom: 16px; }
.gallery-col .col-title a { color: var(--fg); }
.gallery-col .col-title a:hover { color: var(--accent); text-decoration: none; }
.shots { display: grid; gap: 16px; }
.shot { margin: 0; }
.shot img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.shot figcaption { display: flex; gap: 10px; align-items: baseline; margin-top: 6px; font-size: 0.9rem; }
.shot-title { font-weight: 600; }
.shot-date { color: var(--muted); font-size: 0.82rem; }

@media (max-width: 760px) {
  .gallery-split { grid-template-columns: 1fr; gap: 22px; }
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.chips a {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.88rem;
}
.chips a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted); }

.list-rows { display: grid; gap: 10px; }
.row {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.row:hover { border-color: var(--accent); }
.row .row-title { font-weight: 600; }
.row .row-desc { color: var(--muted); font-size: 0.88rem; flex: 1; }
.row .row-date { color: var(--muted); font-size: 0.84rem; white-space: nowrap; }

@media (max-width: 860px) {
  .hero-bg { height: 32vh; }
  h1 { font-size: 1.45rem; }
  .capsules { top: auto; bottom: 14px; right: 12px; }
  .topbar-inner { padding: 10px 14px; }
  .brand { position: static; transform: none; margin-bottom: 6px; font-size: 1rem; }
  .nav { gap: 14px 20px; }
  .nav a { font-size: 1.1rem; }
  .nav a.nav-plain { margin-left: 0; font-size: 1rem; }
}

/* ---------- 17. 右侧书签栏的宽屏布局（R15）----------
   1416 = 1040 内容 + 24 gap + 312 书签 + 40 内边距。
   内容区宽度与现状完全一致，卡片列数不变。 */
@media (min-width: 1416px) {
  .wrap.has-rail {
    max-width: calc(var(--maxw) + var(--rail-w) + var(--rail-gap));
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    gap: var(--rail-gap);
    align-items: start;            /* 否则 sticky 没有移动空间 */
  }
  .wrap.has-rail > .section-main { min-width: 0; }

  .wrap.has-rail > .section-rail {
    display: block;
    position: sticky;
    top: calc(var(--anchor-offset) + 10px);
    max-height: calc(100vh - var(--anchor-offset) - 24px);
    overflow-y: auto;
    border-left: 2px solid var(--border);
    padding: 8px 0 8px 20px;
    font-family: var(--font-head);
    font-size: 1.72rem;              /* 原 0.86rem 的两倍 */
  }
  .section-rail ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 4px;
  }
  .section-rail a {
    display: block; padding: 10px 12px; border-radius: 12px;
    color: var(--muted); line-height: 1.35;
    transition: color 0.15s ease, background-color 0.15s ease;
  }
  .section-rail a:hover {
    color: var(--accent); background: var(--accent-soft); text-decoration: none;
  }
  .section-rail a.is-active {
    color: var(--accent); background: var(--accent-soft); font-weight: 600;
  }
  .section-rail a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { .section-rail a { transition: none; } }
@media print { .section-rail { display: none; } }
