/* ==========================================================================
   别人等冷却，我不等 — 阅读站样式
   设计：纸墨极简 / 米白底 / 墨黑字 / 朱红点缀
   兼容：iOS Safari 12+ · Android Chrome · 微信内置 · 桌面全系
   ========================================================================== */

:root {
  --fs: 19px;            /* 正文字号，JS 可调 */
  --lh: 1.95;            /* 行高 */
  --content-max: 42rem;

  --bg: #f7f4ee;
  --bg-soft: #fffdf8;
  --fg: #1e1c19;
  --fg-2: #4a463f;
  --muted: #8a8478;
  --line: #e2dcd0;
  --accent: #b4472e;
  --bar-bg: rgba(247, 244, 238, 0.92);
  --shadow: 0 6px 24px rgba(60, 50, 35, 0.10);
  --radius: 10px;
}

html[data-theme="sepia"] {
  --bg: #efe5d2;
  --bg-soft: #f6edda;
  --fg: #2a2118;
  --fg-2: #4f4335;
  --muted: #8d7d64;
  --line: #ddcfb4;
  --accent: #9c4a2a;
  --bar-bg: rgba(239, 229, 210, 0.93);
  --shadow: 0 6px 24px rgba(80, 60, 30, 0.14);
}

html[data-theme="dark"] {
  --bg: #14140f;
  --bg-soft: #1c1c16;
  --fg: #d9d4c8;
  --fg-2: #b3ad9f;
  --muted: #7d776b;
  --line: #2c2c24;
  --accent: #d0704f;
  --bar-bg: rgba(20, 20, 15, 0.93);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif SC",
               "STSong", "SimSun", "PingFang SC", "Microsoft YaHei",
               Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: rgba(180, 71, 46, 0.18); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: var(--bar-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  backdrop-filter: saturate(150%) blur(10px);
}

.topbar .t-back,
.topbar .t-act {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  font-size: 15px;
  color: var(--fg-2);
  border: 0;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.topbar .t-back:active,
.topbar .t-act:active { background: rgba(128, 112, 88, 0.12); }

.topbar .t-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 阅读进度条 */
.progress {
  position: fixed;
  left: 0;
  top: env(safe-area-inset-top);
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 60;
  transition: width 0.08s linear;
}

/* ---------- 正文 ---------- */
.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 20px;
}

.article {
  padding: 26px 0 8px;
}

.article h1 {
  font-size: 1.32em;
  line-height: 1.5;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.article .meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.content {
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--fg);
  text-align: justify;
  word-break: break-word;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.content p {
  margin: 0 0 1.02em;
  text-indent: 0;
}

.content p:last-child { margin-bottom: 0; }

/* ---------- 章节底部导航 ---------- */
.chapnav {
  display: flex;
  align-items: stretch;
  margin: 40px 0 0;
  padding: 22px 0 8px;
  border-top: 1px solid var(--line);
}

.chapnav a,
.chapnav span {
  flex: 1 1 0;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 6px;
  font-size: 14.5px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--fg-2);
}

.chapnav a:active { background: var(--line); }
.chapnav .disabled { color: var(--muted); opacity: 0.5; }
.chapnav .to-index { flex: 0 0 84px; margin-right: 0; color: var(--accent); }

/* ---------- 首页 ---------- */
.hero {
  display: flex;
  align-items: flex-start;
  padding: 30px 0 22px;
}

.hero-cover {
  flex: 0 0 108px;
  margin-right: 18px;
  width: 108px;
  height: 162px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(160deg, #23211c, #43403a);
  position: relative;
}

.hero-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-info { flex: 1 1 auto; min-width: 0; }

.hero-info h1 {
  font-size: 1.5em;
  line-height: 1.34;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-info .sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.8;
}

.hero-info .sub em {
  font-style: normal;
  color: var(--fg-2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  font-size: 15px;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn:active { opacity: 0.86; }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
  margin-left: 8px;
}

/* 标签 */
.tags {
  display: flex;
  flex-wrap: wrap;
  margin: 4px -4px 18px;
  padding: 0;
  list-style: none;
}

.tags li {
  margin: 4px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: var(--fg-2);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* 简介 */
.intro {
  padding: 20px 0 8px;
  border-top: 1px solid var(--line);
}

.intro h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 12px;
}

.intro p {
  margin: 0 0 0.85em;
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--fg-2);
  text-align: justify;
}

.intro p.note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}

/* 目录 */
.toc { padding: 26px 0 40px; border-top: 1px solid var(--line); }

.toc h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc h2 .count { font-weight: 400; font-size: 13px; color: var(--muted); }

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 22px;
}

.toc-list li { border-bottom: 1px solid var(--line); }

.toc-list a {
  display: flex;
  align-items: baseline;
  padding: 13px 2px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--fg);
  min-height: 44px;
}

.toc-list a:active { color: var(--accent); }

.toc-list .no {
  flex: 0 0 auto;
  min-width: 2.6em;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.toc-list .nm {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-list .rd {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  margin-left: 10px;
}

/* ---------- 设置面板 ---------- */
.panel {
  position: fixed;
  z-index: 70;
  right: 10px;
  top: 56px;
  width: 250px;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
}

.panel.open { display: block; }

.panel .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel .row:last-child { margin-bottom: 0; }

.panel .lbl { font-size: 13.5px; color: var(--muted); }

.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.stepper button {
  width: 44px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
.stepper button:active { background: var(--line); }

.stepper span {
  min-width: 46px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.themes { display: flex; }

.themes button {
  width: 34px;
  margin-right: 8px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.themes button[data-t="light"] { background: #f7f4ee; }
.themes button[data-t="sepia"] { background: #efe5d2; }
.themes button[data-t="dark"]  { background: #1c1c16; }
.themes button.on { border-color: var(--accent); }

/* 遮罩 */
.mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 65;
  background: rgba(0, 0, 0, 0.28);
  display: none;
}
.mask.open { display: block; }

/* ---------- 页脚 ---------- */
.footer {
  padding: 30px 20px 46px;
  padding-bottom: calc(46px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12.5px;
  line-height: 2;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 34px;
}
.footer a { color: var(--muted); text-decoration: underline; }

/* 回到顶部 */
.totop {
  position: fixed;
  right: 16px;
  bottom: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bar-bg);
  color: var(--fg-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.totop.show { display: block; }

/* ---------- 平板 / 桌面 ---------- */
@media (min-width: 700px) {
  :root { --content-max: 44rem; }
  .wrap { padding: 0 32px; }
  .article { padding-top: 40px; }
  .article h1 { font-size: 1.55em; }
  .hero { padding-top: 44px; }
  .hero-cover { margin-right: 26px; }
  .hero-cover { flex: 0 0 148px; width: 148px; height: 222px; }
  .hero-info h1 { font-size: 1.95em; }
  .toc-list { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 20px; }
}

@media (min-width: 1080px) {
  :root { --content-max: 46rem; }
  .toc-list { grid-template-columns: 1fr 1fr 1fr; }
  .article h1 { font-size: 1.7em; }
}

/* 大屏：正文两侧留白更舒服 */
@media (min-width: 1200px) {
  .content { font-size: calc(var(--fs) + 1px); }
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .panel, .mask, .totop, .chapnav, .footer, .progress { display: none !important; }
  body { background: #fff; color: #000; }
  .content { font-size: 12pt; line-height: 1.7; }
}

/* ---------- 无障碍 / 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress { transition: none; }
}

/* 焦点可见（键盘用户） */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
