:root {
  --paper: #faf8f4;
  --card: #ffffff;
  --ink: #18171a;
  --ink-2: #5c5a55;
  --ink-3: #9b978e;
  --accent: #b23a2e;
  --line: #e7e3da;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "Kaiti", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgba(24, 23, 26, 0.04), 0 10px 30px -18px rgba(24, 23, 26, 0.35);
  --range-fill: #18171a;
  --range-track: #e7e3da;
}

body:has(.reader.open[data-theme="night"]) {
  --range-fill: #cbc6bc;
  --range-track: rgba(255, 255, 255, 0.17);
}

body:has(.reader.open[data-theme="night"]) .player {
  background: rgba(26, 26, 30, 0.94);
  border-top-color: rgba(255, 255, 255, 0.09);
}

body:has(.reader.open[data-theme="night"]) .p-meta strong { color: #ddd8ce; }
body:has(.reader.open[data-theme="night"]) .p-meta span { color: #8b867e; }
body:has(.reader.open[data-theme="night"]) .p-btn { color: #cbc6bc; }
body:has(.reader.open[data-theme="night"]) .p-btn.main { background: #cfcac0; color: #17171a; }
body:has(.reader.open[data-theme="night"]) .time { color: #8b867e; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 96px; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: inherit; }

::selection { background: rgba(178, 58, 46, 0.15); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
  padding: 0 32px;
  background: rgba(250, 248, 244, 0.86);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.14em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}

.brand i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
  margin-top: 3px;
}

.tabs { display: flex; gap: 4px; }

.tabs button {
  padding: 7px 18px;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border-radius: 999px;
  transition: color 0.18s, background 0.18s;
}

.tabs button:hover { color: var(--ink-2); }
.tabs button.on { color: var(--ink); background: rgba(24, 23, 26, 0.055); }

.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  height: 38px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.searchbox:focus-within {
  border-color: rgba(178, 58, 46, 0.4);
  box-shadow: 0 0 0 4px rgba(178, 58, 46, 0.06);
}

.searchbox svg { flex: none; opacity: 0.4; }

.searchbox input {
  border: none;
  outline: none;
  background: none;
  font-size: 13.5px;
  width: 190px;
  color: var(--ink);
  font-family: inherit;
}

.searchbox input::placeholder { color: var(--ink-3); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px 80px;
}

.hero { padding: 72px 0 44px; }

.eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  margin: 0 0 20px;
  text-transform: uppercase;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.14;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  padding-right: 0.06em;
}

.lede {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
  max-width: 560px;
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 34px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.shelf-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -22px 0 34px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
}

.shelf-tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.shelf-tools button:hover {
  border-color: var(--ink-3);
  color: var(--ink);
  background: rgba(24, 23, 26, 0.03);
}

.chip {
  padding: 8px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);  font-size: 13px;
  color: var(--ink-2);
  background: transparent;
  transition: all 0.18s;
  letter-spacing: 0.02em;
}

.chip:hover { border-color: rgba(24, 23, 26, 0.25); color: var(--ink); }

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 34px 26px;
}

.card {
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.32s;
}

.card:hover .cover {
  transform: translateY(-5px);
  box-shadow: 0 2px 4px rgba(24, 23, 26, 0.05), 0 22px 44px -22px rgba(24, 23, 26, 0.45);
}

.cover .ct {
  position: absolute;
  inset: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

.cover .ct b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.cover .ct b::before {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.42;
  margin-bottom: 13px;
}

.cover .ct i {
  position: absolute;
  left: 0;
  bottom: 0;
  font-style: normal;
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  opacity: 0.55;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover .play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.card:hover .play-badge { opacity: 1; transform: none; }

.card h3 {
  font-size: 14.5px;
  font-weight: 500;
  margin: 0;
  line-height: 1.45;
  min-height: 2.9em; /* 书名长短不一时保持行高对齐 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card p {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  height: 84px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.player.up { transform: none; }

.p-cover {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.p-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.p-meta { min-width: 0; width: 220px; flex: none; }

.p-meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-meta span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-center { flex: 1; display: flex; align-items: center; gap: 16px; }

.p-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.18s, transform 0.12s;
  flex: none;
}

.p-btn:hover { background: rgba(24, 23, 26, 0.06); }
.p-btn:active { transform: scale(0.93); }

.p-btn.main {
  width: 42px;
  height: 42px;
  background: var(--ink);
  color: #fff;
}

.p-btn.main:hover { background: #000; }

.p-bar { flex: 1; display: flex; align-items: center; gap: 10px; }

.time {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  width: 38px;
  flex: none;
}

.time.r { text-align: right; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
  flex: 1;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px #fff;
  opacity: 0.9;
  transition: transform 0.15s;
}

input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }

.p-right { display: flex; align-items: center; gap: 12px; flex: none; width: 130px; justify-content: flex-end; }

.p-right input[type="range"] { width: 72px; flex: none; }

.reader {
  --rd-bg: #fdfbf7;
  --rd-ink: #23221f;
  --rd-ink-2: #6c6862;
  --rd-line: rgba(231, 227, 218, 0.8);
  --rd-accent: #b23a2e;
  --rd-size: 18.5px;
  --rd-lead: 2.05;
  --rd-font: var(--serif);
  --rd-width: 660px;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--rd-bg);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, background 0.3s;
}

.reader[data-theme="sepia"] {
  --rd-bg: #f4e9d4;
  --rd-ink: #40372a;
  --rd-ink-2: #6d6250;
  --rd-line: rgba(170, 152, 118, 0.42);
  --rd-accent: #9c5b32;
}

.reader[data-theme="green"] {
  --rd-bg: #e7eee1;
  --rd-ink: #2c352b;
  --rd-ink-2: #5b6653;
  --rd-line: rgba(140, 160, 128, 0.4);
  --rd-accent: #4a6b48;
}

.reader[data-theme="night"] {
  --rd-bg: #17171a;
  --rd-ink: #c8c3b9;
  --rd-ink-2: #827d75;
  --rd-line: rgba(255, 255, 255, 0.11);
  --rd-accent: #c1654f;
}

.reader.open { opacity: 1; pointer-events: auto; }

.reader-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--rd-accent);
  z-index: 82;
  width: 0;
  transition: width 0.12s linear;
}

.reader-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 26px;
  background: color-mix(in srgb, var(--rd-bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rd-line);
  z-index: 81;
  transition: background 0.3s;
}

.reader-bar .r-title {
  font-size: 13px;
  color: var(--rd-ink-2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-bar .r-page {
  font-size: 11.5px;
  color: var(--rd-ink-2);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.reader-bar button {
  font-size: 12.5px;
  color: var(--rd-ink-2);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.16s, background 0.16s;
}

.reader-bar button:hover {
  color: var(--rd-ink);
  background: color-mix(in srgb, var(--rd-ink) 7%, transparent);
}

.reader-bar button.on {
  color: var(--rd-ink);
  background: color-mix(in srgb, var(--rd-ink) 9%, transparent);
}

.reader-body {
  max-width: var(--rd-width);
  margin: 0 auto;
  padding: 52px 26px 140px 26px;
  font-family: var(--rd-font);
  font-size: var(--rd-size);
  line-height: var(--rd-lead);
  color: var(--rd-ink);
  letter-spacing: 0.01em;
  transition: font-size 0.15s, line-height 0.15s;
}

.reader-body h1, .reader-body h2, .reader-body h3 {
  font-weight: 500;
  line-height: 1.5;
  margin: 2.2em 0 1em;
}

.reader-body h1 { font-size: 30px; letter-spacing: 0.02em; }

.reader-body p { margin: 0 0 1.1em; text-indent: 2em; }

.reader-body p.noindent, .reader-body div > p:first-child { text-indent: 0; }

.reader-body .ws-header, .reader-body .noprint,
.reader-body .mw-empty-elt, .reader-body sup.reference { display: none; }

.reader-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 16px;
  line-height: 1.9;
}

.reader-body table td, .reader-body table th {
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
  border: none;
}

.reader-body table tr { border-bottom: none; }
.reader-body table.multicol { table-layout: fixed; }
.reader-body table.multicol td { width: 50%; vertical-align: top; }
.reader-body table p { text-indent: 0; margin: 0 0 0.5em; }
.reader-body table ul { margin: 0.3em 0; }

.reader-body a {
  color: var(--rd-ink);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--rd-ink) 22%, transparent);
  transition: color 0.15s, border-color 0.15s;
}

.reader-body a:hover {
  color: var(--rd-accent);
  border-bottom-color: color-mix(in srgb, var(--rd-accent) 55%, transparent);
}

.reader-body ul, .reader-body ol { padding-left: 1.25em; margin: 0.8em 0; }
.reader-body li { margin: 0.3em 0; }
.reader-body li > ul { margin: 0.2em 0; }

.reader-body img { max-width: 100%; height: auto; }

.reader-body blockquote {
  margin: 1.6em 0;
  padding-left: 1.2em;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
}

/* 本地导入的书：章节标题与截断提示 */
.reader-body .local-chap {
  font-size: 21px;
  font-weight: 500;
  line-height: 1.6;
  margin: 2.8em 0 1.4em;
  text-align: center;
  letter-spacing: 0.08em;
}

.reader-body .local-chap:first-child { margin-top: 0; }

.reader-body .local-cut {
  margin: 2.4em 0;
  padding: 14px 0;
  border-top: 1px solid var(--rd-line);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  text-indent: 0;
}

.chap-nav {
  margin-top: 70px;
  padding-top: 26px;
  border-top: 1px solid rgba(231, 227, 218, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
}

.chap-nav button {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color 0.18s, color 0.18s;
}

.chap-nav button:hover { border-color: var(--ink-3); color: var(--ink); }
.chap-nav span { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }

.empty {
  padding: 90px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 2;
}

.jump-note {
  margin-top: 56px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.9;
}

.jump-note a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 23, 26, 0.2);
  padding-bottom: 1px;
}

.jump-note a:hover { color: var(--accent); border-bottom-color: rgba(178, 58, 46, 0.45); }

.skeleton {
  aspect-ratio: 1;
  border-radius: var(--r);
  background: linear-gradient(100deg, #f0ede6 30%, #f7f5ef 50%, #f0ede6 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -40% 0; }
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 26px;
}

.section-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.02em;
}

.section-head span { font-size: 12px; color: var(--ink-3); }

/* ---------- 顶栏图标按钮 ---------- */

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: rgba(255, 255, 255, 0.9);
  transition: color 0.18s, border-color 0.18s, transform 0.4s;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: rgba(24, 23, 26, 0.28);
  transform: rotate(45deg);
}

/* ---------- 音源切换 ---------- */

.source-row {
  display: flex;
  gap: 10px;
  margin: 0 0 24px;
}

.src {
  text-align: left;
  padding: 11px 18px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.src b {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  transition: color 0.18s;
}

.src span {
  display: block;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 3px;
  letter-spacing: 0.03em;
}

.src:hover { border-color: rgba(24, 23, 26, 0.22); }

.src.on {
  border-color: rgba(24, 23, 26, 0.8);
  background: #fff;
  box-shadow: 0 6px 18px -12px rgba(24, 23, 26, 0.5);
}

.src.on b { color: var(--ink); }

/* ---------- 带专辑封面的卡片 ---------- */

.cover.pic .ct { display: none; }

.cover.pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover.pic .play-badge {
  background: rgba(255, 255, 255, 0.94);
}

.cover.pic .play-badge svg { fill: #18171a; }

/* ---------- 阅读器：分页 ---------- */

.reader[data-mode="paged"] { overflow: hidden; }

.reader[data-mode="paged"] .reader-stage {
  position: relative;
  width: var(--rd-width);
  max-width: 100%;
  margin: 0 auto;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--rd-bg);
}

.reader[data-mode="paged"] .reader-body {
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 42px 26px 96px;
  column-width: calc(var(--rd-width) - 52px);
  column-gap: 52px;
  column-fill: auto;
  overflow: visible;
  will-change: transform;
}

/* ---------- 仿真翻页 ---------- */

/* 纸翻动时压在下方页面的投影 */
.page-shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(to left,
      color-mix(in srgb, var(--rd-ink) 24%, transparent) 0%,
      color-mix(in srgb, var(--rd-ink) 7%, transparent) 26%,
      transparent 48%);
}

/* 书脊：暗示装订线的那道暗边 */
.spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 26px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--rd-ink) 10%, transparent),
    color-mix(in srgb, var(--rd-ink) 2%, transparent) 62%,
    transparent);
}

