/* ============================================================
   山顶时代 · 文库典藏  —— 古籍书院风
   宣纸米白 / 墨色 / 朱砂 / 青灰，克制素雅
   ============================================================ */

:root {
  --paper: #f6f1e6;
  --paper-2: #efe8d8;
  --ink: #26221c;
  --ink-soft: #6b6255;
  --cinnabar: #a63a2b;
  --cinnabar-dark: #8a2f22;
  --slate: #7d8577;
  --line: #d9cfb9;
  --line-soft: #e4dcc9;
  --empty-bg: rgba(239, 232, 216, .45);
  --pbar: #ddd2ba;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
::selection { background: rgba(166, 58, 43, .18); }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 57px;
  padding: 6px 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--cinnabar);
  color: #f8f2e4;
  border-radius: 3px;
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 230, .42);
}
.brand-name { font-size: 18px; letter-spacing: .14em; }
.brand-name small { margin-left: 8px; font-size: 11px; color: var(--ink-soft); letter-spacing: .26em; }

.topnav { display: flex; gap: 4px; }
.topnav a {
  padding: 5px 12px;
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--cinnabar); }
.topnav a.active { color: var(--cinnabar); border-bottom-color: var(--cinnabar); }

.top-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(340px, 38vw);
  padding: 5px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-soft);
}
.top-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--ink);
}
.top-search input::-webkit-search-cancel-button { display: none; }

/* ---------------- 布局 ---------------- */

main#app {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.page { padding: 26px 22px 80px; }

.dim { color: var(--ink-soft); font-size: 13px; }

.sec-head { display: flex; align-items: baseline; gap: 12px; margin: 36px 0 16px; }
.sec-head:first-child { margin-top: 6px; }
.sec-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .18em;
  border-left: 3px solid var(--cinnabar);
  padding-left: 10px;
  line-height: 1.3;
}

