@charset "UTF-8";
/* ===========================================================
   五刻书阁 —— 主样式
   主题由 <html data-theme> 驱动，字体由 <html data-font> 驱动
   =========================================================== */

/* ---------- 字体族 ---------- */
:root {
  --f-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
             "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --f-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun",
             Georgia, "Times New Roman", serif;
  --f-kai:   "Kaiti SC", "KaiTi", "STKaiti", "楷体", "Noto Serif SC", serif;
  --f-round: "Yuanti SC", "YouYuan", "圆体-简", "Quicksand", "PingFang SC", sans-serif;
  --f-mono:  ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --reader-size:    18px;
  --reader-leading: 1.95;
  --reader-width:   720px;
  --reader-para:    0.9em;

  /* 页面主容器宽度：随屏幕分档放宽，见文件末尾「宽屏」一节 */
  --shell: 1180px;
  --gut:   24px;

  --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --shadow-2: 0 4px 12px rgba(0,0,0,.07), 0 12px 32px rgba(0,0,0,.06);
  --shadow-3: 0 18px 50px rgba(0,0,0,.16);
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- 主题 ---------- */
html[data-theme="paper"] {
  --bg:#faf7f0; --bg-2:#f3eee3; --surface:#fffdf8; --surface-2:#f7f2e8;
  --text:#1f1d1a; --text-2:#6b655c; --text-3:#9a9287;
  --line:#e8e1d3; --line-2:#d8cfbc;
  --accent:#a8402a; --accent-soft:#f6e6e0; --accent-text:#fff;
  --gold:#9a7b3f; --ok:#3f7a4f; --warn:#a8722a;
  --grain:.028;
}
html[data-theme="sepia"] {
  --bg:#f0e6d2; --bg-2:#e8dcc4; --surface:#f8f0df; --surface-2:#f0e5cf;
  --text:#40352a; --text-2:#7a6b57; --text-3:#a1917a;
  --line:#ded0b4; --line-2:#cdbc9c;
  --accent:#9a4e26; --accent-soft:#f2e0cf; --accent-text:#fff;
  --gold:#8a6b32; --ok:#5a7346; --warn:#a06a24;
  --grain:.04;
}
html[data-theme="mint"] {
  --bg:#e4efe6; --bg-2:#d9e8dc; --surface:#f1f8f1; --surface-2:#e6f1e7;
  --text:#22332a; --text-2:#5b6f60; --text-3:#89998d;
  --line:#cfe0d2; --line-2:#b9d0be;
  --accent:#2f6b4a; --accent-soft:#dcece0; --accent-text:#fff;
  --gold:#7a7a33; --ok:#2f6b4a; --warn:#96702c;
  --grain:.03;
}
html[data-theme="dark"] {
  --bg:#161512; --bg-2:#100f0d; --surface:#1e1c18; --surface-2:#262320;
  --text:#e0d9cb; --text-2:#968f81; --text-3:#6d6659;
  --line:#2d2a24; --line-2:#3b372f;
  --accent:#d0714d; --accent-soft:#2e231d; --accent-text:#191713;
  --gold:#c0a065; --ok:#71a97e; --warn:#c69152;
  --grain:.02;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 6px 20px rgba(0,0,0,.45);
  --shadow-3: 0 20px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}
html[data-theme="oled"] {
  --bg:#000; --bg-2:#000; --surface:#0b0b0a; --surface-2:#151412;
  --text:#d6d0c6; --text-2:#8d867a; --text-3:#615b51;
  --line:#1f1e1b; --line-2:#2b2925;
  --accent:#dd7d55; --accent-soft:#1d1512; --accent-text:#0a0908;
  --gold:#c9a869; --ok:#77b184; --warn:#cd9757;
  --grain:0;
  --shadow-1: 0 1px 2px rgba(0,0,0,.6);
  --shadow-2: 0 6px 20px rgba(0,0,0,.7);
  --shadow-3: 0 20px 60px rgba(0,0,0,.85);
  color-scheme: dark;
}

/* ---------- 正文字体切换 ---------- */
html[data-font="serif"] { --f-read: var(--f-serif); }
html[data-font="sans"]  { --f-read: var(--f-sans); }
html[data-font="kai"]   { --f-read: var(--f-kai); }
html[data-font="round"] { --f-read: var(--f-round); }
html { --f-read: var(--f-serif); }

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
/* 纸张肌理 —— 极淡的噪点，让大片留白不发死 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--accent-text); }

h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }

.wrap { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gut); }
.wrap-narrow { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* ---------- PJAX 顶部进度条 ---------- */
#pjax-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 200; opacity: 0; transition: width .25s var(--ease), opacity .3s;
}
#pjax-bar.on  { opacity: 1; }
#pjax-bar.done { width: 100% !important; opacity: 0; transition: width .1s, opacity .4s .1s; }

/* ===========================================================
   顶栏
   =========================================================== */
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, transform .3s var(--ease), box-shadow .25s;
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 1px 14px rgba(0,0,0,.04); }
.topbar-in {
  max-width: var(--shell); margin: 0 auto; padding: 0 var(--gut);
  height: 62px; display: flex; align-items: center; gap: 20px;
}

.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark { width: 24px; height: 24px; fill: var(--accent); }
.brand-mark rect { fill: var(--gold); }
.brand-text {
  font-family: var(--f-serif); font-size: 18px; font-weight: 700;
  letter-spacing: .06em; white-space: nowrap;
}

.nav { display: flex; gap: 2px; flex-shrink: 0; }
.nav a {
  padding: 7px 13px; border-radius: var(--r-sm); font-size: 14px;
  color: var(--text-2); transition: color .18s, background-color .18s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent); font-weight: 600; }

