/* ============================================================
   笔趣阁 · 阅读站样式
   纸墨质感 / 双主题 / 响应式
   ============================================================ */

:root {
  --bg:        #f6f3ec;
  --bg-soft:   #fffdf8;
  --bg-sunk:   #efeade;
  --fg:        #2a2622;
  --fg-mid:    #6b645b;
  --fg-dim:    #9c9489;
  --line:      #e3dbcc;
  --line-soft: #eee7da;
  --accent:    #a8321e;
  --accent-fg: #fff;
  --accent-bg: #f6e6e2;
  --shadow-sm: 0 1px 2px rgba(42, 38, 34, .05);
  --shadow-md: 0 2px 6px rgba(42, 38, 34, .07), 0 14px 30px -18px rgba(42, 38, 34, .35);
  --shadow-lg: 0 4px 12px rgba(42, 38, 34, .08), 0 28px 60px -28px rgba(42, 38, 34, .45);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --topbar-h: 58px;
}

[data-theme="dark"] {
  --bg:        #151412;
  --bg-soft:   #1d1b18;
  --bg-sunk:   #100f0e;
  --fg:        #ded8ce;
  --fg-mid:    #9a9288;
  --fg-dim:    #6d665e;
  --line:      #2c2926;
  --line-soft: #242220;
  --accent:    #d86a4d;
  --accent-fg: #1a1512;
  --accent-bg: #33221d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 30px -18px rgba(0, 0, 0, .8);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .4), 0 28px 60px -28px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::selection { background: var(--accent); color: var(--accent-fg); }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==================== 顶栏 ==================== */

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  height: 100%;
  display: flex; align-items: center; gap: 18px;
}

.brand {
  display: flex; align-items: baseline; gap: 7px;
  font-family: var(--serif);
  font-size: 21px; font-weight: 700; letter-spacing: .04em;
  white-space: nowrap;
}
.brand b { color: var(--accent); font-weight: 700; }
.brand small {
  font-family: var(--sans);
  font-size: 10px; font-weight: 500; letter-spacing: .18em;
  color: var(--fg-dim); text-transform: uppercase;
  padding-bottom: 1px;
}

.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a {
  padding: 7px 13px; border-radius: var(--r-pill);
  font-size: 14px; color: var(--fg-mid);
  transition: background-color .16s, color .16s;
  white-space: nowrap;
}
.nav a:hover { background: var(--bg-sunk); color: var(--fg); }
.nav a.is-on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.topbar__spacer { flex: 1; }

.search {
  position: relative;
  width: clamp(180px, 26vw, 320px);
}
.search input {
  width: 100%; height: 38px;
  padding: 0 40px 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.search input::placeholder { color: var(--fg-dim); }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search button {
  position: absolute; right: 4px; top: 4px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--fg-mid);
  transition: color .16s, background-color .16s;
}
.search button:hover { color: var(--accent); background: var(--bg-sunk); }

.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--fg-mid);
  transition: color .16s, background-color .16s;
}
.iconbtn:hover { color: var(--fg); background: var(--bg-sunk); }

/* ==================== 通用组件 ==================== */

.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 34px 0 16px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px; font-weight: 700; letter-spacing: .02em;
}
.section-head .count { font-size: 13px; color: var(--fg-dim); }
.section-head .spacer { flex: 1; }

.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 22px 0 4px;
}
.chip {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  font-size: 14px; color: var(--fg-mid);
  transition: all .16s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chip.is-on {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-fg); font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 14.5px; font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: all .16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, #000);
  border-color: transparent; color: var(--accent-fg);
}
.btn--ghost { background: transparent; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ==================== 书籍网格 ==================== */

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

.card { display: block; }
.card__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-sunk);
  box-shadow: var(--shadow-md);
  transition: transform .28s cubic-bezier(.2,.8,.3,1), box-shadow .28s;
}
.card__cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.8,.3,1);
}
.card__cover::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
  pointer-events: none;
}
.card__fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 14px;
  font-family: var(--serif);
  font-size: 16px; font-weight: 700;
  text-align: center; line-height: 1.35;
  color: var(--fg-mid);
  background:
    linear-gradient(150deg, var(--bg-sunk), var(--bg-soft) 55%, var(--bg-sunk));
}
.card:hover .card__cover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}
.card:hover .card__cover img { transform: scale(1.045); }

.card__title {
  margin: 11px 0 3px;
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card:hover .card__title { color: var(--accent); }
.card__meta {
  font-size: 12.5px; color: var(--fg-dim);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; white-space: nowrap;
}
.card__meta i { font-style: normal; }
.card__meta i:first-child { color: var(--fg-mid); }

.card__badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(6px);
  color: var(--fg-mid);
}

/* 骨架屏 */
@keyframes pulse { 0%, 100% { opacity: .55 } 50% { opacity: .9 } }
.skel { animation: pulse 1.4s ease-in-out infinite; }
.skel__cover { aspect-ratio: 3/4; border-radius: var(--r-md); background: var(--bg-sunk); }
.skel__line { height: 12px; margin-top: 12px; border-radius: 4px; background: var(--bg-sunk); }
.skel__line--s { width: 55%; margin-top: 8px; }

