:root {
  --bg: #f7f5ef; --fg: #2a2a2a; --accent: #8a5a2b; --line: #ddd6c8;
  --panel: #fffdf8; --card: #fffdf8; --muted: #8a8175;
  --head-h: 0px; --bar-h: 46px;     /* 由 nav.js 按实测页头/工具条高度写入；
     工具条自身的 min-height 不能用 --bar-h，否则「高度由自己决定」会自锁成一个错值 */
}
body.theme-dark { --bg:#1c1c1e; --fg:#e8e6e1; --accent:#d9a566; --line:#3a3a3c;
  --panel:#26262a; --card:#232326; --muted:#9a958c; }
body.theme-sepia { --bg:#f4ecd8; --fg:#433422; --accent:#9c6b3f; --line:#e0d3b4;
  --panel:#fbf4e3; --card:#fbf4e3; --muted:#8a7656; }

* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg); }
a { color: var(--accent); text-decoration: none; }

/* ---------- 阅读工具条：贴在统一页头下面（字号 / 主题 / 笔记 / 目录）---------- */
.reader-bar { position:sticky; top:var(--head-h, 0px); z-index:40;
  background:var(--panel); border-bottom:1px solid var(--line); }
.rb-inner { max-width:1100px; margin:0 auto; padding:6px 16px; min-height:46px;
  display:flex; align-items:center; gap:12px; }
/* 「← 本书详情」也做成和「目录」一样的方框，一排按钮看着才是一套 */
.rb-back { display:inline-flex; align-items:center; padding:5px 11px; border-radius:8px;
  font-size:13px; white-space:nowrap; color:var(--fg); background:var(--panel);
  border:1px solid var(--line); }
.rb-back:hover { border-color:var(--accent); color:var(--accent); }
.rb-tools { display:flex; align-items:center; gap:6px; margin-left:auto; flex-wrap:wrap; }
.rb-tools .btn { padding:5px 11px; font-size:13px; }
@media (max-width:560px) {
  .rb-inner { padding:6px 10px; gap:8px; }
  .rb-tools .btn { padding:5px 9px; font-size:12.5px; }
}

/* 正文页顶部的书名 / 作者（标题字号） */
.read-head { margin:4px 0 26px; padding-bottom:16px; border-bottom:1px dashed var(--line);
  text-align:center; }
.read-title { margin:0; font-family:"Noto Serif SC","Songti SC",Georgia,serif;
  font-size:clamp(23px, 3vw, 31px); line-height:1.35; letter-spacing:.5px; color:var(--fg); }
.read-author { margin:10px 0 0; font-size:15px; color:var(--muted); }
.read-author a { color:var(--accent); }
.read-sub { margin:8px 0 0; font-size:12.5px; color:var(--muted); }
.read-sub a { color:var(--accent); }

/* 右下角：顶部时「到底部」，滚下去变「返回顶部」 */
.jump-btn { position:fixed; right:18px; bottom:22px; z-index:45;
  display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:999px;
  border:1px solid var(--line); background:var(--panel); color:var(--fg);
  font-size:13.5px; font-family:inherit; cursor:pointer;
  box-shadow:0 8px 22px rgba(0,0,0,.16); transition:transform .15s, box-shadow .15s, opacity .15s; }
.jump-btn:hover { transform:translateY(-2px); box-shadow:0 12px 26px rgba(0,0,0,.22);
  border-color:var(--accent); color:var(--accent); }
@media (max-width:560px) {
  .jump-btn { right:12px; bottom:14px; padding:8px 13px; font-size:13px; }
}

.layout { display:flex; align-items:flex-start; max-width:1100px; margin:0 auto; }
/* 桌面端：点「目录」可折叠左侧目录栏，正文占满整行 */
@media (min-width: 721px) {
  .layout.toc-collapsed .toc { display:none; }
  .rb-tools #toggle-toc.active { border-color:var(--accent); color:var(--accent); }
}
.toc { width:240px; flex:none; position:sticky;
  top:calc(var(--head-h, 0px) + var(--bar-h, 46px));
  max-height:calc(100vh - var(--head-h, 0px) - var(--bar-h, 46px) - 12px);
  overflow:auto; padding:16px; border-right:1px solid var(--line); }