.searchbox {
  flex: 1; max-width: 340px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px 0 12px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 999px; transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.searchbox:focus-within {
  background: var(--surface); border-color: var(--line-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.searchbox svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; }
.searchbox input {
  flex: 1; min-width: 0; border: 0; background: none; font-size: 13.5px; outline: none;
}
.searchbox input::placeholder { color: var(--text-3); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox kbd {
  font-family: var(--f-mono); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; line-height: 1.4;
}
.searchbox:focus-within kbd { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; background: none; border-radius: var(--r-sm); cursor: pointer;
  color: var(--text-2); transition: background-color .18s, color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle .i-moon { display: none; }
html[data-theme="dark"] #theme-toggle .i-sun,
html[data-theme="oled"] #theme-toggle .i-sun { display: none; }
html[data-theme="dark"] #theme-toggle .i-moon,
html[data-theme="oled"] #theme-toggle .i-moon { display: block; }

/* ---------- 公告条 ---------- */
.announce {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
  animation: announce-in .4s var(--ease);
}
@keyframes announce-in { from { opacity: 0; transform: translateY(-100%); } }
.announce-in {
  max-width: var(--shell); margin: 0 auto; padding: 9px var(--gut);
  display: flex; align-items: center; gap: 9px;
}
.announce svg {
  width: 15px; height: 15px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.announce a, .announce span { flex: 1; min-width: 0; line-height: 1.5; }
.announce a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.announce-x {
  flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 4px; cursor: pointer;
  color: inherit; opacity: .5; transition: opacity .16s, background-color .16s;
}
.announce-x:hover { opacity: 1; background: rgba(0,0,0,.06); }
.announce-x svg { width: 13px; height: 13px; }
.announce-info   { color: var(--text-2); }
.announce-warn   { background: color-mix(in srgb, var(--warn) 13%, var(--surface)); color: var(--warn); border-bottom-color: color-mix(in srgb, var(--warn) 24%, transparent); }
.announce-strong { background: var(--accent); color: var(--accent-text); border-bottom-color: transparent; }
.announce-strong .announce-x:hover { background: rgba(255,255,255,.18); }

/* ---------- 搜索联想 ---------- */
.searchwrap { position: relative; flex: 1; max-width: 340px; margin-left: auto; }
.searchwrap .searchbox { max-width: none; margin: 0; width: 100%; }
.suggest {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0; z-index: 95;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 5px; max-height: 400px; overflow-y: auto;
  animation: sug-in .16s var(--ease);
}
@keyframes sug-in { from { opacity: 0; transform: translateY(-5px); } }
.sug-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  border-radius: var(--r-sm); cursor: pointer; transition: background-color .12s;
}
.sug-item:hover, .sug-item.on { background: var(--surface-2); }
.sug-cover {
  width: 30px; aspect-ratio: 3/4; border-radius: 3px; overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
}
.sug-cover img { width: 100%; height: 100%; object-fit: cover; }
.sug-body { flex: 1; min-width: 0; }
.sug-title {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sug-title mark { background: none; color: var(--accent); font-weight: 700; }
.sug-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.sug-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.sug-all {
  display: block; padding: 8px 9px; margin-top: 3px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--accent); text-align: center; border-radius: var(--r-sm);
}
.sug-all:hover { background: var(--accent-soft); }

/* ---------- 通知铃 ---------- */
.notif-bell { position: relative; }
.bell-dot {
  position: absolute; top: 1px; right: 1px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-bell.has-new svg { animation: bell-swing 2.4s var(--ease) 1s 2; transform-origin: 50% 4px; }
@keyframes bell-swing {
  0%,60%,100% { transform: rotate(0); }
  70% { transform: rotate(11deg); } 80% { transform: rotate(-9deg); }
  90% { transform: rotate(5deg); }
}
.dd-badge {
  float: right; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text);
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}

/* ---------- 通知列表 ---------- */
.notif {
  display: flex; gap: 12px; padding: 15px 20px; align-items: flex-start;
  border-bottom: 1px solid var(--line); transition: background-color .16s;
}
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); }
.notif-new { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.notif-ico {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.notif-ico[data-kind="reply"]    { background: var(--accent-soft); color: var(--accent); }
.notif-ico[data-kind="feedback"] { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
.notif-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-title { font-size: 13.5px; font-weight: 600; }
.notif-text { font-size: 12.5px; color: var(--text-2); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time { font-size: 11px; color: var(--text-3); }
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  flex-shrink: 0; margin-top: 12px;
}

/* ---------- 排行榜页 ---------- */
.rank-hero {
  padding: 44px 0 34px; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(760px 300px at 50% -30%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 72%);
  text-align: center;
}
.rank-hero h1 { font-family: var(--f-serif); font-size: clamp(24px, 3.4vw, 33px); letter-spacing: .06em; }
.rank-hero p { margin: 12px 0 0; font-size: 13.5px; color: var(--text-3); }

.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin: 34px 0 8px; align-items: end;
}
.podium-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 20px 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  position: relative; transition: transform .26s var(--ease), box-shadow .26s var(--ease), border-color .2s;
}
.podium-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.pod-1 { order: 2; padding-top: 28px; padding-bottom: 26px; }
.pod-2 { order: 1; }
.pod-3 { order: 3; }
.pod-1 .cover { width: 96px; }
.pod-2 .cover, .pod-3 .cover { width: 78px; }
.pod-medal {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%;
  background: var(--medal); color: #fff; font-family: var(--f-mono);
  font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  border: 2px solid var(--surface);
}
.podium-card h3 {
  margin-top: 13px; font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.podium-card p { margin: 4px 0 0; font-size: 11.5px; color: var(--text-3); }
.pod-heat {
  margin-top: 9px; font-family: var(--f-mono); font-size: 11.5px;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px;
}

.ranklist-full .rankrow { padding: 11px 10px; }
.rank-author { font-size: 11.5px; color: var(--text-3); margin-left: 8px; font-weight: 400; }
.rank-cells { display: flex; gap: 18px; flex-shrink: 0; font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3); }
.rank-cells span { min-width: 32px; text-align: right; }

.rank-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: 34px;
}

/* ---------- 分类页 ---------- */
.cats-hero {
  padding: 40px 0 30px; border-bottom: 1px solid var(--line); text-align: center;
  background: radial-gradient(700px 260px at 50% -30%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 72%);
}
.cats-hero h1 { font-family: var(--f-serif); font-size: clamp(22px, 3vw, 30px); letter-spacing: .06em; }
.cats-hero p { margin: 11px 0 0; font-size: 13.5px; color: var(--text-3); }

.cat-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cat-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  transition: transform .26s var(--ease), box-shadow .26s var(--ease), border-color .2s;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.cat-empty { opacity: .55; }

/* 四张封面斜着叠出一个书堆 */
.cat-covers {
  position: relative; height: 108px; overflow: hidden;
  background: linear-gradient(140deg, hsl(var(--h) 30% 52% / .22), hsl(calc(var(--h) + 36) 26% 42% / .12));
}
.cat-cv {
  position: absolute; bottom: -14px; width: 58px; aspect-ratio: 3/4;
  border-radius: 3px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,.18);
  transition: transform .3s var(--ease);
}
.cat-cv img { width: 100%; height: 100%; object-fit: cover; }
.cat-cv em {
  width: 100%; height: 100%; display: grid; place-items: center; font-style: normal;
  font-family: var(--f-serif); font-size: 13px; color: #fff; text-align: center; line-height: 1.2;
  background: linear-gradient(150deg, hsl(var(--gh) 30% 44%), hsl(calc(var(--gh) + 28) 32% 32%));
}
.cv-0 { left: 16px;  transform: rotate(-8deg); z-index: 1; }
.cv-1 { left: 68px;  transform: rotate(-3deg); z-index: 2; }
.cv-2 { left: 120px; transform: rotate(3deg);  z-index: 3; }
.cv-3 { left: 172px; transform: rotate(8deg);  z-index: 4; }
.cat-card:hover .cv-0 { transform: rotate(-12deg) translateY(-6px); }
.cat-card:hover .cv-1 { transform: rotate(-4deg) translateY(-9px); }
.cat-card:hover .cv-2 { transform: rotate(4deg)  translateY(-9px); }
.cat-card:hover .cv-3 { transform: rotate(12deg) translateY(-6px); }

.cat-meta { padding: 15px 17px 17px; }
.cat-meta h3 { font-family: var(--f-serif); font-size: 16px; letter-spacing: .04em; display: flex; align-items: center; gap: 7px; }
.cat-card:hover .cat-meta h3 { color: var(--accent); }
.cat-ico { font-size: 17px; line-height: 1; }
.cat-intro {
  margin: 7px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-n { margin: 9px 0 0; font-size: 11.5px; color: var(--text-3); }

.cat-hero {
  padding: 26px 0 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, hsl(var(--h) 30% 52% / .10), transparent);
}
.cat-hero h1 { font-family: var(--f-serif); font-size: clamp(22px, 3vw, 30px); letter-spacing: .05em; display: flex; align-items: center; gap: 10px; }
.cat-hero-intro { margin: 11px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--text-2); max-width: 44em; }
.cat-hero-n { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.cat-switch { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 作者页 ---------- */
.author-hero {
  padding: 38px 0 32px; border-bottom: 1px solid var(--line);
  background: radial-gradient(700px 260px at 20% -20%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.author-hero-in { display: flex; align-items: center; gap: 22px; }
.author-avatar {
  width: 70px; height: 70px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--f-serif);
  font-size: 28px; font-weight: 700; color: #fff;
  background: hsl(var(--hue) 40% 44%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), var(--shadow-1);
}
.author-hero h1 { font-family: var(--f-serif); font-size: clamp(21px, 2.8vw, 28px); letter-spacing: .04em; }
.author-stats { margin-top: 11px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.author-stats b { color: var(--text); font-family: var(--f-serif); font-size: 15px; margin-right: 3px; }
.author-hero-bio {
  margin: 10px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--text-2); max-width: 46em;
}

/* 作品页的信息表 */
.info-dl { margin: 0; font-size: 13px; line-height: 2.05; color: var(--text-2); }
.info-dl > div { display: flex; justify-content: space-between; gap: 14px; }
.info-dl dt { flex-shrink: 0; }
.info-dl dd { margin: 0; color: var(--text); text-align: right; min-width: 0; }
.info-dl dd a:hover { color: var(--accent); }

/* 作品页的作者卡 */
.author-head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.author-mini {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  font-family: var(--f-serif); font-size: 16px; font-weight: 700;
  background: hsl(var(--hue) 40% 45%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.author-head strong { display: block; font-size: 13.5px; }
.author-head em { display: block; font-style: normal; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.author-card:hover .author-head em { color: var(--accent); }
.author-bio { margin: 0; font-size: 12.5px; line-height: 1.85; color: var(--text-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 15px; border: 1px solid transparent;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background-color .18s, border-color .18s, color .18s, transform .12s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); background: var(--surface-2); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-soft:hover { background: var(--line); }
.btn-lg { height: 40px; padding: 0 22px; font-size: 14px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- 用户菜单 ---------- */
.usermenu { position: relative; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: #fff; background: hsl(var(--hue) 42% 44%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  transition: transform .15s var(--ease);
}
.avatar:hover { transform: scale(1.06); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 9px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 5px; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97);
  transform-origin: top right; transition: all .18s var(--ease);
}
.usermenu.open .dropdown { opacity: 1; visibility: visible; transform: none; }
.dd-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-head strong { display: block; font-size: 13.5px; }
.dd-head span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown a {
  display: block; padding: 8px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2); transition: background-color .15s, color .15s;
}
.dropdown a:hover { background: var(--surface-2); color: var(--text); }
.dd-admin { color: var(--gold) !important; font-weight: 600; }
.dd-danger:hover { color: var(--accent) !important; }

/* ===========================================================
   通用组件
   =========================================================== */
.section { margin: 46px 0; }
.section-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px;
  padding-bottom: 11px; border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-family: var(--f-serif); font-size: 19px; letter-spacing: .04em;
  display: flex; align-items: center; gap: 9px;
}
.section-head h2::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px;
  background: var(--accent);
}
.section-head .sub { font-size: 12.5px; color: var(--text-3); }
.section-head .more { margin-left: auto; font-size: 13px; color: var(--text-2); }
.section-head .more:hover { color: var(--accent); }

.tagpill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  background: var(--surface-2); border-radius: 999px;
  font-size: 11.5px; color: var(--text-2); white-space: nowrap;
  transition: background-color .15s, color .15s;
}
a.tagpill:hover { background: var(--accent-soft); color: var(--accent); }
.tagpill.on { background: var(--accent); color: var(--accent-text); }

.badge {
  display: inline-flex; align-items: center; height: 19px; padding: 0 7px;
  border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.badge-ongoing  { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge-finished { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.badge-draft    { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.meta-dot { color: var(--text-3); margin: 0 6px; }

/* ---------- 书籍封面 ---------- */
.cover {
  position: relative; aspect-ratio: 3/4; border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface-2); flex-shrink: 0;
  box-shadow: var(--shadow-1);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
/* 无封面时用书名生成一张，配色由 --h 决定 */
.cover-gen {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 12% 10%;
  background:
    linear-gradient(150deg, hsl(var(--h) 30% 42%), hsl(calc(var(--h) + 28) 34% 30%));
  color: rgba(255,255,255,.96);
  font-family: var(--f-serif); font-weight: 700; text-align: center;
  line-height: 1.25; letter-spacing: .04em;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.cover-gen span {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* 书脊高光 */
.cover::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%;
  background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(255,255,255,.09) 60%, transparent);
  pointer-events: none;
}

/* ---------- 书卡（网格） ---------- */
.grid-books {
  display: grid; gap: 24px 20px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.bookcard-wrap { display: flex; flex-direction: column; min-width: 0; }
.bookcard { display: block; }

/* 最新章节行 —— 让读者一眼看出更没更，同时是一条带锚文本的内链 */
.bc-latest {
  margin-top: 7px; display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3); min-width: 0;
  transition: color .16s;
}
.bc-latest:hover { color: var(--accent); }
.bcl-tag {
  flex-shrink: 0; padding: 1px 5px; border-radius: 3px;
  background: var(--surface-2); color: var(--text-3);
  font-size: 10px; letter-spacing: .04em;
}
.bc-latest:hover .bcl-tag { background: var(--accent-soft); color: var(--accent); }
.bcl-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookcard .cover { transition: transform .28s var(--ease), box-shadow .28s var(--ease); }
.bookcard:hover .cover { transform: translateY(-5px); box-shadow: var(--shadow-2); }
.bookcard .bc-title {
  margin-top: 10px; font-size: 13.5px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .18s;
}
.bookcard:hover .bc-title { color: var(--accent); }
.bookcard .bc-meta {
  margin-top: 3px; font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 5px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.bookcard .bc-stats { margin-top: 5px; display: flex; gap: 10px; font-size: 11px; color: var(--text-3); }
.bookcard .bc-stats span { display: inline-flex; align-items: center; gap: 3px; }
.bookcard .bc-stats svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- 书条（列表） ---------- */
.booklist { display: flex; flex-direction: column; }
.bookrow {
  display: flex; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--line);
  transition: background-color .18s;
}
.bookrow:last-child { border-bottom: 0; }
.bookrow .cover { width: 72px; }
.bookrow-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bookrow-title { font-size: 15px; font-weight: 700; transition: color .18s; }
.bookrow:hover .bookrow-title { color: var(--accent); }
.bookrow-meta { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.bookrow-intro {
  margin-top: 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bookrow-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===========================================================
   首页
   =========================================================== */
.hero {
  padding: 52px 0 42px; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 340px at 12% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    radial-gradient(700px 300px at 88% -20%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%);
}
.hero-in { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gut); }
.hero-copy { min-width: 0; }

/* 宽屏时 hero 右侧本来是一片空地，放常用入口正好 */
.hero-side { display: none; }
@media (min-width: 1100px) {
  .hero-in { display: flex; align-items: flex-start; gap: 46px; }
  .hero-copy { flex: 1; }
  .hero-side {
    display: block; width: 300px; flex-shrink: 0; margin-top: 6px;
    padding: 16px 17px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
    background: color-mix(in srgb, var(--surface) 65%, transparent);
  }
  .hs-head {
    display: flex; align-items: baseline; gap: 10px;
    padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
  }
  .hs-head h2 { font-family: var(--f-serif); font-size: 15px; letter-spacing: .04em; }
  .hs-head a { margin-left: auto; font-size: 12px; color: var(--text-3); }
  .hs-head a:hover { color: var(--accent); }
  .hs-links { margin-top: 14px; display: flex; gap: 14px; }
  .hs-links a { font-size: 12.5px; color: var(--text-2); }
  .hs-links a:hover { color: var(--accent); }
}
@media (min-width: 1400px) { .hero-side { width: 340px; } }
.hero h1 {
  font-family: var(--f-serif); font-size: clamp(28px, 4.2vw, 42px);
  letter-spacing: .04em; line-height: 1.28;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 14px 0 0; font-size: 15px; color: var(--text-2); max-width: 46em; line-height: 1.85; }
.hero-stats { margin-top: 26px; display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stat b {
  display: block; font-family: var(--f-serif); font-size: 26px; font-weight: 700;
  letter-spacing: .02em; line-height: 1.2;
}
.hero-stat span { font-size: 12px; color: var(--text-3); letter-spacing: .06em; }

/* ===========================================================
   广告位 —— 只占两侧富余空白，绝不压正文
   =========================================================== */
.ad-rail {
  position: fixed; top: 96px; width: 160px; z-index: 40;
  display: none;                       /* 默认不出现，够宽才放出来 */
}
.ad-rail-l { left: max(12px, calc((100vw - var(--shell)) / 2 - 176px)); }
.ad-rail-r { right: max(12px, calc((100vw - var(--shell)) / 2 - 176px)); }

/* 内容区最宽 1300（见「宽屏」一节）+ 两侧各需 176 的余量 → 1660 起才显示 */
@media (min-width: 1660px) { .ad-rail { display: block; } }
/* 阅读页更保守：正文宽度可调，两侧还有翻页热区，再宽一点才放 */
@media (max-width: 1700px) { body.reader-mode .ad-rail { display: none; } }

.ad {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-2);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
a.ad:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); transform: translateY(-2px); }
.ad img { width: 100%; height: auto; display: block; }
.ad-text { padding: 15px 14px 16px; }
.ad-t { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.45; }
.ad-b { display: block; margin-top: 6px; font-size: 12px; line-height: 1.65; color: var(--text-3); }
.ad-cap { display: block; padding: 9px 11px; font-size: 12px; line-height: 1.5; }
.ad-html { padding: 0; }

/* 「广告」角标：明确标注，不欺骗读者 */
.ad-flag {
  position: absolute; right: 5px; bottom: 5px;
  padding: 1px 6px; border-radius: 3px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--text-3); font-size: 9.5px; letter-spacing: .06em;
  backdrop-filter: blur(4px); pointer-events: none;
}

/* 作品页侧栏 / 列表内嵌的广告，跟着内容流走 */
.ad-inline { margin: 18px 0; }
.ad-inline .ad { max-width: 100%; }

/* ---------- 首页编辑推荐（封面主视觉） ---------- */
.feature-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: stretch; }

.feat-lead {
  position: relative; display: flex; gap: 22px; align-items: center;
  padding: 26px 28px; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.feat-lead:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

/* 封面放大模糊铺底，做出杂志封面的氛围 */
.feat-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--h) 26% 52% / .16), hsl(calc(var(--h) + 40) 24% 40% / .10)); }
.feat-blur {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(34px) saturate(1.5); transform: scale(1.25); opacity: .34;
}
.feat-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--surface) 22%, color-mix(in srgb, var(--surface) 62%, transparent) 100%);
}
.feat-lead > *:not(.feat-bg) { position: relative; z-index: 1; }

