/* ========== 主题色 ========== */
:root {
  --bg: #F6F2EC;
  --surface: #FFFFFF;
  --surface-2: #FBF8F4;
  --text: #26211D;
  --text-2: #4D463F;
  --muted: #8C8379;
  --line: #E7DFD4;
  --accent: #9E3A46;
  --accent-soft: #F5E5E4;
  --on-accent: #FFFFFF;
  --ok: #2F7D5B; --ok-soft: #E2F1E9;
  --warn: #A86A12; --warn-soft: #FBEFD9;
  --danger: #B42318; --danger-soft: #FBE6E3;
  --shadow: 0 1px 2px rgba(45, 33, 22, .05), 0 10px 30px rgba(45, 33, 22, .07);
  --wm: rgba(70, 55, 40, .085);
  --fs: 15px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --top-h: 52px;
  --toc-w: 312px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210; --surface: #1C1A18; --surface-2: #22201D;
    --text: #E9E3DA; --text-2: #C9C1B6; --muted: #8E867C; --line: #302C28;
    --accent: #E48A94; --accent-soft: #3A2427; --on-accent: #1C1A18;
    --ok: #5FC499; --ok-soft: #1B3127; --warn: #E5B15C; --warn-soft: #362C1A; --danger: #F2766B; --danger-soft: #3D211E;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --wm: rgba(255, 255, 255, .055);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210; --surface: #1C1A18; --surface-2: #22201D;
  --text: #E9E3DA; --text-2: #C9C1B6; --muted: #8E867C; --line: #302C28;
  --accent: #E48A94; --accent-soft: #3A2427; --on-accent: #1C1A18;
  --ok: #5FC499; --ok-soft: #1B3127; --warn: #E5B15C; --warn-soft: #362C1A; --danger: #F2766B; --danger-soft: #3D211E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --wm: rgba(255, 255, 255, .055);
  color-scheme: dark;
}

/* ========== 基础 ========== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; transition: background-color .25s, color .25s; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-line; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
[hidden] { display: none !important; }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: grid; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: grid; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .1s, background .2s, opacity .2s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { opacity: .92; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-ghost-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .6; cursor: default; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.dot-on { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); vertical-align: 1px; }

/* ========== 授权码入口 / 提示页 ========== */
.landing { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.landing-top { display: flex; justify-content: flex-end; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 12px; }
.landing-main { flex: 1; display: grid; place-items: center; padding: 16px 16px max(48px, env(safe-area-inset-bottom)); }
.landing-card { width: 100%; max-width: 420px; padding: 36px 28px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); text-align: center; }
.seal { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.seal svg { width: 24px; height: 24px; }
.landing-title { margin: 6px 0 6px; font-size: 30px; line-height: 1.25; letter-spacing: .04em; }
.landing-title.small { font-size: 22px; }
.landing-sub { margin: 0 0 24px; color: var(--muted); }
.code-form { display: grid; gap: 12px; }
.code-input { width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); text-align: center; font-family: var(--mono); font-size: 19px; letter-spacing: .14em; text-transform: uppercase; outline: none; transition: border-color .2s, box-shadow .2s; }
.code-input::placeholder { font-family: var(--sans); font-size: 15px; letter-spacing: .04em; color: var(--muted); text-transform: none; }
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.landing-card .btn-primary { height: 50px; font-size: 16px; }
.landing-card > .code-input { margin-bottom: 12px; letter-spacing: .04em; text-transform: none; font-family: var(--sans); }
.form-error { margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 14px; text-align: left; white-space: pre-line; }
.landing-notes { margin: 22px 0 0; padding: 16px 0 0; border-top: 1px dashed var(--line); list-style: none; text-align: left; color: var(--muted); font-size: 13px; }
.landing-notes li { position: relative; padding-left: 14px; margin: 4px 0; }
.landing-notes li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }

/* ========== 阅读页 ========== */
.reader { background: var(--bg); }
.read-progress { position: fixed; z-index: 40; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; }
.read-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid transparent; transition: transform .28s ease, border-color .2s, background-color .25s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar.hide { transform: translateY(-100%); }
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.top-doc { font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.top-chap { max-width: 100%; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page { padding: calc(var(--top-h) + env(safe-area-inset-top) + 20px) max(20px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.article, .pager { max-width: 700px; margin: 0 auto; }
.chap-head { padding: 24px 0 28px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.chap-head h1 { margin: 10px 0 10px; font-size: calc(var(--fs) * 1.6); line-height: 1.35; letter-spacing: .02em; }
.chap-meta { margin: 0; font-size: 13px; color: var(--muted); }

.prose { font-size: var(--fs); line-height: 1.9; color: var(--text); letter-spacing: .01em; overflow-wrap: break-word; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.prose p { margin: 0 0 1.05em; text-align: justify; }
.prose h2 { margin: 2.2em 0 .8em; font-size: 1.32em; line-height: 1.45; scroll-margin-top: calc(var(--top-h) + env(safe-area-inset-top) + 16px); }
.prose h3 { margin: 1.9em 0 .7em; font-size: 1.14em; line-height: 1.5; scroll-margin-top: calc(var(--top-h) + env(safe-area-inset-top) + 16px); }
.prose h4 { margin: 1.6em 0 .6em; font-size: 1.02em; color: var(--text-2); scroll-margin-top: calc(var(--top-h) + env(safe-area-inset-top) + 16px); }
/* 小节标题上方原来有一道短横线，紧贴「一、」时容易被看成「一」，各样式都不再显示 */
.prose h2::before { content: none; }
.prose strong { color: var(--text); font-weight: 700; background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
.prose blockquote { margin: 1.3em 0; padding: .9em 1.1em; border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--surface); color: var(--text-2); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li > p { margin: 0 0 .4em; }
.prose hr { margin: 2.4em auto; width: 40%; border: 0; border-top: 1px dashed var(--line); }
.prose mark { background: var(--warn-soft); color: inherit; padding: 0 .15em; border-radius: 3px; }
.prose img { display: block; max-width: 100%; height: auto; margin: 1.4em auto; border-radius: 12px; pointer-events: none; }
.prose table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.4em 0; border-collapse: collapse; font-size: .86em; line-height: 1.65; }
.prose th, .prose td { padding: .55em .7em; border: 1px solid var(--line); text-align: left; vertical-align: top; min-width: calc(var(--fs, 15px) * 7); text-indent: 0; text-wrap: wrap; }
.prose th:first-child, .prose td:first-child { min-width: calc(var(--fs, 15px) * 6); font-weight: 600; }
.prose th { background: var(--surface-2); }
.prose code { padding: .1em .35em; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); font-size: .88em; }
.prose a { color: var(--accent); }
.prose .flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; transition: border-color .2s, transform .15s; }
.pager-card:hover { border-color: var(--accent); }
.pager-card:active { transform: scale(.99); }
.pager-card.next { text-align: right; align-items: flex-end; }
.pager-k { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.pager-k svg { width: 16px; height: 16px; }
.pager-t { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager-end { grid-column: 2; align-self: center; text-align: right; color: var(--muted); }

/* 目录 */
.toc { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(86vw, 360px); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .3s cubic-bezier(.2,.8,.2,1); padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); }
.toc.open { transform: none; box-shadow: var(--shadow); }
.toc-head { display: flex; align-items: flex-start; gap: 8px; padding: 22px 14px 12px 22px; }
.toc-head > div { flex: 1; min-width: 0; }
.toc-title { margin: 4px 0 4px; font-size: 20px; }
.toc-meta { margin: 0; font-size: 12px; color: var(--muted); }
.toc-overall { height: 3px; margin: 0 22px 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.toc-overall i { display: block; height: 100%; background: var(--accent); }
.toc nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.toc-list, .toc-sub { list-style: none; margin: 0; padding: 0; }
.toc-chap { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--text-2); font-size: 14.5px; line-height: 1.45; }
.toc-chap:hover { background: var(--surface-2); color: var(--text); }
.toc-n { flex: none; width: 1.8em; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.toc-list .current > .toc-chap { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc-list .current > .toc-chap .toc-n { color: var(--accent); }
.toc-sub { margin: 4px 0 8px 2.6em; border-left: 1px solid var(--line); }
.toc-sub a { display: block; padding: 5px 10px; font-size: 13px; line-height: 1.45; color: var(--muted); text-decoration: none; border-radius: 0 8px 8px 0; }
.toc-sub a:hover { color: var(--text); background: var(--surface-2); }
.toc-sub .lv3 a { padding-left: 22px; font-size: 12.5px; }
.toc-sub a.on { color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(15, 10, 5, .38); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.open { opacity: 1; pointer-events: auto; }

/* 字号面板 */
.type-pop { position: fixed; z-index: 35; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); right: max(10px, env(safe-area-inset-right)); width: 300px; max-width: calc(100vw - 20px); padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.type-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.type-row + .type-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.type-row > span { font-size: 13px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button, .seg button { min-width: 40px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.stepper output { min-width: 32px; text-align: center; font-family: var(--mono); font-size: 14px; }
.seg { display: flex; gap: 4px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* 水印 */
.wm { position: fixed; inset: 0; z-index: 25; pointer-events: none; background-repeat: repeat; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); animation: up .3s ease; }
.toast span { white-space: normal; line-height: 1.5; }
.toast button { border: 0; padding: 6px 10px; border-radius: 9px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }
body.veiled .prose, body.veiled .chap-head { filter: blur(10px); transition: filter .15s; }

/* iPad：更宽的留白、更大的字 */
@media (min-width: 700px) {
  :root { --fs: 19px; }
  .page { padding-left: 48px; padding-right: 48px; }
  .chap-head { padding-top: 40px; }
}
/* 电脑 / iPad 横屏：目录常驻左侧 */
@media (min-width: 1180px) {
  .toc { transform: none; width: var(--toc-w); box-shadow: none; z-index: 20; }
  .toc-close, .toc-btn, .scrim { display: none; }
  .topbar { left: var(--toc-w); }
  .page { margin-left: var(--toc-w); }
  .top-title { align-items: flex-start; padding-left: 12px; }
}
@media print { body * { display: none !important; } body::after { content: "本内容不支持打印"; display: block !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ========== 管理后台 ========== */
.admin { font-size: 14px; }
.admin-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--accent); }
.admin-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.admin-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; text-decoration: none; color: var(--text-2); white-space: nowrap; }
.admin-nav a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.admin-top-r { display: flex; align-items: center; gap: 4px; }
.link-muted { color: var(--muted); text-decoration: none; font-size: 13px; }
.link-muted:hover { color: var(--text); }
.admin-main { max-width: 1200px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); display: grid; gap: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; }
.stat-k { color: var(--muted); font-size: 13px; }
.stat-v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); }
.stat-danger .stat-v { color: var(--danger); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; min-width: 0; }
.panel h2 { margin: 0; font-size: 16px; }
.panel h3 { margin: 22px 0 4px; font-size: 15px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.gen > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; cursor: pointer; list-style: none; font-weight: 600; }
.gen > summary::-webkit-details-marker { display: none; }
.gen > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.gen[open] > summary::before { content: "−"; }
.gen > summary .muted { font-weight: 400; font-size: 13px; }
.gen-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-top: 14px; }
.span2 { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea, .search input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none; }
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.narrow { max-width: 260px; }
.gen-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text-2); font-size: 13px; background: var(--surface-2); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.search { width: min(260px, 100%); }

.table { display: grid; }
.row { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(150px, 1.4fr) minmax(110px, 1fr) minmax(90px, .8fr) 120px; gap: 12px; align-items: center; padding: 12px 10px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
a.row:hover { background: var(--surface-2); }
.row.head { border-top: 0; padding-top: 4px; padding-bottom: 8px; font-size: 12px; color: var(--muted); }
.row > span { min-width: 0; }
.c-main, .c-seen, .c-dev { display: flex; flex-direction: column; gap: 2px; }
.c-note { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-code { font-size: 12.5px; color: var(--muted); }
.c-dev { flex-direction: row; align-items: center; gap: 8px; }
.dev-count { flex: none; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.dev-count.full { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.c-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
.empty { margin: 8px 0; padding: 20px; text-align: center; color: var(--muted); }
.batch-text { width: 100%; margin: 6px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13px; line-height: 1.7; resize: vertical; }
.panel .table .row:has(.c-link) { grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto; }

.back { color: var(--muted); text-decoration: none; font-size: 13px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.detail-head h1 { margin: 0; font-size: 24px; }
.big-code { margin: 4px 0 8px; font-size: 18px; color: var(--text-2); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions form { margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-all { grid-column: 1 / -1; }

.device { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.device:first-of-type { border-top: 0; padding-top: 4px; }
.device.removed { opacity: .6; }
.device-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); flex: none; }
.device-body { flex: 1; min-width: 0; }
.device-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.device-act { margin: 0; }
.removed-list > summary, .danger-zone > summary { margin-top: 10px; cursor: pointer; color: var(--muted); font-size: 13px; }
.danger-zone form { margin-top: 10px; }

.alert { padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; border: 1px solid var(--line); border-left-width: 4px; }
.alert.lv1 { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.alert.lv2 { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.alert.resolved { opacity: .55; background: transparent; }
.alert-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.alert p { margin: 6px 0; overflow-wrap: anywhere; }
.alert a { text-decoration: none; }
.alert form { margin: 4px 0 0; }

.events .row { grid-template-columns: 140px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr); font-size: 13px; }
.row-danger { background: color-mix(in srgb, var(--danger-soft) 50%, transparent); }

.rules { display: grid; gap: 10px; margin: 14px 0 18px; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch em { font-style: normal; font-size: 13px; color: var(--muted); }

/* 后台：iPad 竖屏及以下 */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main tags" "dev dev" "seen prog"; gap: 6px 12px; }
  .row.head { display: none; }
  .row > .c-main { grid-area: main; }
  .row > .c-tags { grid-area: tags; justify-content: flex-end; }
  .row > .c-dev { grid-area: dev; }
  .row > .c-seen { grid-area: seen; flex-direction: row; gap: 8px; font-size: 13px; }
  .row > .c-prog { grid-area: prog; text-align: right; font-size: 13px; }
  .panel .table .row:has(.c-link) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main tags" "link link"; }
  .row > .c-link { grid-area: link; font-size: 12px; color: var(--muted); }
  .events .row { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 2px; }
  .events .row > span { grid-area: auto; text-align: left; }
}
@media (max-width: 560px) {
  .admin-top { flex-wrap: wrap; gap: 8px 12px; }
  .admin-nav { order: 3; flex-basis: 100%; }
  .admin-top-r { margin-left: auto; }
  .gen-form { grid-template-columns: minmax(0, 1fr); }
  .stat-v { font-size: 24px; }
  .panel { padding: 16px; border-radius: 16px; }
  .rule { flex-direction: column; align-items: flex-start; }
  .search { width: 100%; }
}

/* ========== 用户主页（我的文档） ========== */
.home { min-height: 100vh; min-height: 100dvh; background: radial-gradient(1200px 520px at 50% -12%, var(--accent-soft), transparent 62%), var(--bg); }
.home-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
.home-main { max-width: 1080px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.home-hero { padding: 20px 4px 22px; }
.home-hero h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: .03em; }
.home-hero p { margin: 0; }
.home-hero .form-error { margin-top: 14px; max-width: 560px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.doc-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.doc-cover { position: relative; display: flex; align-items: flex-end; height: 148px; padding: 18px 20px; text-decoration: none; color: #fff; background:
  radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.22), transparent 55%),
  repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 2px, transparent 2px 14px),
  linear-gradient(135deg, var(--c1, #B0505B), var(--c2, #6E2733)); }
.doc-cover-t { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 30px; font-weight: 700; letter-spacing: .12em; text-shadow: 0 2px 12px rgba(0,0,0,.18); }
.doc-card.locked .doc-cover { background: repeating-linear-gradient(135deg, rgba(255,255,255,.04) 0 2px, transparent 2px 14px), linear-gradient(135deg, #8F8780, #5E5852); }
.doc-lock { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.18); }
.doc-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.doc-title { margin: 0; font-size: 20px; line-height: 1.35; }
.doc-title a { text-decoration: none; }
.doc-meta { margin: 0; font-size: 13px; color: var(--muted); }
.doc-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.doc-progress .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.doc-progress .bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.doc-last { margin: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-body .btn { margin-top: auto; }
.doc-body .doc-progress + .btn, .doc-last + .btn { margin-top: 8px; }
.doc-toc-link { align-self: center; font-size: 13px; color: var(--muted); text-decoration: none; }
.doc-toc-link:hover { color: var(--text); }
.doc-blocked { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.unlock { display: grid; grid-template-columns: 1fr minmax(0, 360px); align-items: center; gap: 16px 32px; margin-top: 28px; padding: 22px 24px; background: var(--surface); border: 1px dashed var(--line); border-radius: 20px; scroll-margin-top: 80px; }
.unlock h2 { margin: 0 0 4px; font-size: 18px; }
.unlock p { margin: 0; font-size: 14px; }
.unlock .code-input { height: 48px; font-size: 17px; }
@media (max-width: 720px) {
  .unlock { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .home-hero h1 { font-size: 26px; }
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-cover { height: 128px; }
}

/* 阅读页目录里的「我的文档」 */
.toc-home { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 10px -4px; padding: 4px 8px 4px 2px; border-radius: 8px; font-size: 13px; color: var(--muted); text-decoration: none; }
.toc-home:hover { color: var(--accent); background: var(--surface-2); }
.toc-home svg { width: 16px; height: 16px; }
.topbar a.icon-btn { text-decoration: none; }

/* ========== 排版风格（html[data-style]，不设置时就是「经典」） ========== */
.prose p.solo { text-align: left; }

/* A 留白：段距拉开、字距放松、正文深灰、重点只变色 */
:root[data-style="air"] .article, :root[data-style="air"] .pager { max-width: min(700px, calc(var(--fs) * 32 + 40px)); }
:root[data-style="air"] .prose { line-height: 2.05; letter-spacing: .05em; color: var(--text-2); }
:root[data-style="air"] .prose p { margin-bottom: 1.6em; text-align: left; }
:root[data-style="air"] .prose h2 { margin: 3.2em 0 1.2em; font-size: 1.24em; letter-spacing: .04em; color: var(--text); }
:root[data-style="air"] .prose h3 { margin: 2.6em 0 1em; color: var(--text); }
:root[data-style="air"] .prose strong { background: none; color: var(--accent); font-weight: 600; }
:root[data-style="air"] .prose li { margin: .6em 0; }
:root[data-style="air"] .prose blockquote { margin: 2em 0; padding: .2em 0 .2em 1.2em; border-left: 2px solid var(--line); border-radius: 0; background: none; }

/* B 书卷：纸色背景、宋体、首行缩进 */
:root[data-style="book"] {
  --bg: #F3EBDD; --surface: #FAF5EC; --surface-2: #F6EFE2; --line: #E3D6C0;
  --text: #3A3126; --text-2: #574B3C; --muted: #9A8C76;
  --accent: #8A5A2B; --accent-soft: #EEE0CA; --on-accent: #FFFFFF;
  --wm: rgba(90, 65, 35, .08);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="book"]:not([data-theme="light"]) {
    --bg: #191511; --surface: #221D17; --surface-2: #29231C; --line: #3A3128;
    --text: #DDD0BC; --text-2: #C2B49E; --muted: #8F826F;
    --accent: #D2A46E; --accent-soft: #3A2E20; --on-accent: #1F1A14;
  }
}
:root[data-style="book"][data-theme="dark"] {
  --bg: #191511; --surface: #221D17; --surface-2: #29231C; --line: #3A3128;
  --text: #DDD0BC; --text-2: #C2B49E; --muted: #8F826F;
  --accent: #D2A46E; --accent-soft: #3A2E20; --on-accent: #1F1A14;
}
:root[data-style="book"] .chap-head h1, :root[data-style="book"] .prose { font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif; }
:root[data-style="book"] .chap-head { text-align: center; }
:root[data-style="book"] .prose { line-height: 2; letter-spacing: .04em; }
:root[data-style="book"] .prose > p { margin-bottom: 1.3em; text-align: left; }
:root[data-style="book"] .prose li { margin: .5em 0; }
:root[data-style="book"] .prose h2 { margin: 3em 0 1.3em; text-align: center; font-size: 1.22em; }
:root[data-style="book"] .prose h3 { text-align: center; }
:root[data-style="book"] .prose strong { background: none; font-weight: 700; color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }
:root[data-style="book"] .prose blockquote { margin: 1.8em 0; border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 0; background: none; padding: .2em 0 .2em 1.1em; color: var(--text-2); }

/* C 金句：引用变卡片，单独一句的加粗变居中金句 */
:root[data-style="card"] .prose { line-height: 1.95; letter-spacing: .04em; }
:root[data-style="card"] .prose p { margin-bottom: 1.4em; }
:root[data-style="card"] .prose h2 { margin: 3em 0 1.1em; padding-left: .7em; border-left: 3px solid var(--accent); line-height: 1.4; }
:root[data-style="card"] .prose h2::before { display: none; }
:root[data-style="card"] .prose strong { background: none; font-weight: 600; color: var(--text); }
:root[data-style="card"] .prose blockquote { margin: 1.8em 0; padding: 1.1em 1.3em; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); }
:root[data-style="card"] .prose p.solo { margin: 2em 0; padding: .9em .5em; text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif; font-size: 1.1em; line-height: 1.7; }
:root[data-style="card"] .prose p.solo strong { color: var(--accent); font-weight: 700; }

/* ========== 划线和笔记 ========== */
.prose mark.hl { background: none; color: inherit; padding: 0; border-radius: 0; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 2px; text-underline-offset: .28em; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; background-image: linear-gradient(color-mix(in srgb, var(--accent) 9%, transparent), color-mix(in srgb, var(--accent) 9%, transparent)); cursor: pointer; }
.prose mark.hl.has-note { text-decoration-style: wavy; text-decoration-thickness: 1.5px; }
.prose mark.hl.flash { animation: flash 1.6s ease; }
.sel-menu { position: absolute; z-index: 40; display: flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--text); box-shadow: var(--shadow); }
.sel-menu[hidden], .sheet[hidden] { display: none; }
.sel-menu button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--bg); font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.sel-menu button { position: relative; }
.sel-menu button + button::before { content: ""; position: absolute; left: -1px; top: 28%; bottom: 28%; width: 1px; background: color-mix(in srgb, var(--bg) 22%, transparent); }
.sel-menu button:active { background: color-mix(in srgb, var(--bg) 16%, transparent); }

.notes { position: fixed; z-index: 50; top: 0; bottom: 0; right: 0; width: min(90vw, 400px); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); transform: translateX(102%); transition: transform .3s cubic-bezier(.2,.8,.2,1); padding-top: env(safe-area-inset-top); padding-right: env(safe-area-inset-right); }
.notes.open { transform: none; box-shadow: var(--shadow); }
.notes-head { display: flex; align-items: flex-start; gap: 8px; padding: 22px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.notes-head > div { flex: 1; min-width: 0; }
.notes-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 16px; overscroll-behavior: contain; }
.notes-list .empty { margin: 40px 8px; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.8; }
.notes-chap { margin: 18px 4px 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.note-item { padding: 12px 14px 8px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.note-q { margin: 0; padding-left: 10px; border-left: 2px solid var(--accent); font-size: 14.5px; line-height: 1.75; color: var(--text); }
.note-t { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; }
.note-t::before { content: "笔记："; color: var(--accent); }
.note-act { display: flex; justify-content: flex-end; gap: 2px; margin-top: 6px; }
.note-act button { padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.note-act button:hover { background: var(--surface); color: var(--text); }
.notes-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.notes-foot .btn { padding: 0 6px; }

.sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 10, 5, .38); }
.sheet-card { width: 100%; max-width: 560px; padding: 18px 18px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); animation: up .25s ease; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-card { border-radius: 18px; } }
.sheet-quote { margin: 0 0 12px; padding: 2px 0 2px 12px; border-left: 2px solid var(--accent); color: var(--text-2); font-size: 14px; line-height: 1.7; max-height: 30vh; overflow-y: auto; }
.sheet textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 16px; line-height: 1.6; resize: vertical; outline: none; }
.sheet textarea:focus { border-color: var(--accent); }
.sheet-act { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.sheet-act span { flex: 1; }
@media print { .notes, .sel-menu, .sheet { display: none !important; } }
.note-row { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.7; }
.notes.open ~ .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
.sel-layer { position: absolute; top: 0; left: 0; width: 0; height: 0; z-index: 15; pointer-events: none; }
.sel-layer i { position: absolute; border-radius: 3px; background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ========== 其他设备在读时的遮罩 ========== */
.pause { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.pause[hidden] { display: none; }
.pause-card { width: 100%; max-width: 360px; padding: 32px 24px 24px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.pause-card h2 { margin: 0 0 8px; font-size: 20px; }
.pause-by { margin: 0 0 22px; color: var(--text-2); font-size: 14px; }
.pause-note { margin: 16px 0 0; color: var(--muted); font-size: 12.5px; }
body.paused { overflow: hidden; }
body.paused .prose, body.paused .pager, body.paused .notes-list { visibility: hidden; }

/* 后台：文档多选 */
.doc-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-checks .check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.doc-checks .check input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.doc-checks .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.doc-checks em { font-style: normal; font-size: 12px; }

/* ========== 后台：开通方式 ========== */
.access { display: grid; gap: 10px; }
.access-kind { display: flex; flex-wrap: wrap; gap: 8px; }
.access-kind .check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.access-kind .check input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.access-kind .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.access-kind em { font-style: normal; font-size: 12px; }
.doc-checks[hidden] { display: none; }
.field.is-off { opacity: .45; }
.tag-member { background: color-mix(in srgb, #B8862F 16%, transparent); color: #9A6B1F; border: 1px solid color-mix(in srgb, #B8862F 35%, transparent); }
:root[data-theme="dark"] .tag-member { color: #E2B866; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag-member { color: #E2B866; } }
.c-code { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.c-code .tag { padding: 0 7px; font-size: 11px; }

/* ========== 学员书架 ========== */
:root { --shelf-top: #E6D7BF; --shelf-mid: #D5C09E; --shelf-edge: #BFA77F; }
:root[data-theme="dark"] { --shelf-top: #3B3229; --shelf-mid: #30281F; --shelf-edge: #221C16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --shelf-top: #3B3229; --shelf-mid: #30281F; --shelf-edge: #221C16; } }
.home-hero h1 { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; letter-spacing: .08em; }
.all-badge { display: inline-block; margin-right: 8px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #9A6B1F; background: color-mix(in srgb, #B8862F 16%, transparent); border: 1px solid color-mix(in srgb, #B8862F 35%, transparent); vertical-align: 1px; }

.resume { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.resume-cover { flex: none; display: grid; place-items: center; width: 44px; height: 60px; border-radius: 3px 6px 6px 3px; color: rgba(255,255,255,.92); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 18px; background: linear-gradient(90deg, rgba(0,0,0,.22) 0 4px, rgba(255,255,255,.12) 4px 5px, transparent 5px), linear-gradient(160deg, var(--c1), var(--c2)); box-shadow: 0 4px 10px -4px rgba(0,0,0,.35); }
.resume-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.resume-k { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.resume-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-go { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.resume-go svg, .book-lock svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.shelf { --gap-x: 26px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(124px, calc((100% - 2 * var(--gap-x)) / 3)), 1fr)); gap: 30px var(--gap-x); padding: 30px 22px 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.book { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.book-stand { position: relative; display: block; padding: 0 8%; }
/* 书架隔板：每本书下面一块，向两边延伸到整行，被书架容器裁掉 */
.book-stand::after { content: ""; position: absolute; left: -100vw; right: -100vw; bottom: -10px; height: 10px; background: linear-gradient(var(--shelf-top) 0 3px, var(--shelf-mid) 3px 7px, var(--shelf-edge) 7px); z-index: 0; }
.book-cover { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; aspect-ratio: 3 / 4.1; padding: 12% 10% 9%; border-radius: 3px 8px 8px 3px; color: #fff;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28) 0 6%, rgba(255,255,255,.16) 6% 7%, rgba(0,0,0,.05) 7% 9%, transparent 9%),
    radial-gradient(120% 80% at 70% 10%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 10px 18px -8px rgba(30,15,5,.55), 0 2px 4px rgba(30,15,5,.18);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.book-cover::before { content: ""; position: absolute; inset: 7% 8% 6% 13%; border: 1px solid rgba(255,255,255,.28); border-radius: 2px; pointer-events: none; }
.book-brand { position: relative; font-size: 10px; letter-spacing: .3em; opacity: .8; white-space: nowrap; }
.book-title { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; margin: 6% 0; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-weight: 700; font-size: clamp(14px, 3.8vw, 21px); letter-spacing: .06em; line-height: 1.45; text-align: center; text-wrap: wrap; text-shadow: 0 2px 8px rgba(0,0,0,.25); overflow: hidden; word-break: break-all; }
.book-foot { position: relative; font-size: 10px; letter-spacing: .2em; opacity: .75; }
.book-lock { position: absolute; z-index: 2; bottom: 6%; right: 8%; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.22); color: #fff; }
.book-lock svg { width: 15px; height: 15px; }
.book-new { position: absolute; z-index: 3; top: -9px; right: -7px; padding: 2px 8px; border-radius: 999px; background: #E8B44C; color: #4A3209; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; box-shadow: 0 3px 8px -2px rgba(0,0,0,.3); }
.book:hover .book-cover, .book:focus-visible .book-cover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 16px 24px -10px rgba(30,15,5,.6), 0 2px 4px rgba(30,15,5,.18); }
.book:active .book-cover { transform: translateY(-1px); }
.book-info { display: flex; flex-direction: column; gap: 3px; padding: 4px 8% 0; }
.book-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.book-sub { font-size: 12px; color: var(--muted); }
.book-bar { display: block; height: 3px; margin-top: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.book-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
/* 未开通：置灰 */
.book.locked .book-cover { filter: grayscale(1) brightness(1.05) contrast(.85); opacity: .55; }
.book.locked .book-name { color: var(--muted); }
.book.locked:hover .book-cover { opacity: .7; }

.unlock { border-style: dashed; box-shadow: none; }

/* 未开通弹窗 */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(15, 10, 5, .45); animation: fade .2s ease; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 360px; padding: 28px 22px 20px; text-align: center; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); animation: up .25s ease; }
.modal-card h2 { margin: 0 0 10px; font-size: 19px; line-height: 1.4; }
.modal-text { margin: 0 0 18px; color: var(--text-2); font-size: 14.5px; line-height: 1.75; white-space: pre-line; }
.wx-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px 0 18px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.wx-row[hidden] { display: none; }
.wx-row b { font-size: 15px; letter-spacing: .04em; }
.modal-card .btn + .btn { margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 520px) {
  .shelf { --gap-x: 16px; padding: 24px 14px 22px; gap: 26px var(--gap-x); }
  .book-stand { padding: 0 6%; }
  .book-info { padding: 2px 6% 0; }
  .book-name { font-size: 13.5px; }
}
.wx-row > span, .wx-row .btn { flex: none; white-space: nowrap; }
.wx-row b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== 联系郑大钱 ========== */
.contact { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); text-align: left; }
.contact-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.contact-name { font-weight: 700; font-size: 15.5px; letter-spacing: .04em; }
.contact-wx { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-wx b { color: var(--text); font-size: 13px; letter-spacing: .04em; -webkit-user-select: all; user-select: all; }
.contact-copy { flex: none; min-height: 36px; padding: 0 14px; border-radius: 10px; white-space: nowrap; }
.contact-copy.done { background: var(--ok); border-color: var(--ok); }
.contact-card { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.contact-card h2 { margin: 0 0 14px; font-size: 17px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; letter-spacing: .06em; }
.contact-tip { margin: 12px 2px 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.modal-lock { display: inline-grid; place-items: center; width: 46px; height: 46px; margin-bottom: 12px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.modal-lock svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.modal-card [data-contact-box] { margin-bottom: 14px; }
@media (max-width: 380px) {
  .contact { flex-wrap: wrap; }
  .contact-copy { width: 100%; }
}

/* 书架页左上角：头像 + 学习库名字 */
.brand-home { gap: 10px; color: var(--text); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 17px; letter-spacing: .06em; }
.brand-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ========== 首次输码页 ========== */
.landing { background:
  radial-gradient(900px 520px at 50% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
  radial-gradient(600px 400px at 100% 100%, color-mix(in srgb, #B8862F 10%, transparent), transparent 60%),
  var(--bg); }
.landing-main { padding-top: 0; }
.welcome { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; }
.welcome-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 18px; }
.welcome-avatar { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent), 0 10px 24px -8px rgba(60, 30, 20, .45); }
.welcome-name { margin: 14px 0 2px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 22px; font-weight: 700; letter-spacing: .1em; color: var(--text); }
.welcome-tag { margin: 0; font-size: 12px; letter-spacing: .32em; color: var(--muted); }

/* 卡片上方的一小排书 */
.mini-shelf { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; height: 104px; margin-bottom: -30px; }
.mini-book { --w: 70px; position: relative; display: flex; justify-content: center; width: var(--w); height: 98px; margin: 0 -4px; padding: 10px 6px 0 11px; border-radius: 2px 5px 5px 2px; color: rgba(255,255,255,.92);
  background: linear-gradient(90deg, rgba(0,0,0,.25) 0 5px, rgba(255,255,255,.14) 5px 6px, transparent 6px), linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 10px 18px -8px rgba(30,15,5,.55), 0 1px 0 rgba(255,255,255,.2) inset;
  transform: rotate(calc(var(--i) * 14deg)) translateY(calc(var(--i) * var(--i) * 8px)); transform-origin: 50% 100%; }
.mini-book span { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 11px; font-weight: 700; line-height: 1.3; letter-spacing: .04em; text-align: center; text-wrap: wrap; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; height: fit-content; }

.landing-card { position: relative; z-index: 2; padding: 40px 24px 22px; border-radius: 24px; }
.landing-title { margin: 0 0 6px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 22px; letter-spacing: .06em; }
.landing-sub { margin: 0 0 22px; font-size: 13.5px; }
.code-form { gap: 10px; text-align: left; }
.code-label { font-size: 12px; font-weight: 600; letter-spacing: .2em; color: var(--muted); padding-left: 4px; }
.code-field { position: relative; }
.code-field .code-input { height: 58px; padding: 0 18px; text-align: center; font-size: 22px; font-weight: 600; letter-spacing: .2em; border-radius: 16px; }
.code-field .code-input::placeholder { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; color: color-mix(in srgb, var(--muted) 55%, transparent); }
.code-field .code-input.filled { border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.code-paste { position: absolute; top: 9px; right: 9px; bottom: 9px; display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; border: 0; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.code-paste:active { transform: scale(.97); }
.code-paste svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.code-hint { margin: -2px 4px 0; font-size: 12.5px; line-height: 1.6; color: var(--accent); }
.code-hint[hidden] { display: none; }
.code-go { height: 52px; margin-top: 4px; font-size: 16px; letter-spacing: .12em; border-radius: 16px; box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--accent) 80%, transparent); }
.landing-notes { margin: 20px 0 0; padding: 16px 2px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.landing-notes li { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.6; }
.landing-notes li::before { display: none; }
.landing-notes svg { flex: none; width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.landing-contact { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; margin-top: 18px; font-size: 13px; text-align: center; }
.wx-chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer; }
.wx-chip b { color: var(--accent); letter-spacing: .04em; }
.wx-chip.done { border-color: var(--ok); color: var(--ok); }

/* ========== 书架顶部：问候 + 身份 ========== */
.greet { padding: 18px 2px 6px; }
.greet-row { display: flex; align-items: center; gap: 12px; }
.greet-avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 21px; font-weight: 700; }
.greet-avatar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.is-member .greet-avatar { background: linear-gradient(145deg, #3A2E1E, #17120B); color: #F2D28B; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px #C9A15A; }
.greet-text { flex: 1; min-width: 0; }
.greet-hi { margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .06em; }
.greet-name { margin: 2px 0 0; font-size: 24px; line-height: 1.25; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; letter-spacing: .04em; }
.nick-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.nick-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nick-btn svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tier-badge { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.tier-badge svg { width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 1; stroke-linejoin: round; }
.tier-member { color: #3A2A0E; background: linear-gradient(135deg, #F7E2A8, #D9A94F 55%, #F3D58E); box-shadow: 0 4px 12px -4px rgba(185, 134, 47, .6), inset 0 1px 0 rgba(255,255,255,.6); }
.tier-single { color: var(--accent); background: var(--accent-soft); }

/* 黑金会员卡 */
.vip-card { position: relative; overflow: hidden; margin: 16px 0 6px; padding: 18px 20px 16px; border-radius: 18px; color: #F3DFAE;
  background: radial-gradient(120% 140% at 100% 0%, rgba(217, 169, 79, .32), transparent 55%), linear-gradient(135deg, #2B2216 0%, #15110B 60%, #231B10 100%);
  box-shadow: 0 18px 36px -18px rgba(20, 12, 4, .8), inset 0 0 0 1px rgba(233, 196, 116, .35); }
.vip-card::before { content: ""; position: absolute; inset: 7px; border-radius: 13px; border: 1px solid rgba(233, 196, 116, .18); pointer-events: none; }
.vip-shine { position: absolute; top: -50%; left: -40%; width: 40%; height: 200%; background: linear-gradient(100deg, transparent, rgba(255, 236, 190, .22), transparent); transform: rotate(18deg); animation: vipShine 5.5s ease-in-out 1s infinite; pointer-events: none; }
@keyframes vipShine { 0% { left: -40%; } 45%, 100% { left: 130%; } }
.vip-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vip-brand { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: .28em; }
.vip-brand svg { width: 16px; height: 16px; fill: #E9C474; stroke: #E9C474; stroke-width: 1; }
.vip-no { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; color: #E9C474; }
.vip-holder { position: relative; margin: 20px 0 16px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 24px; font-weight: 700; letter-spacing: .16em; color: #FFF1CF; text-shadow: 0 1px 0 rgba(0,0,0,.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vip-foot { font-size: 11.5px; letter-spacing: .08em; color: rgba(243, 223, 174, .72); }
.plain-card { display: flex; flex-direction: column; gap: 3px; margin: 16px 0 6px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.plain-card b { font-size: 15px; }
.plain-card span { font-size: 12.5px; color: var(--muted); }
.shelf-title { margin: 22px 4px 12px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 18px; letter-spacing: .1em; }
.home-main .resume { margin-top: 16px; }

/* 改称呼 */
.name-input { width: 100%; height: 48px; margin-bottom: 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 17px; text-align: center; outline: none; }
.name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ========== 欢迎仪式 ========== */
.cel { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 22px; animation: fade .35s ease; }
.cel.out { animation: celOut .38s ease forwards; }
@keyframes celOut { to { opacity: 0; transform: scale(1.02); } }
.cel-warm { background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cel-gold { background: radial-gradient(90% 60% at 50% 30%, rgba(80, 58, 24, .55), transparent 70%), rgba(10, 8, 5, .9); }
.cel-fx { position: absolute; inset: 0; pointer-events: none; }
.cel-card { position: relative; width: 100%; max-width: 340px; padding: 30px 22px 20px; border-radius: 26px; text-align: center; background: var(--surface); box-shadow: 0 30px 60px -20px rgba(30, 15, 5, .45); animation: celIn .6s cubic-bezier(.2, .9, .25, 1.15); }
@keyframes celIn { from { opacity: 0; transform: translateY(18px) scale(.94); } }
.cel-gold .cel-card { color: #F6E6C0; background: linear-gradient(160deg, #2E2417, #15110B 70%); box-shadow: 0 30px 70px -20px rgba(0,0,0,.8), inset 0 0 0 1px rgba(233, 196, 116, .45); }
.cel-crown { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #F7E2A8, #D9A94F); box-shadow: 0 8px 20px -6px rgba(217, 169, 79, .8); }
.cel-crown svg { width: 24px; height: 24px; fill: #4A3209; stroke: #4A3209; stroke-width: 1; }
.cel-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }
.cel-gold .cel-avatar { margin-top: 10px; box-shadow: 0 0 0 3px #1C160E, 0 0 0 5px #D9A94F; }
.cel-kicker { margin: 14px 0 4px; font-size: 12px; letter-spacing: .24em; color: var(--muted); }
.cel-gold .cel-kicker { color: #CDB07A; }
.cel-title { margin: 0 0 12px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 23px; line-height: 1.4; letter-spacing: .06em; }
.cel-gold .cel-title { color: #FFF1CF; }
.cel-line { margin: 12px 0 0; font-size: 14px; line-height: 1.7; color: var(--text-2); }
.cel-gold .cel-line { color: rgba(246, 230, 192, .82); }
.cel-no { margin: 8px 0 0; font-size: 12.5px; letter-spacing: .12em; color: #CDB07A; }
.cel-no b { font-family: var(--mono); color: #F2D28B; }
.cel-name { display: grid; gap: 6px; margin: 18px 0 0; text-align: left; font-size: 12.5px; color: var(--muted); }
.cel-gold .cel-name { color: #CDB07A; }
.cel-name input { height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 16px; outline: none; }
.cel-gold .cel-name input { border-color: rgba(233, 196, 116, .35); background: rgba(255, 241, 207, .06); color: #FFF1CF; }
.cel-go { height: 50px; margin-top: 18px; font-size: 16px; letter-spacing: .1em; border-radius: 15px; }
.cel-gold .cel-go { color: #3A2A0E; border-color: transparent; background: linear-gradient(135deg, #F7E2A8, #D9A94F 55%, #F3D58E); box-shadow: 0 10px 24px -10px rgba(217, 169, 79, .9); }
@media (prefers-reduced-motion: reduce) { .vip-shine { animation: none; display: none; } .cel-card { animation: none; } }
.cel-fx { z-index: 3; }

/* 学员头像 */
img.greet-avatar { object-fit: cover; background: var(--surface-2); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.is-member img.greet-avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px #C9A15A, 0 6px 14px -6px rgba(185, 134, 47, .7); }
.greet-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vip-holder { display: flex; align-items: center; gap: 10px; }
.vip-holder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vip-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 2px #1C160E, 0 0 0 3px #D9A94F; }
.cel-avatar { width: 72px; height: 72px; background: #fff; }
.detail-title { display: flex; align-items: center; gap: 10px; }
.detail-avatar { width: 40px; height: 40px; border-radius: 50%; }

.code-field.has-paste .code-input { padding: 0 92px 0 18px; text-align: left; }
.code-paste[hidden] { display: none; }
.code-hint.soft { color: var(--muted); }
.vip-foot { flex-wrap: nowrap; font-size: clamp(10px, 2.9vw, 11.5px); letter-spacing: .04em; }
.vip-foot span { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vip-foot span:first-child { flex: none; }

/* ========== 防止只剩一两个字单独换行 ==========
   短的说明文字：各行长度均衡（balance）；正文段落：避免最后一行只剩一个字（pretty）；
   单行标签类：不换行，放不下就省略号 */
p, li, .modal-text, .contact-tip, .cel-line, .landing-sub, .code-hint, .plain-card span, .landing-notes span, .book-sub, .greet-hi, .welcome-tag { text-wrap: wrap; }
.contact-tip, .cel-line, .cel-title, .modal-text, .book-name, .modal-card h2, .landing-sub, .landing-title, .code-hint, .landing-notes span, .plain-card span, .contact-card h2, .shelf-title, .form-error, .pause-card h2, .pause-note, .empty, .toast span { text-wrap: wrap; }
.resume-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 书名固定占两行高度，一行的书名也留出第二行，这样同一排书的「已读 / 未开始」和进度条水平对齐 */
.book-name { min-height: calc(1.35em * 2); }

/* ========== 书架按系列分排 ========== */
.series-row { display: block; padding: 18px 20px 22px; margin-bottom: 16px; }
.series-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 18px; }
.series-head h3 { margin: 0; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 17px; letter-spacing: .08em; display: flex; align-items: center; gap: 8px; }
.series-head h3::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--sc); }
.series-chip { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.series-chip.some { background: var(--accent-soft); color: var(--accent); }
.series-chip.all { color: #6B4A12; background: color-mix(in srgb, #D9A94F 22%, transparent); border: 1px solid color-mix(in srgb, #D9A94F 45%, transparent); }
.series-chip.none { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
:root[data-theme="dark"] .series-chip.all { color: #E9C474; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .series-chip.all { color: #E9C474; } }
.shelf-books { --gap-x: 26px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(124px, calc((100% - 2 * var(--gap-x)) / 3)), 1fr)); gap: 30px var(--gap-x); }
@media (max-width: 520px) { .series-row { padding: 16px 14px 18px; } .shelf-books { --gap-x: 16px; gap: 26px var(--gap-x); } }

/* ========== 封面：奶油撞色 ========== */
.book-cover.cover-b { align-items: stretch; justify-content: space-between; padding: 13% 11% 10% 17%; color: #2B2420; border-radius: 2px 6px 6px 2px;
  background: linear-gradient(90deg, var(--sc) 0 8%, rgba(0,0,0,.12) 8% 9%, transparent 9%), linear-gradient(160deg, #FBF7F0, #F1E9DC);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 18px -8px rgba(30,15,5,.4), 0 2px 4px rgba(30,15,5,.14); }
.book-cover.cover-b::before { display: none; }
.cb-series { font-size: 9.5px; font-weight: 700; letter-spacing: .22em; color: var(--sc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-title { flex: 1; margin: 9% 0 6%; padding-top: 9%; border-top: 1.5px solid var(--sc); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-weight: 700; line-height: 1.32; letter-spacing: .02em; color: #2B2420; text-wrap: wrap; word-break: break-all; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.cb-title.t-xs { font-size: clamp(22px, 6vw, 28px); }
.cb-title.t-s { font-size: clamp(17px, 4.8vw, 22px); }
.cb-title.t-m { font-size: clamp(14px, 3.9vw, 17px); }
.cb-title.t-l { font-size: clamp(12.5px, 3.4vw, 15px); }
.cb-title.t-xl { font-size: clamp(11px, 3vw, 13px); }
.cb-no { align-self: flex-end; font-family: Georgia, "Times New Roman", serif; font-size: clamp(20px, 5.4vw, 26px); line-height: 1; color: var(--sc); opacity: .9; }
.cover-b .book-lock { background: rgba(43, 36, 32, .12); color: #2B2420; left: 17%; right: auto; }
.book.locked .book-cover.cover-b { filter: grayscale(1) contrast(.9); opacity: .5; }

/* 继续阅读小封面 */
.resume-cover { color: var(--sc); font-family: Georgia, serif; font-size: 16px; background: linear-gradient(90deg, var(--sc) 0 6px, rgba(0,0,0,.12) 6px 7px, transparent 7px), linear-gradient(160deg, #FBF7F0, #F1E9DC); }
/* 输码页卡片上方的小书 */
.mini-book { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px; padding: 10px 7px 0 13px; color: #2B2420; text-align: left;
  background: linear-gradient(90deg, var(--sc) 0 6px, rgba(0,0,0,.12) 6px 7px, transparent 7px), linear-gradient(160deg, #FBF7F0, #F1E9DC); }
.mini-book em { font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: .15em; color: var(--sc); white-space: nowrap; overflow: hidden; }
.mini-book span { text-align: left; border-top: 1px solid var(--sc); padding-top: 4px; color: #2B2420; }
/* 封面排版收紧：保证 3 列手机上长书名也能完整显示 */
.book-cover.cover-b { padding: 11% 8% 9% 15%; }
.cb-title { margin: 7% 0 4%; padding-top: 7%; line-height: 1.3; -webkit-line-clamp: 6; }
.cb-title.t-xs { font-size: clamp(20px, 5.6vw, 28px); }
.cb-title.t-s { font-size: clamp(15px, 4.2vw, 21px); }
.cb-title.t-m { font-size: clamp(12.5px, 3.45vw, 16px); }
.cb-title.t-l { font-size: clamp(11.5px, 3.1vw, 14.5px); }
.cb-title.t-xl { font-size: clamp(10.5px, 2.85vw, 13px); line-height: 1.25; }
.cb-no { font-size: clamp(17px, 4.6vw, 24px); }
.cover-b .book-lock { left: auto; right: auto; position: static; display: inline-grid; width: 20px; height: 20px; border-radius: 6px; margin-right: auto; }
.cover-b .book-lock svg { width: 12px; height: 12px; }
.cb-foot { display: flex; align-items: flex-end; justify-content: space-between; }
.cb-no { margin-left: auto; }
.cb-title.t-s { font-size: clamp(13.5px, 3.65vw, 21px); }
.cb-title.t-xl { font-size: clamp(10px, 2.65vw, 13px); -webkit-line-clamp: 7; }

/* ========== 封面：经典精装（取代奶油撞色） ========== */
.book-cover.cover-a { container-type: inline-size; align-items: center; justify-content: space-between; padding: 12% 9% 9% 15%; text-align: center; color: #fff; border-radius: 2px 6px 6px 2px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28) 0 7%, rgba(255,255,255,.16) 7% 8%, rgba(0,0,0,.05) 8% 10%, transparent 10%),
    radial-gradient(120% 80% at 75% 8%, rgba(255,255,255,.16), transparent 60%),
    linear-gradient(160deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #120808));
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 10px 18px -8px rgba(30,15,5,.55), 0 2px 4px rgba(30,15,5,.18); }
.book-cover.cover-a::before { content: ""; display: block; position: absolute; inset: 6% 6% 5% 13%; border: 1px solid rgba(255,255,255,.3); border-radius: 2px; pointer-events: none; }
.ca-series { position: relative; max-width: 100%; font-size: max(7.5px, 8.5cqw); letter-spacing: .2em; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-title { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; margin: 6% 0; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-weight: 700; line-height: 1.32; letter-spacing: .03em; text-shadow: 0 2px 8px rgba(0,0,0,.25); text-wrap: wrap; word-break: break-all; overflow: hidden; }
.ca-title.t-xs { font-size: 26cqw; }
.ca-title.t-s { font-size: 18.5cqw; }
.ca-title.t-m { font-size: 14.5cqw; }
.ca-title.t-l { font-size: 12.5cqw; }
.ca-title.t-xl { font-size: 10.5cqw; line-height: 1.26; }
.ca-foot { position: relative; font-size: max(7.5px, 8cqw); letter-spacing: .25em; opacity: .75; white-space: nowrap; }
.cover-a .book-lock { top: auto; bottom: 5%; right: 6%; left: auto; width: max(16px, 17cqw); height: max(16px, 17cqw); border-radius: 22%; background: rgba(255,255,255,.22); color: #fff; }
.cover-a .book-lock svg { width: 62%; height: 62%; }
.book.locked .book-cover.cover-a { filter: grayscale(1) brightness(1.05) contrast(.85); opacity: .55; }
.resume-cover { color: rgba(255,255,255,.92); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 18px;
  background: linear-gradient(90deg, rgba(0,0,0,.25) 0 4px, rgba(255,255,255,.14) 4px 5px, transparent 5px), linear-gradient(160deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #120808)); }
.mini-book { align-items: center; text-align: center; color: rgba(255,255,255,.92);
  background: linear-gradient(90deg, rgba(0,0,0,.25) 0 5px, rgba(255,255,255,.14) 5px 6px, transparent 6px), linear-gradient(160deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #120808)); }
.mini-book em { color: rgba(255,255,255,.8); }
.mini-book span { text-align: center; border-top: 0; padding-top: 2px; color: #fff; }

/* ========== 一行 4 本 ========== */
.shelf-books { --gap-x: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px var(--gap-x); }
.shelf-books .book-stand { padding: 0 4%; }
.shelf-books .book-info { padding: 2px 4% 0; }
.shelf-books .book-name { font-size: 13px; }
.shelf-books .book-sub { font-size: 11.5px; }
.book-new { top: -8px; right: -6px; padding: 1px 6px; font-size: 9.5px; }
@media (min-width: 720px) { .shelf-books { --gap-x: 26px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 30px var(--gap-x); } .shelf-books .book-name { font-size: 14.5px; } }
@media (max-width: 520px) { .series-row { padding: 16px 12px 18px; } .shelf-books { --gap-x: 10px; gap: 22px var(--gap-x); } }
/* 经典精装：按封面内宽重新分配字号（4 本一行时书名也够大） */
.book-cover.cover-a { padding: 11% 7% 8% 14%; }
.book-cover.cover-a::before { inset: 5% 5% 4% 12%; }
.ca-title { margin: 4% 0; letter-spacing: 0; line-height: 1.28; }
.ca-title.t-xs { font-size: 34cqw; }
.ca-title.t-s { font-size: 24cqw; }
.ca-title.t-m { font-size: 24cqw; }
.ca-title.t-l { font-size: 23cqw; }
.ca-title.t-xl { font-size: 17cqw; line-height: 1.22; }
.ca-series, .ca-foot { font-size: max(7px, 11cqw); letter-spacing: .12em; }
.shelf-books .book-name { font-size: 12px; line-height: 1.35; }
@media (min-width: 720px) { .shelf-books .book-name { font-size: 14px; } }
/* 未开通：册数位置换成小锁，避免小屏上锁和「第几册」挤在一起 */
.book.locked .ca-foot { visibility: hidden; }
.cover-a .book-lock { right: auto; left: calc(50% + 3.5%); transform: translateX(-50%); bottom: 5%; }

/* ========== 书架方案 3：每个系列一行，书多了左右滑 ========== */
.series-row { padding: 0; margin: 0 0 30px; border: 0; background: none; box-shadow: none; }
.series-row .series-head { margin: 0 2px 14px; }
.series-more { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.shelf-scroll { --gap: 12px; display: flex; gap: var(--gap); align-items: flex-start; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 0 0; padding: 4px max(16px, env(safe-area-inset-right)) 10px 2px; -webkit-overflow-scrolling: touch; }
.shelf-scroll::-webkit-scrollbar { display: none; }
.shelf-scroll .book { flex: none; width: calc((100% - 3 * var(--gap) - max(16px, env(safe-area-inset-right))) / 4 + 2px); scroll-snap-align: start; gap: 9px; }
.shelf-scroll .book-stand { padding: 0; }
.shelf-scroll .book-stand::after { display: none; }
.shelf-scroll .book-info { padding: 0; }
.shelf-scroll .book-name { font-size: 12.5px; line-height: 1.35; }
.shelf-scroll .book-sub { font-size: 11.5px; }
.shelf-scroll .book-cover.cover-a { box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 12px 20px -10px rgba(30,15,5,.55), 0 2px 5px rgba(30,15,5,.16); }
@media (min-width: 720px) { .shelf-scroll { --gap: 22px; } .shelf-scroll .book { width: 140px; } .shelf-scroll .book-name { font-size: 14px; } }

/* 书架整体放进一张卡片，和页面其他卡片统一 */
.shelf-card { margin-top: 22px; padding: 18px 16px 6px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.shelf-card .shelf-title { margin: 0 2px 16px; }
.shelf-card .series-row { margin: 0; padding: 16px 0 14px; border-top: 1px solid var(--line); }
.shelf-card .shelf-title + .series-row { padding-top: 0; border-top: 0; }
.shelf-card .shelf-scroll { margin-right: -16px; padding-right: 16px; }
.shelf-card .shelf-scroll .book { width: calc((100% - 3 * var(--gap) - 16px) / 4 + 2px); }
@media (min-width: 720px) { .shelf-card { padding: 22px 24px 8px; } .shelf-card .shelf-scroll { margin-right: -24px; padding-right: 24px; } .shelf-card .shelf-scroll .book { width: 140px; } }

/* 会员卡中间：会员编号当作卡号放大显示（名字只在问候语里出现一次） */
.vip-number { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 500; letter-spacing: .28em; color: #F2D28B; text-shadow: 0 1px 0 rgba(0,0,0,.5); }

/* 「新上线」：封面右上角外侧的小圆标，不压封面文字；滑动行顶部留出空间，不会被裁掉 */
.book-new { top: -7px; right: -7px; left: auto; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; letter-spacing: 0; transform: none; box-shadow: 0 0 0 2px var(--surface), 0 3px 8px -2px rgba(0,0,0,.35); }
.shelf-scroll { padding-top: 10px; padding-left: 4px; }

/* 会员卡：左上角编号，中间放大「终身会员」 */
.vip-no { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; letter-spacing: .16em; color: #E9C474; }
.vip-title { display: flex; align-items: center; gap: 10px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 26px; font-weight: 700; letter-spacing: .3em; color: #F2D28B; }
.vip-title svg { flex: none; width: 24px; height: 24px; fill: #E9C474; stroke: #E9C474; stroke-width: 1; }

/* ========== 电脑端书架页：内容收窄居中，不再被拉满整屏 ========== */
@media (min-width: 720px) {
  body.home .home-main { max-width: 760px; padding-top: 24px; }
  body.home .home-top { max-width: 100%; }
  .shelf-card { padding: 24px 28px 10px; }
  .shelf-card .shelf-scroll { --gap: 24px; margin-right: -28px; padding-right: 28px; }
  .shelf-card .shelf-scroll .book { width: 132px; }
  .shelf-card .series-row { padding: 20px 0 18px; }
  .shelf-scroll .book-name { font-size: 14px; }
  .shelf-scroll .book-sub { font-size: 12.5px; }
  .vip-card { padding: 22px 26px 18px; }
}

/* 电脑（鼠标）上不方便横向滑动：书自动换行全部摆出来 */
@media (min-width: 720px) and (pointer: fine) {
  .shelf-card .shelf-scroll { flex-wrap: wrap; overflow: visible; margin-right: 0; padding-right: 0; row-gap: 28px; }
  .swipe-hint { display: none; }
}

/* Safari 修复：未开通的书是 <button>，Safari 里按钮内容按内容宽度收缩，
   封面设了 container-type 后内容宽度为 0，整本封面消失。这里把宽度写死为 100%。 */
button.book { display: flex; align-items: stretch; }
.book-stand, .book-info { display: block; width: 100%; }
.book-cover { width: 100%; }

/* 单篇学员：提示卡带「联系开通」按钮 */
.plain-card.has-cta { flex-direction: row; align-items: center; gap: 14px; }
.plain-card.has-cta > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.plain-cta { flex: none; white-space: nowrap; min-height: 34px; padding: 0 14px; border-radius: 10px; }

/* 正文不使用「均衡/美化断行」：它会提前断行，再配合两端对齐，字距被拉散（2026-11-14 修复） */
.prose p, .prose li, .prose blockquote, .prose blockquote p { text-wrap: wrap; }

/* 未开通弹窗：书名一行，「还没有开通」一行 */
#lock-title .lt-book { display: block; text-wrap: wrap; }
#lock-title .lt-sub { display: block; margin-top: 2px; font-size: .78em; font-weight: 600; color: var(--text-2); letter-spacing: .08em; }
/* 弹窗里的联系卡：复制按钮单独一行，微信号完整显示不截断 */
.modal-card .contact { flex-wrap: wrap; }
.modal-card .contact-copy { width: 100%; }
.modal-card .contact-wx { white-space: normal; overflow: visible; }

/* 书名前缀（如「模块一」）：书名上方一行小字 */
.book-pre { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--muted); }

/* 系列名旁的说明：共 N 个模块 · 已完结 */
.series-head { flex-wrap: wrap; row-gap: 6px; }
.series-meta { font-size: 12px; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }

/* 系列名 6 个字以上（深度亲密关系）：封面顶部小字收紧，不被截断 */
.ca-series.long { font-size: max(6.5px, 9.2cqw); letter-spacing: .02em; text-overflow: clip; }
.book-cover:has(.book-new) .ca-series.long { margin-right: 22%; }
.nb { white-space: nowrap; }
.ca-lines { display: block; }

/* 会员卡标题：金色徽章 + 渐变金字（字距收紧）+ 英文小字 */
.vip-title { gap: 14px; letter-spacing: 0; margin: 18px 0 16px; }
.vip-emblem { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4A3A1E, #1E170C 70%);
  box-shadow: inset 0 0 0 1px rgba(242, 210, 139, .55), 0 0 0 3px rgba(242, 210, 139, .08), 0 4px 12px -4px rgba(0,0,0,.6); }
.vip-emblem svg { width: 20px; height: 20px; fill: #F2D28B; stroke: #F2D28B; }
.vip-tt { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.vip-tt b { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 27px; font-weight: 900; line-height: 1.05; letter-spacing: .08em; white-space: nowrap;
  background: linear-gradient(180deg, #FFF6DC 0%, #F6DA95 50%, #DDAA52 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.45)); }
.vip-tt small { font-family: "Didot", "Bodoni 72", "Times New Roman", serif; font-size: 10px; letter-spacing: .38em; color: rgba(242, 210, 139, .62); white-space: nowrap; }

/* 换行规则见 public/static/fit.js：正常换行；只有最后一行剩 1~2 个字时，把这一句的字号略微缩小让它收回去 */
.prose h2, .prose h3, .prose h4, .reader-head h1, article h1, .toc-t, .toc-sub a, .toc-title, .book-name, .book-pre, .ca-title { text-wrap: wrap; }

/* 书架书名按词换行后可能要 3 行：书名最多 3 行，阅读进度统一压到底部，几本书的进度条仍然对齐 */
.shelf-scroll .book { display: flex; flex-direction: column; }
.shelf-scroll .book-info { flex: 1; display: flex; flex-direction: column; }
.shelf-scroll .book-name { -webkit-line-clamp: 3; }
.shelf-scroll .book-sub { margin-top: auto; padding-top: 4px; }
.shelf-scroll { align-items: stretch; }
.top-doc, .top-chap { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ========== 继续阅读：书签式卡片 ========== */
.resume.rs { position: relative; align-items: stretch; gap: 16px; padding: 16px 14px 16px 16px; overflow: hidden; }
.rs-cover { flex: none; width: 66px; align-self: center; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.rs-cover .book-cover { width: 100%; }
.rs-cover .ca-series { visibility: hidden; }
.resume.rs .resume-body { gap: 0; justify-content: center; }
.rs-flag { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--sc); }
.rs-flag::before { content: ""; width: 6px; height: 9px; background: var(--sc); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.rs-book { margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume.rs .resume-t { margin-top: 3px; font-size: 15.5px; line-height: 1.4; font-weight: 700; color: var(--text); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.rs-prog { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.rs-prog .book-bar { flex: 1; height: 3px; margin: 0; }
.rs-prog .book-bar i { background: var(--sc); }
.rs-prog b { flex: none; font-size: 11px; font-weight: 600; color: var(--sc); font-variant-numeric: tabular-nums; }
.rs-meta { margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rs-go { flex: none; align-self: center; display: grid; place-items: center; width: 22px; color: var(--muted); }
.rs-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.resume.rs:active { transform: scale(.99); }

/* ---------- 主页「我的笔记」入口 ---------- */
.nb-entry { display: flex; align-items: center; gap: 12px; margin: 16px 0 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; color: inherit; }
.nb-entry:active { transform: scale(.99); }
.nb-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.nb-ic svg, .nb-go svg, .nb-back svg, .nb-act a svg, .nb-blank-ic svg, .nb-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nb-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nb-tx b { font-size: 15px; }
.nb-tx small { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nb-go { flex: none; display: grid; place-items: center; color: var(--muted); }
.nb-entry.is-empty .nb-ic { background: var(--surface-2); color: var(--muted); }

/* ---------- 我的笔记页 ---------- */
.nb-back { display: inline-flex; align-items: center; gap: 2px; padding: 6px 8px 6px 2px; color: var(--text-2); text-decoration: none; font-size: 15px; }
.nb-main { max-width: 720px; }
.nb-hero { padding: 8px 2px 4px; }
.nb-hero h1 { margin: 0; font-size: 26px; letter-spacing: .02em; }
.nb-sum { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.nb-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.nb-actions .btn { min-height: 40px; padding: 0 6px; font-size: 14px; }
.nb-tools { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 5; display: flex; gap: 8px; align-items: center; margin: 18px -4px 6px; padding: 8px 4px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.nb-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.nb-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nb-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; -webkit-appearance: none; appearance: none; }
.nb-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.nb-seg { flex: none; display: flex; gap: 0; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.nb-seg button { min-width: 0; height: 30px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.nb-seg button.on { background: var(--accent); color: var(--on-accent); }
.nb-book { margin-top: 18px; padding: 16px 14px 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.nb-bh { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.nb-cover { flex: none; align-self: flex-start; width: 48px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.16)); }
.nb-cover .book-cover { width: 100%; }
.nb-cover .ca-series, .nb-cover .ca-title, .nb-cover .ca-lines, .nb-cover .ca-vol { visibility: hidden; }
.nb-bt { flex: 1; min-width: 0; }
.nb-name { margin: 0; font-size: 16px; line-height: 1.4; }
.nb-count { margin: 3px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-series { margin: 0 0 2px; font-size: 11.5px; color: var(--sc); font-weight: 600; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-exp { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.nb-exp button { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12px; cursor: pointer; }
.nb-chap { margin: 16px 2px 8px; padding-left: 9px; border-left: 3px solid var(--sc); font-size: 13px; line-height: 1.45; font-weight: 600; color: var(--text-2); }
.nb-item { margin-bottom: 10px; padding: 12px 14px 8px; border-radius: 12px; background: var(--surface-2); }
.nb-q { margin: 0; font-size: 15px; line-height: 1.8; color: var(--text); }
.nb-n { margin: 10px 0 0; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, var(--sc) 9%, transparent); font-size: 13.5px; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; }
.nb-n span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--sc); }
.nb-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.nb-foot time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nb-act { display: flex; align-items: center; gap: 2px; }
.nb-act button, .nb-act a { display: inline-flex; align-items: center; gap: 1px; padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12.5px; text-decoration: none; cursor: pointer; }
.nb-act a { color: var(--sc); }
.nb-act a svg { width: 14px; height: 14px; }
.nb-none { margin-top: 32px; }
.nb-tail { margin: 28px 0 0; text-align: center; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.nb-blank { margin: 12vh auto 0; max-width: 360px; text-align: center; }
.nb-blank-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.nb-blank-ic svg { width: 26px; height: 26px; }
.nb-blank h1 { margin: 16px 0 8px; font-size: 22px; }
.nb-blank p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.8; }

.resume + .nb-entry { margin-top: -10px; }

/* ---------- 正文按语义排版（build-content.mjs 的 semantic() 加的 class） ---------- */
/* 用 :root .prose 提高优先级，盖过各阅读风格里的 .prose p 外边距 */
:root .prose h3.ph, :root .prose h4.ph { text-align: left; }
:root .prose p.h-sub { margin: -.35em 0 1.1em; font-size: .9em; color: var(--muted); text-align: left; }
:root .prose p.lead { margin-bottom: .5em; font-weight: 600; text-align: left; }
:root .prose p.scene { margin: 1.7em 0 .7em; font-weight: 600; line-height: 1.6; text-align: left; }
.prose .scene-k { display: inline-block; margin-right: .5em; padding: .05em .55em; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: .8em; letter-spacing: .04em; vertical-align: .08em; }
:root .prose p.li { position: relative; margin-bottom: .55em; padding-left: 1.1em; text-align: left; }
.prose p.li::before { content: ""; position: absolute; left: .2em; top: .82em; width: .32em; height: .32em; border-radius: 50%; background: var(--accent); opacity: .75; }
.prose .pn { color: var(--accent); font-weight: 700; }
:root .prose p.en.pt { margin: 1.4em 0 .5em; font-weight: 700; text-align: left; }
:root .prose p.en.tight { margin-bottom: .5em; text-align: left; }
/* ✅ / ❌ 正反示例：标签行和后面的内容是相邻的几个块，拼成一张卡片 */
.prose .eg-ok { --eg: #3B8B6C; }
.prose .eg-bad { --eg: #C0505F; }
:root[data-theme="dark"] .prose .eg-ok { --eg: #6FC19C; }
:root[data-theme="dark"] .prose .eg-bad { --eg: #E78A97; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prose .eg-ok { --eg: #6FC19C; } :root:not([data-theme="light"]) .prose .eg-bad { --eg: #E78A97; } }
:root .prose .eg.eg { margin: 0; padding: .3em 1em; border: 0; border-left: 3px solid var(--eg); border-radius: 0; background: color-mix(in srgb, var(--eg) 7%, transparent); box-shadow: none; text-align: left; }
:root .prose .eg-k.eg-k { margin-top: 1.2em; padding-top: .75em; border-top-right-radius: 12px; }
:root .prose .eg-end.eg-end { margin-bottom: 1.3em; padding-bottom: .8em; border-bottom-right-radius: 12px; }
:root .prose ul.eg.eg, :root .prose ol.eg.eg { padding-left: 2.4em; }
.prose .eg-tag { display: inline-flex; align-items: center; gap: .4em; color: var(--eg); font-size: .82em; font-weight: 700; letter-spacing: .06em; }
.prose .eg-tag::before { content: "✓"; display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%; background: var(--eg); color: #fff; font-size: .82em; letter-spacing: 0; }
.prose .eg-bad .eg-tag::before { content: "✕"; }
.prose .eg-inline { display: block; margin-top: .25em; }
:root .prose p.eg-or.eg-or { padding-top: 0; padding-bottom: 0; font-size: .82em; color: var(--muted); }
:root .prose p.en.tight + :not(.en) { margin-top: 1.1em; }

/* ---------- 听书播放器 ---------- */
.listen-btn { color: var(--accent); }
.player { position: fixed; z-index: 45; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100vw - 20px), 560px); padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 12px 32px -10px rgba(0,0,0,.28); animation: up .25s ease; }
.player[hidden] { display: none; }
body.listening .page { padding-bottom: 190px; }
body.listening .toast { bottom: calc(170px + env(safe-area-inset-bottom)); }
.pl-top { display: flex; align-items: flex-start; gap: 8px; }
.pl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pl-k { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: var(--accent); }
.pl-k svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pl-t { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-x { width: 30px; height: 30px; margin: -4px -6px 0 0; }
.pl-bar { margin-top: 8px; }
.pl-bar input[type=range] { --p: 0%; width: 100%; height: 18px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.pl-bar input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
.pl-bar input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
.pl-bar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.pl-bar input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.pl-time { display: flex; justify-content: space-between; margin-top: 2px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-ctrl { display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 14px; margin-top: 4px; }
.pl-ctrl button { border: 0; background: none; color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pl-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.pl-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pl-play { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent) !important; color: var(--on-accent) !important; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.pl-play svg { width: 26px; height: 26px; }
.pl-play .i-pause, .player.playing .pl-play .i-play { display: none; }
.player.playing .pl-play .i-pause { display: grid; }
.pl-play .i-play svg { margin-left: 3px; }
.pl-sm { justify-self: start; min-width: 52px; height: 30px; padding: 0 10px; border-radius: 15px; background: var(--surface-2) !important; font-size: 12.5px; color: var(--text-2) !important; font-variant-numeric: tabular-nums; }
.pl-ctrl .pl-sm:last-child { justify-self: end; }
.pl-note { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.pl-note a, .pl-note button { margin-left: 4px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: none; cursor: pointer; }
.prose > .speaking { background-color: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: -10px 0 0 color-mix(in srgb, var(--accent) 8%, transparent), 10px 0 0 color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 4px; transition: background-color .3s; }
@media (prefers-reduced-motion: reduce) { .player { animation: none; } }
/* 听书：章节导航、选择菜单、回到正在念的位置、段落旁的小耳机 */
.pl-info { padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.pl-caret { margin-left: 2px; font-size: 10px; opacity: .7; }
.pl-nav { width: 30px; height: 30px; margin-top: -4px; color: var(--text-2); }
.pl-nav:disabled { opacity: .3; }
.pl-nav svg { width: 18px; height: 18px; }
.pl-list { max-height: 42vh; margin: 10px -6px 0; padding: 6px 0 0; overflow-y: auto; border-top: 1px dashed var(--line); list-style: none; -webkit-overflow-scrolling: touch; }
.pl-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; font-size: 13.5px; cursor: pointer; }
.pl-list button .n { flex: none; width: 1.8em; color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.pl-list button .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-list button .s { flex: none; font-size: 11.5px; color: var(--muted); }
.pl-list button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pl-list button.on .s { color: var(--accent); }
.pl-list button:disabled { opacity: .45; cursor: default; }
.pl-sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.32); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.pl-sheet-card { width: min(100vw, 520px); padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--surface); box-shadow: 0 -8px 30px rgba(0,0,0,.18); animation: up .25s ease; }
.pl-sheet-h { margin: 0 4px 12px; font-size: 13px; color: var(--muted); }
.pl-opt { display: flex; flex-direction: column; gap: 3px; width: 100%; margin-bottom: 8px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.pl-opt b { font-size: 15.5px; }
.pl-opt span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-opt.pri { border-color: var(--accent); background: var(--accent-soft); }
.pl-opt.pri b { color: var(--accent); }
.pl-opt-x { width: 100%; margin-top: 2px; padding: 11px; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.pl-back { position: fixed; z-index: 44; left: 50%; bottom: calc(184px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 18px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); cursor: pointer; animation: up .2s ease; }
.pl-back[hidden], .pl-here[hidden] { display: none; }
.pl-back svg, .pl-here svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pl-here { position: absolute; z-index: 30; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); cursor: pointer; animation: fade .2s ease; }
.player, .pl-sheet { overscroll-behavior: contain; }
.pl-list { overscroll-behavior: contain; touch-action: pan-y; }

/* ---------- 手机阅读页：顶栏只留目录、书架和标题；功能收进右下角按钮 ---------- */
.fab { display: none; }
@media (max-width: 767px) {
  .reader .top-tools { display: none; }
  .fab { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; position: fixed; z-index: 40; right: max(14px, env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); transition: transform .28s ease, opacity .28s ease, bottom .25s ease; }
  .fab.hide { opacity: 0; transform: translateY(14px); pointer-events: none; }
  body.listening .fab { bottom: calc(var(--pl-h, 180px) + 24px + env(safe-area-inset-bottom)); }
  .fab-btn { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); box-shadow: 0 6px 18px -6px rgba(0,0,0,.28); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .fab-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; transition: transform .22s ease; }
  .fab.open .fab-btn { background: var(--text); color: var(--bg); border-color: transparent; }
  .fab-more circle { fill: currentColor; stroke: none; }
  .fab-btn .fab-x, .fab.open .fab-btn .fab-more { display: none; }
  .fab.open .fab-btn .fab-x { display: block; }
  .fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
  .fab-item { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; opacity: 0; transform: translateY(10px) scale(.96); transition: opacity .18s ease, transform .2s ease; -webkit-tap-highlight-color: transparent; }
  .fab.open .fab-menu { pointer-events: auto; }
  .fab.open .fab-item { opacity: 1; transform: none; }
  .fab.open .fab-item:nth-last-child(2) { transition-delay: .03s; }
  .fab.open .fab-item:nth-last-child(3) { transition-delay: .06s; }
  .fab.open .fab-item:nth-last-child(4) { transition-delay: .09s; }
  .fab-l { padding: 6px 11px; border-radius: 10px; background: var(--surface); box-shadow: 0 3px 12px -4px rgba(0,0,0,.25); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
  .fab-i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 14px -6px rgba(0,0,0,.28); }
  .fab-i svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .fab-listen .fab-i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .fab-item .i-moon-l { display: none; }
  :root[data-theme="dark"] .fab-item .i-sun-l { display: none; }
  :root[data-theme="dark"] .fab-item .i-moon-l { display: inline; }
  .type-pop { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
  body.listening .type-pop { bottom: calc(var(--pl-h, 180px) + 86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fab-item .i-sun-l { display: none; }
  :root:not([data-theme="light"]) .fab-item .i-moon-l { display: inline; }
}
/* 播放条上「第 N 章 · 全部章节」做成明显的胶囊按钮，一看就知道能点开章节列表 */
.pl-info .pl-k { align-self: flex-start; gap: 6px; padding: 3px 8px 3px 7px; border-radius: 999px; background: var(--accent-soft); }
.pl-caret { display: inline-flex; align-items: center; gap: 1px; margin-left: 2px; padding-left: 7px; border-left: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; opacity: 1; }
.pl-caret svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.player:has(.pl-list:not([hidden])) .pl-caret svg { transform: rotate(180deg); }
.pl-t { margin-top: 3px; }

/* 手机顶栏：左「目录」、中间标题、右「⋯」，左右对称；书架入口收进「⋯」 */
.top-more, .more-pop { display: none; }
@media (max-width: 767px) {
  .reader .top-home { display: none; }
  .reader .top-more { display: grid; }
  .top-more svg circle { fill: currentColor; stroke: none; }
  .top-more.on { background: var(--surface-2); }
  .reader .top-title { align-items: center; gap: 1px; padding: 0 4px; text-align: center; }
  .reader .top-doc { font-size: 11px; letter-spacing: .04em; }
  .reader .top-chap { font-size: 14px; }
  .more-pop:not([hidden]) { display: block; position: fixed; z-index: 36; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); right: max(8px, env(safe-area-inset-right)); min-width: 176px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 14px 34px -12px rgba(0,0,0,.3); animation: drop .18s ease; transform-origin: top right; }
  @keyframes drop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
  .more-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 11px; background: none; color: var(--text); font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .more-item:active { background: var(--surface-2); }
  .more-i { display: grid; place-items: center; width: 22px; height: 22px; color: var(--text-2); }
  .more-i svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .more-listen { color: var(--accent); font-weight: 600; }
  .more-listen .more-i { color: var(--accent); }
  .more-item .i-moon-l { display: none; }
  :root[data-theme="dark"] .more-item .i-sun-l { display: none; }
  :root[data-theme="dark"] .more-item .i-moon-l { display: inline; }
  .more-item + a.more-item { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 11px 11px; padding-top: 13px; }
  .type-pop { top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); bottom: auto; }
  body.listening .type-pop { bottom: auto; }
  .type-pop.at-bottom { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); }
  body.listening .type-pop.at-bottom { bottom: calc(var(--pl-h, 180px) + 86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .more-item .i-sun-l { display: none; }
  :root:not([data-theme="light"]) .more-item .i-moon-l { display: inline; }
}

.pl-list button .n { display: none; }
.pl-list button { padding-left: 12px; }

/* ---------- 主页「继续听」 ---------- */
.ls { display: flex; align-items: center; gap: 14px; margin: -10px 0 22px; padding: 12px 14px 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.ls:first-child, .greet + .ls { margin-top: 16px; }
.ls + .resume { margin-top: -10px; }
.ls + .nb-entry { margin-top: -10px; }
.ls:active { transform: scale(.99); }
.ls-play { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--sc); color: #fff; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--sc) 80%, transparent); }
.ls-play svg { width: 22px; height: 22px; margin-left: 3px; }
.ls-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ls-k { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.ls-k svg { flex: none; width: 13px; height: 13px; fill: none; stroke: var(--sc); stroke-width: 2; }
.ls-k b { flex: none; color: var(--sc); font-weight: 600; letter-spacing: .08em; }
.ls-book { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-book::before { content: "·"; margin: 0 4px 0 1px; }
.ls-t { margin-top: 2px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-prog { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.ls-prog .book-bar { flex: 1; height: 3px; margin: 0; }
.ls-prog .book-bar i { background: var(--sc); }
.ls-time { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ls-foot { margin-top: 3px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 书架封面上的「可以听」小标记 */
.book-audio { position: absolute; right: -7px; bottom: -7px; z-index: 2; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.92); color: #333; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.book-audio svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; }
/* 从主页「继续听」进来：播放按钮轻轻跳动，提示点一下就接着听 */
.player.nudge:not(.playing) .pl-play { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); transform: scale(1.04); } }
/* 修复：右下角按钮收起时，透明的菜单区域会挡住「下一章」等按钮——容器本身不接收点击，只有按钮和展开后的菜单接收 */
@media (max-width: 767px) {
  .fab { pointer-events: none; }
  .fab .fab-btn, .fab.open .fab-menu, .fab.open .fab-item { pointer-events: auto; }
  .fab:not(.open) .fab-menu { visibility: hidden; }
  .fab.open .fab-menu { visibility: visible; }
  /* 翻到页底时，「上一章 / 下一章」停在右下角按钮上方，不被它盖住 */
  .reader .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
/* 播放条打开时，页底的「上一章 / 下一章」要停在播放条上方（播放条高度会变，用实际高度） */
body.listening.reader .page { padding-bottom: calc(var(--pl-h, 200px) + 40px + env(safe-area-inset-bottom)); }
@media (max-width: 767px) { body.listening.reader .page { padding-bottom: calc(var(--pl-h, 200px) + 96px + env(safe-area-inset-bottom)); } }

/* 最后一章底部：跳到下一模块 / 下一个系列 */
button.pager-card { font: inherit; color: inherit; cursor: pointer; width: 100%; -webkit-appearance: none; appearance: none; }
.pager-after { grid-column: 1 / -1; order: -1; border-color: var(--accent); background: var(--accent-soft); }
.pager-after.next { text-align: left; align-items: flex-start; }
.pager-after .pager-t { white-space: normal; overflow: visible; font-size: 17px; line-height: 1.5; }
.pager-s { font-size: 13px; color: var(--text-2); }
.pager-after .pager-k { color: var(--accent); }
.pager-lock { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--muted); }
.pager-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 主页上新公告 ---------- */
.announce { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 11px 12px 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; }
.announce:active { transform: scale(.99); }
.an-tag { flex: none; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.an-tx { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-go { flex: none; display: inline-flex; align-items: center; gap: 1px; font-size: 12.5px; color: var(--accent); }
.an-go svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.series-row { border-radius: 18px; scroll-margin: 80px; }
.series-row.flash { animation: rowflash 2.4s ease-out; }
@keyframes rowflash { 0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); } 100% { background: transparent; box-shadow: 0 0 0 2px transparent; } }

/* ---------- 课程介绍页 ---------- */
.course-main { padding-bottom: 96px; }
.course-head { margin: 8px 0 16px; }
.course-head h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 24px; }
.course-head h1::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--sc); }
.course-head p { margin: 6px 0 0 15px; font-size: 13px; color: var(--muted); }
.course-posters { display: flex; flex-direction: column; gap: 12px; }
.course-poster { display: block; width: 100%; height: auto; border-radius: 14px; background: #111; }
.course-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
.course-bar span { font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-bar .btn { flex: none; }
@media (min-width: 720px) { .course-bar { left: 50%; right: auto; width: min(680px, 100%); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; } }
.check.remember { display: flex; align-items: flex-start; gap: 8px; margin: 12px 2px 14px; font-size: 13px; color: var(--muted); text-align: left; cursor: pointer; }
.check.remember input { flex: none; margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); }

/* 后台：文档勾选按系列分组 */
.doc-groups { display: grid; gap: 12px; }
.doc-groups[hidden] { display: none; }
.pick-group { margin: 0; padding: 10px 12px 12px; min-width: 0; color: var(--text); border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.pick-group.has-pick { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pick-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; margin-bottom: 8px; float: left; }
.pick-head + * { clear: both; }
.pick-head b { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; }
.pick-head b::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--sc); }
.pick-n { flex: 1; font-size: 12px; color: var(--muted); }
.pick-all { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; cursor: pointer; }
.pick-all input { width: 14px; height: 14px; min-height: 0; margin: 0; accent-color: var(--accent); }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .pick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .pick-group.single .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pick { position: relative; color: var(--text); display: flex; align-items: flex-start; gap: 8px; min-height: 52px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick i { flex: none; width: 16px; height: 16px; margin-top: 1px; border: 1.5px solid var(--muted); border-radius: 5px; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick:has(input:checked) i { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.pick-tx small { font-size: 11.5px; color: var(--muted); }

/* 后台：学习时长 */
.stat-v small { margin-left: 3px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--muted); }
.c-prog { display: flex; flex-direction: column; gap: 2px; }
.c-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 900px) { .row > .c-prog { align-items: flex-end; } }
.study-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.study-sum div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.study-sum b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.study-sum span { font-size: 12px; color: var(--muted); }
.study-chart { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; align-items: end; height: 96px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.sb { display: flex; flex-direction: column-reverse; height: 100%; min-width: 0; }
.sb i { display: block; width: 100%; }
.sb-r { background: var(--accent); border-radius: 2px 2px 0 0; }
.sb-l { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.sb-r + .sb-l, .sb-l:only-child { border-radius: 2px 2px 0 0; }
.study-axis { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 12px; font-size: 11.5px; color: var(--muted); }
.study-axis i { display: inline-block; width: 9px; height: 9px; margin: 0 4px 0 8px; border-radius: 2px; vertical-align: -1px; }
.lg-r { background: var(--accent); } .lg-l { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.study-doc { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.study-doc span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-doc .muted { flex: none; }

/* 后台：开通了多篇文档时，文档标签可以换行，不撑出屏幕 */
.tag-docs { white-space: normal; max-width: 100%; border-radius: 10px; height: auto; line-height: 1.45; padding-top: 2px; padding-bottom: 2px; overflow-wrap: anywhere; text-align: left; }
.c-code, .detail-head .tags { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.detail-head, .detail-head > div, .c-main { min-width: 0; }

/* 后台：学员筛选（身份 / 状态 / 排序分组 + 按文档） */
.chip-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); }
.filter-bar { display: flex; gap: 8px; width: min(520px, 100%); }
.filter-bar select { flex: 1 1 220px; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; }
.filter-bar input { flex: 1 1 160px; min-width: 0; }
.list-count { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.list-count a { color: var(--accent); }
@media (max-width: 900px) { .chip-sep { display: none; } .filter-bar { width: 100%; } }
.filter-bar select { -webkit-appearance: none; appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }

/* ICP 备案号（首页、书架页底部） */
.beian { padding: 0 16px max(14px, env(safe-area-inset-bottom)); text-align: center; font-size: 12px; line-height: 1.6; }
.beian a { color: var(--muted); text-decoration: none; opacity: .85; }