/* ==================== 书架 ==================== */

.shelf-strip {
  display: flex; gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.shelf-strip::-webkit-scrollbar { height: 6px; }
.shelf-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.shelf-card {
  flex: 0 0 190px;
  scroll-snap-align: start;
  display: flex; gap: 11px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.shelf-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.shelf-card__cover {
  flex: 0 0 54px; width: 54px; height: 72px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-sunk);
  position: relative;
}
.shelf-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.shelf-card__body { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.shelf-card__title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shelf-card__sub {
  margin-top: 5px;
  font-size: 12px; color: var(--fg-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shelf-card__del {
  margin-top: 7px;
  font-size: 12px; color: var(--fg-dim);
  align-self: flex-start;
  padding: 2px 0;
  border-bottom: 1px dashed transparent;
}
.shelf-card__del:hover { color: var(--accent); border-bottom-color: currentColor; }

/* ==================== 分页 ==================== */

.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 7px; flex-wrap: wrap;
  margin: 40px 0 10px;
}
.pager button {
  min-width: 38px; height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  font-size: 14px; color: var(--fg-mid);
  transition: all .16s;
}
.pager button:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.pager button.is-on {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-fg); font-weight: 600;
}
.pager button[disabled] { opacity: .35; cursor: default; }
.pager .gap { color: var(--fg-dim); padding: 0 2px; }

/* ==================== 详情页 ==================== */

.book-hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 34px;
  padding: 34px 0 8px;
}

.book-hero__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-sunk);
  box-shadow: var(--shadow-lg);
}
.book-hero__cover img { width: 100%; height: 100%; object-fit: cover; }

