/* ============================================================
   半卷书 · 阅读器
   微信读书式留白与蓝 → 书架 / 书库 / 详情 / 阅读页
   ============================================================ */

@import url('wenkai.css');

/* ---------- 1. 变量 ---------- */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
             "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-kai: 'WenKaiLocal', 'LXGW WenKai', 'Kaiti SC', STKaiti, 'KaiTi', serif;
  --font-song: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;

  --blue: #1677ff;
  --blue-h: #0a63e0;
  --blue-weak: rgba(22, 119, 255, .08);
  --blue-weak-2: rgba(22, 119, 255, .14);

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --text: #17181b;
  --text-2: #5b6169;
  --text-3: #9aa1aa;
  --line: #eceef1;
  --line-2: #f3f4f6;
  --scrim: rgba(0, 0, 0, .32);

  --rail: 232px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 3px rgba(17, 24, 39, .05);
  --shadow-2: 0 6px 24px -8px rgba(17, 24, 39, .14);
  --shadow-3: 0 16px 48px -12px rgba(17, 24, 39, .24);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .22s;
  color-scheme: light;
}

html[data-theme="dark"] {
  --blue: #4b91ff;
  --blue-h: #6aa4ff;
  --blue-weak: rgba(75, 145, 255, .12);
  --blue-weak-2: rgba(75, 145, 255, .2);

  --bg: #0f1013;
  --surface: #181a1e;
  --surface-2: #1e2025;
  --text: #e8eaee;
  --text-2: #9ba2ac;
  --text-3: #6b727c;
  --line: #25282e;
  --line-2: #202329;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-2: 0 6px 24px -8px rgba(0, 0, 0, .6);
  --shadow-3: 0 16px 48px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
svg { display: block; }
img { display: block; max-width: 100%; }
::selection { background: rgba(22, 119, 255, .2); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

* { scrollbar-width: thin; scrollbar-color: #d2d6dc transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #d2d6dc; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #b9bfc7; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #34383f; background-clip: padding-box; }

/* ---------- 2. 外壳 ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2b86ff, #1677ff 55%, #0f66d8);
  color: #fff;
  box-shadow: 0 4px 10px -3px rgba(22, 119, 255, .5);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: .16em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14.5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item svg { width: 20px; height: 20px; opacity: .8; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--blue-weak); color: var(--blue); font-weight: 500; }
.nav-item.is-active svg { opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 12px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-count { color: var(--blue); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.rail-note {
  font-size: 11.5px; line-height: 1.75; color: var(--text-3);
  padding: 14px 12px 0;
  border-top: 1px solid var(--line-2);
}
.rail-note b { color: var(--text-2); font-weight: 500; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--rail);
  padding: 0 clamp(20px, 4vw, 56px) 80px;
}
.view { max-width: 1040px; margin: 0 auto; }
.tabbar { display: none; }

/* ---------- 3. 通用组件 ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 40px 0 18px;
}
.pg-title { font-size: clamp(23px, 2.6vw, 28px); font-weight: 600; letter-spacing: .01em; }
.page-head .sub { font-size: 12.5px; color: var(--text-3); letter-spacing: .02em; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 32px 0 14px;
}
.sec-head h2 { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.sec-head .hint { font-size: 12.5px; color: var(--text-3); }
.sec-head .hint:hover { color: var(--blue); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: #cfd4db; box-shadow: var(--shadow-1); }
.btn:active { transform: scale(.985); }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 4px 12px -4px rgba(22, 119, 255, .55);
}
.btn-primary:hover { background: var(--blue-h); border-color: var(--blue-h); }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-block { width: 100%; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 31px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px; color: var(--text-2);
  transition: all var(--dur) var(--ease);
}
.chip:hover { color: var(--text); border-color: #d5dae0; }
.chip.is-on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-3);
  min-width: 200px;
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  border: 0; background: none; outline: none; width: 100%;
  font-size: 13.5px; color: var(--text);
}
.search input::placeholder { color: var(--text-3); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  height: 34px; min-width: 46px; padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 13px; color: var(--text-2);
  transition: all var(--dur) var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 4px; background: var(--blue-weak);
  font-size: 10.5px; color: var(--blue); letter-spacing: .02em;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .7; flex: none; }

.bar { position: relative; height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 99px; transition: width .5s var(--ease); }

.empty { text-align: center; padding: 72px 20px; color: var(--text-3); }
.empty .big { font-size: 17px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13.5px; }

/* 封面 */
.cover {
  position: relative;
  aspect-ratio: 3 / 4.3;
  width: 100%;
  border-radius: 4px 7px 7px 4px;
  background: var(--accent, #8a5a44);
  background-image:
    linear-gradient(150deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 44%),
    linear-gradient(205deg, rgba(0, 0, 0, .26), rgba(0, 0, 0, 0) 58%);
  box-shadow: 0 1px 3px rgba(17, 24, 39, .16), 0 8px 20px -12px rgba(17, 24, 39, .5);
  overflow: hidden;
  color: #f8f4ea;
  isolation: isolate;
  container-type: inline-size;
}
.cover::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 7px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(0, 0, 0, .04) 60%, rgba(255, 255, 255, .14));
}
.cover .cv-in { position: absolute; inset: 0; }
.cover .cv-title {
  position: absolute; right: 13%; top: 13%;
  writing-mode: vertical-rl;
  font-family: var(--font-kai);
  font-size: clamp(14px, 1.5vw, 19px);
  letter-spacing: .2em; line-height: 1.1;
  max-height: 64%; overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .28);
}
.cover .cv-author {
  position: absolute; left: 14%; bottom: 12%;
  writing-mode: vertical-rl;
  max-height: 30%; overflow: hidden; white-space: nowrap;
  font-family: var(--font-kai);
  font-size: 9px; letter-spacing: .14em; opacity: .8;
}
.cover .cv-seal {
  position: absolute; right: 12%; bottom: 11%;
  width: 17px; height: 17px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  font-family: var(--font-kai); font-size: 7.5px; line-height: 1;
  border-radius: 2px;
}
@container (max-width: 108px) {
  .cv-title { font-size: 13px; letter-spacing: .16em; right: 11%; }
  .cv-author { font-size: 8px; }
  .cv-seal { width: 15px; height: 15px; font-size: 6.5px; }
}
@container (max-width: 64px) {
  .cv-author { display: none; }
  .cv-title { font-size: 11px; letter-spacing: .12em; }
  .cv-seal { width: 12px; height: 12px; font-size: 6px; }
}
.cover-lg .cv-title { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: .26em; }
.cover-lg .cv-seal { width: 26px; height: 26px; font-size: 11px; }
.cover-lg .cv-author { font-size: 11px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 10px);
  z-index: 300;
  background: rgba(24, 26, 30, .9); color: #fff;
  font-size: 13px; letter-spacing: .02em;
  padding: 9px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity .24s var(--ease), transform .24s var(--ease);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 80vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 4. 书架 ---------- */
.shelf-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 34px 0 20px; }
.shelf-head h1 { font-size: clamp(23px, 2.6vw, 28px); font-weight: 600; }
.shelf-head .dayline { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.shelf-tools { display: flex; align-items: center; gap: 10px; }

.continue {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.continue:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.continue::after {
  content: "";
  position: absolute; inset: 0 0 0 auto; width: 44%;
  background: radial-gradient(120% 130% at 100% 0%, color-mix(in srgb, var(--accent, #1677ff) 14%, transparent), transparent 72%);
  pointer-events: none;
}
.continue .cover { width: 92px; }
.continue-body { position: relative; z-index: 1; min-width: 0; }
.continue-label { font-size: 11px; letter-spacing: .14em; color: var(--text-3); }
.continue-title { font-size: 20px; font-weight: 600; margin: 5px 0 3px; letter-spacing: .01em; }
.continue-chapter {
  font-size: 13px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.continue-meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; font-size: 12px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.continue-meta .bar { flex: 1; max-width: 200px; }
.continue-cta { position: relative; z-index: 1; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 26px 22px;
}
.shelf-card { position: relative; display: flex; flex-direction: column; gap: 9px; }
.shelf-card .cover { transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.shelf-card:hover .cover { transform: translateY(-4px); box-shadow: 0 14px 30px -12px rgba(17, 24, 39, .38); }
.shelf-card .c-title {
  font-size: 13.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shelf-card .c-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.shelf-card .c-progress { height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; }
.shelf-card .c-progress > i { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width .5s var(--ease); }

.card-menu {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 22, 26, .55); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--dur) var(--ease);
  z-index: 2;
}
.card-menu svg { width: 15px; height: 15px; }
.shelf-card:hover .card-menu, .card-menu:focus-visible { opacity: 1; }
.shelf-card.is-pinned .c-title::after { content: " ·"; color: var(--blue); }

/* ---------- 5. 书库 ---------- */
.lib-tools {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 0 18px;
}
.lib-tools .search { margin-left: auto; }
.booklist { display: flex; flex-direction: column; }
.book-row {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 18px; align-items: center;
  padding: 16px 8px;
  border-radius: 12px;
  border-top: 1px solid var(--line-2);
  transition: background var(--dur) var(--ease);
}
.book-row:hover { background: var(--surface); }
.book-row:last-child { border-bottom: 1px solid var(--line-2); }
.book-row .cover { width: 68px; }
.book-row h3 {
  font-size: 17px; font-weight: 600; letter-spacing: .01em;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.book-row .r-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 5px; font-size: 12px; color: var(--text-3);
}
.book-row .r-blurb {
  margin-top: 8px; font-size: 13px; line-height: 1.8; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 64ch;
}
.book-row .r-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 6. 书籍详情 ---------- */
.backlink {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 28px; font-size: 13px; color: var(--text-3);
}
.backlink svg { width: 16px; height: 16px; }
.backlink:hover { color: var(--text); }

.book-hero {
  display: grid; grid-template-columns: 168px 1fr;
  gap: clamp(24px, 4vw, 48px);
  padding: 28px 0 34px;
  border-bottom: 1px solid var(--line);
}
.book-hero .cover { width: 168px; }
.book-hero h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 600; letter-spacing: .01em; line-height: 1.25; }
.book-hero .h-meta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin: 13px 0 16px; font-size: 13px; color: var(--text-2);
}
.book-hero .h-meta .sep { color: var(--text-3); opacity: .5; }
.book-hero .h-blurb { font-size: 14px; line-height: 1.95; color: var(--text-2); max-width: 52ch; }
.book-hero .h-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.book-stats {
  display: flex; gap: 26px; margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.book-stats div { display: flex; flex-direction: column; gap: 1px; }
.book-stats b { font-size: 17px; font-weight: 600; white-space: nowrap; }
.book-stats span { font-size: 11.5px; color: var(--text-3); }

.catalog { padding: 26px 0 10px; }
.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.catalog-head h2 { font-size: 16px; font-weight: 600; }
.catalog-head .sub { font-size: 12.5px; color: var(--text-3); }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 24px; }
.chapter-link {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line-2);
  border-radius: 8px 8px 0 0;
  font-size: 14px; color: var(--text-2);
  text-align: left;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.chapter-link:hover { color: var(--blue); background: var(--surface); }
.chapter-link .n {
  font-size: 11px; color: var(--text-3); min-width: 2.3em;
  font-variant-numeric: tabular-nums; flex: none;
}
.chapter-link .cl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-link.is-read { color: var(--text-3); }
.chapter-link.is-current { color: var(--blue); font-weight: 500; }
.chapter-link.is-current .n { color: var(--blue); }

/* ---------- 7. 我的 ---------- */
.me-head { display: flex; align-items: center; gap: 16px; padding: 40px 0 24px; }
.me-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2b86ff, #1677ff);
  color: #fff; font-size: 21px; font-weight: 600;
  box-shadow: 0 4px 12px -4px rgba(22, 119, 255, .5);
}
.me-head h1 { font-size: 21px; font-weight: 600; }
.me-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin: 6px 0 28px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--text-3); }

.panel {
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); padding: 2px 18px; margin-bottom: 18px;
}
.panel-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 0; border-bottom: 1px solid var(--line-2);
}
.panel-row:last-child { border-bottom: 0; }
.panel-row .p-title { font-size: 14px; font-weight: 500; }
.panel-row .p-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.panel-row .p-ctrl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 600; color: var(--text-2); margin: 26px 0 10px; }

