:root {
  --bg: #f7f4ee;
  --paper: #fffdf8;
  --ink: #2b2723;
  --muted: #8a8178;
  --line: #e2dcd2;
  --accent: #8c5a3c;
  --max: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --paper: #1d1d22;
    --ink: #d8d4cc;
    --muted: #8b8b93;
    --line: #2e2e35;
    --accent: #c99a72;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  font-size: 18px;
  line-height: 1.9;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

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

/* ---------- 首页 ---------- */

.book-head { text-align: center; padding: 1.5rem 0 2.5rem; }

.book-head h1 {
  margin: 0 0 .4rem;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  letter-spacing: .04em;
  font-weight: 700;
}

.byline { margin: 0; color: var(--muted); font-size: .95rem; letter-spacing: .08em; }

.intro {
  margin: 1.4rem auto 0;
  max-width: 32rem;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.8;
}

.toc h2 {
  font-size: .85rem;
  font-weight: 400;
  letter-spacing: .12em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: .6rem;
  margin: 0 0 .4rem;
}

.toc ol { list-style: none; margin: 0; padding: 0; }

.toc li { border-bottom: 1px solid var(--line); }

.toc li a {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .85rem .25rem;
  color: var(--ink);
}

.toc li a:hover { background: var(--paper); text-decoration: none; }

.toc .num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
  min-width: 2.2rem;
}

.toc .name { flex: 1; }
.toc .chars { color: var(--muted); font-size: .75rem; white-space: nowrap; }

/* ---------- 章节页 ---------- */

.crumbs {
  font-size: .8rem;
  color: var(--muted);
  letter-spacing: .05em;
  margin-bottom: 2rem;
}
.crumbs a { color: var(--muted); }

.chapter h1 {
  font-size: clamp(1.4rem, 4.5vw, 1.75rem);
  line-height: 1.5;
  margin: 0 0 2rem;
  text-align: center;
  font-weight: 700;
}

.chapter-body p { margin: 0 0 1.1em; text-indent: 2em; }

.chapter-body h2,
.chapter-body h3 { margin: 2rem 0 1rem; font-size: 1.1em; }

.chapter-body blockquote {
  margin: 1.5rem 0;
  padding: .5rem 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: .95rem;
}
.chapter-body blockquote p { text-indent: 0; margin-bottom: .6em; }

.chapter-body img { max-width: 100%; height: auto; display: block; margin: 1.5rem auto; }

.chapter-body hr { border: 0; text-align: center; margin: 2.5rem 0; color: var(--muted); }
.chapter-body hr::after { content: "＊ ＊ ＊"; letter-spacing: .5em; }

/* ---------- 上下章 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: .85rem;
}

.pager a { max-width: 40%; }
.pager .next { text-align: right; }
.pager .toc-link { color: var(--muted); }
.pager .disabled { color: var(--muted); opacity: .55; }

/* ---------- 页脚 / 404 ---------- */

.site-foot {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
  line-height: 1.7;
}
.site-foot p { margin: .2rem 0; }

.notfound { text-align: center; padding: 4rem 0; }
.notfound h1 { font-size: 3rem; margin: 0; letter-spacing: .1em; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .wrap { padding: 1.75rem 1rem 3rem; }
  .toc .chars { display: none; }
}