.feat-cover { width: 132px; flex-shrink: 0; box-shadow: var(--shadow-2); }
.feat-info { flex: 1; min-width: 0; }
.feat-tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
}
.feat-info h3 {
  margin: 12px 0 5px; font-family: var(--f-serif);
  font-size: clamp(19px, 2.2vw, 25px); letter-spacing: .03em; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feat-lead:hover .feat-info h3 { color: var(--accent); }
.feat-by { margin: 0; font-size: 12.5px; color: var(--text-2); }
.feat-intro {
  margin: 11px 0 0; font-size: 13px; line-height: 1.75; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feat-stats { margin-top: 14px; display: flex; gap: 16px; font-size: 11.5px; color: var(--text-3); }
.feat-stats span { position: relative; }
.feat-stats span + span::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 1px; height: 10px;
  transform: translateY(-50%); background: var(--line-2);
}

.feat-side { display: grid; grid-template-rows: repeat(4, 1fr); gap: 10px; }
.feat-mini {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color .2s, background-color .2s, transform .2s var(--ease);
}
.feat-mini:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateX(3px); }
.feat-mini .cover { width: 40px; }
.feat-mini-body { flex: 1; min-width: 0; }
.feat-mini h4 { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feat-mini:hover h4 { color: var(--accent); }
.feat-mini p { margin: 2px 0 0; font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feat-mini-n { font-size: 10.5px; color: var(--text-3); font-family: var(--f-mono); flex-shrink: 0; }

/* 继续阅读 */
.resume-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.resume-card {
  display: flex; gap: 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.resume-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); transform: translateY(-2px); }
.resume-card .cover { width: 46px; }
.resume-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.resume-body h4 { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-body p {
  margin: 4px 0 7px; font-size: 11.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pbar { height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* 排行榜 */
.rank-wrap { display: grid; gap: 26px; grid-template-columns: 1fr 320px; align-items: start; }
.ranklist { display: flex; flex-direction: column; gap: 2px; }
.rankrow {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: var(--r-sm); transition: background-color .18s;
}
.rankrow:hover { background: var(--surface-2); }
.rank-no {
  width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 12px; font-weight: 700;
  color: var(--text-3); border-radius: 5px; background: var(--surface-2);
}
.rankrow:nth-child(1) .rank-no { background: var(--accent); color: var(--accent-text); }
.rankrow:nth-child(2) .rank-no { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); color: var(--accent-text); }
.rankrow:nth-child(3) .rank-no { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); color: var(--text); }
.rank-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankrow:hover .rank-title { color: var(--accent); }
.rank-heat {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3);
}
.rank-heat svg { width: 11px; height: 11px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
/* 热度条：宽度由内联 --pct 决定 */
.rank-bar { height: 2px; background: var(--surface-2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; width: var(--pct); background: linear-gradient(90deg, var(--accent), var(--gold)); }

.side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
}
.side-card h3 {
  font-family: var(--f-serif); font-size: 15px; letter-spacing: .04em;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===========================================================
   书库
   =========================================================== */
.lib-layout { display: grid; grid-template-columns: 196px 1fr; gap: 32px; align-items: start; padding: 32px 0 60px; }
.lib-side { position: sticky; top: 82px; }
.filter-group { margin-bottom: 24px; }
.filter-group h4 {
  font-size: 11.5px; letter-spacing: .1em; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 9px;
}
.filter-links { display: flex; flex-direction: column; gap: 1px; }
.filter-links a {
  padding: 6px 10px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between;
  transition: background-color .16s, color .16s;
}
.filter-links a:hover { background: var(--surface-2); color: var(--text); }
.filter-links a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.filter-links a em { font-style: normal; font-size: 11px; color: var(--text-3); }

.lib-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.lib-head h1 { font-family: var(--f-serif); font-size: 22px; letter-spacing: .04em; }
.lib-count { font-size: 12.5px; color: var(--text-3); }
.sorttabs { margin-left: auto; display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: var(--r-sm); }
.sorttabs a {
  padding: 5px 12px; border-radius: 5px; font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; flex-shrink: 0;      /* 窄屏里宁可横向滚，也不折成两行 */
  transition: background-color .18s, color .18s;
}
.sorttabs a:hover { color: var(--text); }
.sorttabs a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

/* 搜索：作品 / 正文 两个 tab */
.searchtabs { display: flex; gap: 4px; }
.searchtabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2);
  transition: background-color .16s, color .16s;
}
.searchtabs a:hover { background: var(--surface-2); color: var(--text); }
.searchtabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.searchtabs a span {
  font-family: var(--f-mono); font-size: 11px; color: var(--text-3);
  padding: 1px 5px; border-radius: 3px; background: var(--surface-2);
}
.searchtabs a.on span { background: var(--accent); color: var(--accent-text); }

/* 正文命中：书名 + 章节 + 高亮片段 */
.hitlist { display: flex; flex-direction: column; }
.hit {
  padding: 15px 2px; border-bottom: 1px solid var(--line);
  transition: background-color .16s;
}
.hit:last-child { border-bottom: 0; }
.hit-head {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  font-size: 13.5px; margin-bottom: 7px;
}
.hit-book { font-weight: 700; }
.hit:hover .hit-book { color: var(--accent); }
.hit-ch { color: var(--text-2); }
.hit-author { margin-left: auto; font-size: 12px; color: var(--text-3); }
.hit-snip {
  margin: 0; font-size: 13.5px; line-height: 1.85; color: var(--text-2);
  font-family: var(--f-read);
}
.hit-snip mark {
  background: color-mix(in srgb, var(--gold) 30%, transparent);
  color: var(--text); border-radius: 2px; padding: 0 1px;
}

/* 分页 */
.pager { display: flex; justify-content: center; align-items: center; gap: 5px; margin-top: 40px; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px; display: inline-grid; place-items: center;
  border-radius: var(--r-sm); font-size: 13px; color: var(--text-2);
  border: 1px solid transparent; transition: all .16s;
}
.pager a:hover { background: var(--surface-2); color: var(--text); }
.pager .on { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.pager .gap { color: var(--text-3); }

/* 空状态 */
.empty { padding: 70px 20px; text-align: center; }
.empty svg { width: 46px; height: 46px; margin: 0 auto 16px; fill: none; stroke: var(--text-3); stroke-width: 1.3; opacity: .7; }
.empty h3 { font-size: 16px; margin-bottom: 7px; }
.empty p { font-size: 13.5px; color: var(--text-3); margin: 0 0 18px; }

/* ===========================================================
   书详情
   =========================================================== */
.book-hero { padding: 36px 0 30px; border-bottom: 1px solid var(--line); }
.book-hero-in { display: flex; gap: 30px; align-items: flex-start; }
.book-hero .cover { width: 168px; box-shadow: var(--shadow-2); }
.book-info { flex: 1; min-width: 0; }
.book-info h1 { font-family: var(--f-serif); font-size: clamp(23px, 3vw, 31px); letter-spacing: .03em; }
.book-byline { margin-top: 9px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.book-byline a:hover { color: var(--accent); }
.book-stats { margin-top: 20px; display: flex; gap: 30px; flex-wrap: wrap; }
.book-stat b { display: block; font-family: var(--f-serif); font-size: 20px; line-height: 1.25; }
.book-stat span { font-size: 11.5px; color: var(--text-3); letter-spacing: .05em; }
.book-tags { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.book-actions { margin-top: 22px; display: flex; gap: 9px; flex-wrap: wrap; }

.act-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 15px;
  border: 1px solid var(--line-2); background: transparent; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: all .18s;
}
.act-btn:hover { border-color: var(--text-3); color: var(--text); }
.act-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.act-btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.act-btn.on svg { fill: var(--accent); }
.act-btn .cnt { font-family: var(--f-mono); font-size: 12px; }
@keyframes pop { 50% { transform: scale(1.22); } }
.act-btn.bump svg { animation: pop .32s var(--ease); }

.book-body { padding: 30px 0 60px; display: grid; grid-template-columns: 1fr 300px; gap: 34px; align-items: start; }
.book-intro { font-size: 14px; line-height: 1.95; color: var(--text-2); white-space: pre-wrap; }
.book-intro p { margin: 0 0 .85em; }

/* 目录 */
.toc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.toc-head h2 { font-family: var(--f-serif); font-size: 17px; letter-spacing: .04em; }
.toc-head .toc-n { font-size: 12.5px; color: var(--text-3); }
.toc-head .toc-sort { margin-left: auto; }
.toc {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1px 16px;
}
.toc a {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 9px;
  border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2);
  overflow: hidden; transition: background-color .15s, color .15s;
}
.toc a:hover { background: var(--surface-2); color: var(--accent); }
.toc a.read { color: var(--text-3); }
.toc a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc .ci { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.toc .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===========================================================
   阅读页
   =========================================================== */
.page-read .footer { display: none; }
.reader-top {
  padding: 26px 0 0;
}
.reader-crumb {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3);
  margin-bottom: 20px;
}
.reader-crumb a:hover { color: var(--accent); }

.reader {
  max-width: var(--reader-width); margin: 0 auto; padding: 0 24px 40px;
}
.reader h1 {
  font-family: var(--f-read); font-size: clamp(21px, 2.6vw, 27px);
  letter-spacing: .03em; line-height: 1.45; text-align: center;
  padding-bottom: 22px; margin-bottom: 8px;
}
.reader-sub {
  text-align: center; font-size: 12px; color: var(--text-3);
  padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--line);
}
.reader-body {
  font-family: var(--f-read);
  font-size: var(--reader-size);
  line-height: var(--reader-leading);
  letter-spacing: .015em;
  color: var(--text);
  word-break: break-word;
  hanging-punctuation: allow-end;
}
.reader-body p { margin: 0 0 var(--reader-para); }
html[data-indent="1"] .reader-body p { text-indent: 2em; }

.reader-nav {
  max-width: var(--reader-width); margin: 0 auto; padding: 34px 24px 20px;
  display: flex; align-items: center; gap: 12px;
}
.reader-nav .btn { flex: 1; height: 44px; }
.reader-nav .rn-mid { flex: 0 0 auto; }

.reader-like { text-align: center; padding: 26px 0 6px; }
.like-big {
  display: inline-flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 26px; border: 1px solid var(--line-2); background: transparent;
  border-radius: var(--r-lg); cursor: pointer; color: var(--text-2); transition: all .2s;
}
.like-big:hover { border-color: var(--accent); color: var(--accent); }
.like-big.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.like-big svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.like-big.on svg { fill: var(--accent); }
.like-big span { font-size: 12px; font-family: var(--f-mono); }

/* 正文防复制（后台开关控制，默认关） */
html[data-noselect="1"] .reader-body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}