.toc ul { list-style:none; margin:0; padding:0; }
.toc li { margin:2px 0; }
.toc a { display:block; padding:6px 8px; border-radius:6px; color:var(--fg); font-size:14px; }
.toc a:hover, .toc a.active { background:var(--line); }

.reader { flex:1; min-width:0; padding:32px 28px 80px;
  font-family:"Noto Serif SC", Georgia, "Songti SC", serif; }
.reader .chapter { margin-bottom:2.4em; }
.reader .chapter-title { text-align:center; font-size:1.2em; margin:1.6em 0 1em; color:var(--accent); }

/* ---------- 正文插图（原书图片，抓来放在它所属的段落前面）---------- */
.reader .fig { margin:1.4em auto; max-width:min(560px, 100%); text-align:center; }
.reader .fig img { max-width:100%; height:auto; display:block; margin:0 auto;
  border:1px solid var(--line); border-radius:6px; background:var(--panel); }
.reader .fig figcaption { margin-top:.5em; font-size:.85em; color:var(--muted);
  font-style:italic; line-height:1.5; }
.reader p { line-height:1.9; margin:0.9em 0; text-indent:2em; font-size:var(--fs, 18px); }
.reader p.orig { text-indent:0; color:var(--muted); font-size:0.92em; font-style:italic; }

