/* ============================================================
   novel.css — 暖色调阅读舒适风
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --nbg: #fdf6ec;
  --nbg-alt: #f7ede0;
  --ntext: #3d2b1f;
  --ntext-muted: #8c6a55;
  --nlink: #c0784e;
  --nborder: #e8d5c4;
  --ncard-bg: #fffaf4;
  --nstatus-bg: #fef3c7;
  --nstatus-color: #92400e;
  --nstatus-done-bg: #d1fae5;
  --nstatus-done-color: #065f46;
  --nfont-body: 'Noto Serif SC', 'Source Han Serif CN', '宋体', Georgia, serif;
  --nfont-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nmax-w: 800px;
  --nradius: 8px;
  --nline-height: 2.0;
}

/* Night mode */
body.novel-night {
  --nbg: #1a1208;
  --nbg-alt: #231809;
  --ntext: #e8d5b7;
  --ntext-muted: #a08060;
  --nlink: #d4976a;
  --nborder: #3d2a18;
  --ncard-bg: #221710;
  --nstatus-bg: #3d2a18;
  --nstatus-color: #f3c47a;
}

html { font-size: 17px; }
body.novel-body {
  font-family: var(--nfont-ui);
  background: var(--nbg);
  color: var(--ntext);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--nlink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.novel-header {
  border-bottom: 1px solid var(--nborder);
  background: rgba(253, 246, 236, 0.95);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 100;
  transition: background 0.3s;
}
body.novel-night .novel-header { background: rgba(26,18,8,0.95); }

.novel-nav {
  max-width: var(--nmax-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 54px;
  display: flex;
  align-items: center;
}
.novel-brand {
  font-family: var(--nfont-ui);
  font-weight: 700;
  color: var(--ntext);
  font-size: 1rem;
}
.novel-nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.novel-nav-links a { font-size: 0.9rem; color: var(--ntext-muted); }
.novel-nav-links a.active { color: var(--ntext); }
.theme-toggle {
  background: none;
  border: 1px solid var(--nborder);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ntext-muted);
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--nlink); }

/* ── Main ── */
.novel-main { flex: 1; }
.novel-page-container {
  max-width: var(--nmax-w);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.novel-page-title {
  font-family: var(--nfont-body);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--ntext);
}

/* ── Disclaimer box ── */
.disclaimer-box {
  background: var(--nbg-alt);
  border: 1px solid var(--nborder);
  border-radius: var(--nradius);
  padding: 0.9rem 1.2rem;
  font-size: 0.85rem;
  color: var(--ntext-muted);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}
.disclaimer-box a { color: var(--nlink); }
.disclaimer-inline {
  font-size: 0.82rem;
  color: var(--ntext-muted);
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--nborder);
}