/* 试读到期的门禁卡片 */
.gate-ico {
  width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft);
}
.gate-ico svg {
  width: 25px; height: 25px; fill: none; stroke: var(--accent);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* 左右翻页热区 —— 贴在正文两侧的空白里，不遮挡文字 */
.turn-zone {
  position: fixed; top: 62px; bottom: 0; width: calc((100vw - var(--reader-width)) / 2 - 20px);
  max-width: 210px; min-width: 60px;
  display: none; align-items: center; z-index: 60;
  color: var(--text-3); opacity: 0; transition: opacity .2s, color .2s;
  text-decoration: none; user-select: none;
}
html[data-zones="1"] .turn-zone { display: flex; }
.turn-prev { left: 0;  justify-content: flex-start; padding-left: 22px; }
.turn-next { right: 0; justify-content: flex-end;  padding-right: 22px; }
.turn-zone span { font-size: 34px; line-height: 1; font-family: var(--f-serif); }
.turn-zone:hover { opacity: 1; color: var(--accent); }
/* 窄屏没有富余留白，直接关掉，避免盖住正文 */
@media (max-width: 1100px) { html[data-zones="1"] .turn-zone { display: none; } }

/* 自动滚动中：光标提示 + 按钮切图标 */
body.auto-scrolling { cursor: progress; }
#dock-auto .i-pause { display: none; }
body.auto-scrolling #dock-auto .i-play  { display: none; }
body.auto-scrolling #dock-auto .i-pause { display: block; }
body.auto-scrolling #dock-auto { color: var(--accent); border-color: var(--accent); }

/* 「上次读到 N%」的恢复提示 */
.resume-tip {
  position: fixed; left: 50%; bottom: 26px; z-index: 85;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); font-size: 13px; color: var(--text-2);
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.resume-tip.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.resume-tip .rt-go {
  height: 27px; padding: 0 13px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-size: 12.5px; font-weight: 700;
}
.resume-tip .rt-go:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.resume-tip .rt-x {
  width: 22px; height: 22px; border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 17px; line-height: 1; border-radius: 50%;
}
.resume-tip .rt-x:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 860px) { .resume-tip { bottom: calc(66px + env(safe-area-inset-bottom)); } }

/* 阅读进度条（顶部细线） */
#read-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 95; transition: width .1s linear;
}

/* 悬浮工具条 */
.reader-dock {
  position: fixed; right: 22px; bottom: 26px; z-index: 80;
  display: flex; flex-direction: column; gap: 7px;
  opacity: 1; transition: opacity .3s, transform .3s var(--ease);
}
.reader-dock.hide { opacity: 0; transform: translateX(14px); pointer-events: none; }
.dock-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 50%; cursor: pointer; color: var(--text-2);
  box-shadow: var(--shadow-1); transition: all .18s;
}
.dock-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.dock-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* 章节抽屉 */
.toc-drawer {
  position: fixed; inset: 0 auto 0 0; width: 340px; max-width: 86vw; z-index: 120;
  background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .3s var(--ease);
}
.toc-drawer.open { transform: none; }
.toc-drawer-head {
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.toc-drawer-head h3 { font-family: var(--f-serif); font-size: 16px; flex: 1; }
.toc-drawer-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.toc-drawer-list a {
  display: flex; gap: 9px; padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2); transition: background-color .15s, color .15s;
}
.toc-drawer-list a:hover { background: var(--surface-2); }
.toc-drawer-list a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ===========================================================
   评论
   =========================================================== */