.reader[data-mode="paged"] .spine { opacity: 1; }

/* 翻动的那张纸 */
.leaf-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  perspective: 2200px;
  perspective-origin: 50% 44%;
}

/* 整张纸：绕左侧书脊转，纸面朝读者翻出去（角度为负） */
.leaf3d {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
}

/* 纸被切成一条条斜带，每条绕同向的轴折一点，拼起来就是一卷弧面 */
.curl-piece {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  background: var(--rd-bg);
  will-change: transform;
}

.curl-piece > .reader-body {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  max-width: none;
}

/* 卷面上的光：跨片连续的斜向明暗带 */
.curl-tone {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(var(--tone-deg, 138deg),
    transparent 0%,
    transparent 52%,
    rgba(0, 0, 0, 0.34) 60%,
    rgba(0, 0, 0, 0.05) 64%,
    rgba(255, 255, 255, 0.82) 70%,
    rgba(255, 255, 255, 0.20) 76%,
    rgba(0, 0, 0, 0.18) 82%,
    rgba(0, 0, 0, 0.42) 88%,
    rgba(255, 255, 255, 0.60) 94%,
    rgba(0, 0, 0, 0.40) 100%);
}

/* 纸背面：卷过 90° 之后朝外的那一面 */
.curl-piece.is-back {
  background: color-mix(in srgb, var(--rd-bg) 93%, var(--rd-ink));
}