/* ── Novel grid ── */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
}
.novel-card {
  background: var(--ncard-bg);
  border: 1px solid var(--nborder);
  border-radius: var(--nradius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.novel-card:hover { box-shadow: 0 4px 20px rgba(180,100,50,0.1); }
.novel-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.novel-cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #f5c89a, #e89568);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--nfont-body);
  font-size: 3rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  text-decoration: none;
}
.novel-card-body { padding: 1.25rem; }
.novel-card-title { font-family: var(--nfont-body); font-size: 1.1rem; font-weight: 700; margin-bottom: 0.6rem; }
.novel-card-title a { color: var(--ntext); }
.novel-tag-fanfic {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.08rem 0.45rem;
  font-family: var(--nfont-ui);
  font-size: 0.72rem;
  font-weight: 500;
  color: #a6794d;
  background: #f3e4cd;
  border: 1px solid #d8b98a;
  border-radius: 3px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.novel-card-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.82rem; color: var(--ntext-muted); margin-bottom: 0.6rem; }
.novel-author-info { margin-bottom: 0.5rem; line-height: 1.8; }
.author-item { display: inline-block; font-size: 0.82rem; margin-right: 0.5rem; }
.author-label {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  background: var(--nbg-alt);
  color: var(--ntext-muted);
  border-radius: 3px;
  font-size: 0.72rem;
  margin-right: 0.2rem;
}
.author-label-fanfic {
  background: #f5e6d3;
  color: #8b5a2b;
}
.author-value { color: var(--ntext); }
.novel-original { font-size: 0.82rem; color: var(--ntext-muted); margin-bottom: 0.5rem; }
.novel-desc { font-size: 0.88rem; color: var(--ntext-muted); line-height: 1.6; margin-bottom: 1rem; }
.novel-read-btn {
  display: inline-block;
  background: var(--nlink);
  color: #fff;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-size: 0.88rem;
  font-family: var(--nfont-ui);
  transition: filter 0.15s;
  text-decoration: none;
}
.novel-read-btn:hover { filter: brightness(1.1); text-decoration: none; }
.novel-empty { color: var(--ntext-muted); }

/* ── Status badges ── */
.novel-status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: var(--nfont-ui);
}
.status-ongoing { background: var(--nstatus-bg); color: var(--nstatus-color); }
.status-done { background: var(--nstatus-done-bg); color: var(--nstatus-done-color); }

/* ── Novel detail ── */
.breadcrumb { font-size: 0.88rem; color: var(--ntext-muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--nlink); }
.novel-detail-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}
.novel-detail-cover {
  width: 160px;
  height: 220px;
  object-fit: cover;
  border-radius: var(--nradius);
  flex-shrink: 0;
  border: 1px solid var(--nborder);
}
.novel-detail-info { flex: 1; min-width: 200px; }
.novel-detail-title { font-family: var(--nfont-body); font-size: 1.75rem; font-weight: 700; margin-bottom: 0.75rem; }
.novel-detail-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.88rem; color: var(--ntext-muted); margin-bottom: 1rem; }
.novel-description { font-size: 0.95rem; line-height: 1.8; color: var(--ntext-muted); margin-top: 0.75rem; white-space: pre-line; }

/* ── Chapter list ── */
.chapter-list-section { margin-top: 1rem; }
.chapter-list { list-style: none; }
.chapter-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--nborder);
  gap: 1rem;
}
.chapter-link { display: flex; gap: 0.75rem; color: var(--ntext); flex: 1; }
.chapter-link:hover { color: var(--nlink); text-decoration: none; }
.chapter-num { font-size: 0.82rem; color: var(--ntext-muted); white-space: nowrap; }
.chapter-title { font-family: var(--nfont-body); }
.chapter-meta { font-size: 0.8rem; color: var(--ntext-muted); white-space: nowrap; }
.chapter-start-wrap { margin-top: 1.5rem; text-align: center; }

/* ── Flash ── */
.flash-container { max-width: var(--nmax-w); margin: 1rem auto; padding: 0 1.5rem; }
.flash { padding: 0.75rem 1rem; border-radius: var(--nradius); margin-bottom: 0.5rem; font-size: 0.9rem; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Footer ── */
.novel-footer {
  border-top: 1px solid var(--nborder);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ntext-muted);
}
.novel-footer-inner { max-width: var(--nmax-w); margin: 0 auto; }
.novel-footer-inner p { margin: 0.25rem 0; }
.disclaimer-full { margin-top: 0.5rem; line-height: 1.6; }

@media (max-width: 600px) {
  .novel-detail-header { flex-direction: column; }
  .novel-detail-cover { width: 120px; height: 165px; }
}

/* 多结局分组 */
.ending-group { margin-bottom: 2.5rem; }
.ending-group-title {
  font-size: 0.95rem;
  color: var(--ntext-muted);
  font-weight: normal;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--nborder);
}
.chapter-subtitle {
  font-size: 0.85rem;
  color: var(--ntext-muted);
  margin-left: 0.5rem;
}
.ending-group .chapter-list { border: none; }
