/* ==========================================================================
   铁旦说心学 · AI为学平台 2.0 — 沉浸书斋阅读器、左右对照与评论区 (reader.css)
   ========================================================================== */

/* 顶部朱砂阅读进度条 */
.reader-progress-track {
  position: relative;
  height: 3px;
  width: 100%;
  background: var(--border-hairline);
  flex-shrink: 0;
  z-index: 3;
}

.reader-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cinnabar) 0%, var(--gold) 100%);
  transition: width 100ms linear;
}

/* 阅读器顶部工具栏 */
.reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 8px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 2;
}

.reader-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.reader-topbar-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-topbar-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.reader-tool-group {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  gap: 2px;
}

.reader-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.reader-tool-btn:hover {
  color: var(--ink);
  background: var(--bg-hover);
}
.reader-tool-btn.active {
  background: var(--bg-elevated);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.reader-font-val {
  min-width: 34px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* 阅读器顶栏三主题雅致圆点色卡（宣纸 / 青瓷 / 黑白黄夜读） */
.theme-swatch {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.theme-swatch.paper {
  background: #F5F2EB;
}
.theme-swatch.celadon {
  background: #DCE6DC;
}
.theme-swatch.night {
  background: radial-gradient(circle at 65% 35%, #DFB764 0%, #DFB764 26%, #181816 30%, #181816 100%);
  border-color: rgba(223, 183, 100, 0.55);
}

/* 阅读器主体布局：左目录 + 右宣纸正文 */
.reader-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* 左侧可折叠纲目目录 */
.reader-toc {
  width: 256px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--t-base) var(--ease), opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}

.reader-toc.collapsed {
  width: 0;
  border-right: none;
  opacity: 0;
  pointer-events: none;
}

.reader-toc-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
}

.reader-toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-item {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-muted);
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.toc-item:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}
.toc-item.toc-h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink-secondary);
}
.toc-item.toc-h2 {
  padding-left: 22px;
  font-size: 12.5px;
}
.toc-item.active {
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  font-weight: 600;
}
.toc-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2.5px;
  border-radius: 2px;
  background: var(--cinnabar);
}

.toc-empty {
  padding: 18px 12px;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
}

/* 右侧阅读滚动画布 */
.reader-scroll {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 28px 96px;
}

.reader-sheet {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 42px 52px 54px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  container-type: inline-size;
  container-name: reader-sheet;
  transition: max-width var(--t-base) var(--ease), padding var(--t-base) var(--ease);
}

/* 对照分栏模式自动扩宽宣纸画幅 */
.reader-sheet.is-split {
  max-width: 1120px;
  padding: 38px 44px 52px;
}

/* 伴读分屏开启时，阅读器自适应紧凑工具栏与画幅，彻底根治任何裁切与遮挡 */
@media (min-width: 1025px) {
  body.ai-drawer-open .reader-topbar {
    padding: 6px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }

  body.ai-drawer-open .reader-topbar-left {
    min-width: 120px;
  }

  body.ai-drawer-open .reader-topbar-title {
    font-size: 14.5px;
  }

  body.ai-drawer-open .reader-topbar-tools {
    gap: 5px;
  }

  body.ai-drawer-open .reader-tool-btn {
    padding: 0 6px;
    font-size: 11.5px;
  }

  body.ai-drawer-open .reader-topbar .btn-sm {
    padding: 0 9px;
    height: 30px;
    font-size: 12px;
  }

  body.ai-drawer-open .reader-scroll {
    padding: 18px 16px 80px;
  }

  body.ai-drawer-open .reader-sheet {
    padding: 26px 26px 40px;
  }

  body.ai-drawer-open .reader-sheet.is-split {
    max-width: 100%;
    padding: 22px 22px 38px;
  }

  body.ai-drawer-open .reader-comments {
    max-width: 100%;
    padding: 22px 24px 30px;
  }
}

/* 当阅读纸张容器宽度窄于 620px 时（例如同时开目录+宽幅伴读），左右对照自动优雅折行呈上下紧凑对照 */
@container reader-sheet (max-width: 620px) {
  .kb-article.layout-split .kb-pair {
    grid-template-columns: 1fr;
  }
  .kb-article.layout-split .kb-pair-orig {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* 卷首典籍题头 */
.reader-doc-header {
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.reader-doc-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 72px;
  height: 2px;
  background: var(--cinnabar);
  opacity: 0.72;
}

.reader-doc-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reader-doc-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 12px;
}

.reader-doc-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.doc-meta-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-size: 12px;
  transition: all var(--t-fast) var(--ease);
}
.doc-meta-link:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

