:root {
  --bg: #f7f4ed;
  --paper: #fffdf8;
  --ink: #241f1a;
  --ink-soft: #4c463d;
  --muted: #827a6e;
  --line: #e7e0d3;
  --accent: #b04a2f;
  --accent-soft: rgba(176, 74, 47, 0.12);
  --accent-line: rgba(176, 74, 47, 0.32);
  --radius: 10px;
  --serif: "Songti SC", "SimSun", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; letter-spacing: 0.01em; }

img, svg { display: block; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------ 顶栏 ------------------------------ */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 66px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand-seal {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #fffaf0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1;
}

.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: 0.06em; }

.nav { display: flex; gap: 22px; font-size: 14px; color: var(--ink-soft); }

.nav a { padding: 4px 0; border-bottom: 2px solid transparent; transition: color 0.16s ease, border-color 0.16s ease; }
.nav a:hover { color: var(--accent); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.search { margin-left: auto; display: flex; align-items: center; gap: 0; }

.search input {
  width: 190px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 7px 0 0 7px;
  background: var(--paper);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}

.search input:focus { outline: none; border-color: var(--accent-line); }

.search button {
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: var(--accent);
  color: #fffaf0;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.search button:hover { filter: brightness(1.06); }

.header-ad { padding-top: 14px; }

/* ------------------------------ 广告位 ------------------------------ */

.ad-slot {
  margin: 20px 0;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  overflow: hidden;
}

.ad-tag {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: #a9a196;
  text-transform: uppercase;
}

.ad-link {
  display: inline-block;
  padding: 6px 18px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.ad-link:hover { background: var(--accent); color: #fffaf0; }

.ad-slot-sidebar { min-height: 250px; margin-top: 0; }

.ad-sticky {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 45;
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 8px;
  background: rgba(255, 253, 248, 0.97);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -6px 24px rgba(60, 48, 32, 0.12);
}

.ad-sticky .ad-tag { font-size: 10px; }

.ad-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ------------------------------ 按钮 / 标签 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fffaf0; }
.btn-primary:hover { filter: brightness(1.07); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }

.btn.disabled { opacity: 0.42; pointer-events: none; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.chip-ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

/* ------------------------------ 封面 ------------------------------ */

.cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  border-radius: 5px;
  color: #fffaf2;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(60, 48, 32, 0.18);
}

.cover::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  pointer-events: none;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(255, 255, 255, 0.22), transparent 46%);
  pointer-events: none;
}

.cover-title {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.cover-author {
  position: relative;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.82;
}

.cover-0 { background: linear-gradient(155deg, #7c3327, #c06443); }
.cover-1 { background: linear-gradient(155deg, #35524a, #7c9a83); }
.cover-2 { background: linear-gradient(155deg, #2c3d57, #5f7a9b); }
.cover-3 { background: linear-gradient(155deg, #55412d, #a3835a); }
.cover-4 { background: linear-gradient(155deg, #463350, #7c6287); }
.cover-5 { background: linear-gradient(155deg, #34474a, #6e8884); }

.cover-xs { width: 42px; height: 56px; padding: 5px; border-radius: 3px; }
.cover-xs .cover-title { font-size: 8px; letter-spacing: 0; }
.cover-xs .cover-author { display: none; }
.cover-xs::before { inset: 3px; }

.cover-sm { width: 58px; height: 78px; padding: 7px; }
.cover-sm .cover-title { font-size: 10px; }
.cover-sm .cover-author { font-size: 8px; }

.cover-md { width: 112px; height: 150px; }
.cover-lg { width: 158px; height: 210px; padding: 14px; }
.cover-lg .cover-title { font-size: 21px; }
.cover-lg .cover-author { font-size: 11px; }

.cover-xl { width: 214px; height: 286px; padding: 18px; }
.cover-xl .cover-title { font-size: 30px; line-height: 1.3; }
.cover-xl .cover-author { font-size: 12px; }

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

.home-hero {
  background:
    radial-gradient(720px 340px at 82% 8%, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, #fbf8f1, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: 56px 0 62px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.kicker {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.22;
}

.hero-author { margin: 0 0 18px; color: var(--muted); font-size: 14px; letter-spacing: 0.04em; }

.hero-intro {
  margin: 0 0 26px;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-visual { display: flex; justify-content: center; }

.hero-visual .cover { transform: rotate(-2deg); box-shadow: 0 22px 46px rgba(60, 48, 32, 0.28); }

.section { padding: 52px 0; }

.section-plain { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-head h2 { margin: 0; font-size: 22px; }

.section-sub { color: var(--muted); font-size: 13px; }

.empty-tip { color: var(--muted); font-size: 14px; padding: 18px 0; }

/* 最近更新 */

.update-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.update-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.update-cover { display: block; flex-shrink: 0; }

.update-main { flex: 1; min-width: 0; display: grid; gap: 3px; }

.update-title { font-family: var(--serif); font-size: 16.5px; font-weight: 700; }
.update-title:hover { color: var(--accent); }

.update-chapter {
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-chapter:hover { color: var(--accent); }

.update-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* 书籍网格 */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.book-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.book-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(60, 48, 32, 0.09);
}

.book-card-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.book-card-body strong {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.4;
}

.book-card-author { font-size: 12.5px; color: var(--muted); }

.book-card-meta { font-size: 12px; color: #9a9285; }

/* ------------------------------ 内页通用 ------------------------------ */

.page-main { padding-top: 22px; padding-bottom: 60px; }

.page-main.narrow { max-width: 820px; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 20px;
}

.breadcrumb a:hover { color: var(--accent); }

.panel-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 20px;
}

.panel-block h1 { margin: 0 0 18px; font-size: 26px; }
.panel-block h2 { margin: 0 0 14px; font-size: 19px; }

.intro-text { margin: 0; color: var(--ink-soft); line-height: 1.95; white-space: pre-wrap; }

/* 详情页 */

.book-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }

.book-head {
  display: flex;
  gap: 26px;
  padding: 26px 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.book-info { min-width: 0; }

.book-info h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.3; }

.book-author { margin: 0 0 14px; color: var(--muted); font-size: 14px; letter-spacing: 0.05em; }

.book-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.book-stat { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }

.book-aside { display: grid; gap: 18px; position: sticky; top: 24px; }

.aside-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 8px;
}

.aside-card h3 { margin: 0 0 12px; font-size: 15px; }

.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.related-list a { display: flex; gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }

.related-list li:last-child a { border-bottom: none; padding-bottom: 4px; }

.related-list span { display: grid; gap: 2px; min-width: 0; }
.related-list strong { font-family: var(--serif); font-size: 14.5px; font-weight: 700; }
.related-list small { color: var(--muted); font-size: 12px; }
.related-list a:hover strong { color: var(--accent); }

/* 章节目录 */

.chapter-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

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

.chapter-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  font-size: 14.5px;
  transition: color 0.15s ease, background 0.15s ease;
}

.chapter-list a:hover { color: var(--accent); background: rgba(176, 74, 47, 0.035); }

.chapter-list a.current { color: var(--accent); font-weight: 600; }

.chapter-index { font-size: 11.5px; color: #a49b8d; font-variant-numeric: tabular-nums; flex-shrink: 0; }

.chapter-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chapter-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.chapter-list.compact a { padding: 9px 4px; font-size: 13.5px; }

/* ------------------------------ 阅读页 ------------------------------ */

.reader-page { background: #f4f1e9; }

.reader-top { border-bottom: 1px solid var(--line); background: var(--paper); }

.reader-top-inner {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
}

.reader-book { color: var(--ink-soft); font-weight: 600; flex-shrink: 0; }
.reader-book:hover { color: var(--accent); }

.reader-divider { color: #cfc7b8; }

.reader-chapter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reader-toc { margin-left: auto; flex-shrink: 0; color: var(--accent); }

.reader-article {
  max-width: 800px;
  margin: 26px auto 70px;
  padding: 46px 54px 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(60, 48, 32, 0.06);
}

.reader-article h1 {
  margin: 0 0 10px;
  font-size: 27px;
  line-height: 1.45;
  text-align: center;
}

.reader-meta {
  margin: 0 0 30px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.reader-content {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 2.05;
  color: #2a2520;
}

.reader-content p { margin: 0 0 1.05em; text-indent: 2em; }

.reader-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 34px 0 6px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.reader-chapters { margin-top: 28px; padding: 22px 24px; }

.reader-chapters h2 { font-size: 16px; }

/* ------------------------------ 搜索 / 隐私 ------------------------------ */

.search-inline { margin: 0 0 12px; }
.search-inline input { width: min(420px, 70vw); border-radius: 7px 0 0 7px; }

.privacy-text h1 { font-size: 24px; }
.privacy-text p { color: var(--ink-soft); line-height: 1.95; margin: 0 0 1em; }

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

.site-footer {
  margin-top: 20px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  background: #f2eee5;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr;
  gap: 40px;
  padding-bottom: 30px;
}

.footer-about p { margin: 12px 0 0; max-width: 420px; font-size: 13px; color: var(--muted); line-height: 1.85; }

.footer-links { display: grid; gap: 8px; font-size: 13px; color: var(--muted); align-content: start; }

.footer-links h4 {
  margin: 0 0 4px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #9a9285;
  font-weight: 600;
}

.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px 30px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #9a9285;
}

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 980px) {
  .book-layout { grid-template-columns: 1fr; }
  .book-aside { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0 8px; gap: 10px; }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 16px;
    font-size: 13px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .search { margin-left: auto; }
  .search input { width: 140px; }
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-visual { display: none; }
  .home-hero { padding: 40px 0 44px; }
  .section { padding: 38px 0; }
  .book-head { flex-direction: column; gap: 18px; padding: 20px; }
  .reader-article { padding: 26px 20px 28px; margin: 16px 12px 50px; }
  .reader-content { font-size: 17px; line-height: 1.95; }
  .reader-article h1 { font-size: 21px; }
  .update-side time { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { padding: 14px 24px 90px; }
  .panel-block { padding: 20px; }
}