.book-hero__title {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 700; line-height: 1.25; letter-spacing: .01em;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tag {
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  background: var(--bg-sunk);
  color: var(--fg-mid);
}
.tag--accent { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.intro {
  font-size: 14.5px; line-height: 1.85;
  color: var(--fg-mid);
  max-width: 62em;
  white-space: pre-wrap;
}
.intro.is-clamped {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.intro-toggle {
  margin-top: 6px;
  font-size: 13px; color: var(--accent);
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
}

.book-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 24px 0 4px;
}

.book-stats {
  display: flex; flex-wrap: wrap; gap: 26px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--fg-dim);
}
.book-stats b { display: block; font-size: 15px; color: var(--fg); font-weight: 600; margin-bottom: 2px; }

/* 目录 */
.toc-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.toc-filter {
  flex: 1 1 200px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  outline: none;
}
.toc-filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}
.toc__item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--fg-mid);
  transition: background-color .14s, color .14s;
  min-width: 0;
}
.toc__item:hover { background: var(--bg-sunk); color: var(--accent); }
.toc__item span {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toc__item em {
  font-style: normal; font-size: 11.5px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.toc__item.is-cur { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* ==================== 阅读页 ==================== */

body.reader {
  --reader-bg: var(--bg);
  --reader-fg: var(--fg);
  background: var(--reader-bg);
}

body.reader[data-paper="sepia"] { --reader-bg: #f3ead6; --reader-fg: #3b3225; --line: #e0d3b8; --bg-sunk: #ece1c8; --accent-bg: #e8dcc2; }
body.reader[data-paper="snow"]  { --reader-bg: #fbfbfa; --reader-fg: #26262a; --line: #e8e8e6; --bg-sunk: #f0f0ee; --accent-bg: #eee; }
body.reader[data-paper="green"] { --reader-bg: #d8e6d2; --reader-fg: #2b3a28; --line: #c4d6bd; --bg-sunk: #cdddc6; --accent-bg: #c9ddc2; }
body.reader[data-paper="night"] { --reader-bg: #12110f; --reader-fg: #b9b3a8; --line: #2a2724; --bg-sunk: #1c1a18; --accent-bg: #2b211d; }

.readbar {
  position: sticky; top: 0; z-index: 70;
  height: 52px;
  background: color-mix(in srgb, var(--reader-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: transform .28s cubic-bezier(.3,.8,.3,1);
}
.readbar.is-hidden { transform: translateY(-100%); }
.readbar__in {
  height: 100%;
  display: flex; align-items: center; gap: 10px;
}
.readbar__title {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.readbar__title small {
  display: block; font-family: var(--sans);
  font-size: 12px; font-weight: 400; color: var(--fg-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.readbar__pos {
  font-size: 12.5px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.read-progress {
  position: fixed; top: 0; left: 0; z-index: 80;
  height: 2px; width: 0;
  background: var(--accent);
  transition: width .1s linear;
}

.article-wrap {
  width: min(var(--measure, 40rem), 100% - 36px);
  margin: 0 auto;
  padding: 34px 0 120px;
}

.chapter-head {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.chapter-head h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 700; line-height: 1.4;
}
.chapter-head .sub {
  font-size: 13px; color: var(--fg-dim);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.chapter-head .sub a:hover { color: var(--accent); }

.article {
  font-family: var(--serif);
  font-size: var(--fs, 19px);
  line-height: var(--lh, 1.95);
  letter-spacing: .01em;
  color: var(--reader-fg);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.article p {
  margin: 0 0 .95em;
  text-indent: 2em;
}
.article.is-tight p { margin-bottom: .55em; }

.article .placeholder {
  padding: 22px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  color: var(--fg-mid);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.8;
  text-indent: 0;
}

.chapter-nav {
  display: flex; align-items: center; gap: 10px;
  margin-top: 46px; padding-top: 26px;
  border-top: 1px solid var(--line);
}
.chapter-nav .btn { flex: 1; justify-content: center; }

/* 正文容器：分页模式只挂载当前页，滚动模式挂载整章 */
.view { animation: view-in .22s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }

.page-split {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 30px;
}
.page-split__ind {
  font-size: 13px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* 设置抽屉 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .32);
  opacity: 0; pointer-events: none;
  transition: opacity .24s;
}
.sheet-mask.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; z-index: 100;
  left: 0; right: 0; bottom: 0;
  max-height: 82vh; overflow-y: auto;
  padding: 8px 0 calc(22px + env(safe-area-inset-bottom));
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(102%);
  transition: transform .3s cubic-bezier(.3,.9,.3,1);
}
.sheet.is-open { transform: translateY(0); }

@media (min-width: 900px) {
  .sheet {
    left: auto; right: 26px; bottom: 26px;
    width: 420px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    transform: translateY(calc(100% + 40px));
  }
}

.sheet__handle {
  width: 40px; height: 4px; margin: 8px auto 14px;
  border-radius: 2px; background: var(--line);
}
@media (min-width: 900px) { .sheet__handle { display: none; } }

.sheet__group { padding: 12px 22px; border-bottom: 1px solid var(--line-soft); }
.sheet__group:last-child { border-bottom: 0; }
.sheet__label {
  font-size: 12.5px; color: var(--fg-dim);
  letter-spacing: .06em; margin-bottom: 11px;
}
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 62px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 14px; color: var(--fg-mid);
  transition: all .15s;
}
.seg button:hover { border-color: var(--accent); color: var(--accent); }
.seg button.is-on {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-fg); font-weight: 600;
}
.seg button.swatch { position: relative; }
.seg button.swatch::before {
  content: ""; display: block;
  width: 15px; height: 15px; margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .16);
  background: var(--sw, #fff);
}

.sheet__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; font-size: 14px;
}
.sheet__row + .sheet__row { margin-top: 12px; }
.sheet__row input[type="range"] { flex: 1; accent-color: var(--accent); }

.kbd-hint {
  margin-top: 14px; padding: 12px 22px;
  font-size: 12.5px; color: var(--fg-dim); line-height: 1.9;
}
.kbd-hint kbd {
  display: inline-block;
  padding: 1px 6px; margin: 0 2px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg);
  font-family: var(--sans); font-size: 11.5px;
}

/* ==================== 状态 / 页脚 ==================== */

.state {
  padding: 70px 20px;
  text-align: center;
  color: var(--fg-dim);
}
.state h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 19px; color: var(--fg);
}
.state p { margin: 0 0 20px; font-size: 14px; }

.spinner {
  width: 26px; height: 26px; margin: 0 auto 16px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.footer {
  margin-top: 70px;
  padding: 30px 0 46px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--fg-dim);
  line-height: 2;
}
.footer a:hover { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 40px; z-index: 200;
  transform: translate(-50%, 20px);
  padding: 11px 20px;
  border-radius: var(--r-pill);
  background: var(--fg); color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.fab-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--fg-mid);
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, color .16s;
}
.fab-top.is-on { opacity: 1; pointer-events: auto; }
.fab-top:hover { color: var(--accent); }

/* ==================== 响应式 ==================== */

@media (max-width: 860px) {
  .wrap { width: calc(100% - 28px); }
  .nav { display: none; }
  .search { width: 100%; max-width: none; }
  .brand small { display: none; }
  .book-hero { grid-template-columns: 124px 1fr; gap: 20px; padding-top: 22px; }
  .book-hero__cover { box-shadow: var(--shadow-md); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 20px 13px; }
  .card__title { font-size: 13.5px; }
  .toc { grid-template-columns: 1fr; }
  .article-wrap { width: calc(100% - 30px); padding-top: 22px; }
  .footer { margin-top: 46px; }
}

@media (max-width: 520px) {
  .book-hero { grid-template-columns: 104px 1fr; gap: 16px; }
  .book-actions .btn { flex: 1 1 auto; justify-content: center; }
  .book-stats { gap: 16px; font-size: 12.5px; }
  .shelf-card { flex-basis: 165px; }
}

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