.curl-piece.is-back > .reader-body { opacity: 0; }

/* 纸边缘：一圈极淡的描边，压住分片之间的分辨率毛边 */
.curl-piece::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rd-ink) 5%, transparent);
}

.reader[data-mode="paged"] .reader-body table {
  break-inside: avoid;
}

.reader[data-mode="paged"] .reader-body * {
  max-width: 100%;
}

.reader[data-mode="paged"] .reader-body img {
  height: auto;
  max-height: calc(100vh - 220px);
}

.paged-nav {
  position: fixed;
  left: 0;
  right: 0;
  top: 56px;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
  z-index: 82;
}

.paged-nav button {
  pointer-events: auto;
  width: 38px;
  height: 76px;
  border-radius: 10px;
  border: 1px solid var(--rd-line);
  background: color-mix(in srgb, var(--rd-bg) 62%, transparent);
  color: var(--rd-ink-2);
  font-size: 22px;
  line-height: 1;
  opacity: 0.32;
  transition: opacity 0.2s, background 0.2s;
}

.paged-nav button:hover { opacity: 0.95; }

/* ---------- 阅读器：排版面板 ---------- */

.typeset {
  position: fixed;
  top: 64px;
  right: 22px;
  z-index: 84;
  width: 312px;
  padding: 10px 20px;
  background: var(--rd-bg);
  border: 1px solid var(--rd-line);
  border-radius: 14px;
  box-shadow: 0 22px 60px -26px rgba(0, 0, 0, 0.45);
  color: var(--rd-ink);
  animation: drop 0.2s ease both;
}

