:root {
  --bg: #F7F3EC;
  --wash: #FBEDE0;
  --accent: #F0522B;
  --card: #FFFFFF;
  --ink: #1D1D1F;
  --mute: #6E6E73;
  --faint: #86868B;
  --line: rgba(0, 0, 0, .08);
  --fill: rgba(118, 118, 128, .12);
  --blue: #0066CC;
  --red: #D70015;
  --on-ink: #FFFFFF;
  --hair: rgba(0, 0, 0, .14);
  --glass: rgba(255, 255, 255, .72);
  --top: rgba(249, 240, 230, .5);
  --err-bg: #FFF1F0;
  --err-ink: #B3261E;
  --doc: #424245;
  --ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', sans-serif;
  --read: 'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--ui); font-size: 17px; line-height: 1.47; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; }
:focus-visible { outline: 3px solid rgba(0, 113, 227, .55); outline-offset: 2px; }
.link { color: var(--blue); }

.app {
  position: relative; max-width: 480px; min-height: 100dvh; margin: 0 auto;
  background: linear-gradient(to bottom, var(--wash), var(--bg) 420px) no-repeat, var(--bg);
}
.view { padding: 0 20px calc(112px + env(safe-area-inset-bottom)); outline: none; }
.app.reading .view { padding: 0; }
.app.reading .tabs { display: none; }

/* 底部导航：悬浮毛玻璃胶囊 */
.tabs {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(340px, calc(100% - 40px));
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 5px; border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 .5px var(--line), 0 6px 18px rgba(0, 0, 0, .06);
  z-index: 20; view-transition-name: tabbar;
}
.tabs a { position: relative; z-index: 1; text-align: center; padding: 11px 0; font-size: 15px; color: var(--mute); transition: color .25s; }
.tabs a.on { color: var(--on-ink); font-weight: 600; }
.tabs .ind {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4);
  border-radius: 999px; background: var(--ink);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .45s var(--ease);
}

/* 顶栏 */
.top {
  position: sticky; top: 0; z-index: 10; margin: 0 -20px; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; min-height: 56px;
  background: var(--top);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand small { font-size: 12px; font-weight: 500; color: var(--mute); letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--fill); margin-left: 2px; }
.pill { display: inline-flex; align-items: center; min-height: 36px; background: var(--fill); border-radius: 999px; padding: 0 15px; font-size: 15px; }
.back { width: 40px; height: 40px; border: 0; border-radius: 50%; padding: 0 2px 3px 0; font-size: 26px; line-height: 1; color: var(--ink); background: var(--fill); transition: transform .2s var(--ease); }
.back:active { transform: scale(.92); }

/* 按钮 */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  font-size: 17px; font-weight: 500; padding: 14px 28px; text-align: center;
  transition: transform .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.96); opacity: .85; }
.btn.wide { display: flex; width: 100%; }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn.small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn.danger { background: none; color: var(--red); padding-left: 0; }
.btn[disabled] { opacity: .4; pointer-events: none; }

h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 32px 0 12px; }
.sub { color: var(--mute); font-size: 15px; margin: -6px 0 16px; }
.note { color: var(--faint); font-size: 13px; line-height: 1.5; }

/* 首页主视觉：居中标题，封面漂浮在四周 */
.hero { position: relative; text-align: center; padding: 142px 0 132px; }
.hero h1 { font-size: 40px; line-height: 1.1; font-weight: 600; letter-spacing: -.03em; margin: 0 0 14px; }
.hero p { color: var(--mute); margin: 0 auto 26px; max-width: 15em; }
.hero .float { display: block; position: absolute; animation: drift 9s ease-in-out infinite alternate; }
.hero .float:nth-child(1) { width: 72px; left: 4%; top: 22px; }
.hero .float:nth-child(2) { width: 58px; left: 41%; top: 6px; animation-delay: -2s; }
.hero .float:nth-child(3) { width: 78px; right: 3%; top: 34px; animation-delay: -4s; }
.hero .float:nth-child(4) { width: 64px; left: 9%; bottom: 14px; animation-delay: -1s; }
.hero .float:nth-child(5) { width: 74px; left: 40%; bottom: 0; animation-delay: -5s; }
.hero .float:nth-child(6) { width: 60px; right: 7%; bottom: 26px; animation-delay: -3s; }
@keyframes drift { from { transform: translateY(-3px); } to { transform: translateY(4px); } }

