﻿/* 小说书架 + 阅读器：p1 沉浸 / p2 菜单 */
.rd-view, .rd-read-view{
  display:flex; flex-direction:column; height:100%;
  min-height:0; overflow:hidden;
  background:#F5F5F5;
  color:#1F2937;
}

/* ========== 书架主页（截图样式） ========== */
.rd-view{ background:#F7F7F7; }
.rd-lib{
  flex:1; min-height:0; display:flex; flex-direction:column;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 0;
}
.rd-lib-top{
  display:flex; align-items:center; gap:6px; flex:0 0 auto;
}
.rd-lib-back{
  width:36px; height:36px; flex:0 0 auto;
  color:#222; background:transparent; border-radius:10px;
}
.rd-lib-tabs-wrap{ flex:1; min-width:0; overflow:hidden; }
.rd-lib-tabs{
  display:flex; gap:16px; overflow-x:auto; scrollbar-width:none;
  padding:4px 2px 2px; align-items:flex-end;
}
.rd-lib-tabs::-webkit-scrollbar{ display:none; }
.rd-lib-tabs button{
  flex:0 0 auto; border:0; background:transparent; cursor:pointer;
  padding:8px 2px 10px; font-size:15px; color:#999; position:relative;
  white-space:nowrap;
}
.rd-lib-tabs button.on{ color:#111; font-weight:700; font-size:16px; }
.rd-lib-tabs button.on::after{
  content:''; position:absolute; left:20%; right:20%; bottom:2px;
  height:3px; border-radius:3px; background:#111;
}
.rd-lib-more{
  width:34px; height:34px; border:1px solid #E5E5E5; border-radius:50%;
  background:#fff; color:#333; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; flex:0 0 auto; padding:0;
}
.rd-lib-more svg{ width:18px; height:18px; }
.rd-lib-search{
  margin-top:10px; display:flex; align-items:center; gap:8px;
  background:#EFEFEF; border-radius:14px; padding:0 14px; height:42px;
  color:#999; flex:0 0 auto;
}
.rd-lib-search svg{ width:18px; height:18px; flex:0 0 auto; }
.rd-lib-search input{
  flex:1; border:0; background:transparent; outline:none;
  font-size:14px; color:#222; height:100%;
}
.rd-lib-search input::placeholder{ color:#AAA; }
.rd-lib-stats{
  margin-top:12px; background:#fff; border:1px solid #E8E8E8;
  border-radius:16px; display:flex; align-items:stretch;
  padding:16px 8px; flex:0 0 auto;
}
.rd-lib-stat{ flex:1; text-align:center; min-width:0; }
.rd-lib-stat-num{
  display:flex; align-items:baseline; justify-content:center; gap:4px; color:#111;
}
.rd-lib-stat-num b{ font-size:28px; font-weight:700; line-height:1; font-variant-numeric:tabular-nums; }
.rd-lib-stat-num small{ font-size:13px; color:#666; }
.rd-lib-stat-lab{
  margin-top:8px; display:inline-flex; align-items:center; gap:4px;
  font-size:12px; color:#999;
}
.rd-lib-stat-lab svg{ width:14px; height:14px; }
.rd-lib-stat-div{ width:1px; background:#EEE; margin:4px 0; flex:0 0 auto; }
.rd-shelf{
  flex:1; min-height:0; overflow:auto;
  padding:12px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  display:flex; flex-direction:column; gap:12px;
}
.rd-empty{
  text-align:center; padding:60px 16px;
  color:#9CA3AF; font-size:14px; line-height:1.7;
}
.rd-card{
  display:flex; gap:12px; align-items:stretch;
  background:#fff; border:1px solid #E8E8E8; border-radius:16px;
  padding:12px; cursor:pointer; text-align:left; color:inherit;
  width:100%; position:relative;
}
.rd-card:active{ transform:scale(0.99); }
.rd-card-cover{
  width:78px; height:104px; border-radius:8px; flex:0 0 auto;
  background:linear-gradient(145deg, #8B7CF0, #4F46E5);
  color:#fff; font-size:11px; font-weight:600; line-height:1.35;
  display:flex; align-items:flex-end; padding:8px;
  overflow:hidden; box-shadow:0 4px 12px rgba(79,70,229,.18);
  position:relative;
}
.rd-card-cover img{
  width:100%; height:100%; object-fit:cover; border-radius:8px;
  position:absolute; inset:0;
}
.rd-card-body{ flex:1; min-width:0; display:flex; flex-direction:column; padding-right:18px; }
.rd-card-title{
  font-size:16px; font-weight:700; color:#111; line-height:1.35;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rd-card-author{ font-size:12px; color:#999; margin-top:2px; }
.rd-card-rating{
  display:flex; align-items:center; gap:4px; margin-top:4px;
  font-size:12px; color:#F59E0B; font-weight:600;
}
.rd-card-tags{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.rd-tag{
  font-size:11px; padding:2px 8px; border-radius:999px;
  background:#EEF2FF; color:#4F46E5; line-height:1.5;
}
.rd-tag:nth-child(2){ background:#ECFDF5; color:#059669; }
.rd-tag:nth-child(3){ background:#F5F3FF; color:#7C3AED; }
.rd-tag:nth-child(4){ background:#FFF7ED; color:#EA580C; }
.rd-tag:nth-child(5){ background:#ECFEFF; color:#0891B2; }
.rd-tag:nth-child(6){ background:#FDF2F8; color:#DB2777; }
.rd-card-intro{
  margin-top:6px; font-size:12px; color:#888; line-height:1.45;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.rd-card-meta{
  margin-top:auto; padding-top:8px;
  font-size:11px; color:#AAA;
}
.rd-card-ai{
  margin-top:8px; align-self:flex-start;
  border:1px solid #E5E5E5; background:#FAFAFA; color:#555;
  border-radius:999px; padding:4px 10px; font-size:11px; cursor:pointer;
}
.rd-card-ai.busy{ opacity:.55; pointer-events:none; }
.rd-card-more{
  position:absolute; right:8px; bottom:8px;
  width:28px; height:28px; border:0; background:transparent;
  color:#BBB; border-radius:8px; cursor:pointer; padding:0;
  display:inline-flex; align-items:center; justify-content:center;
}
.rd-card-more svg{ width:16px; height:16px; }
.rd-lib-menu-card button{
  width:100%; height:48px; border:0; background:transparent;
  border-bottom:1px solid #F3F3F3; font-size:15px; color:#222; cursor:pointer;
}
.rd-lib-menu-card button.danger{ color:#EF4444; }
.rd-lib-menu-card .rd-sheet-close{ border-bottom:0; margin-top:4px; background:#F5F5F5; border-radius:12px; }
.rd-book-menu-title{
  text-align:center; font-size:13px; color:#999; padding:4px 0 10px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rd-edit-row{
  display:flex; flex-direction:column; gap:6px;
  margin-bottom:12px; font-size:13px; color:#666;
}
.rd-edit-row input, .rd-edit-row textarea{
  border:1px solid #E5E7EB; border-radius:10px; padding:10px 12px;
  font:14px/1.45 inherit; color:#111; background:#FAFAFA;
}
.rd-sheet-ghost{
  background:#F3F4F6 !important; color:#374151 !important;
  margin-top:8px !important; box-shadow:none !important;
}

/* ========== 阅读页主题 ========== */
.rd-read-view{
  --rd-bg:#FFFFFF; --rd-fg:#111111; --rd-muted:#999999;
  --rd-panel:#FFFFFF; --rd-panel-fg:#111111; --rd-panel-muted:#9CA3AF;
  --rd-track:#E5E7EB; --rd-icon:#222;
  background:var(--rd-bg); color:var(--rd-fg);
  position:relative;
}
.rd-read-view[data-rd-theme="paper"]{
  --rd-bg:#F2F0EA; --rd-fg:#3D3020; --rd-muted:#8B7B60;
  --rd-panel:#FBF7EE; --rd-panel-fg:#3D3020; --rd-panel-muted:#8B7B60;
  --rd-track:#E4D8C4; --rd-icon:#3D3020;
}
.rd-read-view[data-rd-theme="day"]{
  --rd-bg:#FFFFFF; --rd-fg:#111111; --rd-muted:#999999;
  --rd-panel:#FFFFFF; --rd-panel-fg:#111111; --rd-panel-muted:#9CA3AF;
  --rd-track:#E5E7EB; --rd-icon:#222;
}
.rd-read-view[data-rd-theme="mint"]{
  --rd-bg:#E8F5E9; --rd-fg:#1B4332; --rd-muted:#6B8F71;
  --rd-panel:#F4FBF4; --rd-panel-fg:#1B4332; --rd-panel-muted:#6B8F71;
  --rd-track:#CDE5D0; --rd-icon:#1B4332;
}
.rd-read-view[data-rd-theme="cream"]{
  --rd-bg:#F5F0E0; --rd-fg:#3D3020; --rd-muted:#8B7B60;
  --rd-panel:#FAF7EC; --rd-panel-fg:#3D3020; --rd-panel-muted:#8B7B60;
  --rd-track:#E4D8C4; --rd-icon:#3D3020;
}
.rd-read-view[data-rd-theme="blush"]{
  --rd-bg:#F8ECEF; --rd-fg:#3D2A30; --rd-muted:#9A7A84;
  --rd-panel:#FCF5F7; --rd-panel-fg:#3D2A30; --rd-panel-muted:#9A7A84;
  --rd-track:#E8D0D6; --rd-icon:#3D2A30;
}
.rd-read-view[data-rd-theme="night"]{
  --rd-bg:#1A1A1A; --rd-fg:#D4D4D4; --rd-muted:#6B6B6B;
  --rd-panel:#242424; --rd-panel-fg:#E5E5E5; --rd-panel-muted:#8A8A8A;
  --rd-track:#3A3A3A; --rd-icon:#E5E5E5;
}

.rd-read-view.active{ animation:none; }

/* p1：沉浸章节 / 页脚 */
.rd-immersive{
  pointer-events:none;
  position:absolute; inset:0; z-index:5;
}
.rd-chapter{
  position:absolute;
  top:calc(10px + env(safe-area-inset-top, 0px));
  left:18px; right:18px;
  font-size:12px; line-height:1.4; font-weight:400;
  color:var(--rd-muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rd-foot{
  position:absolute;
  left:18px; right:18px;
  bottom:calc(10px + env(safe-area-inset-bottom, 0px));
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; color:var(--rd-muted); font-variant-numeric:tabular-nums;
}
.rd-read-view[data-rd-menu="on"] .rd-immersive{
  opacity:0; visibility:hidden;
  transition:opacity .2s ease, visibility .2s;
}
.rd-read-view[data-rd-menu="off"] .rd-immersive{
  opacity:1; visibility:visible;
  transition:opacity .2s ease;
}

/* p2：底栏 */
.rd-menu-bottom{
  position:absolute; left:0; right:0; bottom:0; z-index:20;
  background:var(--rd-panel);
  color:var(--rd-panel-fg);
  border-radius:18px 18px 0 0;
  padding:18px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow:0 -6px 28px rgba(0,0,0,.08);
  transform:translateY(110%);
  transition:transform .28s cubic-bezier(.22,.8,.28,1);
  pointer-events:none;
}
.rd-menu-bottom[hidden]{ display:block !important; }
.rd-read-view[data-rd-menu="on"] .rd-menu-bottom{
  transform:translateY(0);
  pointer-events:auto;
}

.rd-menu-top{
  position:absolute; left:0; right:0; top:0; z-index:20;
  display:flex; align-items:center; gap:4px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 10px;
  background:var(--rd-panel);
  color:var(--rd-icon);
  transform:translateY(-110%);
  transition:transform .28s cubic-bezier(.22,.8,.28,1);
  box-shadow:0 1px 0 rgba(0,0,0,.04);
  pointer-events:none;
}
.rd-read-view[data-rd-menu="on"] .rd-menu-top{
  transform:translateY(0);
  pointer-events:auto;
}
.rd-menu-top-spacer{ flex:1; }
.rd-menu-icon{
  width:42px; height:42px; border:0; background:transparent;
  color:inherit; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; border-radius:10px; padding:0;
  -webkit-tap-highlight-color:transparent;
}
.rd-menu-icon svg{ width:22px; height:22px; display:block; }
.rd-menu-icon:active{ background:rgba(0,0,0,.05); }
.rd-read-view[data-rd-theme="night"] .rd-menu-icon:active{ background:rgba(255,255,255,.08); }
.rd-invite-on{ color:#8B5CF6 !important; }

/* 正文区 */
.rd-read-body{
  flex:1; min-height:0; overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  overflow-anchor:none;
  position:relative; z-index:1;
}
.rd-read-view[data-rd-turn="tap"] .rd-read-body{
  overflow:hidden;
}
.rd-pages{
  max-width:680px; margin:0 auto;
  padding: calc(36px + env(safe-area-inset-top, 0px)) 22px calc(48px + env(safe-area-inset-bottom, 0px));
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size:18px; line-height:1.9;
  color:var(--rd-fg);
}
.rd-read-view[data-rd-turn="tap"] .rd-pages{
  height:100%;
  overflow:hidden;
  column-width:100%;
  column-gap:0;
  padding-top: calc(36px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
}
.rd-para{
  margin:0 0 1.15em; text-indent:2em;
  position:relative;
}
.rd-para.is-chapter{
  text-indent:0;
  font-size:1.05em; font-weight:600;
  margin:1.6em 0 1em;
  text-align:left;
}
.rd-para.has-cmt::after{
  content:'';
  position:absolute; right:-2px; top:6px;
  width:6px; height:6px; border-radius:50%;
  background:#8B5CF6;
}
.rd-mark{
  background:rgba(251,191,36,.3);
  border-bottom:2px solid rgba(245,158,11,.5);
  cursor:pointer;
}
.rd-mark.blue{ background:rgba(96,165,250,.28); border-bottom-color:rgba(59,130,246,.5); }
.rd-mark.green{ background:rgba(52,211,153,.28); border-bottom-color:rgba(16,185,129,.5); }

/* p2：悬浮书本按钮 */
.rd-float-book{
  position:absolute; right:16px; z-index:18;
  bottom:calc(210px + env(safe-area-inset-bottom, 0px));
  width:40px; height:40px; border-radius:50%;
  border:1px solid rgba(0,0,0,.35);
  background:var(--rd-panel); color:var(--rd-icon);
  display:none; align-items:center; justify-content:center;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
  cursor:pointer; padding:0;
}
.rd-float-book[hidden]{ display:none !important; }
.rd-float-book svg{ width:18px; height:18px; }
.rd-read-view[data-rd-menu="on"] .rd-float-book{
  display:inline-flex;
}
.rd-read-view[data-rd-theme="night"] .rd-float-book{
  border-color:rgba(255,255,255,.35);
}

.rd-stats{
  display:grid; grid-template-columns:repeat(4, 1fr);
  gap:6px; margin-bottom:16px;
}
.rd-stat{
  text-align:center; min-width:0;
}
.rd-stat b{
  display:block; font-size:13px; font-weight:600; color:var(--rd-panel-fg);
  line-height:1.35; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.rd-stat span{
  display:block; margin-top:4px; font-size:11px; color:var(--rd-panel-muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.rd-prog-row{
  display:flex; align-items:center; gap:10px;
  margin-bottom:14px;
}
.rd-prog-step{
  width:28px; height:28px; border:0; background:transparent;
  color:var(--rd-panel-muted); font-size:18px; line-height:1;
  cursor:pointer; padding:0; flex:0 0 auto;
}
.rd-prog-slider{
  flex:1; -webkit-appearance:none; appearance:none;
  height:3px; border-radius:999px; background:var(--rd-track);
  outline:none;
}
.rd-prog-slider::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:22px; height:22px; border-radius:50%;
  background:#fff; border:1px solid #D1D5DB;
  box-shadow:0 1px 6px rgba(0,0,0,.18);
  cursor:pointer;
}
.rd-prog-slider::-moz-range-thumb{
  width:22px; height:22px; border-radius:50%;
  background:#fff; border:1px solid #D1D5DB;
  box-shadow:0 1px 6px rgba(0,0,0,.18);
  cursor:pointer;
}
.rd-read-view[data-rd-theme="night"] .rd-prog-slider::-webkit-slider-thumb,
.rd-read-view[data-rd-theme="night"] .rd-prog-slider::-moz-range-thumb{
  background:#3A3A3A; border-color:#555;
}

.rd-menu-nav{
  display:grid; grid-template-columns:repeat(3, 1fr);
  gap:4px; padding-top:4px;
}
.rd-nav-btn{
  border:0; background:transparent; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:6px;
  padding:10px 4px; color:var(--rd-panel-fg);
  font-size:12px; -webkit-tap-highlight-color:transparent;
}
.rd-nav-btn svg{ width:24px; height:24px; }
.rd-nav-btn:active{ opacity:.55; }
.rd-nav-btn.on{ color:#111; font-weight:600; }
.rd-read-view[data-rd-theme="night"] .rd-nav-btn.on{ color:#fff; }
.rd-menu-home[hidden], .rd-set-panel[hidden], .rd-set-more[hidden]{ display:none !important; }

/* ========== 设置面板（截图样式） ========== */
.rd-set-panel{
  margin:0 -4px 8px;
  padding:14px 12px 12px;
  background:#F2F2F2;
  border-radius:18px;
  color:#222;
}
.rd-read-view[data-rd-theme="night"] .rd-set-panel{
  background:#2C2C2C; color:#E5E5E5;
}
.rd-set-bright, .rd-set-line{
  display:flex; align-items:center; gap:10px;
  margin-bottom:12px;
}
.rd-set-edge{
  flex:0 0 auto; font-size:12px; color:#888; width:1.2em; text-align:center;
}
.rd-set-bright input[type="range"],
.rd-set-track input[type="range"]{
  flex:1; -webkit-appearance:none; appearance:none;
  height:4px; border-radius:999px; background:#D8D8D8; outline:none;
}
.rd-read-view[data-rd-theme="night"] .rd-set-bright input[type="range"],
.rd-read-view[data-rd-theme="night"] .rd-set-track input[type="range"]{
  background:#444;
}
.rd-set-bright input[type="range"]::-webkit-slider-thumb,
.rd-set-track input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:28px; height:28px; border-radius:50%;
  background:#fff; border:0;
  box-shadow:0 1px 6px rgba(0,0,0,.16);
  cursor:pointer;
}
.rd-set-bright-val{
  width:34px; height:34px; border-radius:50%;
  background:#fff; color:#222; font-size:12px; font-weight:600;
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow:0 1px 6px rgba(0,0,0,.12); flex:0 0 auto;
}
.rd-set-track{
  flex:1; position:relative; display:flex; align-items:center; min-width:0;
}
.rd-set-pill{
  position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%);
  pointer-events:none;
  background:#fff; border-radius:999px;
  padding:5px 12px; font-size:13px; font-weight:600; color:#222;
  box-shadow:0 1px 6px rgba(0,0,0,.12);
  white-space:nowrap;
}
.rd-set-pill-sm{ padding:5px 10px; font-size:12px; font-weight:500; }
.rd-set-link{
  border:0; background:transparent; color:#888; font-size:13px;
  padding:4px 0 4px 6px; cursor:pointer; flex:0 0 auto; white-space:nowrap;
}
.rd-set-theme-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  margin:4px 0 10px;
}
.rd-set-theme-title{ font-size:14px; font-weight:600; color:#222; }
.rd-set-theme-sub{ font-size:11px; color:#999; margin-top:2px; }
.rd-read-view[data-rd-theme="night"] .rd-set-theme-title{ color:#EEE; }
.rd-theme-swatches{
  display:flex; gap:8px; overflow-x:auto; padding-bottom:4px;
  margin-bottom:12px; -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.rd-theme-swatches::-webkit-scrollbar{ display:none; }
.rd-swatch{
  flex:0 0 auto; width:56px; height:56px; border:0; border-radius:12px;
  background:var(--sw, #fff); cursor:pointer; position:relative;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.06);
  padding:0;
}
.rd-swatch span{
  position:absolute; left:0; right:0; bottom:6px;
  text-align:center; font-size:10px; color:rgba(0,0,0,.45);
}
.rd-swatch[data-theme="night"] span{ color:rgba(255,255,255,.55); }
.rd-swatch.on::after{
  content:'✓';
  position:absolute; left:50%; bottom:0; transform:translate(-50%, 35%);
  width:18px; height:14px; border-radius:4px 4px 0 0;
  background:#222; color:#fff; font-size:10px; line-height:14px;
  text-align:center;
}
.rd-set-foot{
  display:grid; grid-template-columns:1fr 1fr; gap:10px;
}
.rd-set-chip{
  height:42px; border:0; border-radius:12px;
  background:#E8E8E8; color:#333; font-size:13px; cursor:pointer;
}
.rd-read-view[data-rd-theme="night"] .rd-set-chip{ background:#3A3A3A; color:#EEE; }
.rd-set-more{
  margin-top:12px; padding-top:10px; border-top:1px solid rgba(0,0,0,.06);
}
.rd-set-more-row{
  display:flex; align-items:center; gap:10px;
  margin-bottom:10px; font-size:13px; color:#555;
}
.rd-set-more-row input[type="range"]{ flex:1; }

/* 亮度遮罩 */
.rd-bright-mask{
  position:absolute; inset:0; z-index:4; pointer-events:none;
  background:#000; opacity:0;
}

/* ========== 目录面板（截图样式） ========== */
.rd-toc-sheet{
  position:absolute; inset:0; z-index:45;
  display:flex; align-items:flex-end; justify-content:center;
}
.rd-toc-sheet[hidden]{ display:none !important; }
.rd-toc-backdrop{
  position:absolute; inset:0; border:0; padding:0;
  background:rgba(0,0,0,.28); cursor:pointer;
}
.rd-toc-card{
  position:relative; z-index:1;
  width:100%; max-width:520px; height:92%;
  background:#fff; color:#111;
  border-radius:18px 18px 0 0;
  display:flex; flex-direction:column;
  box-shadow:0 -8px 40px rgba(0,0,0,.18);
  overflow:hidden;
}
.rd-toc-handle{
  width:36px; height:4px; border-radius:999px; background:#D8D8D8;
  margin:8px auto 6px; flex:0 0 auto;
}
.rd-toc-book{
  display:flex; gap:12px; padding:6px 16px 12px; flex:0 0 auto;
}
.rd-toc-cover{
  width:52px; height:70px; border-radius:6px;
  background:linear-gradient(145deg, #7C6CF0, #4F46E5);
  flex:0 0 auto; box-shadow:0 4px 12px rgba(79,70,229,.25);
  color:#fff; font-size:10px; font-weight:600; line-height:1.3;
  display:flex; align-items:flex-end; padding:6px;
  overflow:hidden;
}
.rd-toc-meta{ min-width:0; flex:1; padding-top:2px; }
.rd-toc-title{
  font-size:16px; font-weight:700; color:#111;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rd-toc-title::after{ content:' ›'; color:#BBB; font-weight:400; }
.rd-toc-author{ font-size:12px; color:#999; margin-top:3px; }
.rd-toc-info{ font-size:11px; color:#AAA; margin-top:6px; line-height:1.4; }
.rd-toc-tabs{
  display:flex; gap:2px; padding:0 8px;
  overflow-x:auto; flex:0 0 auto;
  border-bottom:1px solid #F0F0F0;
  scrollbar-width:none;
}
.rd-toc-tabs::-webkit-scrollbar{ display:none; }
.rd-toc-tabs button{
  flex:0 0 auto; border:0; background:transparent;
  padding:10px 12px; font-size:14px; color:#888; cursor:pointer;
  position:relative; white-space:nowrap;
}
.rd-toc-tabs button.on{
  color:#111; font-weight:700;
}
.rd-toc-tabs button.on::after{
  content:''; position:absolute; left:12px; right:12px; bottom:0;
  height:3px; border-radius:3px 3px 0 0; background:#222;
}
.rd-toc-toolbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px 6px; flex:0 0 auto;
  font-size:12px; color:#999;
}
.rd-toc-tools{ display:flex; gap:2px; }
.rd-toc-tools button{
  width:32px; height:32px; border:0; background:transparent;
  color:#666; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; border-radius:8px;
}
.rd-toc-tools svg{ width:18px; height:18px; }
.rd-toc-panels{ flex:1; min-height:0; position:relative; }
.rd-toc-panel{ display:none; height:100%; overflow:auto; }
.rd-toc-panel.on{ display:block; }
.rd-toc-list{ padding:0 0 72px; }
.rd-toc-item{
  display:flex; align-items:center; gap:10px;
  width:100%; border:0; background:transparent; cursor:pointer;
  padding:14px 16px; text-align:left; color:#222; font-size:14px;
  border-bottom:1px solid #F3F3F3; position:relative;
}
.rd-toc-item .t{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-toc-item .n{ flex:0 0 auto; color:#C0C0C0; font-size:12px; font-variant-numeric:tabular-nums; }
.rd-toc-item.on{
  background:#F3F3F3; font-weight:600;
}
.rd-toc-item.on::before{
  content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background:#222;
}
.rd-toc-empty{
  padding:48px 16px; text-align:center; color:#AAA; font-size:13px; line-height:1.7;
}
.rd-toc-fab{
  position:absolute; right:18px; bottom:88px; z-index:2;
  width:48px; height:48px; border-radius:50%; border:0;
  background:#222; color:#fff; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow:0 6px 18px rgba(0,0,0,.22);
}
.rd-toc-fab svg{ width:20px; height:20px; }
.rd-toc-nav{
  flex:0 0 auto;
  display:grid; grid-template-columns:repeat(3, 1fr);
  padding:4px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top:1px solid #F0F0F0; background:#fff;
}
.rd-toc-nav .rd-nav-btn{ color:#222; }
.rd-toc-nav .rd-nav-btn.on{ font-weight:700; }

/* 选中文本工具栏 */
.rd-sel-bar{
  position:fixed; left:50%; bottom:calc(24px + env(safe-area-inset-bottom, 0px));
  transform:translateX(-50%);
  display:flex; gap:4px; padding:6px;
  border-radius:16px; background:rgba(31,41,55,.95); color:#fff;
  z-index:40; box-shadow:0 8px 32px rgba(0,0,0,.25);
  backdrop-filter:blur(10px);
}
.rd-sel-bar[hidden]{ display:none !important; }
.rd-sel-bar button{
  border:0; background:transparent; color:#fff;
  padding:8px 14px; font-size:14px; font-weight:500; cursor:pointer;
  border-radius:10px;
}
.rd-sel-bar button:active{ background:rgba(255,255,255,.15); }

/* 通用 sheet（更多设置 / 段评） */
.rd-sheet{
  position:fixed; inset:0; z-index:50;
  background:rgba(0,0,0,.4);
  display:flex; align-items:flex-end; justify-content:center;
}
.rd-sheet[hidden]{ display:none !important; }
.rd-sheet-card{
  width:100%; max-width:480px;
  background:#fff;
  color:#1F2937;
  border-radius:24px 24px 0 0;
  padding:24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow:0 -8px 40px rgba(0,0,0,.15);
}
.rd-sheet-title{ font-size:17px; font-weight:600; margin-bottom:20px; color:#1F2937; }
.rd-set-row{
  display:flex; align-items:center; gap:12px;
  margin-bottom:16px; font-size:14px; color:#4B5563;
}
.rd-set-row input[type="range"]{ flex:1; }
.rd-theme-btn, .rd-turn-btn{
  border:1px solid #E5E7EB; background:#F9FAFB;
  border-radius:10px; padding:8px 14px; font-size:13px; cursor:pointer; color:#4B5563;
  transition:all .2s;
}
.rd-theme-btn.on, .rd-turn-btn.on{
  border-color:#222; background:#111; color:#fff; font-weight:500;
}
.rd-sheet-close{
  width:100%; height:48px; margin-top:12px; border:0; border-radius:14px;
  background:#111; color:#fff;
  font-size:15px; font-weight:600; cursor:pointer;
}

/* 段评卡片 */
.rd-cmt-card{ max-height:78vh; display:flex; flex-direction:column; }
.rd-cmt-quote{
  font-size:13px; color:#6B7280; padding:12px 14px;
  border-left:3px solid #8B5CF6; margin-bottom:14px;
  max-height:80px; overflow:auto;
  background:#F9FAFB; border-radius:0 8px 8px 0;
}
.rd-cmt-thread{
  flex:1; min-height:100px; max-height:40vh; overflow:auto;
  display:flex; flex-direction:column; gap:10px; margin-bottom:14px;
}
.rd-cmt-item{
  padding:12px 14px; border-radius:12px; background:#F9FAFB;
  font-size:14px; line-height:1.6; color:#1F2937;
}
.rd-cmt-item .who{ font-size:12px; color:#9CA3AF; margin-bottom:4px; }
.rd-cmt-compose{ display:flex; gap:10px; align-items:flex-end; }
.rd-cmt-compose textarea{
  flex:1; border:1px solid #E5E7EB; border-radius:12px;
  padding:10px 14px; font:14px/1.5 var(--font-body); resize:none;
  background:#F9FAFB; color:#1F2937;
}
.rd-cmt-send{
  height:42px; padding:0 18px; border:0; border-radius:12px;
  background:#111; color:#fff;
  font-weight:600; cursor:pointer;
}
.rd-cmt-acts{
  display:flex; gap:10px; margin-top:12px;
}
.rd-cmt-acts button{
  flex:1; height:40px; border-radius:10px; border:1px solid #E5E7EB;
  background:#F9FAFB; font-size:13px; cursor:pointer; color:#4B5563;
}
.rd-cmt-acts .danger{ color:#EF4444; }

/* 深色主题 · 书架 */
html[data-theme="dark"] .rd-view{
  background:#111827;
}
html[data-theme="dark"] .rd-lib-tabs button{ color:#9CA3AF; }
html[data-theme="dark"] .rd-lib-tabs button.on{ color:#F9FAFB; }
html[data-theme="dark"] .rd-lib-tabs button.on::after{ background:#F9FAFB; }
html[data-theme="dark"] .rd-lib-more{ background:#1F2937; border-color:#374151; color:#F9FAFB; }
html[data-theme="dark"] .rd-lib-search{ background:#1F2937; color:#9CA3AF; }
html[data-theme="dark"] .rd-lib-search input{ color:#F9FAFB; }
html[data-theme="dark"] .rd-lib-stats{ background:#1F2937; border-color:#374151; }
html[data-theme="dark"] .rd-lib-stat-num{ color:#F9FAFB; }
html[data-theme="dark"] .rd-lib-stat-div{ background:#374151; }
html[data-theme="dark"] .rd-card{ background:#1F2937; border-color:#374151; }
html[data-theme="dark"] .rd-card-title{ color:#F9FAFB; }
html[data-theme="dark"] .rd-card-intro{ color:#9CA3AF; }
html[data-theme="dark"] .rd-sheet-card{
  background:#1F2937; color:#F9FAFB;
}
html[data-theme="dark"] .rd-sheet-title{ color:#F9FAFB; }
html[data-theme="dark"] .rd-set-row{ color:#D1D5DB; }
html[data-theme="dark"] .rd-edit-row input,
html[data-theme="dark"] .rd-edit-row textarea{
  background:#374151; color:#F9FAFB; border-color:#4B5563;
}
html[data-theme="dark"] .rd-lib-menu-card button{ color:#F9FAFB; border-bottom-color:#374151; }
html[data-theme="dark"] .rd-theme-btn, html[data-theme="dark"] .rd-turn-btn{
  background:#374151; color:#D1D5DB; border-color:#4B5563;
}
html[data-theme="dark"] .rd-theme-btn.on, html[data-theme="dark"] .rd-turn-btn.on{
  background:rgba(139,92,246,.2); color:#A78BFA;
}
html[data-theme="dark"] .rd-toc-card{
  background:#1F2937; color:#F9FAFB;
}
html[data-theme="dark"] .rd-toc-title{ color:#F9FAFB; }
html[data-theme="dark"] .rd-toc-tabs{ border-bottom-color:#374151; }
html[data-theme="dark"] .rd-toc-tabs button.on{ color:#F9FAFB; }
html[data-theme="dark"] .rd-toc-item{
  color:#F9FAFB; border-bottom-color:#374151;
}
html[data-theme="dark"] .rd-toc-item.on{ background:#374151; }
html[data-theme="dark"] .rd-toc-nav{
  background:#1F2937; border-top-color:#374151;
}
html[data-theme="dark"] .rd-toc-nav .rd-nav-btn{ color:#F9FAFB; }
html[data-theme="dark"] .rd-cmt-quote{
  background:#374151; color:#9CA3AF;
}
html[data-theme="dark"] .rd-cmt-item{
  background:#374151; color:#F9FAFB;
}
html[data-theme="dark"] .rd-cmt-compose textarea{
  background:#374151; color:#F9FAFB; border-color:#4B5563;
}
html[data-theme="dark"] .rd-cmt-acts button{
  background:#374151; color:#D1D5DB;
}

/* ========== 阅读主题弹窗 ========== */
.rd-theme-modal{
  position:absolute; inset:0; z-index:55;
  display:flex; align-items:center; justify-content:center;
  padding:18px 16px;
}
.rd-theme-modal[hidden]{ display:none !important; }
.rd-theme-modal-bd{
  position:absolute; inset:0; border:0; padding:0;
  background:rgba(0,0,0,.22); cursor:pointer;
}
.rd-theme-card{
  position:relative; z-index:1;
  width:min(100%, 360px); max-height:78vh;
  background:#fff; color:#111;
  border-radius:22px;
  box-shadow:0 16px 48px rgba(0,0,0,.22);
  display:flex; flex-direction:column;
  overflow:hidden;
  opacity:var(--rd-modal-op, 1);
}
.rd-theme-seg{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:4px; margin:14px 14px 8px; padding:4px;
  background:#EFEFEF; border-radius:12px; flex:0 0 auto;
}
.rd-theme-seg button{
  border:0; background:transparent; border-radius:10px;
  height:34px; font-size:14px; color:#888; cursor:pointer; font-weight:500;
}
.rd-theme-seg button.on{
  background:#fff; color:#111; font-weight:700;
  box-shadow:0 1px 4px rgba(0,0,0,.08);
}
.rd-theme-body{ flex:1; min-height:0; display:flex; flex-direction:column; }
.rd-tm-pane{ display:none; flex:1; min-height:0; flex-direction:column; padding:0 14px 14px; }
.rd-tm-pane.on{ display:flex; }
.rd-tm-pane[hidden]{ display:none !important; }
.rd-tm-row-label{ font-size:13px; color:#666; margin:8px 0 10px; }
.rd-tm-swatches, .rd-tm-fonts{
  display:grid; grid-template-columns:repeat(3,1fr); gap:10px;
}
.rd-tm-sw{
  height:56px; border:0; border-radius:12px; cursor:pointer;
  background:var(--sw,#fff); font-size:12px; color:#555;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.06);
}
.rd-tm-sw.on{ box-shadow:inset 0 0 0 2px #111; font-weight:700; }
.rd-tm-fonts button{
  height:48px; border:0; border-radius:12px; cursor:pointer;
  background:#F3F3F3; font-size:14px; color:#222;
}
.rd-tm-fonts button.on{ background:#111; color:#fff; }
.rd-tm-hint{ margin-top:14px; font-size:12px; color:#AAA; text-align:center; }
.rd-tm-pick em{
  border:0; background:transparent; color:#999; font-size:13px; cursor:pointer;
}
.rd-tm-scroll{
  flex:1; min-height:0; overflow:auto; padding-bottom:8px;
  -webkit-overflow-scrolling:touch;
}
.rd-tm-sec{ padding-bottom:6px; }
.rd-tm-sec-title{
  display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:600; color:#666;
  margin:14px 0 8px;
}
.rd-tm-sec-title i{
  width:3px; height:12px; border-radius:2px; background:#C8C8C8; display:block;
}
.rd-tm-slider{
  display:grid;
  grid-template-columns:78px 28px 1fr 28px 36px;
  align-items:center; gap:6px;
  margin-bottom:10px; font-size:13px; color:#333;
}
.rd-tm-slider .lb{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-tm-slider .pm{
  width:28px; height:28px; border:0; border-radius:8px;
  background:#F0F0F0; color:#333; font-size:16px; line-height:1; cursor:pointer;
}
.rd-tm-slider input[type="range"]{
  width:100%; -webkit-appearance:none; appearance:none;
  height:4px; border-radius:999px; background:#E4E4E4; outline:none;
}
.rd-tm-slider input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:20px; height:20px; border-radius:50%;
  background:#fff; border:1px solid #DDD;
  box-shadow:0 1px 4px rgba(0,0,0,.15); cursor:pointer;
}
.rd-tm-slider .val{
  text-align:right; font-weight:600; font-variant-numeric:tabular-nums; color:#222;
}
.rd-tm-pick{
  width:100%; display:flex; align-items:center; justify-content:space-between;
  border:0; background:transparent; padding:12px 0;
  font-size:14px; color:#222; cursor:pointer;
  border-bottom:1px solid #F2F2F2;
}
.rd-tm-toggle{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 0; font-size:14px; color:#222;
  border-bottom:1px solid #F2F2F2;
}
.rd-switch{
  width:44px; height:26px; border-radius:999px; border:0;
  background:#D6D6D6; position:relative; cursor:pointer; padding:0;
}
.rd-switch::after{
  content:""; position:absolute; top:3px; left:3px;
  width:20px; height:20px; border-radius:50%; background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,.2);
  transition:transform .2s;
}
.rd-switch.on{ background:#111; }
.rd-switch.on::after{ transform:translateX(18px); }
.rd-tm-seg2{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 0; font-size:14px;
}
.rd-tm-mini-seg{
  display:flex; background:#EFEFEF; border-radius:10px; padding:3px; gap:2px;
}
.rd-tm-mini-seg button{
  border:0; background:transparent; border-radius:8px;
  padding:6px 12px; font-size:12px; color:#888; cursor:pointer;
}
.rd-tm-mini-seg button.on{ background:#fff; color:#111; font-weight:600; }
.rd-tm-actions{
  display:grid; grid-template-columns:1fr 1fr; gap:10px;
  margin-top:12px;
}
.rd-tm-actions button{
  height:52px; border:0; border-radius:14px;
  background:#F0F0F0; color:#222; font-size:13px; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
}
.rd-tm-actions button svg{ width:18px; height:18px; }
.rd-tm-actions button.danger{ color:#E11D48; }
.rd-theme-resize{
  position:absolute; right:10px; bottom:8px;
  width:12px; height:12px;
  background:
    linear-gradient(135deg, transparent 40%, #D0D0D0 40%, #D0D0D0 45%, transparent 45%),
    linear-gradient(135deg, transparent 55%, #D0D0D0 55%, #D0D0D0 60%, transparent 60%),
    linear-gradient(135deg, transparent 70%, #D0D0D0 70%, #D0D0D0 75%, transparent 75%);
  pointer-events:none; opacity:.7;
}
.rd-set-theme-head{ cursor:pointer; }
