/* ============================================================
   废柴召唤术 · 暖纸轻小说阅读站 — 样式
   设计方向：米黄纸感背景 + 书棕/琥珀暖色点缀，
   UI 用圆润无衬线、正文用衬线，长篇中文阅读最护眼。
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --paper:       #FFFBEB;   /* 页面米黄纸 */
  --paper-card:  #FFFFFF;   /* 卡片暖白 */
  --paper-sunk:  #FBF1DA;   /* 下沉区块（更深米黄） */
  --ink:         #2A2018;   /* 正文深墨 */
  --ink-2:       #5F5346;   /* 次级文字 */
  --ink-3:       #8A7C6A;   /* 弱化文字（仅装饰/大字） */
  --line:        #ECE0C6;   /* 细描边 */
  --line-2:      #E2D3B2;   /* 强描边 */
  --amber:       #D97706;   /* 品牌琥珀（填充/装饰） */
  --amber-ink:   #B45309;   /* 琥珀文字（米黄上达标对比） */
  --amber-soft:  #FDEFC9;   /* 琥珀浅底（徽章/高亮） */
  --cta:         #C2410C;   /* 主按钮（白字达标） */
  --cta-hover:   #9A3412;
  --brown:       #92400E;   /* 书棕（标题点缀） */
  --shadow:      0 1px 2px rgba(120,80,20,.06), 0 8px 24px rgba(120,80,20,.07);
  --shadow-lg:   0 2px 6px rgba(120,80,20,.08), 0 18px 48px rgba(120,80,20,.12);
  --radius:      16px;
  --radius-sm:   10px;
  --maxw:        1080px;
  --read:        clamp(16px, 2.2vw, 19px);

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
               "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong",
                "SimSun", Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  --paper:       #1E1A14;
  --paper-card:  #29231B;
  --paper-sunk:  #181410;
  --ink:         #F2E9D6;
  --ink-2:       #CABCA1;
  --ink-3:       #95876F;
  --line:        #3A3328;
  --line-2:      #473D2E;
  --amber:       #F6B53B;
  --amber-ink:   #F6C25A;
  --amber-soft:  #3A2D17;
  --cta:         #D2691E;
  --cta-hover:   #E07B3A;
  --brown:       #F6C25A;
  --shadow:      0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:   0 2px 6px rgba(0,0,0,.4), 0 18px 48px rgba(0,0,0,.5);
}

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  letter-spacing: .01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* ---------- 顶部导航 ---------- */
.nav-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.nav-logo {
  font-weight: 800; font-size: 1.18rem; letter-spacing: .04em;
  color: var(--ink);
}
.nav-badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  color: var(--cta);
  background: var(--amber-soft);
  border: 1px solid var(--line-2);
  padding: 3px 9px; border-radius: 999px;
}
.nav-subtitle { font-size: .82rem; color: var(--ink-2); margin-left: auto; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-chapter-title {
  margin: 0 auto; font-weight: 600; color: var(--ink-2);
  font-size: .92rem; max-width: 50%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; border-radius: 999px;
  padding: 12px 24px; min-height: 44px;
  transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--cta); color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--cta) 38%, transparent);
}
.btn-primary:hover { background: var(--cta-hover); }
.btn-outline {
  background: var(--paper-card); color: var(--ink);
  border: 1.5px solid var(--line-2); box-shadow: var(--shadow);
}
.btn-outline:hover { border-color: var(--amber); color: var(--amber-ink); }
.btn-outline:disabled { opacity: .4; cursor: not-allowed; }
.btn-outline:disabled:hover { border-color: var(--line-2); color: var(--ink); }
.btn-small {
  padding: 0; width: 44px; height: 44px; min-height: 44px;
  border-radius: 50%; font-weight: 700; font-size: .9rem;
  background: var(--paper-card); border: 1.5px solid var(--line-2);
}
.btn-small:hover { border-color: var(--amber); color: var(--amber-ink); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-2); background: var(--paper-card);
}
.icon-btn:hover { border-color: var(--amber); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 60% at 85% 10%, color-mix(in srgb, var(--amber) 22%, transparent), transparent 70%),
    radial-gradient(50% 50% at 8% 90%, color-mix(in srgb, var(--brown) 14%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 23px, color-mix(in srgb, var(--line) 55%, transparent) 24px);
}
.hero-content {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(40px, 7vw, 84px) 20px;
  display: grid; grid-template-columns: 1.4fr .9fr; gap: 48px; align-items: center;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tag {
  font-size: .76rem; font-weight: 600; color: var(--ink-2);
  background: var(--paper-card); border: 1px solid var(--line-2);
  padding: 4px 11px; border-radius: 999px;
}
.tag-accent { color: var(--cta); background: var(--amber-soft); border-color: transparent; }
.hero-title {
  font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 800;
  letter-spacing: .06em; line-height: 1.05; color: var(--ink);
  margin-bottom: 10px;
}
.hero-subtitle { font-size: clamp(1rem, 2.4vw, 1.3rem); color: var(--amber-ink); font-weight: 700; margin-bottom: 18px; }
.hero-premise { font-size: 1.02rem; color: var(--ink-2); line-height: 1.85; max-width: 42ch; margin-bottom: 26px; }
.hero-stats { display: flex; gap: 30px; margin-bottom: 30px; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--brown); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--ink-2); margin-top: 6px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* 书封 */
.hero-cover { display: flex; justify-content: center; }
.cover-placeholder {
  width: min(280px, 70vw); aspect-ratio: 3 / 4;
  border-radius: 18px; padding: 14px;
  background: linear-gradient(155deg, var(--amber) 0%, var(--brown) 100%);
  box-shadow: var(--shadow-lg);
  transform: rotate(2.5deg);
  transition: transform .3s ease;
}
.cover-placeholder:hover { transform: rotate(0deg) translateY(-4px); }
.cover-inner {
  height: 100%; border-radius: 12px;
  border: 1.5px dashed rgba(255,255,255,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: #fff;
}
.cover-icon { font-family: var(--font-serif); font-size: 5.4rem; font-weight: 700; line-height: 1; text-shadow: 0 3px 10px rgba(0,0,0,.2); }
.cover-name { font-weight: 800; letter-spacing: .22em; font-size: 1.05rem; }

/* ---------- 区块 ---------- */
.section { padding: clamp(44px, 7vw, 76px) 20px; }
.section-sunk { background: var(--paper-sunk); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-title {
  font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 800; color: var(--ink);
  margin-bottom: 26px; display: flex; align-items: center; gap: 12px;
}
.section-title::before {
  content: ""; width: 8px; height: 1.1em; border-radius: 4px;
  background: linear-gradient(var(--amber), var(--brown));
}
.section-body { font-size: 1.04rem; line-height: 1.95; color: var(--ink-2); max-width: 70ch; }

/* 信息卡 */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 30px; }
.info-card {
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.info-card h3 { font-size: .96rem; font-weight: 800; color: var(--amber-ink); margin-bottom: 10px; }
.info-card p { font-size: .94rem; line-height: 1.8; color: var(--ink-2); }

/* 分卷 */
.volume-list { display: grid; gap: 14px; }
.volume-card {
  background: var(--paper-card); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: var(--radius-sm); padding: 18px 22px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease;
}
.volume-card:hover { transform: translateX(3px); box-shadow: var(--shadow-lg); }
.volume-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.volume-number { font-size: .76rem; font-weight: 800; color: #fff; background: var(--amber); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.volume-title { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.volume-state { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--ink-3); }
.volume-state.live { color: var(--cta); }
.volume-summary { font-size: .9rem; line-height: 1.75; color: var(--ink-2); }

/* 角色 */
.cast-group + .cast-group { margin-top: 34px; }
.cast-group-title { font-size: 1.02rem; font-weight: 800; color: var(--brown); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.cast-group-title::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--amber); }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.cast-card {
  background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; gap: 14px;
  transition: transform .15s ease, box-shadow .2s ease;
}
.cast-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.cast-avatar {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; color: #fff;
}
.cast-info { min-width: 0; }
.cast-name { font-size: 1.04rem; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.cast-lead-badge { font-size: .64rem; font-weight: 800; color: #fff; background: var(--cta); padding: 2px 7px; border-radius: 999px; letter-spacing: .04em; }
.cast-role { font-size: .78rem; color: var(--amber-ink); font-weight: 600; margin: 3px 0 8px; }
.cast-blurb { font-size: .85rem; line-height: 1.7; color: var(--ink-2); }

/* 章节 */
.chapter-list { display: grid; gap: 10px; }
.chapter-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 20px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.chapter-item:hover { transform: translateX(4px); border-color: var(--amber); box-shadow: var(--shadow-lg); }
.chapter-num { flex: none; font-size: .78rem; font-weight: 800; color: var(--amber-ink); background: var(--amber-soft); padding: 5px 10px; border-radius: 8px; min-width: 64px; text-align: center; }
.chapter-title { flex: 1; font-weight: 600; color: var(--ink); }
.chapter-words { flex: none; font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chapter-arrow { flex: none; color: var(--ink-3); transition: transform .15s ease, color .2s ease; }
.chapter-item:hover .chapter-arrow { transform: translateX(3px); color: var(--amber); }
.list-empty { color: var(--ink-3); padding: 24px; text-align: center; }

/* ---------- 页脚 ---------- */
.footer { text-align: center; padding: 40px 20px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .88rem; }
.footer-meta { margin-top: 6px; font-size: .78rem; color: var(--ink-3); }

/* ============================================================
   阅读页
   ============================================================ */
.read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--amber), var(--cta));
  z-index: 60; transition: width .1s linear;
}
.reader-main { max-width: 720px; margin: 0 auto; padding: 36px 20px 60px; }
.reader-content { font-family: var(--font-serif); font-size: var(--read); color: var(--ink); }
.chapter-heading {
  text-align: center; margin-bottom: 38px; padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.chapter-heading .ch-no { font-family: var(--font-sans); font-size: .82rem; font-weight: 700; letter-spacing: .1em; color: var(--amber-ink); }
.chapter-heading .ch-title { font-size: clamp(1.5rem, 4.5vw, 2.1rem); font-weight: 800; color: var(--ink); margin-top: 10px; line-height: 1.3; }
.chapter-body p { margin: 0 0 1.35em; line-height: 2.05; text-align: justify; }
.chapter-body p:first-child { margin-top: 0; }
.chapter-body .scene-break { text-align: center; color: var(--ink-3); letter-spacing: .6em; margin: 2em 0; font-family: var(--font-sans); }
.chapter-body .highlight-block {
  color: var(--amber-ink); font-weight: 600;
  background: var(--amber-soft); padding: 1px 5px; border-radius: 5px;
  font-family: var(--font-sans); font-size: .94em;
}
.chapter-body h2, .chapter-body h3 { font-family: var(--font-sans); margin: 1.6em 0 .6em; color: var(--ink); }
.chapter-body em { color: var(--ink-2); }

.reader-nav-bottom {
  max-width: 720px; margin: 40px auto 0; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.reader-nav-bottom .btn { flex: 1; }
.reader-footer { margin-top: 30px; }
.loading { text-align: center; color: var(--ink-3); padding: 80px 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero-content { grid-template-columns: 1fr; gap: 32px; }
  .hero-cover { order: -1; }
  .cover-placeholder { transform: rotate(0); width: min(220px, 56vw); }
  .nav-subtitle { display: none; }
}
@media (max-width: 560px) {
  .hero-stats { gap: 22px; }
  .nav-chapter-title { max-width: 40%; }
  .chapter-item { gap: 12px; padding: 14px 16px; }
  .chapter-words { display: none; }
  .reader-nav-bottom .btn { padding: 12px 12px; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto; }
}