/* ==========================================================================
   古籍正文精排引擎样式 (.kb-article)
   ========================================================================== */
.kb-article {
  --reader-fs: 17px;
  --reader-lh: 1.9;
  font-family: var(--font-serif);
  font-size: var(--reader-fs);
  line-height: var(--reader-lh);
  color: var(--ink);
  letter-spacing: 0.025em;
  word-break: break-word;
}

.kb-h1 {
  font-family: var(--font-serif);
  font-size: calc(var(--reader-fs) * 1.32);
  font-weight: 700;
  color: var(--ink);
  margin: 1.9em 0 0.85em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 24px;
}
.kb-h1:first-child {
  margin-top: 0.2em;
}

.kb-h2 {
  font-family: var(--font-serif);
  font-size: calc(var(--reader-fs) * 1.12);
  font-weight: 700;
  color: var(--primary);
  margin: 1.55em 0 0.65em;
  padding-left: 11px;
  border-left: 3px solid var(--primary);
  scroll-margin-top: 24px;
}

.kb-p {
  margin: 0 0 1.05em;
  text-align: justify;
  text-justify: inter-ideograph;
}

.kb-li {
  position: relative;
  margin: 0 0 0.7em;
  padding-left: 1.35em;
}
.kb-li::before {
  content: '◇';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--gold-deep);
  font-size: 0.78em;
}

/* 章节属性印签（原文 / 译文 / 注释） */
.kb-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 1.35em 0 0.55em;
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.55;
}

.kb-label.original {
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar-border);
}

.kb-label.trans {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.kb-label.note {
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1px solid var(--gold-border);
}

.kb-label.label-other {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  border: 1px solid var(--border-strong);
}

/* 朱砂原文框 */
.kb-quote {
  margin: 0.45em 0 1.25em;
  padding: 15px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 3.5px solid var(--cinnabar);
  background: var(--reader-quote-bg);
  font-family: var(--font-serif);
  font-size: calc(var(--reader-fs) * 1.03);
  color: var(--ink);
}
.kb-quote p {
  margin: 0 0 0.65em;
}
.kb-quote p:last-child {
  margin-bottom: 0;
}

/* 青黛竹青译文笺 */
.kb-trans {
  margin: 0.45em 0 1.25em;
  padding: 14px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 3.5px solid var(--primary);
  background: var(--reader-trans-bg);
  font-family: var(--font-sans);
  font-size: calc(var(--reader-fs) * 0.94);
  line-height: var(--reader-lh);
  color: var(--ink-secondary);
}
.kb-trans p {
  margin: 0 0 0.65em;
}
.kb-trans p:last-child {
  margin-bottom: 0;
}

/* 泥金注释 / 按语笺 */
.kb-note {
  margin: 0.4em 0 1.1em;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
  background: var(--reader-note-bg);
  font-family: var(--font-sans);
  font-size: calc(var(--reader-fs) * 0.87);
  line-height: 1.75;
  color: var(--ink-secondary);
}

.kb-article code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.kb-article strong {
  color: var(--ink);
  font-weight: 700;
}

.kb-article em {
  font-style: italic;
  color: var(--cinnabar);
}

/* ==========================================================================
   原文 / 译文 左右分栏对照模式 (.kb-article.layout-split)
   ========================================================================== */
.kb-article.layout-split .kb-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  margin: 1.15em 0 1.45em;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-paper);
}

.kb-article.layout-split .kb-pair-col {
  padding: 16px 20px;
  min-width: 0;
}

.kb-article.layout-split .kb-pair-orig {
  background: var(--reader-quote-bg);
  border-right: 1px solid var(--border);
}

.kb-article.layout-split .kb-pair-trans {
  background: var(--reader-trans-bg);
  font-family: var(--font-sans);
  font-size: calc(var(--reader-fs) * 0.94);
  color: var(--ink-secondary);
}

