/* ============================================================
   佛家经典学习站 · 1.2
   设计语言：经卷纸感（暖纸 + 金色点缀 + 卷/品层级）
   首页 黛青印记 · 目录 藕荷经录 · 阅读 朱砂经卷
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  /* 纸与墨 */
  --paper: #EDE8E0;          /* 页面底色 */
  --card: #FBF9F5;           /* 经录卡片 */
  --card-read: #F7F3EC;      /* 阅读卡片 */
  --bar: #F0EBE2;
  --ink: #1F1C18;
  --ink-2: #2B2620;
  --ink-3: #4A4238;
  --muted: #8A7F70;
  --faint: #A39A8C;
  --line: #E4DCCC;
  --line-2: #EDE6DA;

  /* 点缀 */
  --gold: #B8863A;
  --gold-soft: #D9C9A8;
  --gold-pale: #F3E6C8;
  --green: #2F5B52;
  --seal: #A63026;

  --radius: 16px;
  --shadow: 0 10px 28px rgba(40, 32, 22, .08), 0 2px 6px rgba(40, 32, 22, .04);
}

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

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-pale); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ============================================================
   首页 · 经卷封面
   ============================================================ */
body.p-home {
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(62% 48% at 82% 6%, rgba(173, 190, 156, .20) 0%, rgba(173, 190, 156, 0) 68%),
    radial-gradient(96% 82% at 50% 4%, #FBF7EC 0%, rgba(251, 247, 236, 0) 62%),
    #F4EEDF;
  padding: clamp(14px, 2.6vw, 30px);
  display: flex;
}

.p-home .cover {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(1.6rem, 4vh, 3rem) clamp(1.4rem, 4vw, 3.4rem);
  border: 1px solid rgba(184, 134, 58, .30);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, 0) 34%);
}

/* 四角细饰 */
.p-home .cover::before,
.p-home .cover::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(184, 134, 58, .55);
  pointer-events: none;
}
.p-home .cover::before { left: 9px; top: 9px; border-right: 0; border-bottom: 0; }
.p-home .cover::after { right: 9px; bottom: 9px; border-left: 0; border-top: 0; }

.p-home .cover-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(12px, 2.2vh, 22px);
  padding: 2vh 0 3vh;
}

.p-home .cover-lotus {
  width: clamp(136px, 22vw, 214px);
  height: auto;
  opacity: .95;
  filter: drop-shadow(0 14px 30px rgba(47, 91, 82, .12));
}

.p-home h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.4vw, 2.85rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .24em;
  text-indent: .24em;
  color: #22392F;
}

.p-home .cover-count {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  padding-top: .2em;
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .3em;
  color: var(--muted);
}
.p-home .cover-count b {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--gold);
}

.p-home .cover-rule {
  width: clamp(80px, 16vw, 140px);
  height: 1px;
  margin: .2em 0;
  background: linear-gradient(90deg, transparent, rgba(184, 134, 58, .55), transparent);
}

.p-home .enter {
  margin-top: clamp(10px, 2.4vh, 22px);
  padding: .78em 2.5em;
  border: 1px solid rgba(184, 134, 58, .55);
  font-size: .84rem;
  letter-spacing: .46em;
  text-indent: .46em;
  color: #2A3F36;
  background: rgba(255, 255, 255, .35);
  transition: background .2s, border-color .2s, color .2s;
}
.p-home .enter:hover {
  background: rgba(184, 134, 58, .1);
  border-color: var(--gold);
  color: #1E332B;
}

.p-home .cover-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .16em;
  color: var(--faint);
}
.p-home .cover-foot a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.p-home .cover-foot a:hover { color: var(--gold); border-bottom-color: var(--gold-soft); }

/* ============================================================
   通用卡片（经录 / 阅读 / 关于）
   ============================================================ */
body.p-page { padding: clamp(14px, 2.6vw, 34px) clamp(12px, 3vw, 28px) clamp(40px, 6vw, 72px); }