.switch {
  position: relative; width: 44px; height: 26px; border-radius: 99px;
  background: #d6dade; transition: background var(--dur) var(--ease); flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform var(--dur) var(--ease);
}
.switch.is-on { background: var(--blue); }
.switch.is-on::after { transform: translateX(18px); }

.about { font-size: 12.5px; line-height: 1.95; color: var(--text-3); }
.about b { color: var(--text-2); font-weight: 500; }
.about a { color: var(--blue); }

.theme-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.theme-dot i { width: 22px; height: 22px; border-radius: 50%; background: var(--c, #fff); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.theme-dot:hover { transform: scale(1.06); }
.theme-dot.is-on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-weak-2); }

/* ============================================================
   8. 阅读页
   ============================================================ */
.rx {
  --rx-pad: 30px;
  --rx-gap: 60px;
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--rx-bg);
  color: var(--rx-fg);
  overscroll-behavior: none;
  touch-action: manipulation;
  transition: background .28s var(--ease), color .28s var(--ease);
}

/* 纸张配色 */
.rx, .rx[data-paper="white"] {
  --rx-bg: #ffffff; --rx-fg: #1b1c1e; --rx-fg-2: #6b7076; --rx-fg-3: #9aa0a6;
  --rx-line: rgba(20, 22, 26, .1); --rx-veil: rgba(255, 255, 255, .82);
  --rx-hl: rgba(22, 119, 255, .22); --rx-ink: #ffffff;
}
.rx[data-paper="sepia"] {
  --rx-bg: #f8f2e3; --rx-fg: #3a3226; --rx-fg-2: #7d7362; --rx-fg-3: #a49a86;
  --rx-line: rgba(80, 60, 30, .14); --rx-veil: rgba(248, 242, 227, .85);
  --rx-hl: rgba(200, 120, 40, .26); --rx-ink: #f8f2e3;
}
.rx[data-paper="green"] {
  --rx-bg: #e6efe4; --rx-fg: #2c362b; --rx-fg-2: #67735f; --rx-fg-3: #94a08c;
  --rx-line: rgba(40, 60, 36, .13); --rx-veil: rgba(230, 239, 228, .85);
  --rx-hl: rgba(56, 130, 90, .22); --rx-ink: #e6efe4;
}
.rx[data-paper="night"] {
  --rx-bg: #191a1d; --rx-fg: #b6b9bf; --rx-fg-2: #82868d; --rx-fg-3: #63676d;
  --rx-line: rgba(255, 255, 255, .1); --rx-veil: rgba(25, 26, 29, .85);
  --rx-hl: rgba(90, 150, 255, .26); --rx-ink: #191a1d;
}
.rx[data-paper="black"] {
  --rx-bg: #000000; --rx-fg: #9c9ca1; --rx-fg-2: #6e6e73; --rx-fg-3: #55555a;
  --rx-line: rgba(255, 255, 255, .1); --rx-veil: rgba(0, 0, 0, .85);
  --rx-hl: rgba(90, 150, 255, .26); --rx-ink: #000000;
}