.kb-pair-head {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  padding: 1px 8px;
  border-radius: var(--radius-xs);
  font-family: var(--font-serif);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.kb-pair-orig .kb-pair-head {
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar-border);
}

.kb-pair-trans .kb-pair-head {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.kb-pair-col p {
  margin: 0 0 0.7em;
}
.kb-pair-col p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   划词浮动菜单 (.selection-popover)
   ========================================================================== */
.selection-popover {
  position: fixed;
  z-index: var(--z-popover);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-full);
  background: var(--ink);
  color: var(--ink-inverse);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -100%);
  animation: fadeSlideUp 140ms var(--ease);
}

.selection-popover::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: var(--ink) transparent transparent transparent;
}

.selection-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink-inverse);
  font-size: 12.5px;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}
.selection-pop-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
.selection-pop-btn.accent {
  color: #F4C3A8;
  font-weight: 500;
}

.selection-pop-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   文末「同门切磋 · 批注评论区」
   ========================================================================== */
.reader-comments {
  max-width: 800px;
  margin: 28px auto 0;
  padding: 28px 36px 34px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.reader-sheet.is-split + .reader-comments {
  max-width: 1120px;
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.comments-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.06em;
}

.comments-count {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
}

/* 发表批注区 */
.comment-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-paper);
  border: 1px solid var(--border);
  margin-bottom: 22px;
}

.comment-quote-preview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--cinnabar);
  background: var(--cinnabar-soft);
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.comment-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--primary);
}

.comment-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-guest-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-paper);
  border: 1px dashed var(--border-strong);
  margin-bottom: 22px;
  color: var(--ink-secondary);
  font-size: 13.5px;
}

/* 评论列表与单条卡片 */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-paper);
  border: 1px solid var(--border-hairline);
  transition: border-color var(--t-fast) var(--ease);
}
.comment-item:hover {
  border-color: var(--border-strong);
}

.comment-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.comment-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.comment-author-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.comment-author-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
}

.comment-time {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.comment-quote-box {
  padding: 7px 12px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  border-left: 2.5px solid var(--cinnabar);
  background: var(--reader-quote-bg);
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.comment-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   微信读书式「行间划线句评」：虚线划线 + 句末小标志 + 句评共读浮层
   ========================================================================== */
.inline-quote-mark {
  background: transparent;
  color: inherit;
  padding: 1px 0 2px;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--primary) 68%, transparent);
  border-radius: 2px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.inline-quote-mark:hover,
.inline-quote-mark:focus-visible {
  background: var(--gold-soft);
  border-bottom-color: var(--gold-deep);
  outline: none;
}

/* 句末迷你古籍批注标志（微信读书式数字气泡，轻盈不撑开行高） */
.inline-quote-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 17px;
  padding: 0 5px;
  margin: 0 3px 0 3px;
  vertical-align: 0.12em;
  border-radius: 5px 5px 5px 1.5px;
  border: 1px solid var(--gold-border);
  background: var(--private-bg);
  color: var(--private-accent);
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: all var(--t-fast) var(--ease);
}
.inline-quote-badge:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--ink-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

/* 点赞共鸣按钮（句评浮层与文末理解分享通用） */
.cmt-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  transition: all var(--t-fast) var(--ease);
}
.cmt-like-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}
.cmt-like-btn.is-liked {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  border-color: var(--cinnabar-border);
}
.cmt-like-btn.is-liked svg {
  fill: var(--cinnabar);
}
.cmt-like-btn .like-num {
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 600;
}

/* 句评共读浮层（参考微信读书评价卡片流，融合道场三套主题美学） */
.quote-thread-backdrop {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px 16px;
}

.qt-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeSlideUp 200ms var(--ease);
}

.qt-scroll {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 4px 10px;
}

/* 顶部原句与操作卡 */
.qt-hero-card {
  position: relative;
  padding: 20px 22px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}

.qt-hero-quote-mark {
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 0.7;
  color: var(--primary);
  opacity: 0.35;
  margin-bottom: 6px;
}

.qt-hero-quote {
  font-family: var(--font-kai);
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 16px;
  word-break: break-word;
}

.qt-hero-toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
}