.card {
  max-width: 980px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.read { background: var(--card-read); max-width: 880px; }

/* 页眉吸顶：滚动时始终可点「品目 / 简繁」 */
/* 吸顶后去掉圆角，避免左右上角露出底色 */
.card-bar.stuck { border-radius: 0; }
.card-bar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .82rem clamp(1rem, 3vw, 1.6rem);
  background: var(--bar);
  border-bottom: 1px solid rgba(0, 0, 0, .04);
  border-radius: var(--radius) var(--radius) 0 0;
  will-change: border-radius;
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: #7A6E5E;
  backdrop-filter: saturate(1.2) blur(8px);
}
.card-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-soft); flex: none; }
.card-bar .spacer { flex: 1; }
.card-bar .bar-title {
  flex: 1;
  min-width: 0;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-bar a, .card-bar button { color: #7A6E5E; }
.card-bar a:hover, .card-bar button:hover { color: var(--gold); }

.chip {
  padding: .26em .72em;
  border: 1px solid rgba(184, 134, 58, .34);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .06em;
  color: #6E5F49;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { background: var(--gold-pale); border-color: var(--gold); color: #4A3A22; }

/* ============================================================
   经录（站点目录 / 单经目录）
   ============================================================ */
.cat-inner {
  padding: clamp(1.3rem, 3vw, 2rem) clamp(1.1rem, 3.4vw, 2.2rem) clamp(1.6rem, 3vw, 2.4rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cat-head h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink);
}
.cat-head .sub {
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--faint);
}

.grp { border-top: 1px solid var(--line-2); }
.grp > summary {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .95rem .2rem .7rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--gold);
}
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::after {
  content: "";
  width: .4em;
  height: .4em;
  margin-left: auto;
  border-right: 1.3px solid currentColor;
  border-bottom: 1.3px solid currentColor;
  transform: rotate(45deg) translateY(-.1em);
  opacity: .7;
  transition: transform .15s;
}
.grp[open] > summary::after { transform: rotate(-135deg) translateY(-.1em); }
.grp > summary .n {
  font-weight: 400;
  font-size: .66rem;
  letter-spacing: .06em;
  color: var(--faint);
}

.items {
  list-style: none;
  margin: 0 0 .5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: 0 .5rem;
}

/* 单经目录：卷分组 */
.juan { border-top: 1px solid var(--line-2); }
.juan-label {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: .95rem .2rem .45rem;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--gold);
}
.juan-label .n {
  font-weight: 400;
  font-size: .64rem;
  letter-spacing: .06em;
  color: var(--faint);
}

.item {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  padding: .62rem .7rem;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.item:hover { background: #F3EDE3; border-left-color: var(--gold-soft); }
.item .num {
  flex: none;
  min-width: 1.7rem;
  text-align: right;
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.item .name {
  flex: 1;
  min-width: 0;
  font-size: .94rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item:hover .name { color: #5A4420; }
.item .meta {
  flex: none;
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--faint);
  letter-spacing: .04em;
}
.item .tag {
  flex: none;
  padding: 0 .3em;
  font-family: var(--sans);
  font-size: .56rem;
  color: var(--gold);
  border: 1px solid rgba(184, 134, 58, .4);
  border-radius: 3px;
}



/* ============================================================
   阅读页 · 经卷
   ============================================================ */
.read-inner {
  padding: clamp(1.4rem, 3.4vw, 2.4rem) clamp(1.1rem, 4.6vw, 3.2rem) clamp(1.8rem, 3.4vw, 2.6rem);
  display: flex;
  flex-direction: column;
}

.read-loc {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .03em;
  color: var(--faint);
}
.read-loc .vol { color: var(--gold); }

.read-title {
  margin: 1.35rem 0 0;
  font-size: clamp(1.45rem, 3.1vw, 1.9rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--ink);
}
.read-by {
  margin: .55rem 0 0;
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--muted);
}

#content {
  margin-top: clamp(1.2rem, 3vw, 1.9rem);
  font-size: calc(clamp(1rem, 1.1vw, 1.08rem) * var(--fs, 1));
  line-height: 2;
  letter-spacing: .012em;
  color: var(--ink-2);
}
#content .p {
  margin: 0 0 1.05em;
  text-indent: 2em;
  text-align: justify;
  text-justify: inter-ideograph;   /* 中文两端对齐，右边缘不再参差 */
  overflow-wrap: break-word;
}
#content .p.dharani { text-indent: 0; letter-spacing: .1em; }
#content .head {
  margin: 2.4rem 0 .9rem;
  padding-left: .7rem;
  border-left: 3px solid var(--gold-soft);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: #5A4420;
}
#content .juan-title {
  margin: 2.2rem 0 .9rem;
  font-size: .98rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--muted);
}
#content .head-sub { margin: 1.7rem 0 .6rem; font-size: .98rem; font-weight: 600; }
#content .head-sub[data-h="h3"], #content .head-sub[data-h="h6"] { padding-left: 1.4em; }
#content .head-sub[data-h="h4"], #content .head-sub[data-h="h7"] { padding-left: 2.8em; }
#content .head-sub[data-h="h5"], #content .head-sub[data-h="h8"] { padding-left: 4.2em; }
#content .byline {
  margin: 0 0 1.2rem;
  text-align: right;
  text-indent: 0;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--faint);
}
#content .lg { margin: 0 0 .8em; }
#content .l { display: block; text-indent: 2em; }
/* 校改字：不换颜色，只用细下划线与正文区分 */
#content .corr { color: inherit; border-bottom: 1px dotted rgba(120, 104, 84, .45); }
/* 夹注：同样保持正文色，仅缩小字号 */
#content .note-inline { font-size: .82em; color: inherit; letter-spacing: 0; }
#content .div-orig { font-weight: 600; }
#content ul, #content ol { margin: .5em 0 .9em; padding-left: 2.2em; }
#content li { margin: .15em 0; }
#content table { border-collapse: collapse; margin: .8em 0; font-size: .92em; }
#content td, #content th { border: 1px solid var(--line-2); padding: .25em .55em; vertical-align: top; }
#content img { max-width: 100%; height: auto; }