.comments { padding-top: 34px; }
.cmt-form { display: flex; gap: 11px; margin-bottom: 26px; }
.cmt-form .avatar { flex-shrink: 0; cursor: default; }
.cmt-form-body { flex: 1; min-width: 0; }
.cmt-input {
  width: 100%; min-height: 82px; padding: 11px 13px; resize: vertical;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.7; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.cmt-input:focus { border-color: var(--line-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.cmt-input::placeholder { color: var(--text-3); }
.cmt-form-foot { margin-top: 9px; display: flex; align-items: center; gap: 11px; }
.cmt-count { font-size: 11.5px; color: var(--text-3); margin-left: auto; font-family: var(--f-mono); }

.cmt-login-hint {
  padding: 20px; text-align: center; background: var(--surface-2);
  border-radius: var(--r-md); font-size: 13.5px; color: var(--text-2); margin-bottom: 26px;
}
.cmt-login-hint a { color: var(--accent); font-weight: 600; }

.cmt { display: flex; gap: 11px; padding: 15px 0; border-top: 1px solid var(--line); }
.cmt:first-child { border-top: 0; }
.cmt .avatar { width: 30px; height: 30px; font-size: 12px; cursor: default; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.cmt-name { font-weight: 700; color: var(--text); }
.cmt-role { font-size: 10.5px; padding: 1px 5px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cmt-time { color: var(--text-3); }
.cmt-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.cmt-reply-to { color: var(--accent); font-weight: 600; }
.cmt-foot { margin-top: 7px; display: flex; align-items: center; gap: 14px; }
.cmt-act {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none;
  padding: 0; font-size: 12px; color: var(--text-3); cursor: pointer; transition: color .16s;
}
.cmt-act:hover { color: var(--accent); }
.cmt-act.on { color: var(--accent); }
.cmt-act svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cmt-act.on svg { fill: var(--accent); }
.cmt-replies { margin-top: 11px; padding-left: 13px; border-left: 2px solid var(--line); }
.cmt-replies .cmt { padding: 10px 0; border-top: 0; }

/* ===========================================================
   认证页
   =========================================================== */
.page-auth .footer { display: none; }
.auth-wrap {
  min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 40px 24px 70px;
}
.auth-card {
  width: 100%; max-width: 388px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 34px 32px; box-shadow: var(--shadow-2);
}
.auth-card h1 {
  font-family: var(--f-serif); font-size: 22px; letter-spacing: .05em; text-align: center;
}
.auth-card > p.sub { margin: 9px 0 26px; text-align: center; font-size: 13px; color: var(--text-3); }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; height: 40px; padding: 0 13px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 13px; resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.field .hint { margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.field-row { display: flex; gap: 9px; }
.field-row input { flex: 1; }
.code-btn { flex-shrink: 0; width: 116px; }

.auth-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.auth-foot a { color: var(--accent); font-weight: 600; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; font-size: 12.5px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 14px; height: 14px; accent-color: var(--accent); }

/* ===========================================================
   我的
   =========================================================== */
.me-layout { display: grid; grid-template-columns: 190px 1fr; gap: 32px; padding: 32px 0 60px; align-items: start; }
.me-side { position: sticky; top: 82px; }
.me-user { display: flex; align-items: center; gap: 11px; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.me-user .avatar { width: 40px; height: 40px; font-size: 16px; cursor: default; }
.me-user h3 { font-size: 14px; }
.me-user span { font-size: 11px; color: var(--text-3); }
.me-tabs { display: flex; flex-direction: column; gap: 1px; }
.me-tabs a {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2);
  transition: background-color .16s, color .16s;
}
.me-tabs a:hover { background: var(--surface-2); color: var(--text); }
.me-tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.me-tabs svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 22px;
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 15px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.histrow {
  display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.histrow:last-child { border-bottom: 0; }
.histrow .cover { width: 42px; }
.histrow-body { flex: 1; min-width: 0; }
.histrow h4 { font-size: 13.5px; }
.histrow p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-3); }

/* ===========================================================
   外观设置面板
   =========================================================== */
.prefs-backdrop {
  position: fixed; inset: 0; z-index: 130; background: rgba(0,0,0,.28);
  backdrop-filter: blur(2px); animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.prefs {
  position: fixed; top: 0; right: 0; bottom: 0; width: 328px; max-width: 90vw; z-index: 140;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3); padding: 20px; overflow-y: auto;
  animation: slidein .28s var(--ease);
}
@keyframes slidein { from { transform: translateX(100%); } }
.prefs-head { display: flex; align-items: center; margin-bottom: 22px; }
.prefs-head h3 { font-family: var(--f-serif); font-size: 17px; letter-spacing: .05em; flex: 1; }
.prefs-group { margin-bottom: 22px; }
.prefs-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 9px;
}
.prefs-label output { font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3); font-weight: 400; }

.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sw {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 9px 4px; border: 1.5px solid var(--line); background: transparent;
  border-radius: var(--r-md); cursor: pointer; transition: border-color .18s, transform .15s;
}
.sw:hover { transform: translateY(-2px); }
.sw.on { border-color: var(--accent); }
.sw i { width: 100%; height: 26px; border-radius: 5px; border: 1px solid rgba(0,0,0,.09); }
.sw span { font-size: 11px; color: var(--text-2); }
.sw-paper  i { background: linear-gradient(135deg,#fdfbf5,#efe8d9); }
.sw-sepia  i { background: linear-gradient(135deg,#f6eddb,#e2d2b2); }
.sw-mint   i { background: linear-gradient(135deg,#eff7f0,#cfe2d3); }
.sw-dark   i { background: linear-gradient(135deg,#26241f,#131210); }
.sw-oled   i { background: linear-gradient(135deg,#141414,#000); }
.sw-auto   i { background: linear-gradient(135deg,#fdfbf5 50%,#1a1815 50%); }

.fontpick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.fontpick button {
  padding: 11px 6px; border: 1.5px solid var(--line); background: transparent;
  border-radius: var(--r-md); cursor: pointer; font-size: 15px; color: var(--text-2);
  transition: border-color .18s, color .18s;
}
.fontpick button:hover { color: var(--text); }
.fontpick button.on { border-color: var(--accent); color: var(--accent); }

.prefs input[type="range"] {
  width: 100%; height: 4px; appearance: none; -webkit-appearance: none;
  background: var(--surface-2); border-radius: 3px; outline: none;
}
.prefs input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform .15s;
}
.prefs input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.16); }
.prefs input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; background: var(--accent); border: 0; border-radius: 50%; cursor: pointer;
}

.prefs-tip { margin-top: 7px; font-size: 11.5px; color: var(--text-3); }
.prefs-tip kbd, .prefs-keys kbd {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--text-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: var(--bg);
}
.prefs-keys { border-top: 1px solid var(--line); padding-top: 16px; }
.prefs-keys dl { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.prefs-keys dl > div { display: flex; align-items: center; gap: 9px; }
.prefs-keys dt { display: flex; gap: 3px; flex-shrink: 0; min-width: 62px; margin: 0; }
.prefs-keys dd { margin: 0; font-size: 12px; color: var(--text-3); }

.prefs-toggles { display: flex; flex-direction: column; gap: 12px; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch input { display: none; }
.switch span {
  width: 34px; height: 19px; border-radius: 999px; background: var(--line-2);
  position: relative; flex-shrink: 0; transition: background-color .22s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  background: #fff; border-radius: 50%; transition: transform .22s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }
.prefs-reset { width: 100%; }

/* ===========================================================
   Toast
   =========================================================== */
.toast-wrap {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 17px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-2);
  animation: toastin .3s var(--ease);
}
.toast.err { background: var(--accent); color: var(--accent-text); }
.toast.out { animation: toastout .3s var(--ease) forwards; }
@keyframes toastin  { from { opacity: 0; transform: translateY(14px) scale(.94); } }
@keyframes toastout { to  { opacity: 0; transform: translateY(-8px) scale(.96); } }

/* ---------- 错误页 ---------- */
.errpage { padding: 100px 24px 120px; text-align: center; }
.errpage .code {
  font-family: var(--f-serif); font-size: 84px; font-weight: 700;
  color: var(--accent); opacity: .22; line-height: 1;
}
.errpage h1 { font-family: var(--f-serif); font-size: 22px; margin: 14px 0 10px; letter-spacing: .04em; }
.errpage p { color: var(--text-3); font-size: 13.5px; margin: 0 0 26px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--bg-2); }
.footer-in { max-width: var(--shell); margin: 0 auto; padding: 34px var(--gut) 40px; }
.footer-brand { display: flex; align-items: baseline; gap: 11px; }
.footer-brand strong { font-family: var(--f-serif); font-size: 15px; letter-spacing: .06em; }
.footer-brand span { font-size: 12.5px; color: var(--text-3); }
.footer-links { margin-top: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { font-size: 12.5px; color: var(--text-2); }
.footer-links a:hover { color: var(--accent); }
.footer-note { margin: 18px 0 0; font-size: 11.5px; color: var(--text-3); }

/* ===========================================================
   PJAX 页面切换动画
   =========================================================== */
@keyframes pagein { from { opacity: 0; transform: translateY(8px); } }
#pjax-root.swapping { animation: pagein .26s var(--ease); }

/* ===========================================================
   文档页（关于 / 版权声明）
   =========================================================== */
.doc-page { padding: 36px 24px 70px; }
.doc-page h1 {
  font-family: var(--f-serif); font-size: clamp(24px, 3vw, 30px); letter-spacing: .04em;
}
.doc-lead {
  margin: 14px 0 0; font-size: 15px; line-height: 1.9; color: var(--text-2);
}
.doc-page h2 {
  font-family: var(--f-serif); font-size: 18px; letter-spacing: .04em;
  margin: 38px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.doc-page p  { margin: 0 0 14px; font-size: 14.5px; line-height: 1.95; color: var(--text-2); }
.doc-page ul, .doc-page ol { margin: 0 0 16px; padding-left: 22px; }
.doc-page li {
  margin-bottom: 8px; font-size: 14.5px; line-height: 1.9; color: var(--text-2);
}
.doc-page li::marker { color: var(--text-3); }
.doc-page a { color: var(--accent); }
.doc-page a:hover { text-decoration: underline; }
.doc-page strong { color: var(--text); font-weight: 700; }

.doc-figures {
  margin: 26px 0 4px; display: flex; gap: 34px; flex-wrap: wrap;
  padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.doc-fig b {
  display: block; font-family: var(--f-serif); font-size: 22px; font-weight: 700; line-height: 1.25;
}
.doc-fig span { font-size: 11.5px; color: var(--text-3); letter-spacing: .05em; }

/* 投诉入口做成一块高亮区，别埋在正文里 */
.doc-callout {
  margin: 26px 0; padding: 20px 22px;
  border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); background: var(--surface);
}
.doc-callout h3 {
  font-family: var(--f-serif); font-size: 16px; letter-spacing: .04em; margin-bottom: 10px;
}
.doc-callout p { margin-bottom: 8px; }
.doc-callout .doc-note { margin: 0; font-size: 12.5px; color: var(--text-3); line-height: 1.8; }

.doc-links {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; gap: 22px; flex-wrap: wrap;
}
.doc-links a { font-size: 13.5px; color: var(--text-2); }
.doc-links a:hover { color: var(--accent); text-decoration: none; }

/* ===========================================================
   词条页（/tag/<词>）
   =========================================================== */
.tag-hero {
  padding: 34px 0 30px; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(760px 300px at 8% -30%, hsl(var(--h) 45% 52% / .13), transparent 68%),
    radial-gradient(520px 240px at 92% -40%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%);
}
.tag-hero h1 {
  font-family: var(--f-serif); font-size: clamp(24px, 3vw, 32px); letter-spacing: .04em;
  display: flex; align-items: baseline; gap: 6px;
}
.tag-hero .tag-hash { color: hsl(var(--h) 45% 45%); opacity: .7; }
.tag-summary { margin: 12px 0 0; font-size: 14px; line-height: 1.85; color: var(--text-2); max-width: 62em; }
.tag-figures { margin-top: 20px; display: flex; gap: 30px; flex-wrap: wrap; }
.tag-fig b {
  display: block; font-family: var(--f-serif); font-size: 21px; font-weight: 700; line-height: 1.25;
}
.tag-fig span { font-size: 11.5px; color: var(--text-3); letter-spacing: .05em; }

.tag-body { padding: 26px 0 60px; display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; }
.tag-h2 { font-family: var(--f-serif); font-size: 17px; letter-spacing: .04em; }
.side-note { margin: 12px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-3); }
.side-links { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.side-links a { font-size: 13px; color: var(--text-2); transition: color .16s; }
.side-links a:hover { color: var(--accent); }
.filter-more { display: inline-block; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.filter-more:hover { color: var(--accent); }

/* 词条索引 */
.tags-hero { padding: 34px 0 26px; border-bottom: 1px solid var(--line); }
.tags-hero h1 { font-family: var(--f-serif); font-size: clamp(24px, 3vw, 30px); letter-spacing: .04em; }
.tags-hero p { margin: 12px 0 0; font-size: 14px; line-height: 1.8; color: var(--text-2); max-width: 60em; }

.tagcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.tagcard {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 15px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: linear-gradient(150deg, hsl(var(--h) 40% 50% / .08), transparent 62%), var(--surface);
  transition: border-color .18s, transform .2s var(--ease), box-shadow .2s;
}
.tagcard:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.tc-name { font-weight: 700; letter-spacing: .02em; }
.tagcard:hover .tc-name { color: var(--accent); }
.tc-n { font-size: 11.5px; color: var(--text-3); font-family: var(--f-mono); }

/* 词条云：冷热靠颜色权重区分，不动字号 */
.tagcloud .tagpill.lv3 { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tagcloud .tagpill.lv2 { border-color: var(--line-2); color: var(--text); }
.tagcloud .tagpill.lv1 { color: var(--text-3); }

/* ===========================================================
   阅读页桌面常驻章节栏 —— 宽屏才出现，窄屏仍用抽屉
   =========================================================== */
.reader-rail { display: none; }

@media (min-width: 1280px) {
  body.reader-mode #pjax-root,
  body.reader-mode .reader-nav { padding-left: var(--rail-w, 268px); transition: padding-left .28s var(--ease); }
  html[data-rail="0"] body.reader-mode #pjax-root,
  html[data-rail="0"] body.reader-mode .reader-nav { padding-left: 0; }

  .reader-rail {
    position: fixed; left: 0; top: var(--rail-top, 62px); bottom: 0;
    width: var(--rail-w, 268px); z-index: 70;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 70%, var(--surface));
    transition: transform .28s var(--ease), top .2s var(--ease);
  }
  html[data-rail="0"] .reader-rail { transform: translateX(calc(-1 * var(--rail-w, 268px))); }

  /* 收起后留一个贴边的把手，随时能叫回来 */
  .rail-handle {
    position: fixed; left: 0; top: 50%; z-index: 71; transform: translateY(-50%);
    width: 20px; height: 62px; display: none; place-items: center; cursor: pointer;
    border: 1px solid var(--line); border-left: 0;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--surface); color: var(--text-3);
  }
  html[data-rail="0"] .rail-handle { display: grid; }
  .rail-handle:hover { color: var(--accent); border-color: var(--accent); }
  .rail-handle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

  /* 宽屏有常驻目录了，浮标上的目录按钮就是多余的 */
  html:not([data-rail="0"]) body.reader-mode #dock-toc { display: none; }
  /* 左侧空白已被章节栏占用 */
  body.reader-mode .ad-rail-l { display: none; }
  html:not([data-rail="0"]) body.reader-mode .turn-prev { display: none; }
  html:not([data-rail="0"]) body.reader-mode .turn-next {
    width: calc((100vw - var(--rail-w, 268px) - var(--reader-width)) / 2 - 20px);
  }
}

.rail-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.rail-book {
  display: flex; align-items: center; gap: 10px; color: var(--text);
}
.rail-book .cover { width: 34px; flex-shrink: 0; }
.rail-book strong {
  font-family: var(--f-serif); font-size: 14px; font-weight: 700; letter-spacing: .03em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-book:hover strong { color: var(--accent); }
.rail-meta {
  margin-top: 10px; display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-3); font-family: var(--f-mono);
}
.rail-meta .rail-bar { flex: 1; height: 2px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rail-meta .rail-bar i { display: block; height: 100%; background: var(--accent); }
.rail-collapse {
  margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; background: none; cursor: pointer; color: var(--text-3); border-radius: 4px;
}
.rail-collapse:hover { background: var(--surface-2); color: var(--text); }
.rail-collapse svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

.rail-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; scrollbar-width: thin; }
.rail-list a {
  display: flex; gap: 9px; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-2); line-height: 1.5;
  transition: background-color .14s, color .14s;
}
.rail-list a:hover { background: var(--surface-2); color: var(--text); }
.rail-list a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rail-list a.read { color: var(--text-3); }
.rail-list .ci { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.rail-list .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 窗口列表里的省略标记与「完整目录」入口 */
.rail-gap {
  padding: 6px 10px; color: var(--text-3); font-size: 12px;
  letter-spacing: .2em; text-align: center; user-select: none;
}
.rail-all {
  display: block; margin: 6px 8px 2px; padding: 8px 10px;
  border: 1px dashed var(--line-2); border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--text-3); text-align: center;
  transition: color .16s, border-color .16s;
}
.rail-all:hover { color: var(--accent); border-color: var(--accent); }

.rail-foot {
  padding: 10px 12px; border-top: 1px solid var(--line);
  display: flex; gap: 8px;
}
.rail-foot .btn { flex: 1; height: 32px; justify-content: center; }

/* ===========================================================
   宽屏 —— 桌面越宽，容器和栏位跟着放，别让 1180 卡死在中间
   =========================================================== */
@media (min-width: 1400px) {
  :root { --shell: 1300px; --gut: 28px; }
  .lib-layout  { grid-template-columns: 216px 1fr; gap: 36px; }
  .book-body   { grid-template-columns: 1fr 320px; gap: 40px; }
  .tag-body    { grid-template-columns: 1fr 300px; gap: 38px; }
  .rank-wrap   { grid-template-columns: 1fr 340px; gap: 32px; }
  .grid-books  { gap: 26px 22px; }
}
@media (min-width: 1720px) {
  :root { --shell: 1400px; }
  .book-body { grid-template-columns: 1fr 340px; }
  .toc { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* 侧栏跟着滚 —— 比视口矮时粘住，高了就自然跟随，不裁剪内容 */
@media (min-width: 1081px) {
  .book-side, .tag-side { position: sticky; top: 82px; }
}

/* 书页头部右侧的「最新章节」—— 宽屏才放，正好填上 hero 的空白 */
.book-latest { display: none; }
@media (min-width: 1200px) {
  .book-hero-in { align-items: flex-start; }
  .book-latest {
    display: block; width: 300px; flex-shrink: 0; margin-left: auto;
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    padding: 14px 15px 12px;
  }
  .bl-head {
    display: flex; align-items: baseline; gap: 8px;
    padding-bottom: 9px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
  }
  .bl-head h3 { font-family: var(--f-serif); font-size: 14px; letter-spacing: .04em; }
  .bl-head span { font-size: 11.5px; color: var(--text-3); }
  .bl-head .bl-all { margin-left: auto; font-size: 12px; color: var(--text-3); }
  .bl-head .bl-all:hover { color: var(--accent); }
  .book-latest a.bl-row {
    display: flex; align-items: center; gap: 9px; padding: 7px 8px;
    border-radius: var(--r-sm); font-size: 13px; color: var(--text-2);
    transition: background-color .15s, color .15s;
  }
  .book-latest a.bl-row:hover { background: var(--surface-2); color: var(--accent); }
  .bl-row .ci { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); flex-shrink: 0; }
  .bl-row .ct { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bl-row .cd { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
}
@media (min-width: 1400px) { .book-latest { width: 340px; } }

/* 指针设备专属：hover 反馈可以做得更明确，触摸屏一律不给 */
@media (hover: hover) and (pointer: fine) {
  .bookcard:hover .bc-title,
  .tagpill:hover { color: var(--accent); }
  .tagpill:hover { border-color: var(--accent); }
  .side-card { transition: border-color .2s; }
  .rankrow:hover .rank-no { background: var(--accent); color: var(--accent-text); }
  .filter-links a:hover { padding-left: 13px; }
  .footer-links a { transition: color .16s; }
  .footer-links a:hover { color: var(--accent); }
}

/* ===========================================================
   响应式
   =========================================================== */
@media (max-width: 1080px) {
  .tag-body { grid-template-columns: 1fr; }
  .rank-wrap { grid-template-columns: 1fr; }
  .book-body { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .wrap, .hero-in, .topbar-in, .footer-in { padding-left: 16px; padding-right: 16px; }
  .lib-layout, .me-layout { grid-template-columns: 1fr; gap: 20px; }
  .lib-side, .me-side { position: static; }
  .filter-links { flex-direction: row; flex-wrap: wrap; }
  .me-tabs { flex-direction: row; flex-wrap: wrap; }
  .nav { display: none; }
  .searchbox { max-width: none; }
  .searchwrap { max-width: none; }
  .podium { grid-template-columns: 1fr; gap: 12px; }
  .pod-1, .pod-2, .pod-3 { order: 0; }
  .podium-card { flex-direction: row; align-items: center; text-align: left; gap: 14px; padding: 14px; }
  .podium-card .cover, .pod-1 .cover { width: 56px; }
  .pod-medal { position: static; transform: none; }
  .podium-card h3 { margin-top: 0; }
  .rank-cells { display: none; }
  .author-hero-in { flex-direction: column; text-align: center; gap: 14px; }
  .author-stats { justify-content: center; }
  .announce-in { padding-left: 16px; padding-right: 16px; }
  .book-hero-in { flex-direction: column; align-items: center; text-align: center; }
  .book-hero .cover { width: 132px; }
  .book-byline, .book-stats, .book-tags, .book-actions { justify-content: center; }
  .grid-books { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 12px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feat-lead { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px; }
  .feat-cover { width: 96px; }
  .feat-side { grid-template-rows: none; }
  .toc { grid-template-columns: 1fr; }
  .reader-dock { right: 14px; bottom: 16px; }
  .reader { padding: 0 18px 30px; }
}
@media (max-width: 560px) {
  .topbar-in { height: 56px; gap: 10px; }
  .brand-text { display: none; }
  .hero { padding: 34px 0 28px; }
  .hero-stats { gap: 22px; }
  .resume-strip { grid-template-columns: 1fr; }
  .cmt-form .avatar { display: none; }
  .sorttabs { width: 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .sorttabs::-webkit-scrollbar { display: none; }
  .lib-head { flex-wrap: wrap; row-gap: 12px; }
}

/* ===========================================================
   手机端
   =========================================================== */

/* 底部导航 —— 只在窄屏出现 */
.tabbar { display: none; }

@media (max-width: 860px) {
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 88;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(1.5) blur(16px);
    -webkit-backdrop-filter: saturate(1.5) blur(16px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    transition: transform .28s var(--ease);
  }
  .tabbar.hide { transform: translateY(110%); }
  .tabbar a {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: 50px; color: var(--text-3); font-size: 10.5px;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg {
    width: 20px; height: 20px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .2s var(--ease);
  }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on svg { transform: translateY(-1px); }
  .tabbar a:active svg { transform: scale(.88); }
  .tab-dot {
    position: absolute; top: 7px; right: calc(50% - 15px);
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg);
  }

  /* 给底栏让位 */
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .footer { margin-bottom: 0; }
  .reader-dock { bottom: calc(62px + env(safe-area-inset-bottom)); }
  .toast-wrap { bottom: calc(66px + env(safe-area-inset-bottom)); }

  /* 触摸优化：去掉 hover 态残留，加大点击区 */
  .bookcard:hover .cover { transform: none; box-shadow: var(--shadow-1); }
  .bookcard:active .cover { transform: scale(.97); }
  .feat-mini:hover { transform: none; }
  .rankrow, .filter-links a, .toc a, .dropdown a { -webkit-tap-highlight-color: transparent; }
  .toc a { padding: 10px 9px; }
  .filter-links a { padding: 8px 12px; }
  .btn, .act-btn { min-height: 38px; }
  .sorttabs a { padding: 7px 14px; }

  /* 滚动性能：长列表用 content-visibility 跳过屏外渲染 */
  .bookcard, .bookrow, .cmt, .rankrow, .histrow {
    content-visibility: auto;
    contain-intrinsic-size: auto 120px;
  }

  /* 顶栏在手机上收窄，搜索框独占一行更好按 */
  .topbar-in { flex-wrap: wrap; height: auto; padding-top: 9px; padding-bottom: 9px; gap: 9px; }
  .searchwrap { order: 3; flex-basis: 100%; max-width: none; }
  .brand { margin-right: auto; }

  /* 阅读页：正文左右留白收紧，字大一点更适合手持 */
  .reader { padding-left: 20px; padding-right: 20px; }
  .reader-nav { padding-left: 20px; padding-right: 20px; gap: 8px; }
  .reader-nav .btn { padding: 0 10px; font-size: 12.5px; }

  /* 滑动翻章的提示 */
  .swipe-hint {
    position: fixed; top: 50%; z-index: 70; transform: translateY(-50%);
    width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-text);
    font-size: 22px; opacity: 0; pointer-events: none;
    transition: opacity .18s, transform .18s var(--ease);
  }
  .swipe-hint.l { left: 14px; }
  .swipe-hint.r { right: 14px; }
  .swipe-hint.on { opacity: .95; }
}

/* 阅读时下滑，底栏跟着顶栏一起收起，让正文占满 */
@media (max-width: 860px) {
  body.reader-mode .tabbar { transform: translateY(110%); }
  body.reader-mode { padding-bottom: 0; }
}

/* 手机横屏 / 小高度：进一步压缩 */
@media (max-height: 480px) and (max-width: 900px) {
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .footer, .reader-dock, .comments, .reader-nav, #read-progress { display: none !important; }
  body { background: #fff; color: #000; }
  .reader { max-width: none; }
}

/* ===========================================================
   划线 / 段评 / 听书 —— 都长在正文段落上
   =========================================================== */

/* [hidden] 的默认 display:none 权重最低，会被下面这些 display:flex/grid 覆盖，
   所以显式兜一条 —— 否则面板一进页面就全都摊开了。 */
.sel-bar[hidden], .note-pop[hidden], .pc-panel[hidden],
.pc-backdrop[hidden], .tts-bar[hidden] { display: none !important; }

/* 段落本身：留出右侧空档给评论气泡 */
.reader-body .rp { position: relative; }

/* 划线：用背景色带而不是下划线，长段落更好认 */
.reader-body .rp.marked {
  border-radius: 3px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  cursor: pointer;
  transition: background-color .18s;
}
.rp.mk-yellow { background: color-mix(in srgb, var(--gold)  22%, transparent); }
.rp.mk-green  { background: color-mix(in srgb, var(--ok)    18%, transparent); }
.rp.mk-blue   { background: color-mix(in srgb, #3f6ea8      18%, transparent); }
.rp.mk-pink   { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.reader-body .rp.marked:hover { filter: brightness(1.06); }

/* 有笔记的划线，左侧加一道竖线提示「这里有话」 */
.reader-body .rp.has-note {
  border-left: 2px solid var(--accent);
  padding-left: 10px; margin-left: -12px;
}

/* 朗读中的段落 */
.reader-body .rp.speaking {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 3px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* 段评气泡：贴在段落右外侧，不挤正文 */
.pc-bubble {
  position: absolute; top: 2px; right: -34px;
  width: 24px; height: 24px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text-3);
  font-family: var(--f-mono); font-size: 10.5px; line-height: 1;
  display: grid; place-items: center;
  opacity: .5; transition: opacity .18s, color .18s, border-color .18s, transform .18s;
}
.rp:hover .pc-bubble { opacity: 1; }
.pc-bubble:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.12); }
/* 数字由 JS 写进气泡的 textContent —— CSS 的 attr() 只能读伪元素宿主自己的属性，
   读不到父段落上的 data-pc。 */
/* 窄屏没有外侧空间，气泡收进段落右下角 */
@media (max-width: 1100px) {
  .pc-bubble { right: -4px; top: auto; bottom: -6px; opacity: .38; }
}

/* ---------- 选中文字后的小工具条 ---------- */
.sel-bar {
  position: absolute; z-index: 92;
  display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  animation: selin .16s var(--ease);
}
@keyframes selin { from { opacity: 0; transform: translateY(4px); } }
.sel-bar button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: none; color: var(--text-2); font-size: 12.5px; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.sel-bar button:hover { background: var(--surface-2); color: var(--accent); }
.sel-bar svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.sb-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sb-dot.mk-yellow { background: var(--gold); }

/* ---------- 笔记弹窗 ---------- */
.note-pop {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 130; width: min(520px, calc(100vw - 32px));
  padding: 16px 18px 14px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  animation: notein .22s var(--ease);
}
@keyframes notein { from { opacity: 0; transform: translate(-50%, 12px); } }
.np-head { display: flex; align-items: center; margin-bottom: 10px; }
.np-head strong { font-family: var(--f-serif); font-size: 15px; letter-spacing: .03em; flex: 1; }
.note-pop blockquote {
  margin: 0 0 12px; padding: 9px 12px;
  border-left: 2px solid var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2); color: var(--text-2);
  font-size: 13px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.note-pop textarea {
  width: 100%; padding: 10px 12px; resize: vertical; min-height: 74px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--text); font-size: 13.5px; line-height: 1.7; outline: none;
  transition: border-color .16s;
}
.note-pop textarea:focus { border-color: var(--accent); }
.np-foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.np-colors { display: flex; gap: 6px; margin-right: auto; }
.np-colors button {
  width: 22px; height: 22px; padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: 50%;
  transition: transform .16s, border-color .16s;
}
.np-colors button:hover { transform: scale(1.15); }
.np-colors button.on { border-color: var(--text); }
.np-colors .mk-yellow { background: var(--gold); }
.np-colors .mk-green  { background: var(--ok); }
.np-colors .mk-blue   { background: #3f6ea8; }
.np-colors .mk-pink   { background: var(--accent); }

/* ---------- 段评面板（右侧抽屉） ---------- */
.pc-backdrop {
  position: fixed; inset: 0; z-index: 118;
  background: rgba(0,0,0,.28); backdrop-filter: blur(2px);
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } }
.pc-panel {
  position: fixed; inset: 0 0 0 auto; width: min(400px, 90vw); z-index: 120;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  animation: pcin .26s var(--ease);
}
@keyframes pcin { from { transform: translateX(100%); } }
.pc-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.pc-head h3 { font-family: var(--f-serif); font-size: 16px; letter-spacing: .03em; flex: 1; }
.pc-head h3 span { font-size: 12px; color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.pc-quote {
  margin: 0; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-family: var(--f-read); font-size: 13px; line-height: 1.8; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-list { flex: 1; overflow-y: auto; padding: 8px 18px; overscroll-behavior: contain; }
.pc-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pc-item:last-child { border-bottom: 0; }
.pc-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.pc-top b { font-size: 13px; }
.pc-top span { font-size: 11.5px; color: var(--text-3); }
.pc-del {
  margin-left: auto; width: 20px; height: 20px; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%; background: none;
  color: var(--text-3); font-size: 15px; line-height: 1;
}
.pc-del:hover { background: var(--surface-2); color: var(--accent); }
.pc-item p { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--text-2); }
.pc-empty, .pc-loading, .pc-guest {
  padding: 26px 0; text-align: center; font-size: 13px; color: var(--text-3);
}
.pc-guest { padding: 18px; border-top: 1px solid var(--line); }
.pc-guest a { color: var(--accent); }
.pc-form { padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.pc-form textarea {
  width: 100%; padding: 10px 12px; resize: vertical;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--text); font-size: 13.5px; line-height: 1.7; outline: none;
  transition: border-color .16s;
}
.pc-form textarea:focus { border-color: var(--accent); }
.pc-form-foot { margin-top: 9px; display: flex; align-items: center; gap: 10px; }
.pc-count { font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3); margin-right: auto; }

/* ---------- 听书控制条 ---------- */
.tts-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 96; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; max-width: calc(100vw - 24px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border: 1px solid var(--line-2); border-radius: 999px;
  box-shadow: var(--shadow-2);
  animation: ttsin .26s var(--ease);
}
@keyframes ttsin { from { opacity: 0; transform: translate(-50%, 14px); } }
.tts-btn {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: var(--text-2); transition: background-color .16s, color .16s;
}
.tts-btn:hover { background: var(--surface-2); color: var(--accent); }
.tts-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tts-main {
  width: 38px; height: 38px;
  background: var(--accent); color: var(--accent-text);
}
.tts-main:hover { background: color-mix(in srgb, var(--accent) 86%, #000); color: var(--accent-text); }
.tts-main .i-play  { display: none; }
.tts-main.paused .i-pause { display: none; }
.tts-main.paused .i-play  { display: block; }

.tts-info { min-width: 92px; padding: 0 2px; }
.tts-info > span { display: block; font-family: var(--f-mono); font-size: 10.5px; color: var(--text-3); }
.tts-track { margin-top: 3px; height: 2px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.tts-track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.tts-rate { display: flex; align-items: center; gap: 6px; }
.tts-rate span { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); min-width: 30px; }
.tts-rate input { width: 72px; accent-color: var(--accent); }
.tts-voice {
  max-width: 120px; height: 28px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text-2); font-size: 12px; cursor: pointer;
}
.tts-x { color: var(--text-3); }

/* 朗读中：底部有控制条，给它让位 */
body.tts-on .reader-dock { bottom: 78px; }

/* 浮标上的听书按钮：没在念显示喇叭，念着显示停止 */
#dock-tts .i-stop { display: none; }
body.tts-on #dock-tts .i-play { display: none; }
body.tts-on #dock-tts .i-stop { display: block; }
body.tts-on #dock-tts { color: var(--accent); border-color: var(--accent); }

/* 已加书签的章节，按钮点亮 */
#dock-mark.on { color: var(--accent); border-color: var(--accent); }
#dock-mark.on svg { fill: var(--accent); }

@media (max-width: 720px) {
  .tts-bar { left: 12px; right: 12px; transform: none; bottom: 12px; border-radius: var(--r-lg); }
  .tts-rate, .tts-voice { display: none; }     /* 手机上只留核心控制 */
  .tts-info { flex: 1; }
  body.tts-on .tabbar { transform: translateY(110%); }
}

/* ===========================================================
   读完一章后的引导块
   =========================================================== */
.finish-block {
  margin-top: 30px; padding: 34px 0 10px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, transparent), transparent 40%);
}
.finish-head { display: flex; align-items: flex-start; gap: 14px; }
.finish-head svg {
  width: 34px; height: 34px; flex-shrink: 0; padding: 7px;
  border-radius: 50%; background: var(--accent-soft);
  fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.finish-head h2 { font-family: var(--f-serif); font-size: 19px; letter-spacing: .03em; }
.finish-head p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--text-2); }
.finish-acts { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.finish-acts .btn.is-on { opacity: .7; }

/* ===========================================================
   评分
   =========================================================== */
.rate-box {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 0;
}
.rate-score { display: flex; align-items: baseline; gap: 8px; }
.rate-score b {
  font-family: var(--f-serif); font-size: 32px; font-weight: 700; line-height: 1;
}
.rate-score span { font-size: 12px; color: var(--text-3); }

.stars { display: inline-flex; gap: 2px; }
.stars button, .stars span {
  width: 26px; height: 26px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; color: var(--line-2);
  transition: color .14s, transform .14s;
}
.stars button { cursor: pointer; }
.stars svg { width: 20px; height: 20px; fill: currentColor; }
.stars .on { color: var(--gold); }
.stars button:hover { transform: scale(1.16); }
/* hover 时点亮到当前这颗（靠 JS 加 .hot） */
.stars button.hot { color: var(--gold); }

.rate-dist { flex: 1; min-width: 180px; max-width: 260px; }
.rate-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.rate-row .rr-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rate-row .rr-bar i { display: block; height: 100%; background: var(--gold); }
.rate-mine { font-size: 12.5px; color: var(--text-3); }
.rate-mine a, .rate-mine button {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 12.5px;
}

/* ===========================================================
   我的划线 / 阅读统计
   =========================================================== */
.note-card {
  padding: 16px 18px; margin-bottom: 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: var(--r-md); background: var(--surface);
  transition: border-color .18s, box-shadow .18s;
}
.note-card:hover { box-shadow: var(--shadow-1); }
.note-card.c-green { border-left-color: var(--ok); }
.note-card.c-blue  { border-left-color: #3f6ea8; }
.note-card.c-pink  { border-left-color: var(--accent); }
.nc-src { display: flex; align-items: baseline; gap: 7px; margin-bottom: 9px; font-size: 12px; }
.nc-src a { color: var(--text-2); }
.nc-src a:hover { color: var(--accent); }
.nc-src time { margin-left: auto; color: var(--text-3); font-size: 11.5px; }
.nc-quote {
  margin: 0; font-family: var(--f-read); font-size: 14px; line-height: 1.85; color: var(--text);
}
.nc-note {
  margin: 10px 0 0; padding: 9px 12px;
  border-radius: var(--r-sm); background: var(--surface-2);
  font-size: 13px; line-height: 1.75; color: var(--text-2);
}
.nc-foot { margin-top: 10px; display: flex; gap: 12px; }
.nc-foot a, .nc-foot button {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 12px; color: var(--text-3); transition: color .16s;
}
.nc-foot a:hover, .nc-foot button:hover { color: var(--accent); }

/* 阅读统计 */
.stat-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-card {
  padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.stat-card b {
  display: flex; align-items: baseline; flex-wrap: nowrap; white-space: nowrap;
  font-family: var(--f-serif); font-size: 26px; font-weight: 700; line-height: 1.2;
}
.stat-card span { font-size: 12px; color: var(--text-3); letter-spacing: .04em; }
.stat-card .su { font-style: normal; font-size: 14px; margin: 0 2px 0 1px; color: var(--text-2); }
.stat-card em {
  display: block; margin-top: 6px; font-style: normal;
  font-size: 11.5px; color: var(--text-3);
}

/* 60 天热力图：列＝周、行＝星期几，跟常见的贡献图一个读法 */
.heat {
  margin-top: 20px; display: grid; gap: 3px;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column; grid-auto-columns: 13px;
  overflow-x: auto; padding-bottom: 4px;
}
.heat i {
  width: 13px; height: 13px; border-radius: 2px; background: var(--surface-2);
  transition: transform .14s;
}
.heat i.pad { background: none; }
.heat i[data-lv="1"] { background: color-mix(in srgb, var(--accent) 28%, var(--surface-2)); }
.heat i[data-lv="2"] { background: color-mix(in srgb, var(--accent) 52%, var(--surface-2)); }
.heat i[data-lv="3"] { background: color-mix(in srgb, var(--accent) 76%, var(--surface-2)); }
.heat i[data-lv="4"] { background: var(--accent); }
.heat i:hover { transform: scale(1.35); }
.heat-legend {
  margin-top: 10px; display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3);
}
.heat-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* 目录分页：长篇目录按区间分段，别一次吐几千条 */
.toc-pager {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.toc-pager a {
  padding: 5px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--f-mono); font-size: 12px; color: var(--text-2);
  transition: border-color .16s, color .16s, background-color .16s;
}
.toc-pager a:hover { border-color: var(--accent); color: var(--accent); }
.toc-pager a.on {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600;
}
