/* ============ openDu 基础 ============ */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2430;
  --muted: #8b93a1;
  --line: #edf0f4;
  --accent: #2b4a8f;
  --accent-2: #5b8bd6;
  --ok: #16a34a;
  --shadow: 0 6px 22px rgba(31, 36, 48, .07);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 54px; flex: 0 0 54px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: relative; z-index: 20;
  padding-top: env(safe-area-inset-top);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .2px; white-space: nowrap; }
.brand span { color: var(--accent); }
.tb-search {
  flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0;
  border: none; background: var(--bg); border-radius: 999px;
  padding: 8px 12px; font-size: 13px; color: #9aa1ab;
}
.tb-ico { font-size: 13px; }
.tb-ph { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; border: none;
  background: var(--bg); font-size: 15px; display: flex; align-items: center; justify-content: center;
}

/* ---------- 页面 ---------- */
.page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 96px; }
.bottom-space { height: 40px; }

.store-head { padding: 18px 16px 10px; }
.sh-title { font-size: 22px; font-weight: 800; letter-spacing: -.2px; }
.sh-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }

/* 本周阅读 */
.week-card {
  margin: 6px 14px 0; padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(135deg, #2b4a8f, #4a7bd0); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 10px 26px rgba(43, 74, 143, .28);
}
.wk-num { font-size: 28px; font-weight: 800; line-height: 1; }
.wk-lbl { font-size: 11.5px; opacity: .82; margin-top: 5px; }
.wk-days { display: flex; gap: 6px; }
.wk-day {
  width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,.18);
  font-size: 9.5px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.72);
}
.wk-day.on { background: #fff; color: var(--accent); font-weight: 800; }
.wk-day.today { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }

/* 分区标题 */
.sec-head { display: flex; align-items: baseline; gap: 8px; padding: 22px 16px 10px; }
.sec-head b { font-size: 15.5px; }
.sec-head span { font-size: 11.5px; color: var(--muted); }

/* 书封网格（3 列，仿微信读书） */
.book-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px;
  padding: 0 16px;
}
.rec {
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
.rec-cover {
  width: 100%; aspect-ratio: 3 / 3.75; border-radius: 7px; position: relative;
  display: flex; align-items: flex-end; padding: 9px 8px; overflow: hidden;
  box-shadow: 0 6px 16px rgba(31,36,48,.18);
}
.rec-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.38) 100%);
}
.rec-emoji { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); font-size: 27px; opacity: .92; z-index: 1; }
.rec-ctitle {
  position: relative; z-index: 2; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 1.42; text-shadow: 0 1px 3px rgba(0,0,0,.35);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rec-meta { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.rec:active .rec-cover { transform: scale(.975); }

.more-btn {
  display: block; width: calc(100% - 32px); margin: 20px 16px 0; padding: 13px 0;
  border: none; border-radius: 12px; background: #fff; color: var(--accent);
  font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow);
}

/* 继续阅读 */
.cont-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.cont-item {
  display: flex; gap: 12px; align-items: center; padding: 12px;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
}
.cont-cover {
  width: 42px; height: 58px; border-radius: 5px; flex: 0 0 42px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.cont-info { flex: 1; min-width: 0; }
.cont-info b { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cont-info span { font-size: 11.5px; color: var(--muted); }
.cont-bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.cont-bar i { display: block; height: 100%; background: var(--accent-2); border-radius: 2px; }

/* 书架 */
.shelf-list { padding: 6px 16px 0; display: flex; flex-direction: column; gap: 12px; }
.shelf-item {
  display: flex; gap: 13px; padding: 13px; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow);
}
.sh-cover {
  width: 62px; height: 86px; border-radius: 7px; flex: 0 0 62px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  box-shadow: 0 4px 12px rgba(31,36,48,.16);
}
.sh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-title2 { font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.sh-intro {
  font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sh-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.sh-tag {
  font-size: 10.5px; padding: 3px 8px; border-radius: 6px;
  background: #eef3fc; color: var(--accent); font-weight: 700;
}
.sh-tag.warn { background: #fff4e5; color: #b45309; }
.sh-go {
  margin-left: auto; border: none; border-radius: 8px; padding: 7px 13px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}

.empty-box { text-align: center; padding: 60px 30px; }
.eb-emoji { font-size: 54px; }
.empty-box b { display: block; margin-top: 14px; font-size: 16px; }
.empty-box p { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 8px 0 20px; }

/* 我的 */
.mine-head { display: flex; align-items: center; gap: 14px; padding: 22px 16px 8px; }
.mine-avatar {
  width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(135deg, #2b4a8f, #5b8bd6);
  color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(43,74,143,.28);
}
.mine-info b { font-size: 16.5px; display: block; }
.mine-info span { font-size: 12px; color: var(--muted); }
.stat-row { display: flex; gap: 10px; padding: 16px; }
.stat {
  flex: 1; background: #fff; border-radius: 14px; padding: 14px 0; text-align: center;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 19px; color: var(--accent); }
.stat span { font-size: 11px; color: var(--muted); }
.mine-sec { padding: 6px 16px 0; }
.mine-title { font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 14px 2px 8px; }
.mine-item {
  display: flex; align-items: center; width: 100%; padding: 15px 14px; margin-bottom: 9px;
  background: #fff; border: none; border-radius: 13px; font-size: 14px; color: var(--text);
  text-align: left; box-shadow: var(--shadow);
}
.mi-val { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.mine-foot { text-align: center; font-size: 11.5px; color: #b0b6bf; line-height: 1.9; padding: 26px 0 0; }

/* ---------- 底部导航 ---------- */
.tabbar {
  flex: 0 0 auto; display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 0 calc(8px + env(safe-area-inset-bottom));
  position: relative; z-index: 30;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: none; color: #9aa1ab; font-size: 10.5px; font-weight: 600; padding: 4px 0;
}
.tab-ico { font-size: 20px; filter: grayscale(1) opacity(.5); }
.tab.on { color: var(--accent); }
.tab.on .tab-ico { filter: none; }

/* FAB */
.fab {
  position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40;
  border: none; border-radius: 999px; padding: 13px 20px;
  background: linear-gradient(135deg, #2b4a8f, #5b8bd6); color: #fff;
  font-size: 13.5px; font-weight: 800; box-shadow: 0 10px 26px rgba(43,74,143,.36);
}
.fab:active { transform: scale(.97); }

/* ---------- 通用层 / sheet ---------- */
.layer {
  position: fixed; inset: 0; z-index: 100; background: rgba(15,17,21,.42);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--panel);
  border-radius: 18px 18px 0 0; padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  animation: sheetUp .24s cubic-bezier(.22,.8,.3,1);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-head b { font-size: 15.5px; }
.link-btn { border: none; background: none; color: var(--accent); font-size: 13px; font-weight: 600; padding: 6px 4px; }

/* 表单 */
.fld-lbl { display: block; font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
#genTopic, .set-sec input, .set-sec select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 13px; font-size: 13.5px; background: #fbfcfd; color: var(--text); outline: none;
  line-height: 1.65; resize: none;
}
#genTopic:focus { border-color: var(--accent-2); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 13px; font-size: 12.5px; color: #5b6472;
}
.chip.on { border-color: var(--accent); background: #eef3fc; color: var(--accent); font-weight: 700; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.quick-chips .chip { font-size: 11.5px; padding: 7px 11px; background: #f7f9fc; }

.gen-btn {
  display: block; width: 100%; margin-top: 22px; padding: 15px 0;
  border: none; border-radius: 13px; color: #fff; font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, #2b4a8f, #5b8bd6);
  box-shadow: 0 10px 24px rgba(43,74,143,.3);
}
.gen-btn:active { transform: scale(.99); }
.gen-btn:disabled { opacity: .55; box-shadow: none; }
.btn {
  border: none; border-radius: 10px; padding: 11px 16px; font-size: 13px; font-weight: 700;
}
.btn.ghost { background: #f2f5f9; color: var(--accent); }
.btn.ghost.danger { color: #c0392b; }
.btn.primary { background: var(--accent); color: #fff; }
.set-btns { display: flex; gap: 10px; margin-top: 10px; }
.set-msg { font-size: 12px; margin: 9px 0 0; line-height: 1.6; min-height: 16px; }
.set-msg.ok { color: var(--ok); }
.set-msg.err { color: #d64545; }
.set-tip { font-size: 11.5px; color: #a8aeb8; line-height: 1.7; margin: 9px 0 0; }
.set-sec { border-top: 1px solid var(--line); padding: 14px 0 8px; }
.set-sec:first-of-type { border-top: none; }
.set-title { font-weight: 700; font-size: 14px; margin-bottom: 9px; }
.key-state { float: right; font-size: 12px; font-weight: 600; color: var(--muted); }
.key-state.ok { color: var(--ok); }

/* 生成进度 */
.gp-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 12px; }
.gp-head b { font-size: 14px; }
.spinner {
  width: 18px; height: 18px; border: 2.5px solid #dbe6f7; border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gp-stream {
  font-size: 11.5px; color: #8b93a1; line-height: 1.7; max-height: 240px; overflow: hidden;
  white-space: pre-wrap; word-break: break-all; background: #f8fafd; border-radius: 10px; padding: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* 书籍详情 */
.book-card {
  border-radius: 16px; padding: 18px; color: #fff; position: relative; overflow: hidden;
  margin-bottom: 4px;
}
.book-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,.14);
}
.bc-title { font-size: 19px; font-weight: 800; line-height: 1.4; position: relative; z-index: 1; }
.bc-emoji { font-size: 26px; margin-bottom: 8px; position: relative; z-index: 1; }
.bc-intro { font-size: 12px; line-height: 1.75; margin-top: 9px; opacity: .9; position: relative; z-index: 1; }
.bc-meta { font-size: 11px; opacity: .78; margin-top: 10px; position: relative; z-index: 1; }

.outline { margin-top: 16px; }
.ol-ch { margin-bottom: 16px; }
.ol-ch-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ol-ch-num {
  width: 22px; height: 22px; border-radius: 7px; background: #eef3fc; color: var(--accent);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.ol-ch-title { font-size: 14px; font-weight: 700; flex: 1; }
.ol-ch-desc { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin: 0 0 9px 30px; }
.ol-sec {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; margin-left: 30px;
  background: #fafbfd; border-radius: 10px; margin-bottom: 6px;
}
.ol-sec-main { flex: 1; min-width: 0; }
.ol-sec-title { font-size: 12.5px; font-weight: 600; }
.ol-sec-desc { font-size: 11px; color: #9aa1ab; line-height: 1.5; margin-top: 3px; }
.ol-sec .sec-state { font-size: 15px; flex: 0 0 auto; }
.ol-sec .sec-state.done { color: var(--ok); }
.ol-sec.cur { background: #eef3fc; box-shadow: inset 0 0 0 1px #cfe0f7; }
.book-acts { display: flex; gap: 10px; margin-top: 18px; }
.book-acts .btn { flex: 1; padding: 13px 0; font-size: 13.5px; }

/* 目录 */
.toc-tabs { display: flex; background: #f4f6f9; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.toc-tab {
  flex: 1; border: none; background: none; border-radius: 8px; padding: 8px 0;
  font-size: 13px; font-weight: 600; color: #7b8494;
}
.toc-tab.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.toc-ch { padding: 12px 4px 8px; font-size: 12px; font-weight: 800; color: var(--accent); }
.toc-item {
  display: flex; align-items: center; gap: 8px; padding: 12px 6px;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.toc-item:last-child { border-bottom: none; }
.toc-item.cur { color: var(--accent); font-weight: 700; }
.toc-item .ti-idx { font-size: 11px; color: #b0b6bf; width: 22px; flex: 0 0 22px; }
.toc-item .ti-title { flex: 1; }
.toc-item .ti-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.note-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  max-width: 84vw; padding: 11px 16px; border-radius: 11px; z-index: 400;
  background: rgba(31,36,48,.92); color: #fff; font-size: 13px; line-height: 1.5;
  text-align: center; animation: toastIn .2s ease;
}
.toast.err { background: rgba(198,40,40,.94); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.wx-bar {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px;
  padding: 9px 14px; background: #fff7e6; border-bottom: 1px solid #ffe0a3;
  font-size: 11.5px; line-height: 1.5; color: #8a5a00; z-index: 21;
}
.wx-bar b { font-size: 12px; color: #b45309; }

/* ======================================================
   阅读器（独立主题体系）
   ====================================================== */
.reader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: var(--rd-bg, #f8f6f1);
  color: var(--rd-fg, #2c2c2c);
  --rd-size: 19px;
  --rd-lh: 1.9;
  --rd-font: Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  transition: background .22s ease, color .22s ease;
  overflow: hidden;
}
.reader.dark .rd-bookname,
.reader.dark .rd-tool,
.reader.dark .rds span { color: rgba(255,255,255,.55); }

.rd-statusbar { height: env(safe-area-inset-top); flex: 0 0 auto; }

.rd-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0 120px;
  scroll-behavior: smooth;
}
.rd-inner { max-width: 660px; margin: 0 auto; padding: 8px 26px 0; }

.rd-bookname {
  font-size: 11.5px; color: #9a9a92; text-align: center; letter-spacing: .5px;
  padding: 46px 0 26px; font-family: -apple-system, "PingFang SC", sans-serif;
  opacity: .8;
}
.rd-chapter {
  font-size: calc(var(--rd-size) * 1.16);
  font-weight: 700; line-height: 1.5; text-align: center;
  margin: 0 0 26px; letter-spacing: .3px;
  font-family: var(--rd-font);
}
.rd-body { font-family: var(--rd-font); }
.rd-body p {
  font-size: var(--rd-size); line-height: var(--rd-lh);
  text-indent: 2em; margin: 0 0 .95em; text-align: justify;
  word-break: break-word;
}
.rd-body p.no-indent { text-indent: 0; }
.rd-body .rd-sub {
  font-size: calc(var(--rd-size) * .95); font-weight: 700;
  text-indent: 0; margin: 1.6em 0 .7em; opacity: .92;
}
.rd-body .rd-quote {
  text-indent: 0; margin: 1.2em 0; padding: 12px 14px;
  border-left: 3px solid currentColor; opacity: .78;
  font-size: calc(var(--rd-size) * .93); line-height: 1.8;
  border-radius: 0 8px 8px 0; background: rgba(128,128,128,.07);
}
.rd-empty {
  text-align: center; padding: 70px 20px; font-family: -apple-system, "PingFang SC", sans-serif;
}
.rd-empty .re-emoji { font-size: 42px; opacity: .5; }
.rd-empty p { font-size: 13px; line-height: 1.8; opacity: .7; margin: 14px 0 22px; }

.rd-end { padding: 30px 0 10px; text-align: center; font-family: -apple-system, "PingFang SC", sans-serif; }
.re-line { height: 1px; background: currentColor; opacity: .12; margin-bottom: 26px; }
.re-next, .re-gen {
  display: block; width: 100%; margin: 0 auto 10px; padding: 13px 0;
  border: 1px solid currentColor; border-radius: 12px; background: transparent;
  font-size: 13.5px; font-weight: 700; color: inherit; opacity: .82;
}
.re-gen { border-style: dashed; }

/* 浮动按钮 */
.rd-fabs { position: fixed; right: 8px; bottom: 198px; display: flex; flex-direction: column; gap: 8px; z-index: 210; opacity: .78; transition: opacity .2s; }
.rd-fabs.hide { opacity: 0; pointer-events: none; }
.rd-fab {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(128,128,128,.16); color: inherit; backdrop-filter: blur(8px);
  font-size: 15px; font-weight: 700; font-family: -apple-system, "PingFang SC", sans-serif;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.rd-fab:active { transform: scale(.94); }
.rd-fab.on { background: rgba(43,74,143,.85); color: #fff; }

/* 底部面板 */
.rd-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 215;
  background: rgba(255,255,255,.94); backdrop-filter: blur(18px);
  border-radius: 20px 20px 0 0; padding: 4px 16px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 26px rgba(20,24,32,.09);
  color: #1f2430; font-family: -apple-system, "PingFang SC", sans-serif;
  transition: transform .24s cubic-bezier(.22,.8,.3,1), opacity .2s;
}
.reader.dark .rd-bottom { background: rgba(30,32,38,.95); color: #e8e8e8; }
.rd-bottom.hide { transform: translateY(110%); opacity: 0; pointer-events: none; }

.rd-stats { display: flex; padding: 12px 0 8px; }
.rds { flex: 1; text-align: center; }
.rds b { display: block; font-size: 16px; font-weight: 700; }
.rds span { font-size: 10.5px; color: #9aa1ab; }

.rd-prog-wrap { padding: 2px 4px 6px; }
.rd-prog-wrap input[type=range] {
  width: 100%; -webkit-appearance: none; appearance: none; height: 20px; background: transparent;
}
.rd-prog-wrap input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 3px; background: rgba(128,128,128,.22);
}
.rd-prog-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #2b4a8f; margin-top: -5px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.rd-tools { display: flex; border-top: 1px solid rgba(128,128,128,.14); padding-top: 4px; }
.rd-tool {
  flex: 1; border: none; background: none; padding: 8px 0 6px;
  font-size: 9.5px; color: #5b6472; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.reader.dark .rd-tool { color: #b9bec7; }
.rd-tool span { font-size: 17px; line-height: 1; font-family: -apple-system, "PingFang SC", sans-serif; }
.rd-tool:active { opacity: .6; }

.rd-close {
  position: fixed; left: 14px; top: calc(10px + env(safe-area-inset-top)); z-index: 220;
  width: 34px; height: 34px; border-radius: 50%; background: rgba(128,128,128,.16);
  display: flex; align-items: center; justify-content: center; font-size: 15px; opacity: .7;
}
.rd-bright {
  position: fixed; inset: 0; background: #000; pointer-events: none; z-index: 230; opacity: 0;
  transition: opacity .2s;
}

/* 外观面板 */
.style-panel {
  width: 100%; max-width: 560px; background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(26px + env(safe-area-inset-bottom)); color: #1f2430;
  animation: sheetUp .22s cubic-bezier(.22,.8,.3,1);
}
.sp-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sp-lbl { font-size: 12px; color: #8b93a1; font-weight: 700; width: 34px; flex: 0 0 34px; }
.sp-val { font-size: 11.5px; color: #8b93a1; width: 30px; text-align: right; }
.bg-list, .fg-list { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.bg-dot {
  width: 38px; height: 38px; border-radius: 11px; border: 2px solid transparent; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.07);
}
.bg-dot.on { border-color: #2b4a8f; }
.fg-dot {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
.fg-dot.on { border-color: #2b4a8f; }
.sp-row input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px; background: #e8ecf2; }
.sp-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid #2b4a8f; box-shadow: 0 2px 6px rgba(0,0,0,.16);
}
.sp-row .chips { flex: 1; }
.sp-row .chip { padding: 7px 12px; font-size: 12px; }

/* AI 解释气泡 */
.ai-pop {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(94vw, 460px); max-height: 68vh; overflow-y: auto; z-index: 300;
  background: #fff; border-radius: 18px 18px 0 0; padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.2); color: #1f2430;
  font-family: -apple-system, "PingFang SC", sans-serif;
}
.ai-pop h3 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.ai-pop .ai-body { font-size: 13.5px; line-height: 1.85; white-space: pre-wrap; }
.ai-pop .ai-x { position: absolute; right: 14px; top: 12px; border: none; background: none; font-size: 16px; color: #9aa1ab; }

/* 阅读器之上的面板层级 */
#tocLayer, #styleLayer { z-index: 250; }
.rd-end { opacity: .55; transition: opacity .25s; }
.cont-empty { line-height: 1.7; }