.hero {
  padding: 8px 2px 0;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: .08em;
}
.hero b { color: var(--cinnabar); font-weight: 600; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 2px;
  padding: 7px 16px;
  font-size: 14px;
  letter-spacing: .1em;
  white-space: nowrap;
}
.btn:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.btn.primary { background: var(--cinnabar); border-color: var(--cinnabar); color: #f8f2e4; }
.btn.primary:hover { background: var(--cinnabar-dark); color: #f8f2e4; }
.btn.seal {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #f8f2e4;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 230, .35);
}
.btn.seal:hover { background: var(--cinnabar-dark); color: #f8f2e4; }
.btn.ghost { border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--cinnabar); }
.btn.small { padding: 3px 11px; font-size: 13px; }
.btn[disabled] { opacity: .38; pointer-events: none; }

/* ---------------- 封面网格 ---------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px; }

.cover {
  --cover: #3d4f5d;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  height: 188px;
  padding: 14px 10px;
  background: var(--cover);
  color: #f3ecdc;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(38, 34, 28, .16);
  transition: transform .16s ease, box-shadow .16s ease;
}
.cover:hover { transform: translateY(-3px); box-shadow: 0 5px 12px rgba(38, 34, 28, .22); }
.cover-title {
  writing-mode: vertical-rl;
  font-size: 17px;
  letter-spacing: .18em;
  line-height: 1;
  max-height: 100%;
  overflow: hidden;
}
.cover-line { flex: none; width: 1px; background: rgba(243, 236, 220, .38); }
.cover-cat {
  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: .22em;
  line-height: 1;
  opacity: .68;
  max-height: 100%;
  overflow: hidden;
}

/* ---------------- 正在阅读 ---------------- */

.reading-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.reading-item {
  display: block;
  padding: 13px 15px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.reading-item:hover { border-color: var(--cinnabar); }
.reading-title {
  display: block;
  margin-bottom: 9px;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbar { display: block; height: 4px; margin-bottom: 7px; background: var(--pbar); border-radius: 2px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--cinnabar); }

/* ---------------- 书签 ---------------- */

.bm-list { display: flex; flex-direction: column; gap: 10px; }
.bm-item {
  display: flex;
  align-items: stretch;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.bm-item:hover { border-color: var(--cinnabar); }
.bm-link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
}
.bm-book { color: var(--cinnabar); font-size: 14px; letter-spacing: .06em; }
.bm-excerpt {
  font-size: 14px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bm-note { color: var(--ink-soft); font-size: 13px; }
.bm-note::before { content: "记 · "; color: var(--slate); }
.bm-del {
  flex: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 19px;
  padding: 0 13px;
}
.bm-del:hover { color: var(--cinnabar); }

/* ---------------- 空状态 ---------------- */

.empty {
  padding: 26px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--empty-bg);
  border: 1px dashed var(--line);
  border-radius: 2px;
  letter-spacing: .05em;
}
.empty a { color: var(--cinnabar); border-bottom: 1px solid var(--cinnabar); padding-bottom: 1px; }

.error-box {
  margin: 60px auto;
  max-width: 480px;
  padding: 24px;
  text-align: center;
  color: var(--cinnabar-dark);
  border: 1px solid var(--cinnabar);
  border-radius: 2px;
}

/* ---------------- 分类浏览 ---------------- */

.browse { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: start; }

.cat-tree {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding: 8px 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.cat-tree a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 6px 15px;
  font-size: 14px;
  color: var(--ink-soft);
}
.cat-tree a:hover { color: var(--cinnabar); }
.cat-tree a.active { color: var(--cinnabar); background: rgba(166, 58, 43, .08); }
.cat-tree .count { flex: none; font-size: 12px; opacity: .6; }
.cat-tree .cat2-list a { padding-left: 30px; font-size: 13px; }

.browse-head { margin-bottom: 16px; color: var(--ink-soft); font-size: 14px; letter-spacing: .08em; }
.browse-head b { color: var(--ink); font-weight: 600; }

/* ---------------- 分页 ---------------- */

.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 28px; }
.pager a, .pager span {
  min-width: 32px;
  padding: 4px 9px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.pager a:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.pager .cur { background: var(--cinnabar); border-color: var(--cinnabar); color: #f8f2e4; }
.pager .off { opacity: .4; pointer-events: none; }

/* ---------------- 检索结果 ---------------- */

.group-title {
  margin: 30px 0 14px;
  font-size: 18px;
  letter-spacing: .14em;
  border-left: 3px solid var(--cinnabar);
  padding-left: 10px;
  line-height: 1.3;
}
.group-title:first-child { margin-top: 4px; }
.group-title .dim { margin-left: 8px; font-size: 13px; letter-spacing: 0; }

.full-list { display: flex; flex-direction: column; gap: 13px; }
.full-item { padding: 13px 17px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 2px; }
.full-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.full-title { font-size: 17px; letter-spacing: .04em; }
.full-title:hover { color: var(--cinnabar); }
.snippet { margin-bottom: 9px; color: var(--ink-soft); font-size: 14px; line-height: 1.85; word-break: break-all; }

mark { background: rgba(166, 58, 43, .16); color: var(--cinnabar-dark); padding: 0 1px; border-radius: 1px; }

/* ---------------- 书籍详情 ---------------- */

.book-head { display: flex; gap: 28px; align-items: flex-start; margin-bottom: 34px; }
.book-cover-lg { flex: none; width: 148px; height: 208px; }
.book-meta { min-width: 0; }
.book-meta h1 { margin: 2px 0 12px; font-size: 28px; letter-spacing: .05em; line-height: 1.4; }
.meta-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; color: var(--ink-soft); font-size: 14px; }
.meta-rows b { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.book-search { margin-top: 8px; }
.inline-form { display: flex; gap: 8px; max-width: 560px; }
.inline-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
}
.inline-form input:focus { border-color: var(--cinnabar); }

.hits { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.hit { display: block; padding: 7px 9px; font-size: 14px; color: var(--ink-soft); border-radius: 2px; word-break: break-all; }
.hit:hover { background: rgba(166, 58, 43, .07); color: var(--ink); }
.hits-summary { padding: 2px 2px 8px; }

/* ---------------- 阅读器 ---------------- */

.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.reader-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  background: var(--paper);
  flex-wrap: wrap;
}
.reader-top { border-bottom: 1px solid var(--line); }
.reader-bottom { border-top: 1px solid var(--line); gap: 14px; }

.reader-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: .1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 26vw;
}
.reader-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.reader-controls .btn { padding: 5px 12px; font-size: 13px; }
.reader-controls .btn.on { outline: 1px solid var(--cinnabar-dark); }

.reader-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 26px 72px;
}
.reader-text {
  max-width: 42em;
  margin: 0 auto;
  font-size: 19px;
  line-height: 1.9;
  white-space: pre-wrap;
  text-align: justify;
}

/* 竖排模式：核心体验 */
.reader-body.vertical {
  overflow-y: hidden;
  overflow-x: auto;
  padding: 28px 34px;
}
.reader-body.vertical .reader-text {
  writing-mode: vertical-rl;
  max-width: none;
  width: auto;
  height: 100%;
  margin: 0 auto;
  text-align: start;
  letter-spacing: .04em;
}

.reader-slider { flex: 1; min-width: 120px; accent-color: var(--cinnabar); }
.reader-pct { flex: none; min-width: 46px; text-align: center; color: var(--ink-soft); font-size: 14px; }

.reader-search { border-bottom: 1px solid var(--line); background: var(--paper-2); padding: 11px 18px; }
.reader-search .hits { max-height: 210px; overflow: auto; }

.hidden { display: none !important; }

/* ---------------- 弹层 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(38, 34, 28, .38);
}
.modal {
  width: min(430px, 92vw);
  padding: 20px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 12px 34px rgba(38, 34, 28, .28);
}
.modal-title { margin-bottom: 6px; font-size: 17px; letter-spacing: .16em; }
.modal-excerpt { margin-bottom: 12px; color: var(--ink-soft); font-size: 13px; line-height: 1.8; }
.modal textarea {
  width: 100%;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
  resize: vertical;
}
.modal textarea:focus { border-color: var(--cinnabar); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 8px 20px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  font-size: 14px;
  letter-spacing: .1em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.toast.show { opacity: .93; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding: 8px 16px; }
  .top-search { order: 3; width: 100%; }
  .browse { grid-template-columns: 1fr; }
  .cat-tree { position: static; max-height: 220px; }
  .book-head { flex-direction: column; }
  .reader-title { max-width: 38vw; }
  .reader-body { padding: 22px 16px 50px; }
  .reader-body.vertical { padding: 20px 18px; }
}

/* ============================================================
   夜读主题 —— 深棕黑底 / 米灰字 / 朱砂降饱和
   仅切换 CSS 变量，全站组件自动跟随
   ============================================================ */

html[data-theme="night"] {
  --paper: #1a1612;
  --paper-2: #23201a;
  --ink: #cdc4b4;
  --ink-soft: #8f867a;
  --cinnabar: #a05846;
  --cinnabar-dark: #b0715f;
  --slate: #6f7a6e;
  --line: #3a342b;
  --line-soft: #2f2a23;
  --empty-bg: rgba(35, 32, 26, .5);
  --pbar: #3a342b;
}

html[data-theme="night"] ::selection { background: rgba(160, 88, 70, .38); }
html[data-theme="night"] mark { background: rgba(160, 88, 70, .26); color: #d9a892; }
html[data-theme="night"] .brand-seal { color: #f0e6d4; }
html[data-theme="night"] .btn.primary,
html[data-theme="night"] .btn.seal { color: #f0e6d4; }
html[data-theme="night"] .btn.primary:hover,
html[data-theme="night"] .btn.seal:hover { color: #f0e6d4; }
html[data-theme="night"] .pager .cur { color: #f0e6d4; }
html[data-theme="night"] .cover { box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
html[data-theme="night"] .cover:hover { box-shadow: 0 5px 12px rgba(0, 0, 0, .6); }
html[data-theme="night"] .modal { box-shadow: 0 12px 34px rgba(0, 0, 0, .55); }
html[data-theme="night"] .toast { background: #d8cfc0; color: #241f18; }

/* ---------------- 通用开关态 ---------------- */

.btn.on { outline: 1px solid var(--cinnabar-dark); }

/* ---------------- 阅读统计（首页） ---------------- */

.stats-block {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px 36px;
  padding: 16px 20px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.stat-cards { display: flex; gap: 34px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; }
.stat-card b { font-size: 22px; font-weight: 600; color: var(--cinnabar); letter-spacing: .04em; }
.stat-card span { font-size: 12px; color: var(--ink-soft); letter-spacing: .22em; }

.mini-bars { display: flex; align-items: flex-end; gap: 9px; margin-left: auto; }
.mb-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mb-col i {
  display: block;
  width: 14px;
  min-height: 2px;
  background: var(--line);
  border-radius: 1px 1px 0 0;
}
.mb-col i.on { background: var(--cinnabar); }
.mb-col span { font-size: 10px; color: var(--ink-soft); letter-spacing: .04em; }

/* ---------------- 书籍元信息 / 存目残篇徽标 ---------------- */

.book-cell { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cell-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 1em;
  font-size: 12px;
  color: var(--ink-soft);
}
.cell-au {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.stub-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar);
  border-radius: 2px;
  line-height: 1.7;
}
.stub-badge.lg { margin-left: 12px; font-size: 12px; vertical-align: middle; }

.browse-head { display: flex; align-items: center; gap: 12px; }
.browse-head .btn { margin-left: auto; flex: none; }

.search-head-row { display: flex; justify-content: flex-end; margin-bottom: 4px; }

.qnorm-note {
  margin-bottom: 16px;
  padding: 8px 14px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: var(--empty-bg);
  border: 1px dashed var(--line);
  border-radius: 2px;
}
.qnorm-note b { color: var(--cinnabar); font-weight: 600; }

/* ---------------- 注疏关联 ---------------- */

.pairs-box { display: flex; flex-direction: column; gap: 10px; }
.pairs-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.pairs-label {
  flex: none;
  font-size: 14px;
  letter-spacing: .18em;
  color: var(--ink);
  border-left: 2px solid var(--cinnabar);
  padding-left: 8px;
}
.pairs-label small { margin-left: 8px; font-size: 12px; color: var(--ink-soft); letter-spacing: .04em; }
.pairs-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* 阅读器内注疏弹层 */
.pairs-pop {
  position: fixed;
  top: 64px;
  right: 18px;
  z-index: 65;
  min-width: 216px;
  max-width: 300px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 10px 26px rgba(38, 34, 28, .22);
}
html[data-theme="night"] .pairs-pop { box-shadow: 0 10px 26px rgba(0, 0, 0, .55); }
.pairs-group + .pairs-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.pairs-pop .pairs-label { display: block; margin-bottom: 7px; }
.pairs-link {
  display: block;
  padding: 4px 2px;
  font-size: 14px;
  color: var(--ink);
}
.pairs-link:hover { color: var(--cinnabar); }

/* ---------------- 勘误表单 ---------------- */

.corr-form { display: flex; flex-direction: column; gap: 10px; max-width: 620px; }
.corr-row { display: flex; gap: 10px; }
.corr-row input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
}
.corr-row input:focus { border-color: var(--cinnabar); }
.corr-row .btn { flex: none; }

/* ---------------- 阅读器主体三栏（目录 / 正文 / 译文） ---------------- */

.reader-main { flex: 1; min-height: 0; display: flex; align-items: stretch; }

.toc-panel {
  flex: none;
  width: 208px;
  overflow-y: auto;
  padding: 10px 0;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
}
.toc-head {
  padding: 4px 16px 10px;
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.toc-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.toc-item:hover { color: var(--cinnabar); }
.toc-item.active {
  color: var(--cinnabar);
  border-left-color: var(--cinnabar);
  background: rgba(166, 58, 43, .07);
}
html[data-theme="night"] .toc-item.active { background: rgba(160, 88, 70, .12); }
.toc-idx { flex: none; font-size: 11px; opacity: .62; min-width: 18px; text-align: right; }
.toc-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.trans-panel {
  flex: none;
  width: 320px;
  overflow-y: auto;
  padding: 20px 20px 60px;
  background: var(--paper-2);
  border-left: 1px solid var(--line);
}
.trans-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 9px;
  margin-bottom: 12px;
  font-size: 14px;
  letter-spacing: .24em;
  border-bottom: 1px solid var(--line-soft);
}
.trans-head .dim { letter-spacing: 0; font-size: 12px; }
.trans-text p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink);
  text-align: justify;
}
.trans-loading, .trans-note {
  padding: 18px 2px;
  font-size: 13px;
  line-height: 2;
  color: var(--ink-soft);
  letter-spacing: .08em;
}
.trans-note { border-left: 2px solid var(--line); padding-left: 12px; }

.reader-chap {
  flex: none;
  max-width: 18vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: .1em;
}

/* ---------------- 选中弹层 / 查词卡片 ---------------- */

.sel-pop {
  position: fixed;
  z-index: 70;
  max-width: 336px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 10px 26px rgba(38, 34, 28, .24);
}
html[data-theme="night"] .sel-pop { box-shadow: 0 10px 26px rgba(0, 0, 0, .55); }
.sel-actions { display: flex; }
.sel-actions button {
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ink);
  white-space: nowrap;
}
.sel-actions button + button { border-left: 1px solid var(--line-soft); }
.sel-actions button:hover { color: var(--cinnabar); background: rgba(166, 58, 43, .06); }

.lookup-card {
  border-top: 1px solid var(--line-soft);
  padding: 10px 14px 12px;
  font-size: 13px;
  line-height: 1.8;
}
.lookup-word { font-size: 16px; letter-spacing: .08em; }
.lookup-pinyin { margin-left: 10px; color: var(--slate); font-size: 13px; }
.lookup-defs { margin: 6px 0 2px; padding-left: 20px; }
.lookup-defs li { margin-bottom: 3px; }
.lookup-src { margin-top: 6px; }

/* ---------------- 夜读下的顶栏按钮 ---------------- */

#btn-night-top { padding: 5px 10px; font-size: 13px; letter-spacing: .14em; }

/* ---------------- 响应式补充 ---------------- */

@media (max-width: 900px) {
  .reader-main { flex-direction: column; }
  .toc-panel {
    width: auto;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .trans-panel {
    width: auto;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 14px 16px 30px;
  }
  .reader-chap { max-width: 30vw; }
  .pairs-pop { right: 12px; left: 12px; max-width: none; }
  .mini-bars { margin-left: 0; }
  .corr-row { flex-direction: column; }
}