/* 封面：题材背景图，上方压暗放书名 */
.cover {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; flex: none;
  border-radius: 10px; overflow: hidden; color: #fff; container-type: inline-size;
  background-color: #2C2C2E;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, .62), rgba(0, 0, 0, .18) 46%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, .34)), var(--img, none);
  background-size: cover; background-position: center;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .4), inset 0 0 0 .5px rgba(255, 255, 255, .14);
}
.cover::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5%; background: linear-gradient(to right, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
.cover b { position: absolute; left: 10cqw; right: 8cqw; top: 10cqw; font-size: 15cqw; line-height: 1.2; font-weight: 700; letter-spacing: 0; text-align: left; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.cover i { position: absolute; left: 11cqw; bottom: 9cqw; font-style: normal; font-size: 8.5cqw; opacity: .88; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.cover.c0 { background-color: #2C2C2E; }
.cover.c1 { background-color: #8C7862; }
.cover.c2 { background-color: #50665C; }
.cover.c3 { background-color: #55708F; }
.cover.c4 { background-color: #8E5F63; }
.cover.full { background-image: var(--img); }
.cover.full b, .cover.full i { display: none; }
.cover-wrap { position: relative; display: block; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0 0 10px 10px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.prog span { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width .8s var(--ease); }

/* 横向滑动 */
.rail {
  display: flex; gap: 10px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 8px;
  scroll-snap-type: x mandatory; scroll-padding-left: 20px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: none; scroll-snap-align: start; }
.rail .chip { background: var(--card); }
.rail.books { gap: 16px; }
.rail.books a { width: 132px; }
.rail.books h3, .grid h3 { font-size: 15px; font-weight: 600; margin: 10px 0 2px; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rail.books p, .grid p { font-size: 13px; color: var(--faint); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail.books a, .grid a { transition: transform .25s var(--ease); }
.rail.books a:active, .grid a:active { transform: scale(.96); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 14px; }
.badge { display: inline-block; font-size: 12px; color: var(--mute); background: var(--fill); border-radius: 6px; padding: 1px 7px; margin-right: 4px; }

.bar { height: 4px; background: var(--fill); border-radius: 2px; overflow: hidden; margin: 10px 0 6px; }
.bar span { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .8s var(--ease); }

/* 大标题 */
.large { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.03em; margin: 6px 0 18px; }

/* 书架 */
.resume { display: flex; gap: 18px; align-items: center; background: var(--card); border-radius: 22px; padding: 16px; transition: transform .25s var(--ease); }
.resume:active { transform: scale(.98); }
.resume .cover-wrap { width: 96px; flex: none; }
.resume-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.resume-info small { font-size: 13px; color: var(--faint); }
.resume-info strong { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resume-info em { font-style: normal; font-size: 14px; color: var(--mute); margin-bottom: 10px; }
.grid .add .cover-wrap { aspect-ratio: 3 / 4; border-radius: 10px; background: var(--fill); display: grid; place-items: center; }
.grid .add .plus { font-size: 28px; font-weight: 300; color: var(--faint); }
.grid .add h3 { color: var(--mute); font-weight: 500; }
.empty h3 { font-size: 22px; font-weight: 600; color: var(--ink); margin: 0 0 6px; letter-spacing: -.02em; }
.empty p { margin: 0 auto; max-width: 16em; font-size: 15px; }
.empty-art { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin-bottom: 26px; }
.empty-art span { width: 46px; aspect-ratio: 3 / 4; border-radius: 8px; background: var(--fill); }
.empty-art span:nth-child(2) { width: 58px; background: rgba(118, 118, 128, .2); }

/* 定制流程 */
.steps { height: 4px; border-radius: 2px; background: var(--fill); margin: 8px 0 10px; overflow: hidden; }
.stepno { font-size: 13px; color: var(--faint); margin: 0 0 24px; }
.steps span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.wz h1 { font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -.03em; margin: 0 0 8px; }
.wz .sub { margin: 0 0 24px; font-size: 17px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts.one { grid-template-columns: 1fr; }
.opt {
  position: relative; text-align: left; background: var(--card); border: 0;
  border-radius: 18px; padding: 16px; box-shadow: inset 0 0 0 2px transparent;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.opt:active { transform: scale(.97); }
.opt strong { display: block; font-size: 17px; font-weight: 600; }
.opt small { display: block; color: var(--mute); font-size: 13px; margin-top: 3px; }
.opt.on { box-shadow: inset 0 0 0 2.5px var(--accent); }
.opt.pic {
  min-height: 132px; color: #fff; overflow: hidden; background-color: #2C2C2E;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, .66), rgba(0, 0, 0, .22) 52%, rgba(0, 0, 0, 0) 78%), var(--img);
  background-size: cover; background-position: center 82%;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.opt.pic strong { text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.opt.pic small { color: rgba(255, 255, 255, .86); text-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.opt.pic.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--accent); }
.opt.pic.big { min-height: 176px; }
.opt .hot { position: absolute; right: 12px; top: 14px; font-size: 11px; font-weight: 600; color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.opt.big { padding: 28px 22px; }
.opt.big strong { font-size: 28px; letter-spacing: -.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; background: var(--card); border: 0; border-radius: 999px; padding: 0 18px; font-size: 15px;
  transition: transform .2s var(--ease), background .2s, color .2s;
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--ink); color: var(--on-ink); }

label.field { display: block; margin: 0 0 16px; font-size: 13px; color: var(--mute); }
.field input, .field textarea, .char-row input, .char-row select {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 17px; color: var(--ink); letter-spacing: inherit;
  background: var(--card); border: 0; border-radius: 14px; padding: 14px 16px;
  box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .char-row input:focus, .char-row select:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
::placeholder { color: var(--faint); opacity: .7; }

.char-row { display: grid; grid-template-columns: 104px 1fr 44px; gap: 8px; margin-bottom: 10px; animation: rise .35s var(--ease); }
.char-row input, .char-row select { margin: 0; }
.char-row select { padding-right: 8px; background-image: linear-gradient(45deg, transparent 50%, #86868B 50%), linear-gradient(135deg, #86868B 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.char-row .x { border: 0; background: none; color: var(--faint); font-size: 22px; border-radius: 12px; }
.char-row .x[disabled] { visibility: hidden; }
.char-tools { display: flex; gap: 10px; margin: 4px 0 22px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--mute); margin: 4px 0 18px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
details.more { background: var(--card); border-radius: 18px; padding: 16px; margin: 0 0 16px; }
details.more summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '＋'; color: var(--faint); font-weight: 400; }
details.more[open] summary::after { content: '－'; }
details.more[open] summary { margin-bottom: 14px; }
details.more .field { margin: 0; }
details.more textarea { background: var(--bg); }
.err { background: var(--err-bg); color: var(--err-ink); border-radius: 14px; padding: 12px 16px; font-size: 15px; margin: 0 0 18px; animation: rise .3s var(--ease); }
.wz-foot { display: flex; gap: 10px; margin-top: 28px; }
.wz-foot .btn { flex: 1; }
.wz-foot .btn.ghost { flex: 0 0 auto; padding: 14px 24px; }
.wz-foot .btn.ghost:only-child { background: none; color: var(--blue); padding: 14px 0; }

/* 分组列表 */
.rows { background: var(--card); border-radius: 18px; margin: 12px 0; overflow: hidden; }
.rows > * {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; font-size: 17px; background: none; border: 0; text-align: left; position: relative;
}
.rows > * + *::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--hair); }
.rows > a:active { background: var(--fill); }
.rows span:first-child { flex: none; }
.rows em { font-style: normal; color: var(--faint); font-size: 15px; text-align: right; min-width: 0; }
.rows .clip { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .center { justify-content: center; }
.rows .danger-row { color: var(--red); }
.rows > * { min-height: 48px; }
.rows a em:last-child::after { content: '›'; margin-left: 6px; }

.balance { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--card); border-radius: 22px; padding: 18px 20px; }
.balance small { display: block; font-size: 13px; color: var(--faint); }
.balance strong { display: block; font-size: 48px; line-height: 1.05; font-weight: 600; letter-spacing: -.03em; }
.balance p { margin: 0; text-align: right; font-size: 15px; color: var(--mute); line-height: 1.6; }
h3.group { font-size: 13px; font-weight: 400; color: var(--faint); margin: 28px 16px 8px; }
h3.group + .rows { margin-top: 0; }
.note.foot { margin: -4px 16px 12px; }

/* 书详情 */
.detail-head { text-align: center; padding: 12px 0 8px; }
.detail-head .cover { width: 168px; margin: 0 auto 22px; border-radius: 14px; box-shadow: 0 24px 40px -18px rgba(0, 0, 0, .45); }
.detail-head h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.detail-head p { color: var(--mute); font-size: 15px; margin: 0 0 10px; }
.seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--fill); border-radius: 12px; padding: 3px; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 4px; font-size: 14px; border-radius: 9px; }
.seg button.on { font-weight: 600; }
.seg button[disabled] { opacity: .35; }
.seg .ind { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); border-radius: 9px; background: var(--card); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .35s var(--ease); }
.toc a { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; font-size: 16px; position: relative; }
.toc a + a::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--hair); }
.toc a span:last-child { color: var(--faint); font-size: 14px; flex: none; }
.toc a.lock { color: var(--faint); pointer-events: none; }
.toc a.cur { font-weight: 600; }

/* 阅读器 */
.reader { position: relative; min-height: 100dvh; background: var(--r-bg); color: var(--r-ink); transition: background .3s, color .3s; overflow: hidden; }
.reader.t-white { --r-bg: #FFFFFF; --r-ink: #1D1D1F; --r-mute: #86868B; --r-bar: rgba(250, 250, 252, .86); }
.reader.t-sepia { --r-bg: #F6EFE1; --r-ink: #3B3225; --r-mute: #8E826E; --r-bar: rgba(240, 232, 216, .88); }
.reader.t-night { --r-bg: #000000; --r-ink: #A1A1A6; --r-mute: #636366; --r-bar: rgba(28, 28, 30, .88); }
.reader h1 { font-size: 1.3em; font-weight: 600; margin: 0 0 1.4em; line-height: 1.4; break-after: avoid; }
.reader .text p { margin: 0 0 .9em; text-indent: 2em; line-height: 1.9; text-align: justify; letter-spacing: .01em; }
.reader .text .ai-mark { text-indent: 0; text-align: center; font-family: var(--ui); font-size: 12px; color: var(--r-mute); margin-top: 2.2em; }
.reader .text .demo-mark { text-indent: 0; text-align: left; font-family: var(--ui); font-size: 13px; line-height: 1.5; color: var(--r-mute); background: color-mix(in srgb, var(--r-ink) 6%, transparent); border-radius: 12px; padding: 10px 14px; break-inside: avoid; }

/* 左右翻页 */
.pager { position: absolute; inset: 0; padding: 58px 0 46px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.track { height: 100%; padding: 0 26px; column-gap: 52px; column-fill: auto; font-family: var(--read); transition: transform .5s var(--ease); will-change: transform; }
.track.drag { transition: none; }
.r-foot { position: absolute; left: 26px; right: 26px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; font-size: 12px; color: var(--r-mute); pointer-events: none; }

/* 上下滚动 */
.page { padding: 72px 26px 120px; font-family: var(--read); max-width: 36em; margin: 0 auto; }
.r-nav { display: flex; gap: 10px; margin-top: 2em; font-family: var(--ui); }
.r-nav .btn { flex: 1; background: color-mix(in srgb, var(--r-ink) 10%, transparent); color: var(--r-ink); }

.r-top, .r-bottom {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: 100%; max-width: 480px; z-index: 30;
  background: var(--r-bar); color: var(--r-ink); font-family: var(--ui);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  transition: transform .45s var(--ease), opacity .3s;
}
.r-top { top: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 15px; }
.r-top button { background: none; border: 0; padding: 8px; font-size: 15px; }
.r-top .ttl { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; font-weight: 600; }
.r-bottom { bottom: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
.r-bottom .row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.r-bottom .row > span { font-size: 13px; color: var(--r-mute); flex: none; width: 2.4em; }
.r-bottom .grp { display: flex; gap: 3px; flex: 1; background: color-mix(in srgb, var(--r-ink) 9%, transparent); border-radius: 12px; padding: 3px; }
.r-bottom .grp button { flex: 1; min-height: 38px; border: 0; background: none; border-radius: 9px; padding: 0 4px; font-size: 15px; transition: background .25s, color .25s; }
.r-bottom .grp button.on { background: var(--r-bg); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .14); }
.r-bottom .grp button:active { opacity: .6; }
.r-bottom .stepper output { flex: 1; display: grid; place-items: center; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--r-mute); }
.r-bottom .stepper button { font-size: 14px; }
.r-bottom .stepper .bigA { font-size: 20px; }
.toc-row { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 48px; margin-bottom: 6px; padding: 0 2px; border: 0; background: none; font-size: 17px; font-weight: 600; border-bottom: .5px solid color-mix(in srgb, var(--r-ink) 16%, transparent); }
.toc-row em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--r-mute); }
.toc-row em::after { content: '›'; margin-left: 6px; }
.swatches { display: flex; gap: 16px; flex: 1; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--r-ink) 22%, transparent); transition: box-shadow .25s; }
.sw.on { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--r-ink) 22%, transparent), 0 0 0 2px var(--r-bar), 0 0 0 4px var(--r-ink); }
.sw-white { background: #FFFFFF; }
.sw-sepia { background: #F6EFE1; }
.sw-night { background: #000000; }
.reader.bare .r-top { transform: translateY(-105%); opacity: 0; }
.reader.bare .r-bottom { transform: translateY(105%); opacity: 0; }

/* 底部弹层 */
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0); transition: background .35s; }
.drawer.open { background: rgba(0, 0, 0, .4); }
.drawer > div {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 480px; max-height: 76vh;
  overflow: auto; overscroll-behavior: contain; background: var(--bg); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(28px + env(safe-area-inset-bottom)); font-family: var(--ui);
  transform: translateY(100%); transition: transform .5s var(--ease);
}
.drawer.open > div { transform: none; }
.drawer .grab { width: 36px; height: 5px; border-radius: 3px; background: rgba(60, 60, 67, .3); margin: 0 auto 6px; }
.drawer h2 { margin: 12px 4px; font-size: 20px; }
.drawer .toc { background: var(--card); border-radius: 18px; overflow: hidden; }

/* 文档页 */
.doc h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 8px 0 20px; }
.doc h3 { font-size: 17px; font-weight: 600; margin: 22px 0 4px; }
.doc p { margin: 0; color: var(--doc); font-size: 16px; }

.empty { text-align: center; padding: 48px 10px; color: var(--mute); }
.empty .btn { margin-top: 20px; }

.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -260%);
  background: rgba(29, 29, 31, .92); color: #fff; border-radius: 999px; padding: 10px 18px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: 14px; max-width: min(88vw, 420px); text-align: center; pointer-events: none;
  transition: transform .5s var(--ease); z-index: 60; view-transition-name: toast;
}
.toast.show { transform: translate(-50%, 0); }

/* 页面切换 */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .42s; animation-timing-function: var(--ease); mix-blend-mode: normal; }
html[data-nav='forward']::view-transition-old(root) { animation-name: vt-out-left; }
html[data-nav='forward']::view-transition-new(root) { animation-name: vt-in-right; }
html[data-nav='back']::view-transition-old(root) { animation-name: vt-out-right; z-index: 2; }
html[data-nav='back']::view-transition-new(root) { animation-name: vt-in-left; z-index: 1; }
html[data-nav='fade']::view-transition-old(root), html[data-nav='fade']::view-transition-new(root) { animation-duration: .22s; }
@keyframes vt-out-left { to { transform: translateX(-26%); opacity: .5; } }
@keyframes vt-in-right { from { transform: translateX(100%); } }
@keyframes vt-out-right { to { transform: translateX(100%); } }
@keyframes vt-in-left { from { transform: translateX(-26%); opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition: none !important; }
}

.spin { width: 16px; height: 16px; margin-right: 8px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: spin 2s linear infinite !important; } }

/* 深色模式：跟随系统 */
.drawer.dark > div { --bg: #1C1C1E; --card: #2C2C2E; --ink: #F5F5F7; --faint: #8E8E93; --hair: rgba(255, 255, 255, .16); }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0B0A; --wash: #1D1611; --card: #1C1C1E; --ink: #F5F5F7; --mute: #A1A1A6; --faint: #8E8E93;
    --line: rgba(255, 255, 255, .12); --fill: rgba(118, 118, 128, .24); --blue: #2997FF; --red: #FF453A;
    --on-ink: #000000; --hair: rgba(255, 255, 255, .16); --glass: rgba(44, 44, 46, .72); --top: rgba(20, 16, 13, .5);
    --err-bg: #3A1512; --err-ink: #FF8A80; --doc: #C7C7CC;
  }
  .drawer > div { --bg: #1C1C1E; --card: #2C2C2E; }
  .seg .ind { background: #636366; }
}

/* 首页：三步说明 */
.how { list-style: none; counter-reset: how; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 0; padding: 0; }
.how li { counter-increment: how; background: var(--card); border-radius: 16px; padding: 12px 12px 14px; font-size: 13px; color: var(--mute); line-height: 1.4; }
.how li::before { content: counter(how); display: block; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.how b { display: block; font-size: 16px; color: var(--ink); font-weight: 600; }

/* 阅读器：章首引子、常驻返回键、首次指引 */
.reader .text .epi { margin: 0 0 1.6em; padding: .7em 1em; border-left: 3px solid color-mix(in srgb, var(--r-ink) 30%, transparent); background: color-mix(in srgb, var(--r-ink) 5%, transparent); border-radius: 0 10px 10px 0; font-family: var(--ui); font-size: .82em; line-height: 1.7; color: var(--r-mute); break-inside: avoid; }
.reader .text .epi span { display: block; }
.r-back { position: fixed; z-index: 25; top: calc(10px + env(safe-area-inset-top)); left: max(12px, calc(50% - 228px)); width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0 2px 3px 0; font-size: 26px; line-height: 1; color: var(--r-ink); background: color-mix(in srgb, var(--r-bg) 78%, var(--r-ink)); opacity: .85; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.reader:not(.bare) .r-back { display: none; }
.reader .page h1, .reader .track h1 { padding-left: 0; }
.reader .page { padding-top: 76px; }
.guide { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(0, 0, 0, .45); font-family: var(--ui); animation: fadein .3s; }
.guide > div { width: 100%; max-width: 480px; background: var(--bg); color: var(--ink); border-radius: 22px 22px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); animation: sheetup .45s var(--ease); }
.guide h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.guide p { margin: 0 0 8px; font-size: 16px; color: var(--mute); }
.guide .btn { margin-top: 14px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetup { from { transform: translateY(100%); } }