/* 顶栏 / 底栏 */
.rx-top, .rx-foot {
  position: absolute; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center;
  background: var(--rx-veil);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  transition: transform .32s var(--ease), opacity .26s var(--ease);
}
.rx-top {
  top: 0; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 8px) 8px calc(env(safe-area-inset-left) + 6px);
  min-height: 52px;
  border-bottom: 1px solid var(--rx-line);
}
.rx-foot {
  bottom: 0; flex-direction: column; gap: 2px;
  padding: 10px calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + 14px);
  border-top: 1px solid var(--rx-line);
}
.rx.is-bare .rx-top { transform: translateY(-100%); opacity: 0; }
.rx.is-bare .rx-foot { transform: translateY(100%); opacity: 0; }
.rx.is-bare .rx-top, .rx.is-bare .rx-foot { pointer-events: none; }

.rx-ico {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--rx-fg);
  transition: background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.rx-ico svg { width: 21px; height: 21px; }
.rx-ico:hover { background: var(--rx-line); }
.rx-ico:active { opacity: .6; }
.rx-ico.is-on svg { color: var(--rx-fg); }

.rx-head { flex: 1; min-width: 0; padding-left: 4px; display: flex; flex-direction: column; line-height: 1.25; }
.rx-book { font-size: 14px; font-weight: 500; }
.rx-chap {
  font-size: 11px; color: var(--rx-fg-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rx-foot-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.rx-meta {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; font-size: 11px; color: var(--rx-fg-3);
  font-variant-numeric: tabular-nums;
}
.rx-turn { width: 26px; height: 26px; display: grid; place-items: center; color: var(--rx-fg-2); border-radius: 50%; flex: none; }
.rx-turn svg { width: 17px; height: 17px; }
.rx-turn:hover { background: var(--rx-line); }
.rx-turn:disabled { opacity: .25; cursor: default; }

/* 进度条 */
.rx-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 22px; background: none; margin: 0; cursor: pointer;
  --p: 0%;
}
.rx-range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent, #1677ff) var(--p), var(--rx-line) var(--p));
}
.rx-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; margin-top: -5px;
  border-radius: 50%; background: var(--accent, #1677ff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.rx-range::-moz-range-track {
  height: 3px; border-radius: 99px; background: var(--rx-line);
}
.rx-range::-moz-range-progress {
  height: 3px; border-radius: 99px; background: var(--accent, #1677ff);
}
.rx-range::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%;
  background: var(--accent, #1677ff);
}

/* 正文区 */
.rx-body { position: absolute; inset: 0; }
.rx-viewport {
  --rx-maxw: 1180px;
  position: absolute;
  top: calc(env(safe-area-inset-top) + 52px);
  bottom: calc(env(safe-area-inset-bottom) + 74px);
  left: 0; right: 0;
  padding: 0 max(var(--rx-pad), calc((100% - var(--rx-maxw)) / 2));
  overflow: hidden;
}
.rx[data-mode="scroll"] .rx-viewport { --rx-maxw: 760px; }
.rx-clip { position: relative; height: 100%; width: 100%; overflow: hidden; }
.rx[data-mode="scroll"] .rx-clip { overflow: visible; height: auto; }
.rx-flow {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: var(--rx-font, var(--font-kai));
  font-size: var(--rx-fs, 19px);
  line-height: var(--rx-lh, 1.9);
  letter-spacing: .012em;
  color: var(--rx-fg);
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: transform .3s var(--ease);
  word-break: normal;
  overflow-wrap: break-word;
  text-align: justify;
  text-justify: inter-ideograph;
  hanging-punctuation: allow-end;
}
.rx-anim-off .rx-flow { transition: none; }
.rx-flow p {
  margin: 0 0 .55em;
  text-indent: 2em;
  orphans: 1; widows: 1;
}
.rx-flow p:last-child { margin-bottom: 0; }
.rx-flow .rx-ch {
  margin-top: calc(var(--rx-fs, 19px) * 1.1);
  margin-bottom: calc(var(--rx-fs, 19px) * 1.2);
  text-align: left;
}
.rx-flow .rx-ch:first-child { margin-top: 0; }
.rx-flow .rx-ch .num {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: .18em; color: var(--rx-fg-3);
  text-indent: 0; margin-bottom: 10px;
}
.rx-flow .rx-ch h2 {
  font-family: var(--rx-font, var(--font-kai));
  font-size: calc(var(--rx-fs, 19px) * 1.34);
  font-weight: 500; line-height: 1.45; letter-spacing: .04em;
  text-indent: 0;
}
.rx-flow .rx-ch .rule {
  display: block; width: 26px; height: 2px; margin-top: 16px;
  background: var(--accent, #1677ff); opacity: .8;
}
.rx-flow .rx-end {
  margin: calc(var(--rx-fs, 19px) * 1.4) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rx-line);
  text-indent: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--font-ui); font-size: 12.5px; color: var(--rx-fg-3);
}
.rx-flow .rx-end button {
  height: 34px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--rx-line); color: var(--rx-fg-2); font-size: 13px;
}
.rx-flow .rx-end button:hover { border-color: var(--accent); color: var(--accent); }
.rx-flow mark { background: var(--rx-hl); color: inherit; border-radius: 2px; padding: 1px 0; }

