/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -moz-text-size-adjust: none; -webkit-text-size-adjust: none; text-size-adjust: none; }

/* ===== 颜色 ===== */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #999999;
  --border: #e5e1db;
  --accent: #1a73e8;
  --accent-hover: #1558b0;
  --quote-bg: #eeebe7;
  --quote-border: #c0b8b0;
  --code-bg: #eeebe7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1e;
    --surface: #25252a;
    --text: #dedede;
    --text-secondary: #aaaaaa;
    --text-muted: #777777;
    --border: #333338;
    --accent: #5b9cf5;
    --quote-bg: #2a2a2f;
    --quote-border: #555558;
    --code-bg: #2a2a2f;
  }
}

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "Songti SC", Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 2;
  min-height: 100vh;
}

/* ===== 容器 ===== */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 顶栏 ===== */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.nav-link:hover { color: var(--accent); }

.nav-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== 章节信息 ===== */
.chapter-info {
  margin-bottom: 24px;
}

.chapter-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 1px;
}

/* ===== 正文 ===== */
#content {
  background: var(--surface);
  padding: 36px 32px 44px;
  margin-bottom: 28px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* --- 段落 --- */
#content p {
  margin: 0;
  text-indent: 2em;
  line-height: 2;
  font-size: 1.025rem;
  word-break: break-word;
}

/* 第一章第一段不缩进 */
#content p:first-child {
  text-indent: 0;
}

/* --- 标题（小说中很少出现，保留兼容） --- */
#content h1, #content h2, #content h3, #content h4 {
  margin: 1.2em 0 0.5em;
  font-weight: 700;
  line-height: 1.6;
  text-indent: 0;
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#content h1 { font-size: 1.2rem; text-align: center; }
#content h2 { font-size: 1.1rem; border-bottom: none; }

/* --- 引用 --- */
#content blockquote {
  margin: 0.6em 0;
  padding: 6px 14px 6px 18px;
  border-left: 3px solid var(--quote-border);
  background: var(--quote-bg);
  color: var(--text-secondary);
  line-height: 1.9;
}
#content blockquote p {
  text-indent: 0;
  line-height: inherit;
}

/* --- 代码 --- */
#content code {
  font-family: "SF Mono", "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
}
#content pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 3px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 0.8em 0;
}
#content pre code {
  background: none;
  padding: 0;
}

/* --- 列表 --- */
#content ul, #content ol {
  margin: 0.4em 0;
  padding-left: 2em;
}
#content li {
  margin: 0.15em 0;
  line-height: 2;
}

/* --- 链接 --- */
#content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- 分割线 --- */
#content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

/* --- 图片 --- */
#content img {
  max-width: 100%;
  height: auto;
  margin: 0.8em 0;
}

/* ===== 加载 / 错误 ===== */
#content.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#content.loading::after { content: "加载中…"; }

#content .error {
  text-align: center;
  padding: 40px 20px;
  color: var(--accent);
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== 底部 ===== */
.footer {
  text-align: center;
  padding: 16px 0 40px;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .nav-bar { padding: 14px 0 10px; }
  .chapter-title { font-size: 1.15rem; }
  #content { padding: 24px 16px 32px; }
  #content p { font-size: 0.975rem; }
}