/* 上一品 / 下一品 */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  margin-top: clamp(2rem, 4vw, 2.8rem);
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: .75rem;
  letter-spacing: .05em;
}
.pager a, .pager span { color: var(--muted); }
.pager a:hover { color: var(--gold); }
.pager .off { color: #C6BFB3; }

/* ============================================================
   抽屉目录
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(40, 32, 22, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.toc-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 41;
  width: min(72vw, 264px);
  height: 100vh;
  padding: 1.1rem .8rem 3rem;
  overflow-y: auto;
  background: var(--card);
  box-shadow: 0 0 34px rgba(40, 32, 22, .18);
  transform: translateX(-102%);
  transition: transform .22s ease;
  font-family: var(--sans);
  font-size: .74rem;
  line-height: 1.8;
}
.toc-panel.open { transform: none; }

.toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 .3rem .8rem;
  margin-bottom: .6rem;
  border-bottom: 1px solid var(--line);
  font-size: .7rem;
  letter-spacing: .1em;
  color: var(--faint);
}
.toc-head .close { color: var(--muted); }

.toc-nav details { margin-bottom: .15rem; }
.toc-nav summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .35rem;
  cursor: pointer;
  list-style: none;
  color: var(--ink-3);
  font-weight: 600;
  border-radius: 4px;
}
.toc-nav summary::-webkit-details-marker { display: none; }
.toc-nav summary::before {
  content: "";
  width: .36em;
  height: .36em;
  border-right: 1.3px solid currentColor;
  border-bottom: 1.3px solid currentColor;
  transform: rotate(-45deg);
  opacity: .5;
  transition: transform .15s;
}
.toc-nav details[open] > summary::before { transform: rotate(45deg); }
.toc-nav summary:hover { color: var(--gold); }
.toc-nav ul { list-style: none; margin: .1rem 0 .5rem; padding: 0 0 0 1rem; }
.toc-nav li a {
  display: block;
  padding: .26rem .35rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-nav li a:hover { background: #F3EDE3; color: var(--ink-3); }
.toc-nav li a.active { background: var(--gold-pale); color: #5A4420; border-left-color: var(--gold); }

/* ============================================================
   关于本站
   ============================================================ */
.prose {
  padding: clamp(1.4rem, 3.4vw, 2.2rem) clamp(1.1rem, 4vw, 2.4rem) clamp(1.8rem, 3.4vw, 2.4rem);
  font-size: .95rem;
  line-height: 1.95;
  color: var(--ink-2);
}
.prose h1 {
  margin: 0 0 .3rem;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
  letter-spacing: .06em;
}
.prose .lead {
  margin: 0 0 1.8rem;
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .08em;
  color: var(--faint);
}
.prose h2 {
  margin: 2rem 0 .6rem;
  padding-left: .65rem;
  border-left: 3px solid var(--gold-soft);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: #5A4420;
}
.prose p { margin: 0 0 .9rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.3rem; }
.prose li { margin: .2rem 0; }
.prose a { color: var(--gold); border-bottom: 1px dotted var(--gold-soft); }
.prose dl { margin: 0 0 1rem; }
.prose dt { font-family: var(--sans); font-size: .72rem; letter-spacing: .1em; color: var(--gold); margin-top: .8rem; }
.prose dd { margin: .1rem 0 0; }
.prose .note {
  margin: 1.4rem 0;
  padding: .8rem 1rem;
  background: var(--bar);
  border-left: 2px solid var(--gold-soft);
  border-radius: 6px;
  font-size: .85rem;
  color: var(--ink-3);
}
.prose code {
  padding: .1em .38em;
  border-radius: 4px;
  background: #F1ECE3;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .86em;
  color: #6A5132;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 760px) {
  /* 手机端：卡片贴边占满，横向留白交给文字区自己控制 */
  body.p-page {
    padding: 0 0 2rem;
    overflow-x: hidden;
  }
  .card, .card.read, .card-bar {
    border-radius: 0;
  }
  .card { box-shadow: none; }
  .card-bar {
    padding: .72rem 1rem;
    font-size: .7rem;
  }
  .cat-inner { padding: 1.15rem 1rem 1.5rem; gap: .85rem; }
  .read-inner { padding: 1.2rem 1rem 1.6rem; }

  /* 单列 + 可收缩轨道：长品名换行，不再顶出卡片 */
  .items { grid-template-columns: minmax(0, 1fr); }
  .item { padding: .58rem .5rem; gap: .55rem; }
  .item .name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .p-home .cover { padding: 1.4rem 1.2rem; }
  .p-home h1 { letter-spacing: .18em; text-indent: .18em; }
  #content { line-height: 1.95; }
  .pager { font-size: .72rem; }
  .toc-panel { width: min(78vw, 300px); }
}

@media (max-width: 480px) {
  .cat-head { gap: .3rem; }
  .item .num { display: none; }
}

@media print {
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border-radius: 0; max-width: none; }
  .card-bar, .pager, .scrim, .toc-panel, .chip { display: none !important; }
}

