.shelf-wrap, .catalog-wrap { max-width: 1220px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px) 100px; }

/* ---------- 首屏 ---------- */
.hero { position: relative; padding: clamp(52px, 8vw, 96px) 0 46px; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.hero-kicker { display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 11px; letter-spacing: .3em; color: var(--accent); text-transform: uppercase; margin-bottom: 22px; }
.hero-kicker::before { content: ''; width: 28px; height: 1px; background: var(--accent); animation: line-grow calc(.9s * var(--anim-scale)) ease both; transform-origin: left; }
.hero h1 { margin: 0; font-size: clamp(42px, 6.4vw, 82px); line-height: 1.12; letter-spacing: .06em; font-weight: 500; }
.hero h1 .word { display: inline-block; opacity: 0; transform: translateY(20px); animation: rise-in calc(.7s * var(--anim-scale)) cubic-bezier(.2, .85, .25, 1) forwards; }
.hero h1 em { font-style: normal; color: var(--accent); position: relative; }
.hero h1 em::after { content: ''; position: absolute; left: 0; right: 0; bottom: -.08em; height: 3px; background: var(--accent); opacity: .35; border-radius: 9px; transform: scaleX(0); transform-origin: left; animation: line-grow calc(.9s * var(--anim-scale)) .6s ease forwards; }
.hero-desc { margin: 24px 0 30px; max-width: 520px; font-size: 15.5px; line-height: 2; color: var(--ink-soft); }
.hero-stats { display: flex; gap: 34px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 27px; font-weight: 500; font-variant-numeric: tabular-nums; }
.hero-stats small { font-family: var(--sans); font-size: 11px; letter-spacing: .12em; color: var(--ink-faint); }
.hero-orb { position: relative; width: clamp(170px, 20vw, 260px); aspect-ratio: 1; display: grid; place-items: center; }
.hero-orb::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--line-strong); animation: spin 38s linear infinite; border-style: dashed; }
.hero-orb::after { content: ''; position: absolute; inset: 18%; border-radius: 50%; background: var(--accent-soft); filter: blur(6px); }
.hero-orb span { position: relative; font-size: clamp(80px, 10vw, 132px); color: var(--accent); opacity: .82; line-height: 1; transform: rotate(-8deg); }
.hero-orb i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); top: 2%; left: 50%; }