.qt-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  transition: all var(--t-fast) var(--ease);
}
.qt-tool-item svg {
  font-size: 16px;
}
.qt-tool-item:hover,
.qt-tool-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* 写句评输入卡 */
.qt-composer-card {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qt-composer-card.qt-guest {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-secondary);
}
.qt-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qt-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-inverse);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.qt-list-count {
  font-family: var(--font-num);
  opacity: 0.9;
}

.qt-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 单条同门评价卡 */
.qt-card {
  padding: 15px 18px 10px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qt-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qt-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-seal.sm {
  width: 24px;
  height: 24px;
  font-size: 11.5px;
}

.qt-author-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.qt-time {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.qt-content {
  font-family: var(--font-serif);
  font-size: 14.8px;
  line-height: 1.82;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.qt-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-hairline);
}

.qt-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  transition: all var(--t-fast) var(--ease);
}
.qt-act-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}
.qt-act-btn.danger {
  margin-left: auto;
  color: var(--danger);
}
.qt-act-btn.danger:hover {
  background: var(--danger-soft);
}

/* 句评子回复列表 */
.qt-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  border: 1px solid var(--border-hairline);
}
.qt-reply-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.qt-reply-main {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-secondary);
}
.qt-reply-name {
  color: var(--ink);
  margin-right: 6px;
}
.qt-reply-to {
  color: var(--primary);
}
.qt-reply-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-muted);
}
.qt-reply-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11px;
  color: var(--ink-muted);
}
.qt-reply-link:hover {
  color: var(--primary);
}
.qt-reply-link.danger:hover {
  color: var(--danger);
}

.qt-empty {
  padding: 26px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  text-align: center;
}
.qt-empty-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.qt-empty-desc {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.65;
}

/* 底部悬浮圆形关闭按钮 */
.qt-close-fab {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-md);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.qt-close-fab:hover {
  transform: scale(1.06);
  background: var(--primary);
  border-color: var(--primary);
  color: var(--ink-inverse);
}

/* 全篇句评总览列表 */
.qt-overview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qt-overview-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-paper);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--t-fast) var(--ease);
}
.qt-overview-item:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}
.qt-overview-quote {
  font-family: var(--font-kai);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.6;
}
.qt-overview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-muted);
}
.qt-overview-badge {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--private-bg);
  color: var(--private-accent);
  font-weight: 600;
}

/* 文末「全篇理解分享」标题分组 */
.comments-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.comments-sub {
  font-size: 12px;
  color: var(--ink-muted);
}
.comments-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   手机朋友圈书摘分享卡工坊 (.share-card-dialog)
   ========================================================================== */
.share-card-dialog {
  max-width: 860px;
}

.share-card-body {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.share-preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.share-phone-frame {
  width: 100%;
  max-width: 310px;
  max-height: 540px;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-paper);
  box-shadow: var(--shadow-md);
}

.share-poster-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.share-preview-hint {
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: center;
}

.share-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.share-tpl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.share-tpl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-family: var(--font-serif);
  font-size: 12.5px;
  transition: all var(--t-fast) var(--ease);
}
.share-tpl-btn:hover {
  border-color: var(--primary-border);
  color: var(--ink);
}
.share-tpl-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.share-tpl-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid;
}
.share-tpl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.share-inline-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}
.share-inline-chk input {
  accent-color: var(--primary);
}

.share-toggles-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 4px 0 12px;
}

.share-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .share-card-body {
    grid-template-columns: 1fr;
  }
  .share-phone-frame {
    max-width: 280px;
    max-height: 400px;
  }
  .share-tpl-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   阅读器响应式适配
   ========================================================================== */
@media (max-width: 960px) {
  .reader-toc {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 6;
    box-shadow: var(--shadow-lg);
  }

  .reader-scroll {
    padding: 20px 16px 84px;
  }

  .reader-sheet,
  .reader-sheet.is-split {
    padding: 26px 22px 36px;
  }

  .reader-comments {
    padding: 20px 18px 26px;
  }
}

@media (max-width: 768px) {
  .reader-topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .reader-topbar-left {
    width: 100%;
  }

  .reader-topbar-tools {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .reader-doc-title {
    font-size: 22px;
  }

  .kb-article.layout-split .kb-pair {
    grid-template-columns: 1fr;
  }

  .kb-article.layout-split .kb-pair-orig {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