/* 滚动模式 */
.rx[data-mode="scroll"] .rx-viewport {
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.rx[data-mode="scroll"] .rx-flow {
  height: auto; min-height: 100%;
  padding-bottom: 30vh;
  transform: none !important;
  transition: none;
  column-width: auto;
  column-gap: 0;
}
.rx[data-mode="paged"] .rx-flow {
  column-width: var(--rx-colw, 100%);
  column-gap: var(--rx-gap);
  column-fill: auto;
}

/* 点击热区（旧版遗留，reader.js 已改为 viewport 点击分区处理） */
.rx.is-scrollmode .rx-taps { display: none; }

/* 亮度遮罩 */
.rx-dim {
  position: absolute; inset: 0; z-index: 4;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}

/* ---------- 9. 抽屉 / 面板 ---------- */
.rx-scrim {
  position: absolute; inset: 0; z-index: 80;
  background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.rx-scrim.is-on { opacity: 1; pointer-events: auto; }

.rx-drawer {
  position: absolute; z-index: 90;
  top: 0; bottom: 0; left: 0;
  width: min(380px, 86vw);
  display: flex; flex-direction: column;
  background: var(--rx-bg);
  border-right: 1px solid var(--rx-line);
  transform: translateX(-102%);
  transition: transform .34s var(--ease);
  visibility: hidden;
}
.rx-drawer.is-open { transform: none; visibility: visible; }
.rx-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 14px) 14px 10px;
  border-bottom: 1px solid var(--rx-line);
  flex: none;
}
.rx-drawer-head .t { flex: 1; font-size: 15px; font-weight: 500; }
.rx-tabs { display: flex; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--rx-line); flex: none; }
.rx-tab {
  position: relative; padding: 11px 0 10px;
  font-size: 13.5px; color: var(--rx-fg-3);
}
.rx-tab.is-on { color: var(--accent, #1677ff); font-weight: 500; }
.rx-tab.is-on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--accent, #1677ff);
}
.rx-drawer-body { flex: 1; overflow-y: auto; padding: 6px 0 calc(env(safe-area-inset-bottom) + 20px); }

.toc-search {
  margin: 10px 14px 6px;
  height: 36px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-radius: 10px;
  background: var(--rx-line);
  color: var(--rx-fg-3);
}
.toc-search svg { width: 15px; height: 15px; flex: none; }
.toc-search input { border: 0; background: none; outline: none; width: 100%; font-size: 13px; color: var(--rx-fg); }

.toc-item {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; padding: 10px 16px;
  font-size: 13.5px; color: var(--rx-fg-2); text-align: left; line-height: 1.5;
}
.toc-item:hover { background: var(--rx-line); }
.toc-item .n { font-size: 10.5px; color: var(--rx-fg-3); min-width: 2.2em; flex: none; font-variant-numeric: tabular-nums; }
.toc-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-item.is-on { color: var(--accent, #1677ff); font-weight: 500; background: color-mix(in srgb, var(--accent, #1677ff) 8%, transparent); }
.toc-item.is-on .n { color: var(--accent, #1677ff); }
.toc-item .bm { width: 13px; height: 13px; color: var(--accent, #1677ff); flex: none; align-self: center; }

.note-item {
  padding: 12px 16px; border-bottom: 1px solid var(--rx-line);
  display: flex; flex-direction: column; gap: 6px;
}
.note-item .q { font-size: 13px; line-height: 1.7; color: var(--rx-fg); }
.note-item .q mark { background: var(--rx-hl); color: inherit; }
.note-item .meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--rx-fg-3); }
.note-item .meta .del { margin-left: auto; color: var(--rx-fg-3); }
.note-item .meta .del:hover { color: #e5484d; }
.note-item .meta .del svg { width: 14px; height: 14px; }

/* 设置面板 */
.rx-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--rx-bg);
  border-top: 1px solid var(--rx-line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .14);
  transform: translateY(102%);
  transition: transform .34s var(--ease);
  visibility: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.rx-sheet.is-open { transform: none; visibility: visible; }
.rx-sheet-in { max-width: 720px; margin: 0 auto; padding: 16px clamp(16px, 4vw, 28px) 20px; display: flex; flex-direction: column; gap: 16px; }
.rx-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rx-row > .label { width: 42px; flex: none; font-size: 12px; color: var(--rx-fg-3); letter-spacing: .06em; }
.rx-row .seg button {
  border-color: var(--rx-line); color: var(--rx-fg-2); background: transparent;
  height: 36px; border-radius: 10px;
}
.rx-row .seg button.is-on {
  background: color-mix(in srgb, var(--accent, #1677ff) 12%, transparent);
  border-color: var(--accent, #1677ff);
  color: var(--accent, #1677ff);
  font-weight: 500;
}
.rx-row .seg button.swatch { width: 38px; min-width: 38px; padding: 0; display: grid; place-items: center; }
.rx-row .seg button.swatch i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.rx-row .seg button.swatch.is-on { box-shadow: 0 0 0 1.5px var(--accent, #1677ff); }
.rx-row .seg button.aa { font-family: var(--font-song); font-weight: 500; }
.rx-note { font-size: 11.5px; color: var(--rx-fg-3); line-height: 1.7; }
.rx-note b { color: var(--rx-fg-2); font-weight: 500; }

/* 划线气泡 */
.rx-pop {
  position: absolute; z-index: 95;
  display: flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: 10px;
  background: var(--rx-bg);
  border: 1px solid var(--rx-line);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .3);
  transform: translate(-50%, -100%) scale(.94);
  opacity: 0; pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.rx-pop.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, -100%) scale(1); }
.rx-pop button {
  height: 32px; padding: 0 12px; border-radius: 7px;
  font-size: 12.5px; color: var(--rx-fg-2);
  display: flex; align-items: center; gap: 5px;
}
.rx-pop button svg { width: 15px; height: 15px; }
.rx-pop button:hover { background: var(--rx-line); color: var(--rx-fg); }

/* 章末卡片 */
.rx-toast {
  position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 8px);
  z-index: 96;
  background: rgba(24, 26, 30, .9); color: #fff;
  font-size: 12.5px; padding: 8px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .22s var(--ease);
  max-width: 80%;
}
.rx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 10. 入场动画 ---------- */
.view-enter { animation: rise .34s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .4s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .01s }
.stagger > *:nth-child(2) { animation-delay: .04s }
.stagger > *:nth-child(3) { animation-delay: .07s }
.stagger > *:nth-child(4) { animation-delay: .1s }
.stagger > *:nth-child(5) { animation-delay: .13s }
.stagger > *:nth-child(6) { animation-delay: .16s }
.stagger > *:nth-child(7) { animation-delay: .19s }
.stagger > *:nth-child(8) { animation-delay: .22s }
.stagger > *:nth-child(9) { animation-delay: .25s }
.stagger > *:nth-child(10) { animation-delay: .28s }

/* ============================================================
   11. 响应式
   ============================================================ */
@media (max-width: 1024px) {
  :root { --rail: 210px; }
  .continue { grid-template-columns: 80px 1fr; }
  .continue .cover { width: 80px; }
  .continue-cta { grid-column: 2; margin-top: 4px; }
  .continue-cta .btn { height: 34px; font-size: 13px; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .rail { display: none; }
  .main { margin-left: 0; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
  .view { max-width: none; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(3, 1fr);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(18px) saturate(1.6);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    border-top: 1px solid var(--line);
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  }
  html[data-theme="dark"] .tabbar { background: rgba(24, 26, 30, .94); }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10.5px; color: var(--text-3); padding: 4px 0;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.is-active { color: var(--blue); font-weight: 500; }

  .page-head { padding: 22px 0 14px; }
  .shelf-head { padding: 26px 0 16px; }
  .shelf-head h1, .pg-title { font-size: 21px; }

  .continue { grid-template-columns: 66px 1fr; gap: 14px; padding: 14px; border-radius: 14px; }
  .continue .cover { width: 66px; }
  .continue-title { font-size: 17px; }
  .continue-chapter { font-size: 12.5px; }
  .continue-meta { margin-top: 9px; font-size: 11.5px; }
  .continue-cta .btn { height: 30px; font-size: 12.5px; padding: 0 13px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 20px 14px; }
  .shelf-card .c-title { font-size: 12.5px; }
  .shelf-card .c-meta { font-size: 10.5px; }
  .card-menu { opacity: 1; width: 22px; height: 22px; top: 4px; right: 4px; }
  .card-menu svg { width: 13px; height: 13px; }

  .lib-tools { gap: 10px; }
  .lib-tools .search { margin-left: 0; width: 100%; order: 3; }
  .book-row { grid-template-columns: 56px 1fr; gap: 14px; padding: 14px 2px; }
  .book-row .cover { width: 56px; }
  .book-row h3 { font-size: 15.5px; }
  .book-row .r-actions { grid-column: 2; margin-top: 2px; }
  .book-row .r-blurb { -webkit-line-clamp: 2; font-size: 12.5px; }

  .book-hero { grid-template-columns: 96px 1fr; gap: 18px; padding: 20px 0 26px; }
  .book-hero .cover { width: 96px; }
  .book-hero h1 { font-size: 22px; }
  .book-hero .h-meta { font-size: 12px; margin: 9px 0 12px; gap: 7px; }
  .book-hero .h-blurb { font-size: 13px; line-height: 1.85; }
  .book-hero .h-actions { margin-top: 16px; grid-column: 1 / -1; }
  .book-hero .h-actions .btn { flex: 1; }
  .book-stats { gap: 20px; margin-top: 16px; padding-top: 14px; grid-column: 1 / -1; }
  .book-stats b { font-size: 15px; }
  .chapters { grid-template-columns: 1fr; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat b { font-size: 19px; }
  .me-head { padding: 26px 0 18px; }

  /* 阅读页 */
  .rx { --rx-pad: 20px; --rx-gap: 40px; }
  .rx-top { padding-top: calc(env(safe-area-inset-top) + 6px); min-height: 50px; }
  .rx-ico { width: 36px; height: 36px; }
  .rx-ico svg { width: 20px; height: 20px; }
  .rx-book { font-size: 13.5px; }
  .rx-chap { font-size: 10.5px; }
  .rx-viewport { top: calc(env(safe-area-inset-top) + 50px); bottom: calc(env(safe-area-inset-bottom) + 72px); }
  .rx-taps { top: calc(env(safe-area-inset-top) + 50px); bottom: calc(env(safe-area-inset-bottom) + 72px); }
  .rx-drawer { width: 100%; border-right: 0; }
  .rx-sheet { border-radius: 16px 16px 0 0; }
  .rx-sheet-in { padding: 14px 16px 18px; gap: 14px; }
  .rx-row > .label { width: 34px; font-size: 11.5px; }
  .rx-row .seg button { height: 34px; padding: 0 12px; font-size: 12.5px; }
  .rx-foot { padding: 8px calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 8px) calc(env(safe-area-inset-left) + 12px); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 370px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
  .book-hero { grid-template-columns: 82px 1fr; }
  .book-hero .cover { width: 82px; }
}

@media (min-width: 1500px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (min-width: 1024px) {
  .rx { --rx-pad: 40px; --rx-gap: 72px; }
  .rx-foot-row { max-width: 720px; margin: 0 auto; width: 100%; }
  .rx-meta { max-width: 720px; margin: 0 auto; }
}

/* 桌面端左侧常驻目录 */
.rx-side { display: none; }

@media (min-width: 1024px) {
  .rx-side {
    display: flex; flex-direction: column;
    position: absolute; top: 0; bottom: 0; left: 0;
    width: 288px; z-index: 6;
    background: var(--rx-bg);
    border-right: 1px solid var(--rx-line);
  }
  .rx-side-head {
    display: flex; align-items: center; gap: 4px;
    padding: calc(env(safe-area-inset-top) + 10px) 12px 10px 8px;
    min-height: 56px;
  }
  .rx-side-titles { min-width: 0; padding-left: 2px; }
  .rx-side-book {
    font-size: 14px; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .rx-side-sub { font-size: 11px; color: var(--rx-fg-3); margin-top: 2px; }
  .rx-side-search { margin: 0 14px 8px; }
  .rx-side-list { flex: 1; overflow-y: auto; padding: 0 8px 20px; }
  .rx-side-list .toc-item { width: 100%; }
  .rx-side-list .toc-item.is-on { background: var(--rx-line); }

  .rx-body { left: 288px; }
  .rx-top { left: 288px; padding-left: 10px; }
  .rx-top .rx-book { display: none; }
  .rx-top .rx-chap { font-size: 12px; color: var(--rx-fg-2); }
  .rx-foot { left: 288px; }
  .rx-toc-btn { display: none; }
  .rx-drawer { left: 288px; }
  /* 侧栏在位时，正文版心不需要那么宽 */
  .rx-viewport { --rx-maxw: 920px; }
  .rx[data-mode="scroll"] .rx-viewport { --rx-maxw: 720px; }
  /* 宽屏：设置面板变成右下角浮层，不再横贯底部 */
  .rx-sheet {
    left: auto; right: 24px; bottom: 92px;
    width: 420px;
    border: 1px solid var(--rx-line);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
    transform: translateY(12px) scale(.98);
    opacity: 0;
    transform-origin: bottom right;
    transition: transform .22s var(--ease), opacity .2s var(--ease);
  }
  .rx-sheet.is-open { transform: none; opacity: 1; }
  .rx-sheet-in { max-width: none; padding: 18px 20px 20px; gap: 14px; }
  .rx-sheet::after {
    content: ""; position: absolute; right: 42px; bottom: -7px;
    width: 12px; height: 12px; background: var(--rx-bg);
    border-right: 1px solid var(--rx-line); border-bottom: 1px solid var(--rx-line);
    transform: rotate(45deg);
  }
  /* 宽屏抽屉也带一点圆角与阴影，不再是整屏边栏 */
  .rx-drawer { width: 340px; box-shadow: 24px 0 60px rgba(0, 0, 0, .12); }

  .rx-side-list .toc-item .n { width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