/* ---------- 筛选 ---------- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 0 30px; border-top: 1px solid var(--line); }
.filter-bar .label { font-family: var(--sans); font-size: 12px; color: var(--ink-faint); margin-right: 4px; }
.chip { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); font-family: var(--sans); font-size: 12.5px; color: var(--ink-soft); background: var(--surface-2); transition: all .22s ease; }
.chip:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--surface-solid); font-weight: 700; }
.filter-count { margin-left: auto; font-family: var(--sans); font-size: 12px; color: var(--ink-faint); }

/* ---------- 小说卡片 ---------- */
.novel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 28px; }
.novel-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-soft);
  transition: transform .4s cubic-bezier(.2, .85, .25, 1), box-shadow .4s ease, border-color .3s ease;
  animation: rise-in calc(.6s * var(--anim-scale)) cubic-bezier(.2, .85, .25, 1) both;
}
.novel-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .22), transparent 60%);
  transition: opacity .3s ease;
}
.novel-card:hover { transform: translateY(-9px) rotate(-.5deg); box-shadow: var(--shadow); border-color: var(--accent); }
.novel-card:hover::after { opacity: 1; }
.cover {
  position: relative; height: 218px; padding: 22px 24px; display: flex; flex-direction: column; justify-content: space-between;
  color: #f6efe2; overflow: hidden; isolation: isolate;
  background: linear-gradient(145deg, #3c4b58, #1e2b36);
}
.cover[data-palette="slate"] { background: linear-gradient(145deg, #465866 0%, #22313d 62%, #16232d 100%); }
.cover[data-palette="jade"] { background: linear-gradient(145deg, #557761 0%, #2c503f 62%, #1c382c 100%); }
.cover[data-palette="amber"] { background: linear-gradient(145deg, #9a7246 0%, #62442a 62%, #35251a 100%); }
.cover::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .16; background: repeating-linear-gradient(115deg, transparent 0 13px, rgba(255,255,255,.14) 13px 14px); }
.cover::after { content: ''; position: absolute; width: 220px; height: 220px; right: -70px; top: -70px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 60px rgba(255,255,255,.025); }
.cover-glyph { position: absolute; right: 12px; bottom: -34px; font-size: 178px; line-height: 1; opacity: .12; pointer-events: none; }
.cover-top { display: flex; justify-content: space-between; align-items: flex-start; font-family: var(--sans); font-size: 10px; letter-spacing: .22em; opacity: .78; }
.cover-seal { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 7px; font-size: 15px; }
.cover-title { position: relative; font-size: 34px; letter-spacing: .12em; line-height: 1.2; text-shadow: 0 4px 18px rgba(0,0,0,.2); }
.cover-sub { font-family: var(--sans); font-size: 9px; letter-spacing: .28em; opacity: .68; margin-top: 8px; }
.cover-line { width: 46px; height: 2px; background: rgba(255,255,255,.55); margin-top: 16px; transition: width .4s ease; }
.novel-card:hover .cover-line { width: 90px; }
.card-body { padding: 20px 22px 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-head h3 { margin: 0; font-size: 21px; letter-spacing: .05em; font-weight: 600; }
.card-head .rating { font-family: var(--sans); font-size: 12px; color: var(--accent); font-weight: 700; }
.card-author { margin: 6px 0 12px; font-family: var(--sans); font-size: 12px; color: var(--ink-faint); }
.card-desc { margin: 0; font-size: 13.5px; line-height: 1.85; color: var(--ink-soft); min-height: 74px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 15px 0; }
.tag { padding: 3px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-family: var(--sans); font-size: 10.5px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--sans); font-size: 11px; color: var(--ink-faint); }
.card-actions { display: flex; gap: 8px; margin-top: 16px; }
.card-actions .btn { flex: 1; }
.badge-offline { display: inline-flex; align-items: center; gap: 4px; color: #4d9a71; font-weight: 700; }

.empty-state { padding: 80px 20px; text-align: center; color: var(--ink-faint); }
.empty-state .glyph { font-size: 58px; opacity: .3; display: block; margin-bottom: 14px; }
.empty-state h3 { color: var(--ink); font-weight: 500; font-size: 22px; margin: 0 0 8px; }

/* ---------- 大书库：视口外卡片跳过布局与绘制 ----------
 * content-visibility 让浏览器只处理可见卡片；contain-intrinsic-size
 * 给未渲染卡片一个占位高度，避免滚动条在加载过程中跳动。 */
.novel-grid > .novel-card {
  content-visibility: auto;
  contain-intrinsic-size: 480px;
  contain-intrinsic-size: auto 480px;
}

/* 滚动追加哨兵 / 首屏骨架 */
.shelf-sentinel {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px 0 8px; font-family: var(--sans); font-size: 12px;
  letter-spacing: .08em; color: var(--ink-faint);
}
.shelf-sentinel[hidden] { display: none; }
.shelf-sentinel::before, .shelf-sentinel::after {
  content: ''; width: 42px; height: 1px; background: var(--line);
}
.shelf-skeleton {
  margin: 80px auto; max-width: 520px; padding: 60px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  color: var(--ink-faint); font-size: 14px; letter-spacing: .1em;
}

/* ---------- 目录页 ---------- */
.catalog-wrap { padding-top: 46px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint); margin-bottom: 26px; transition: color .2s ease, transform .2s ease; }
.back-link:hover { color: var(--accent); transform: translateX(-4px); }
.catalog-layout { display: grid; grid-template-columns: 320px 1fr; gap: 42px; align-items: start; }
.catalog-side { position: sticky; top: calc(var(--topbar-h) + 28px); }
.catalog-cover { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.catalog-cover .cover { height: 300px; padding: 28px; }
.catalog-cover .cover-title { font-size: 46px; }
.catalog-cover .cover-glyph { font-size: 230px; }
.info-block { margin-top: 26px; }
.info-block h2 { margin: 0; font-size: 30px; letter-spacing: .08em; font-weight: 500; }
.info-block .author { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin: 8px 0 16px; }
.info-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info-stats div { display: flex; flex-direction: column; gap: 3px; }
.info-stats b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.info-stats small { font-family: var(--sans); font-size: 10.5px; color: var(--ink-faint); }
.info-desc { font-size: 14px; line-height: 2; color: var(--ink-soft); margin: 18px 0; }
.info-notice { font-family: var(--sans); font-size: 11.5px; color: var(--ink-faint); background: var(--surface-2); border-left: 2px solid var(--accent); padding: 10px 12px; border-radius: 0 8px 8px 0; }
.side-actions { display: flex; gap: 9px; margin: 22px 0 14px; }
.side-actions .btn { flex: 1; }
.side-actions .btn-primary { flex: 1.4; }
.download-status { font-family: var(--sans); font-size: 11.5px; color: var(--ink-faint); min-height: 20px; }
.preload-track { height: 4px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 8px; }
.preload-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s ease; }

.catalog-main { min-width: 0; }
.catalog-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.catalog-head h3 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: .08em; }
.catalog-head p { margin: 6px 0 0; font-family: var(--sans); font-size: 12px; color: var(--ink-faint); }
.chapter-search { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.chapter-search input { border: 0; outline: 0; background: none; font-family: var(--sans); font-size: 12.5px; width: 150px; }
.volume-title { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; font-size: 15px; letter-spacing: .12em; color: var(--accent); }
.volume-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.chapter-list { display: flex; flex-direction: column; gap: 6px; }
.chapter-row {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2);
  text-align: left; width: 100%; color: var(--ink);
  transition: transform .25s ease, background .25s ease, border-color .25s ease, box-shadow .25s ease;
  animation: row-in calc(.44s * var(--anim-scale)) cubic-bezier(.2, .85, .25, 1) both;
}
.chapter-row:hover { transform: translateX(7px); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-soft); }
.chapter-row.active { border-color: var(--accent); background: var(--accent-soft); }
.chapter-index { font-family: var(--sans); font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.chapter-row.active .chapter-index { color: var(--accent); }
.chapter-name { font-size: 15.5px; letter-spacing: .03em; }
.chapter-words { font-family: var(--sans); font-size: 11px; color: var(--ink-faint); }
.chapter-arrow { font-family: var(--sans); color: var(--accent); opacity: 0; transform: translateX(-6px); transition: all .25s ease; }
.chapter-row:hover .chapter-arrow { opacity: 1; transform: none; }
.cache-dot { width: 6px; height: 6px; border-radius: 50%; background: #5aa87d; display: inline-block; margin-right: 6px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-orb { display: none; }
  .catalog-layout { grid-template-columns: 1fr; gap: 28px; }
  .catalog-side { position: static; }
  .catalog-cover .cover { height: 240px; }
}