.banner { max-width:1100px; margin:12px auto 0; padding:10px 16px; background:#fff4e0;
  border:1px solid #e6c98a; color:#7a5a18; border-radius:8px; line-height:1.75; }
.banner-todo { background:#f2f6f0; border-color:#cfdcc6; color:#3f5237; }
/* 深色 / 米黄主题下，正文顶部的提示条也要跟着变（否则切主题时这一条纹丝不动很突兀） */
body.theme-dark .banner { background:#3a2f1e; border-color:#5c4a2a; color:#e8d3a2; }
body.theme-dark .banner-todo { background:#20301f; border-color:#3a5237; color:#bfd8bf; }
body.theme-sepia .banner { background:#f4e7c6; border-color:#dcc899; color:#6b5320; }
body.theme-sepia .banner-todo { background:#e4ecd8; border-color:#c1cfb0; color:#3f5237; }
.banner-go { display:inline-block; margin-left:6px; padding:2px 10px; border-radius:999px;
  background:#3f5237; color:#fff; text-decoration:none; font-size:13px; white-space:nowrap; }
.banner-go:hover { background:#2f4029; }
@media (max-width:560px) {
  .banner { margin:10px 12px 0; font-size:13.5px; }
  .banner-go { display:block; width:fit-content; margin:8px 0 0; }
}

.btn { background:var(--panel); border:1px solid var(--line); color:var(--fg);
  padding:6px 12px; border-radius:8px; cursor:pointer; font-size:14px; }
.btn:hover { border-color:var(--accent); }
.btn.ghost { background:transparent; }

.bookfoot, .book-extras { max-width:1100px; margin:0 auto; padding:24px 28px 48px;
  border-top:1px solid var(--line); }
.bookfoot .dl, .book-extras .dl { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.bookfoot .note, .book-extras .note { color:var(--muted); font-size:13px; }

.about-wrap { max-width:760px; margin:0 auto; padding:40px 20px; line-height:1.8; }
.about-wrap h1 { color:var(--accent); }
.about-wrap h2 { margin-top:1.6em; color:var(--accent); }
.about-wrap .muted { color:var(--muted); font-size:13px; }

@media (max-width: 720px) {
  .toc { position:fixed; left:0; top:calc(var(--head-h, 0px) + var(--bar-h, 46px)); bottom:0;
    width:78%; background:var(--panel); max-height:none;
    transform:translateX(-100%); transition:transform .2s; z-index:45;
    box-shadow:2px 0 12px rgba(0,0,0,.2); }
  .toc.open { transform:translateX(0); }
  .reader { padding:20px 16px 80px; }
  .read-head { margin-bottom:18px; }
}

/* 顶部登录件 */
.authbar { display:flex; justify-content:flex-end; gap:8px; align-items:center;
  padding:8px 16px 0; background:transparent; border-bottom:0; font-size:14px; }
.authbar .uname { color:var(--muted); margin-right:4px; }
.authbar .btn { background:transparent; border:1px solid var(--line); color:var(--fg);
  padding:5px 13px; border-radius:999px; font-size:13.5px; cursor:pointer; }
.authbar .btn:hover { border-color:var(--accent); color:var(--accent); }
.authbar #regBtn { background:var(--accent); border-color:var(--accent); color:#fff; }
.authbar #regBtn:hover { background:#774d24; color:#fff; }

/* 书页底部导航 */
.booknav { display:flex; flex-wrap:wrap; justify-content:center; gap:6px 16px;
  margin:0 auto 16px; font-size:13.5px; }
.booknav a { color:var(--muted); }
.booknav a:hover { color:var(--accent); }

/* 留言板 */
.comments { max-width:1100px; margin:0 auto; padding:24px 28px 12px; border-top:1px solid var(--line); }
.comments h2 { color:var(--accent); font-size:1.1em; }
.comments ul { list-style:none; margin:12px 0; padding:0; }
.comments li { padding:10px 0; border-bottom:1px dashed var(--line); }
.comments .c-user { font-weight:600; margin-right:8px; }
.comments .c-time { color:var(--muted); font-size:12px; }
.comments .c-text { margin-top:4px; line-height:1.7; }
.comments textarea { width:100%; min-height:64px; padding:8px 10px; border:1px solid var(--line);
  border-radius:8px; background:var(--panel); color:var(--fg); font-family:inherit; }

/* 笔记抽屉 */
.note-drawer { position:fixed; top:0; right:0; height:100%; width:340px; max-width:88vw;
  background:var(--panel); border-left:1px solid var(--line); box-shadow:-4px 0 20px rgba(0,0,0,.15);
  transform:translateX(100%); transition:transform .22s; z-index:90; display:flex; flex-direction:column; }
.note-drawer.open { transform:translateX(0); }
.note-head { display:flex; justify-content:space-between; align-items:center; padding:12px 14px;
  border-bottom:1px solid var(--line); font-weight:600; color:var(--accent); }
.note-close { background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); }
.note-body { padding:12px 14px; overflow:auto; flex:1; }
.note-body ul { list-style:none; margin:0 0 14px; padding:0; }
.note-body li { position:relative; padding:8px 10px; margin-bottom:8px; border:1px solid var(--line);
  border-radius:8px; cursor:pointer; }
.note-body .n-quote { color:var(--muted); font-size:13px; font-style:italic; margin-bottom:4px; }
.note-body .n-text { line-height:1.6; }
.note-body .n-del { position:absolute; top:6px; right:8px; font-size:12px; color:var(--muted);
  background:none; border:none; cursor:pointer; }
.note-edit textarea { width:100%; min-height:80px; padding:8px 10px; border:1px solid var(--line);
  border-radius:8px; background:var(--panel); color:var(--fg); font-family:inherit; }
.note-quote { font-size:13px; color:var(--muted); min-height:1em; margin-bottom:6px; }
.note-actions { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }

/* ---------- 工具栏 ---------- */

/* ---------- 句子级译文：句尾红标 + 对照弹窗 ---------- */
.intro-tip { max-width:1100px; margin:12px auto 0; padding:10px 16px; font-size:13px;
  background:rgba(138,90,43,.08); border:1px dashed var(--line); border-radius:10px; color:var(--muted);
  line-height:1.9; }
.intro-tip b { color:var(--accent); }
.intro-tip .rev-badge-demo { display:inline-block; padding:0 5px; border-radius:4px;
  background:#c0392b; color:#fff; font-size:11px; font-weight:700; }

.sent { border-radius:3px; transition:background .15s; }
.sent.accepted { background:rgba(255,196,0,.22); box-shadow:inset 0 -2px 0 rgba(138,90,43,.6); padding:1px 2px; }

/* 「修 N 条」：句尾右上角的红标 */
.rev-badge { display:inline-block; margin:0 2px 0 4px; padding:1px 5px; border-radius:4px;
  background:#c0392b; color:#fff; font-size:10px; font-weight:700; line-height:1.6;
  letter-spacing:.2px; vertical-align:super; cursor:pointer; user-select:none;
  white-space:nowrap; }
.rev-badge:hover { background:#a5301f; }

/* 轻提示（提交成功后刷新回来时用） */
.guten-toast { position:fixed; left:50%; bottom:28px; transform:translate(-50%,16px);
  max-width:min(86vw,520px); padding:11px 18px; border-radius:10px; z-index:120;
  background:rgba(32,28,22,.94); color:#fdfaf3; font-size:14px; line-height:1.6;
  box-shadow:0 8px 26px rgba(0,0,0,.28); opacity:0; pointer-events:none;
  transition:opacity .2s, transform .2s; }
.guten-toast.show { opacity:1; transform:translate(-50%,0); }
body.theme-dark .guten-toast { background:rgba(245,242,235,.96); color:#201c16; }

/* 修订记录汇总（页脚前） */
.corr-summary { max-width:1100px; margin:0 auto; padding:18px 28px; border-top:1px solid var(--line); }
.corr-summary h2 { color:var(--accent); font-size:1.05em; }
.corr-summary ul { list-style:none; margin:10px 0 0; padding:0; }
.corr-summary li { padding:8px 0; border-bottom:1px dashed var(--line); line-height:1.7; font-size:14px; }
.corr-summary .hl { background:rgba(255,196,0,.28); padding:0 2px; border-radius:3px; }
.corr-summary .orig-small { color:var(--muted); font-size:12px; }

/* 页脚出处声明 */
.provenance { max-width:1100px; margin:10px auto 0; font-size:13px; color:var(--muted); line-height:1.8; }
.provenance a { color:var(--accent); }

/* 译文对照弹窗：英文原文置顶吸附，下面是所有人的译文 */
.corr-modal { position:fixed; inset:0; background:rgba(20,16,10,.5); z-index:120;
  display:flex; align-items:center; justify-content:center; padding:16px; }
.corr-card { width:min(680px, 96vw); max-height:88vh; overflow:auto; background:var(--panel);
  border:1px solid var(--line); border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.corr-top { position:sticky; top:0; z-index:2; background:var(--panel);
  border-bottom:1px solid var(--line); border-radius:14px 14px 0 0; }
.corr-head { display:flex; justify-content:space-between; align-items:center; padding:12px 16px 8px;
  font-weight:600; color:var(--accent); }
.corr-en-box { padding:0 16px 12px; }
.corr-body { padding:14px 16px 18px; }
.corr-block { margin-bottom:14px; }
.corr-label { font-size:12px; color:var(--muted); margin-bottom:5px; }
.corr-count { color:var(--muted); }
.corr-en { font-size:13.5px; color:var(--muted); font-style:italic; line-height:1.7;
  background:rgba(0,0,0,.04); padding:8px 10px; border-radius:8px; }
.corr-orig { font-size:15px; line-height:1.7; padding:8px 10px; border-left:3px solid var(--line); }
.corr-body textarea { width:100%; min-height:70px; padding:9px 11px; border:1px solid var(--line);
  border-radius:8px; background:var(--panel); color:var(--fg); font-family:inherit; font-size:15px; }
.corr-actions { margin-top:8px; text-align:right; }
.corr-own-hint { font-size:12.5px; color:var(--muted); line-height:1.8;
  background:rgba(63,125,90,.10); border:1px dashed rgba(63,125,90,.35);
  border-radius:8px; padding:8px 10px; }

.corr-list { list-style:none; margin:0; padding:0; }
.corr-item { position:relative; border:1px solid var(--line); border-radius:10px;
  padding:10px 12px; margin-bottom:10px; }
.corr-item.is-pinned { border-color:rgba(138,90,43,.55); background:rgba(255,196,0,.07); }
.ci-zh { font-size:15px; line-height:1.75; margin-bottom:8px; }
.ci-flag { font-size:11px; font-weight:600; color:#fff; background:var(--accent);
  border-radius:999px; padding:1px 8px; }
.ci-meta { display:flex; flex-wrap:wrap; gap:8px; align-items:center; font-size:12px; color:var(--muted); }
.ci-meta .c-user { color:var(--accent); font-weight:600; }
.ci-own { color:#3f7d5a; border:1px solid rgba(63,125,90,.4); border-radius:999px;
  padding:0 7px; font-size:11px; }

.vote-btn, .discuss-toggle, .ci-edit-btn, .vote-chip { border:1px solid var(--line);
  background:transparent; color:var(--fg); padding:2px 9px; border-radius:999px;
  cursor:pointer; font-size:12px; font-family:inherit; line-height:1.7; }
.vote-btn:hover, .discuss-toggle:hover, .ci-edit-btn:hover { border-color:var(--accent); color:var(--accent); }
.vote-btn.up.on { border-color:#3f7d5a; color:#3f7d5a; background:rgba(63,125,90,.12); }
.vote-btn.down.on { border-color:#b23b3b; color:#b23b3b; background:rgba(178,59,59,.10); }
.vote-chip { border-style:dashed; color:var(--muted); cursor:default; }
.ci-edit-btn { border-color:var(--accent); color:var(--accent); }
.ci-edit { width:100%; min-height:64px; padding:8px 10px; border:1px solid var(--line);
  border-radius:8px; background:var(--panel); color:var(--fg); font-family:inherit; font-size:15px; }
.ci-edit-act { display:flex; gap:8px; justify-content:flex-end; margin-top:6px; }
.btn.sm { padding:5px 12px; font-size:13px; }

.discuss-box { margin-top:10px; padding-top:8px; border-top:1px dashed var(--line); }
.discuss-list { list-style:none; margin:0 0 8px; padding:0; font-size:13px; }
.discuss-list li { padding:5px 0; border-bottom:1px dotted var(--line); }
.discuss-form { display:flex; gap:6px; }
.discuss-form input { flex:1; padding:7px 10px; border:1px solid var(--line); border-radius:8px;
  background:var(--panel); color:var(--fg); font-size:13px; }
.discuss-form button { border:1px solid var(--line); background:var(--accent); color:#fff;
  border-radius:8px; padding:0 12px; cursor:pointer; font-size:13px; }

/* ---------- 反垃圾：审核中标记 / 举报 ---------- */
.pending-tag { display:inline-block; padding:1px 7px; border-radius:999px; font-size:11px;
  color:#8a5a2b; background:rgba(138,90,43,.10); border:1px solid rgba(138,90,43,.25); }
.corr-item.is-pending { border-style:dashed; opacity:.92; }
.pending-note { font-size:12px; color:var(--muted); margin:-2px 0 7px; }
.report-btn { margin-left:auto; border:none; background:transparent; color:var(--muted);
  font-size:11.5px; cursor:pointer; padding:2px 4px; opacity:.55; }
.report-btn:hover { color:#b23b3b; opacity:1; text-decoration:underline; }
.comments li { position:relative; }
.comments .report-btn { position:absolute; right:0; top:8px; margin:0; }
.vote-btn.disabled { cursor:default; opacity:.6; }
.hp-field { position:absolute !important; left:-9999px !important; top:auto !important;
  width:1px; height:1px; opacity:0; pointer-events:none; }
body.theme-dark .pending-tag { color:#e0c08a; border-color:rgba(224,192,138,.3); }

/* 深色主题适配 */
body.theme-dark .corr-en { background:rgba(255,255,255,.06); }
body.theme-dark .sent.accepted { background:rgba(255,196,0,.18); }
body.theme-dark .corr-item.is-pinned { background:rgba(255,196,0,.08); }
body.theme-dark .corr-own-hint { background:rgba(63,125,90,.22); }

/* 保证 hidden 属性生效（避免 display:flex 覆盖导致弹窗常显） */
[hidden] { display:none !important; }

/* ---------- 选中句子的浮动「修订此句」按钮 ---------- */
.sel-toolbar { position:fixed; z-index:130; display:none; }
.sel-toolbar.show { display:block; }
.sel-toolbar button { background:var(--accent); color:#fff; border:none; border-radius:999px;
  padding:7px 15px; font-size:13px; cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.25);
  white-space:nowrap; }
.sel-toolbar button:hover { filter:brightness(1.08); }



/* 从「我的校译」跳转定位到的那一句：闪一下提示 */
.sent.sid-flash { background:#fdefc9; box-shadow:0 0 0 3px #fdefc9; border-radius:4px;
  transition:background .4s, box-shadow .4s; }
.sent.sid-flash { background:#fdefc9 !important; box-shadow:0 0 0 3px #fdefc9; border-radius:4px; }

/* 目录栏顶部：书名 + 作者（居中） */
.toc-book { text-align:center; padding:6px 8px 10px; margin-bottom:8px;
  border-bottom:1px solid var(--line); }
.toc-book .toc-title { display:block; font-size:15px; line-height:1.35; color:var(--fg); }
.toc-book .toc-author { display:block; margin-top:5px; font-size:12px; color:var(--muted); }