.noscript { padding: 1rem 1.4rem 2rem; font-family: var(--sans); font-size: .8rem; }
.noscript a { color: var(--gold); }


/* ============================================================
   v1.5 新增：暗色主题 / 搜索 / 继续阅读 / 回到顶部 / 阅读设置
   ============================================================ */

/* ---------- 暗色主题 ---------- */
html[data-theme="dark"] {
  --paper: #14110D;
  --card: #1B1712;
  --card-read: #191510;
  --bar: #221C15;
  --ink: #E9E1D3;
  --ink-2: #D9D0BF;
  --ink-3: #B4A995;
  --muted: #9B907E;
  --faint: #7C7264;
  --line: #332B21;
  --line-2: #282218;
  --gold: #C9A25E;
  --gold-soft: #5F4E30;
  --gold-pale: #2B2317;
  --shadow: 0 14px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
}

html[data-theme="dark"] body.p-home {
  background:
    radial-gradient(62% 48% at 82% 6%, rgba(80, 96, 72, .22) 0%, rgba(80, 96, 72, 0) 68%),
    radial-gradient(96% 82% at 50% 4%, #1E1A14 0%, rgba(30, 26, 20, 0) 62%),
    #14110D;
}
html[data-theme="dark"] .p-home h1 { color: var(--ink); }
html[data-theme="dark"] .p-home .enter {
  color: var(--ink-2);
  background: rgba(255, 255, 255, .04);
  border-color: rgba(201, 162, 94, .45);
}
html[data-theme="dark"] .p-home .enter:hover { background: rgba(201, 162, 94, .12); color: var(--ink); }
html[data-theme="dark"] .p-home .cover { border-color: rgba(201, 162, 94, .28); }
html[data-theme="dark"] .card-bar { color: var(--muted); }
html[data-theme="dark"] .card-bar a,
html[data-theme="dark"] .card-bar button { color: var(--muted); }
html[data-theme="dark"] .item:hover { background: #241F17; }
html[data-theme="dark"] .toc-nav li a:hover { background: #241F17; }
html[data-theme="dark"] .prose code { background: #241F17; color: #D8B98A; }
html[data-theme="dark"] .prose .note { background: #221C15; }
html[data-theme="dark"] .chip:hover { background: #2B2317; color: var(--gold); }

/* ---------- 经目搜索 ---------- */
.search {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: .2rem 0 1.1rem;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: .86rem;
  letter-spacing: .02em;
  transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--gold-pale);
}
.search .hint {
  flex: none;
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .06em;
  color: var(--faint);
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.cat-list mark,
.search mark {
  background: var(--gold-pale);
  color: #6A4A16;
  border-radius: 3px;
  padding: 0 .1em;
}
html[data-theme="dark"] .cat-list mark { color: #E9C48A; }

/* ---------- 继续阅读 ---------- */
.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: .1rem 0 1rem;
  padding: .68rem .9rem;
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
  background: var(--gold-pale);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .02em;
  transition: border-color .15s, color .15s;
}
.resume:hover { border-color: var(--gold); color: var(--ink); }
.resume .rs-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume .rs-go { flex: none; color: var(--gold); }

.cover-resume {
  margin-top: .4rem;
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .12em;
  color: var(--muted);
  border-bottom: 1px dotted var(--gold-soft);
  transition: color .2s;
}
.cover-resume:hover { color: var(--gold); }

/* ---------- 回到顶部 ---------- */
.totop {
  position: fixed;
  right: 1.1rem;
  bottom: 1.5rem;
  z-index: 38;
  width: 40px;
  height: 40px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(40, 32, 22, .16);
  transition: color .15s, border-color .15s, opacity .2s;
}
.totop.show { display: grid; }
.totop:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- 抽屉里的阅读设置 ---------- */
.toc-tools {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .1rem .3rem .7rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: .7rem;
  color: var(--faint);
}
.toc-tools .tool { display: flex; align-items: center; gap: .35rem; }
.toc-tools .lb { min-width: 2.4em; letter-spacing: .08em; }
.toc-tools .fs-val { min-width: 2.8em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-tools button {
  padding: .22em .62em;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
  transition: color .15s, border-color .15s, background .15s;
}
.toc-tools button:hover { color: var(--gold); border-color: var(--gold-soft); }
.toc-tools button.on {
  color: #5A4420;
  background: var(--gold-pale);
  border-color: var(--gold-soft);
}
html[data-theme="dark"] .toc-tools button.on { color: #E9C48A; }

.toc-tip {
  padding: 1.1rem .35rem 0;
  margin-top: auto;
  font-family: var(--sans);
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--faint);
}

/* 手机上把回到顶部抬高，避开抽屉按钮 */
@media (max-width: 900px) {
  .totop { right: .9rem; bottom: 1.2rem; width: 36px; height: 36px; }
}

/* 抽屉内的本经查找 */
.toc-find { padding: 0 .3rem .7rem; }
.toc-find input {
  width: 100%;
  padding: .38rem .6rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: .72rem;
}
.toc-find input::placeholder { color: var(--faint); }
.toc-find input:focus { outline: none; border-color: var(--gold); background: var(--gold-pale); }

/* ============================================================
   v1.7：部类跳转、已读标记、阅读进度
   ============================================================ */
.jump { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.1rem; }
.jump button {
  padding: .24em .64em;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--muted);
  transition: color .15s, border-color .15s, background .15s;
}
.jump button:hover { color: var(--gold); border-color: var(--gold-soft); background: var(--gold-pale); }

.item .state {
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: .15rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}
.item.read .state { background: var(--gold); border-color: var(--gold); }
.item.reading .state {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.grp.flash > summary { color: var(--gold); }

.bar-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--gold);
  opacity: .5;
  transition: width .12s linear;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

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