.typeset[hidden] { display: none; }

@keyframes drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.ts-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rd-line);
}

.ts-group:last-child { border-bottom: none; }

.ts-group > label {
  font-size: 12px;
  color: var(--rd-ink-2);
  flex: none;
  width: 36px;
}

.seg {
  display: flex;
  gap: 3px;
  flex: 1;
  justify-content: flex-end;
}

.seg button {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 7px;
  color: var(--rd-ink-2);
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.seg button:hover { color: var(--rd-ink); }

.seg button.on {
  background: color-mix(in srgb, var(--rd-ink) 11%, transparent);
  color: var(--rd-ink);
}

.swatches { display: flex; gap: 9px; }

.swatches button {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--sw);
  border: 1px solid rgba(122, 122, 122, 0.45);
  position: relative;
  transition: transform 0.15s;
}

.swatches button:hover { transform: scale(1.08); }

.swatches button.on::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--rd-ink);
  opacity: 0.5;
}

.stepper { display: flex; align-items: center; gap: 9px; }

.stepper button {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--rd-line);
  border-radius: 7px;
  color: var(--rd-ink-2);
  background: transparent;
}

.stepper button:hover { color: var(--rd-ink); }

.stepper span {
  font-size: 12px;
  width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--rd-ink);
}

/* ---------- 音源设置弹层 ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 23, 26, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade 0.18s ease both;
}

.sheet[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-card {
  width: min(452px, 100%);
  background: var(--card);
  border-radius: 16px;
  padding: 26px 28px 22px;
  box-shadow: 0 34px 90px -34px rgba(0, 0, 0, 0.55);
  animation: pop 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.sheet-card h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.sheet-card p {
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 0 0 12px;
}

.sheet-card ol {
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--ink-2);
  padding-left: 18px;
  margin: 0 0 18px;
}

.sheet-card ol a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }

.sheet-card code {
  background: rgba(24, 23, 26, 0.055);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.field { display: block; margin: 0 0 18px; }

.field > span {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 7px;
  letter-spacing: 0.06em;
}

.field input {
  width: 100%;
  height: 41px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field input:focus {
  border-color: rgba(178, 58, 46, 0.45);
  box-shadow: 0 0 0 3px rgba(178, 58, 46, 0.07);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.sheet-actions button {
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13px;
  transition: opacity 0.16s;
}

.sheet-actions button:hover { opacity: 0.86; }

.ghost {
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: transparent;
}

.primary {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
}

.sheet-card .fine {
  font-size: 11px;
  color: var(--ink-3);
  margin: 16px 0 0;
  line-height: 1.7;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(24, 23, 26, 0.14); border-radius: 6px; border: 3px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

.reader[data-theme="night"]::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-color: #17171a;
}

@media (max-width: 720px) {
  .topbar { padding: 0 18px; gap: 14px; }
  main { padding: 0 18px 70px; }
  .hero { padding: 44px 0 32px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 24px 16px; }
  .p-meta { width: 120px; }
  .p-right { display: none; }
  .searchbox input { width: 110px; }
}
