/* read-canon 最小核 · 样式 */
/* hidden 属性必须始终生效，不可被组件的 display 样式覆盖（否则弹窗关不掉） */
[hidden] { display: none !important; }
.dictionary-entry { text-decoration: none; }
/* DICT-05: no marks or layout changes inside the reading text. */
.dict-toolbar { position: fixed; z-index: 55; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100vw - 16px); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.dict-toolbar button { min-width: 52px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--link-blue); font-size: 15px; }
.dict-toolbar :focus-visible, #dictPanel :focus-visible { outline: 3px solid var(--link-blue); outline-offset: 2px; }
#dictCopyStatus { font-size: 12px; color: var(--fg-2); overflow-wrap: anywhere; max-width: 140px; }
.dict-copy-buffer { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }
.dict-selection-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.dict-selection-body :is(p, h2, span, mark, a) { overflow-wrap: anywhere; }
.dict-selection-body .dict-summary { white-space: pre-wrap; margin-top: 4px; }
.dict-selected-label { font-size: 12px; color: var(--fg-2); margin-bottom: 0; }
.dict-selection-body #dictStatus { font-size: 14px; line-height: 1.7; }
.dict-selection-body .dict-card { padding: 14px; }
.dict-selection-body .dict-term { font-size: 19px; }
.dict-selection-body #dictPageLink { display: block; margin: 16px 0; color: var(--link-blue); }
/* 无障碍：仅屏幕阅读器可见的说明文本 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* 跳卷/跳科判落点需避开固定顶栏与吸顶卷头，避免标题被遮住 */
#workBody .jhead { scroll-margin-top: calc(var(--topbar-h) + 16px); }
#workBody .para { scroll-margin-top: calc(var(--topbar-h) + 76px); }
/* 详情面板/底部面板打开时锁定背景滚动（T05 生命周期） */
body.panel-lock { overflow: hidden; }
html.panel-lock { overflow: hidden; }
/* STUDY-04：图标资产统一用透明底 PNG，组件内自适应；夜读反白见下方主题令牌区 */
.ico { display: block; width: 100%; height: 100%; object-fit: contain; filter: none; }
.line-icon {
  display: inline-block; flex: none; width: var(--line-icon-size, 20px); height: var(--line-icon-size, 20px);
  vertical-align: middle; fill: none; stroke: currentColor; stroke-width: var(--line-icon-stroke, 1.65);
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
:root[data-theme="night-care"] .ico { filter: invert(1); }
/* ================= STUDY-03：视觉令牌（三主题） =================
 * 主题状态由 <html data-theme="follow-system|day-paper|night-care"> 承载：
 *   - day-paper：默认（无 data-theme 时的 :root 令牌即日间纸本）；
 *   - follow-system：由 prefers-color-scheme 决定（下方 media 块）；
 *   - night-care：显式选择，始终生效，不随系统切换。
 * 组件不得散落硬编码颜色，一律引用这里的语义令牌。 */
:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --paper: #fffdf7;
  --panel: #fffcf2;
  --fg: #2b2620;
  --fg-2: #574f44;
  --muted: #8a7f6e;
  --line: #e2d9c8;
  --accent: #8c5b2f;
  --accent-2: #b07d4f;
  /* 经文/引文强调：日间沿用既有「AI 解读引文」蓝，夜读改为低饱和灰粉，仅作层次强调 */
  --quote: #1a66cc;
  /* 强调色背景上的文字（保证对比度） */
  --on-accent: #fff;
  --danger: #a33;
  --err: #c0392b;
  --err-tint: rgba(170, 51, 51, .08);
  --ok: #4a7a4c;
  --ok-tint: rgba(74, 122, 76, .10);
  --warn: #8a7f12;
  --link-blue: #1a66cc;
  --hover: rgba(0, 0, 0, .05);
  /* 强调色轻量/选中底色 */
  --tint: rgba(140, 91, 47, .09);
  --tint-2: rgba(140, 91, 47, .16);
  /* 读经完成留边/背景底色 */
  --letterbox: #2a1c12;
  /* T03-R1：段末操作栏「AI解读」已有内容时的淡绿高亮 */
  --ai-ok: #2f7d4f;
  --ai-ok-bg: #eef7f0;
  --ai-ok-line: #b6dcc0;
  --side-bg: #f0e9db;
  --shadow: 0 2px 10px rgba(60, 45, 20, .12);
  --fs: 19px;
  --lh: 2.05;
  --serif: "Microsoft YaHei", "微软雅黑", system-ui, sans-serif;
  --sans: "Microsoft YaHei", "微软雅黑", system-ui, sans-serif;
  --topbar-h: 50px;
  --side-w: 318px;
}
/* 跟随系统：仅当未显式选择主题，或显式选择 follow-system 时由系统偏好决定 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme="follow-system"] {
    color-scheme: dark;
    --bg: #16130e;
    --paper: #1d1912;
    --panel: #221d15;
    --fg: #e6dcc8;
    --fg-2: #bfb19a;
    --muted: #877b67;
    --line: #38301f;
    --accent: #d9a05f;
    --accent-2: #e0b57f;
    --quote: #8ab4ff;
    --on-accent: #fff;
    --danger: #e08a8a;
    --err: #e08a8a;
    --err-tint: rgba(224, 138, 138, .14);
    --ok: #7fd39b;
    --ok-tint: rgba(127, 211, 155, .14);
    --warn: #d9c96a;
    --link-blue: #8ab4ff;
    --hover: rgba(255, 255, 255, .06);
    --tint: rgba(217, 160, 95, .12);
    --tint-2: rgba(217, 160, 95, .20);
    --letterbox: #0f0b07;
    /* T03-R1：暗色下的「AI解读」淡绿高亮 */
    --ai-ok: #7fd39b;
    --ai-ok-bg: rgba(63, 143, 90, .22);
    --ai-ok-line: rgba(127, 211, 155, .45);
    --side-bg: #1b1710;
    --shadow: 0 2px 12px rgba(0, 0, 0, .4);
  }
}
/* 护眼夜读：显式选择时始终生效（深墨灰底，禁止纯黑；暖灰正文，禁止纯白） */
:root[data-theme="night-care"] {
  color-scheme: dark;
  --bg: #181819;       /* 页面背景：深墨灰 */
  --paper: #1E1E20;    /* 阅读纸面/主面板 */
  --panel: #27272A;    /* 悬浮层/卡片 */
  --fg: #D9D7D3;       /* 主正文：暖灰 */
  --fg-2: #AAA6A1;     /* 次级文字 */
  --muted: #8A8681;
  --line: #343438;     /* 分割线：低反差 */
  --accent: #77A8FF;   /* 链接与活动项：雾蓝 */
  --accent-2: #9CC0FF;
  --quote: #E2C4C8;    /* 经文/引文强调：低饱和灰粉 */
  --on-accent: #10131A;
  --danger: #FF9A9A;
  --err: #FF9A9A;
  --err-tint: rgba(255, 154, 154, .12);
  --ok: #86D6A4;
  --ok-tint: rgba(134, 214, 164, .14);
  --warn: #D9C86A;
  --link-blue: #77A8FF;
  --hover: rgba(255, 255, 255, .08);
  --tint: rgba(119, 168, 255, .14);
  --tint-2: rgba(119, 168, 255, .22);
  --letterbox: #0F0F10;
  --ai-ok: #8FD6A8;
  --ai-ok-bg: rgba(143, 214, 168, .16);
  --ai-ok-line: rgba(143, 214, 168, .42);
  --side-bg: #1C1C1E;
  --shadow: 0 2px 12px rgba(0, 0, 0, .55);
}
/* STUDY-04：跟随系统为暗色时，黑色图标反白（置于主题令牌之后，
 * 避免在 :root 浅色令牌之前新增 prefers-color-scheme 媒体块而破坏既有样式切片约定） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .ico, :root[data-theme="follow-system"] .ico { filter: invert(1); }
}
/* 主题切换过渡（150~200ms）；减少动态效果时直接切换 */
body, #topbar, #sidebar, .sheet, .bm-panel, .finish-card, .mobile-bar {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
@media (prefers-reduced-motion: reduce) {
  body, #topbar, #sidebar, .sheet, .bm-panel, .finish-card, .mobile-bar {
    transition: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 7px; grid-column: 3; min-width: 0; }
.topbar-library, .topbar-support { display: flex; align-items: center; white-space: nowrap; }
.topbar-library { column-gap: 8px; }
.topbar-script { display: flex; align-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 7px; }
.topbar-script button { min-width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: var(--fg-2); }
.topbar-script button[aria-pressed="true"] { background: var(--tint); color: var(--accent); font-weight: 600; }
.brand { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: 2px; white-space: nowrap; }
.brand .sub { font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px; font-family: var(--sans); }
.work-info {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; padding: 0 12px;
}
.wi-title {
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  letter-spacing: 1px; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw;
}
.wi-meta {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wi-div { color: var(--muted); font-size: 12px; }
.wi-juan { position: relative; }
.wi-juan-btn {
  border: 1px solid var(--line); background: var(--paper); color: var(--fg-2);
  border-radius: 6px; padding: 2px 8px; font-size: 12px; min-height: 24px;
  cursor: pointer; white-space: nowrap;
}
.wi-juan:hover .wi-juan-btn { border-color: var(--accent-2); color: var(--accent); }
.wi-juan-list {
  position: absolute; left: 50%; top: calc(100% + 4px);
  transform: translateX(-50%) translateY(-6px);
  min-width: 90px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 31;
}
.wi-juan:hover .wi-juan-list,
.wi-juan-list:hover {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
}
.wi-juan-list button {
  border: none; background: transparent; color: var(--fg-2);
  font-size: 13px; padding: 6px 10px; border-radius: 5px; text-align: left;
  white-space: nowrap;
}
.wi-juan-list button:hover { background: var(--bg); color: var(--accent); }
#pos {
  display: none;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22vw;
}
.iconbtn {
  min-width: 40px; height: 36px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg);
  font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:active { transform: translateY(1px); }
/* 顶栏「联系我」文字按钮：字号调小、横向紧凑，避免三字撑出圆角边框 */
#btnContact {
  font-size: 13px; letter-spacing: 0; padding: 0 8px;
  min-width: 0; width: auto;
  white-space: nowrap;
}
/* 顶栏「首页」按钮：使用阅藏 logo 图片（固定尺寸，避免被撑大） */
#btnHome.home-logo {
  width: 38px; height: 38px; min-width: 38px; max-width: 38px;
  padding: 0; border: none; border-radius: 8px;
  background: transparent; cursor: pointer;
  overflow: hidden; flex: none;
  box-shadow: 0 1px 4px rgba(150, 40, 34, .18);
  transition: transform .12s ease, box-shadow .12s ease;
}
#btnHome.home-logo:hover {
  box-shadow: 0 3px 10px rgba(150, 40, 34, .32);
  transform: translateY(-1px);
}
#btnHome.home-logo:active { transform: translateY(1px) scale(.97); }
#btnHome .home-logo-img {
  display: block;
  width: 38px; height: 38px; min-width: 38px;
  object-fit: cover; border-radius: 8px;
}
/* ---------- 侧栏目录 ---------- */
#sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--side-w);
  background: var(--side-bg); border-right: 1px solid var(--line);
  overflow-y: auto; z-index: 20;
  overscroll-behavior: contain;
  transition: transform .22s ease;
}
/* 吸附区：标题 + 标签 + 搜索框，滚动时固定在侧栏 #sidebar 顶部 */
.side-top {
  position: sticky; top: 0; z-index: 22;
  background: var(--side-bg);
  box-shadow: 0 4px 10px rgba(60, 45, 20, .07);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px;
  background: var(--side-bg);
}
.side-head-actions { display: flex; align-items: center; gap: 6px; }
.side-title { font-weight: 700; font-size: 14px; letter-spacing: 2px; color: var(--fg-2); }
#btnClose { display: none; }

.side-tabs {
  display: flex; gap: 6px; margin: 0 10px 4px; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
}
/* T09-R8 起侧栏最多 4 个标签（经书列表/目录结构/大正藏部/听经馆），318px 侧栏等分后
   每格约 68px：必须单行显示，故去掉字距与内边距，并允许收缩省略（字号保持 13px） */
.side-tabs .tab {
  flex: 1 1 0; min-width: 0; height: 30px; padding: 0 2px;
  border: none; border-radius: 7px;
  background: transparent; color: var(--fg-2); font-size: 13px; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-tabs .tab.active {
  background: var(--accent); color: var(--on-accent); font-weight: 700;
}

/* 侧栏搜索框 + 结果下拉 */
.side-search {
  position: relative; margin: 0 10px 4px;
}
.search-input {
  width: 100%; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper); color: var(--fg); font-size: 13px;
}
.search-input:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.search-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 28;
  max-height: 48vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.search-pop .sp-head {
  font-size: 11px; color: var(--muted); letter-spacing: 1px;
  padding: 6px 8px 2px;
}
.search-pop .sp-item {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  text-align: left; padding: 7px 8px; border-radius: 7px; border: 0;
  background: transparent; color: var(--fg); font-size: 13px;
}
.search-pop .sp-item:hover, .search-pop .sp-item.active { background: var(--tint); }
.search-pop .sp-item .no { font-size: 10px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.search-pop .sp-item .ti { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-pop .sp-item .snip {
  color: var(--fg-2); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.search-pop .sp-tag {
  font-size: 9px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 4px; flex: none;
}
.search-pop .sp-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px; }
.search-pop .sp-juan { font-size: 10px; color: var(--muted); flex: none; }

.catalog { padding: 2px 8px 24px; font-size: 13.5px; }
.catalog .file {
  margin: 2px 0 8px;
}
.catalog .file > summary {
  font-weight: 700; padding: 7px 8px; border-radius: 8px; cursor: pointer;
  color: var(--fg); list-style: none; display: flex; align-items: center; gap: 6px;
}
.catalog .file > summary::-webkit-details-marker { display: none; }
.catalog .file > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.catalog details[open].file > summary::before { transform: rotate(90deg); }
.catalog .file > summary:hover { background: var(--tint); }

.catalog details.head { margin: 1px 0; }
.catalog details.head > summary {
  padding: 5px 8px 5px 16px; border-radius: 6px; cursor: pointer;
  color: var(--fg-2); list-style: none; position: relative;
}
.catalog details.head > summary::-webkit-details-marker { display: none; }
.catalog details.head > summary::before {
  content: "▸"; position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted);
}
.catalog details.head[open] > summary::before { transform: translateY(-50%) rotate(90deg); }
.catalog details.head > summary:hover { background: var(--tint); }

.catalog ul.entries { list-style: none; margin: 0; padding: 0 0 2px 12px; }
.catalog ul.entries li { margin: 0; }
.catalog .entry {
  display: flex; align-items: baseline; gap: 4px;
  width: 100%; text-align: left;
  padding: 6px 8px 6px 18px; border-radius: 6px;
  background: none; border: 0; color: var(--fg);
  font-size: 13.5px; font-family: var(--sans); line-height: 1.45;
}
.catalog .entry:hover { background: var(--tint); }
.catalog .entry.active { background: var(--tint-2); font-weight: 700; }
.catalog .entry .no {
  font-size: 10px; color: var(--muted); flex: none;
  font-variant-numeric: tabular-nums;
}
.catalog .entry .etitle { flex: 1; }
.work-word-count { display:inline-flex; align-items:center; gap:.32em; margin-inline-start:.25em; vertical-align:middle; white-space:nowrap; color:var(--muted); font-size:.78em; font-weight:normal; font-variant-numeric:tabular-nums; }
.work-word-count .line-icon { width:1em; height:1em; }
.badge {
  display: inline-block; font-size: 10px; line-height: 1;
  padding: 2px 4px; border-radius: 4px; margin-left: 3px;
  color: var(--on-accent); background: var(--accent-2); flex: none;
}
.badge.sel-y { background: var(--warn); }
.badge.sel-j { background: var(--accent); }
.badge.same { background: var(--muted); }
.badge.main { background: var(--accent); }
.badge.cur { background: var(--ok); }

/* 已读完的经 → 目录条目标绿 */
.catalog .entry.done .etitle { color: var(--ok); }
.catalog .entry.done .no { color: var(--ok); opacity: .75; }
.catalog .entry.done::before {
  content: "✓"; color: var(--ok); flex: none; margin-right: 2px; font-size: 11px;
}
.catalog .entry.done.active { box-shadow: inset 2px 0 0 var(--ok); }

/* ---------- 遮罩 & 响应式 ---------- */
#scrim { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 19; }
@media (max-width: 860px) {
  /* 手机侧栏更窄（86vw → 320px 视口时仅 275px）：4 个标签必须再收紧外边距与间距，
     否则「经书列表」这类 4 字标签（激活态 font-weight:700 更宽）会被省略号截断。
     对应 R8-F5 几何回归项（code/test/t09-r8-side-tabs.test.mjs）。 */
  .side-tabs { gap: 4px; margin: 0 6px 4px; padding: 3px; }
  .side-tabs .tab { padding: 0 1px; }
  #sidebar {
    transform: translateX(-105%);
    box-shadow: var(--shadow); width: min(86vw, 340px);
  }
  body.drawer-open #sidebar { transform: none; }
  body.drawer-open #scrim { display: block; }
  #btnClose { display: inline-flex; }
  #sideGrip { display: none; }
}

/* PC 端：收起侧栏 → 整块移出屏幕（切换按钮固定定位不随移动） */
@media (min-width: 861px) {
  body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
  body.sidebar-collapsed #reader { padding-left: 0; }
  body.sidebar-collapsed .mini-toc { left: 12px; }
}

/* 目录显示/隐藏切换按钮：固定定位，紧贴目录右侧边缘，始终可见可点。
   展开时贴在目录右缘，收起时跟着边缘移到屏幕左缘（body 直接子元素，避开侧栏 transform 影响） */
#sideGrip {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: calc(var(--side-w) - 40px); /* 按钮右缘基本贴合目录右缘 */
  z-index: 60;
  width: 36px; height: 36px; min-width: 36px; padding: 0;
  font-size: 17px; font-weight: 700; line-height: 1;
  border-radius: 8px 0 0 8px; /* 右缘平直、贴合目录边缘 */
  box-shadow: 0 2px 8px rgba(60, 45, 20, .18);
}
#sideGrip:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
/* 收起目录 → 按钮跟随左缘移到屏幕最左 */
body.sidebar-collapsed #sideGrip { left: 0; border-radius: 0 8px 8px 0; }

/* ---------- 主阅读区 ---------- */
#reader {
  padding-top: var(--topbar-h);
  padding-left: var(--side-w);
  min-height: 100vh;
}
@media (max-width: 860px) { #reader { padding-left: 0; } }

.panel {
  max-width: 760px; margin: 0 auto; padding: 8vh 24px 40px;
  text-align: center;
}
.panel h1 { font-family: var(--serif); font-size: 34px; letter-spacing: 8px; margin: 0 0 14px; }
.panel .lead { font-size: 16px; color: var(--fg-2); line-height: 1.9; }
.panel .sub2 { font-size: 13px; color: var(--muted); margin-top: 4px; }
.panel .hint { font-size: 13px; color: var(--muted); margin-top: 26px; }
.stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.stats .chip {
  font-size: 12px; color: var(--fg-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}

.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* 经文 */
/* 正文栏加宽：右侧预留一条固定「批注列」，批注气泡/图标放这里，不遮挡正文 */
#workBody { max-width: min(72em, 100%); margin: 0 auto; padding: 18px 22px 30vh; }
@media (max-width: 860px) { #workBody { padding: 12px 16px 26vh; } }

/* 科判面板固定贴右；展开时（非隐藏、非折叠）正文居中框右侧让出面板宽度，
   正文在「阅读区 − 面板」的可用区内动态居中，面板收起时自动回中 */
@media (min-width: 861px) {
  .work-wrap:not(:has(.outline-panel[hidden])):not(:has(.outline-panel.collapsed)) {
    padding-right: 240px;
  }
}

.wh { margin-bottom: 22px; }
.wh .wtitle, .wh .wmeta { text-align: center; }
.wh .wtitle { margin-left: auto; margin-right: auto; }
.wh .wtitle {
  font-family: var(--serif); font-size: 1.65em; font-weight: 700;
  letter-spacing: 3px; margin: 6px 0 4px; line-height: 1.4;
}
.wh .wmeta { font-size: 13px; color: var(--muted); line-height: 2; }
.wh .wpath { font-size: 12px; color: var(--muted); line-height: 1.9; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; color: var(--fg-2); background: var(--paper);
  text-decoration: none;
}
a.chip:hover { border-color: var(--accent-2); color: var(--accent); }
.chip .b { font-size: 10px; }

.navrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 10px 0 18px; flex-wrap: wrap;
}
.navrow .spacer { flex: 1; }
.navbtn {
  border: 1px solid var(--line); background: var(--paper);
  color: var(--fg-2); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.navbtn:hover:not(:disabled) { border-color: var(--accent-2); color: var(--accent); }
.navbtn:disabled { opacity: .35; cursor: default; }
.navbtn[data-dir="prev"]::before { content: "‹ "; }
.navbtn[data-dir="next"]::after { content: " ›"; }

/* 经文头部「从此经开始阅藏」操作行 */
.startrow { margin: 12px 0 0; }
.startrow .startbtn {
  color: var(--ok); border-color: var(--ok); font-size: 12px; padding: 6px 12px;
}
.startrow .startbtn:hover { background: var(--ok-tint); }

.jumprows { display: flex; flex-wrap: wrap; gap: 6px; }
.jumprows button {
  border: 1px solid var(--line); background: var(--paper); color: var(--fg-2);
  border-radius: 6px; padding: 4px 10px; font-size: 12px; min-height: 30px;
}
.jumprows button:hover { border-color: var(--accent-2); color: var(--accent); }

.jhead { margin: 30px 0 8px; font-weight: 700; letter-spacing: 4px; color: var(--accent); font-family: var(--serif); }
.pagemark {
  margin: 14px 0 10px; color: var(--muted); font-size: 12px;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.pagemark::before, .pagemark::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.paras { font-family: var(--serif); font-size: var(--fs); line-height: var(--lh); color: var(--fg); }
/* 显式允许正文文本选择：避免宿主 WebView/主题样式继承 user-select:none 后，
   手机长按无法建立原生选区，划词工具条随之不出现。 */
#workBody .paras, #workBody .para {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.para {
  margin: 0 0 .45em; text-align: justify;
  text-indent: 2em; word-break: break-word;
  padding: 1px 0;
}
.para.k-lg { text-indent: 0; white-space: pre-line; line-height: 2; }
.canon-prose-indent { display: inline-block; width: 2em; }
.canon-verse-pair { display: flex; flex-wrap: wrap; column-gap: 1.5em; white-space: normal; }
.canon-verse-clause { min-width: min(6em, 100%); max-width: 100%; }
.para .rn-verse-comment { margin-block: .4em; }

/* 缺字（組字式/Unicode/圖片） */
.gaiji {
  display: inline-block;
  color: var(--accent);
  cursor: help;
  border-bottom: 1px dashed var(--accent-2);
  margin: 0 1px;
  line-height: 1.2;
}
.gaiji img {
  display: inline-block;
  height: 1.1em;
  width: auto;
  vertical-align: text-bottom;
  image-rendering: auto;
}
.gaiji.fallback {
  border-bottom-style: solid;
  padding: 0 2px;
}
.para.k-lg .pline { text-indent: 2em; }
.para.k-byline {
  text-indent: 0; text-align: center; color: var(--fg-2);
  font-size: .95em; margin: .8em 0 1.2em; letter-spacing: 1px;
}
.para.k-byline::before, .para.k-byline::after { content: "——"; color: var(--muted); opacity: .7; padding: 0 .4em; font-size: .9em; }
.para .an {
  display: none; color: var(--muted); font-size: 11px;
  font-family: var(--sans); letter-spacing: 0;
}
.para:hover .an, .para.active .an { display: inline; }

/* T03-R1：段旁「AI 解读菱形角标」已删除；AI 状态改为段末操作栏按钮的淡绿高亮。 */
/* T03：选中段不再添加背景或左侧标记；仅显示其段末操作按钮。
   不改 padding / 字体 / 字号 / 字重，避免选中时正文换行、宽度与阅读位置发生变化。 */
.para.active {
  background: transparent;
  box-shadow: none;
  font-weight: inherit;
}
.divider { border: 0; border-top: 1px dashed var(--line); margin: 22px 0; }
.divider + .append-label {
  color: var(--muted); font-size: 12px; letter-spacing: 2px; margin-bottom: 8px;
}
.para[data-div] .append-label { }

.errbox {
  max-width: 46em; margin: 10vh auto; padding: 20px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  text-align: center; color: var(--danger);
}
/* TEMP-REMOTE-WORK-01：远端正文失败诊断区（分类/次数/耗时/经号/内容包版本 + 主动诊断 + 复制报告） */
.errdiag {
  margin: 16px 0 0; padding: 14px 14px 12px; text-align: left;
  border-top: 1px dashed var(--line); color: var(--fg-2); font-size: 13px;
}
.errdiag-t { margin: 0 0 8px; font-weight: 600; color: var(--fg-2); letter-spacing: 1px; }
.errdiag dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.errdiag dt { color: var(--muted); font-size: 12px; white-space: nowrap; }
.errdiag dd { margin: 0; word-break: break-word; }
.errdiag-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.errdiag-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.errdiag-out {
  margin: 10px 0 0; padding: 10px; max-height: 40vh; overflow: auto;
  background: var(--bg, transparent); border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg-2); font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
}
@media (max-width: 768px) {
  .errbox { margin: 16px 10px; padding: 16px 12px; }
  .errdiag dl { grid-template-columns: 1fr; gap: 2px; }
  .errdiag dt { margin-top: 6px; }
}
/* TEMP-REMOTE-WORK-01：手机经库抽屉内的失败卡片（目录保持可操作；桌面失败走阅读区，不用此容器） */
.side-err {
  padding: 10px 10px 2px; border-bottom: 1px solid var(--line);
  background: var(--paper); flex: 0 0 auto; max-height: 70vh; overflow: auto;
}
.side-err .errbox { margin: 0 0 8px; padding: 12px 10px; }
.side-err .errdiag { margin-top: 10px; padding: 10px 0 4px; }
.side-err .errdiag-out { max-height: 26vh; }

/* ---------- 正文左侧浮动·卷目录缩略图 ---------- */
.mini-toc {
  position: fixed; left: calc(var(--side-w) + 18px); top: 42%;
  transform: translateY(-50%); z-index: 24;
}
.mini-toc .mt-handle {
  writing-mode: vertical-rl;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--fg-2);
  font-size: 13px; letter-spacing: 3px; padding: 9px 3px;
  box-shadow: var(--shadow); opacity: .85; transition: opacity .15s, color .15s;
}
.mini-toc .mt-handle:hover { opacity: 1; color: var(--accent); border-color: var(--accent-2); }
.mini-toc .mt-panel {
  position: absolute; left: 100%; top: 0;
  display: none; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; box-shadow: var(--shadow);
  max-height: 62vh; overflow-y: auto; margin-left: 6px;
}
/* 透明桥接带：覆盖竖标与面板之间的空隙，鼠标穿过不脱离悬停区域 */
.mini-toc .mt-panel::before {
  content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px;
}
.mini-toc.open .mt-panel { display: flex; }
.mini-toc .mt-panel button {
  border: none; background: transparent; color: var(--fg-2);
  font-size: 13px; padding: 7px 16px; border-radius: 6px; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
}
.mini-toc .mt-panel .mt-vol-main { font-weight: 600; white-space: nowrap; }
.mini-toc .mt-panel { min-width: 64px; }
.mini-toc .mt-panel .mt-vol-sub {
  font-size: 11px; color: var(--muted); line-height: 1.3;
  max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-toc .mt-panel button:hover { background: var(--tint); color: var(--accent); }
.mini-toc .mt-panel button.cur { background: var(--accent); color: var(--on-accent); font-weight: 700; }
/* 窄屏左侧无空白，隐藏 */
@media (max-width: 1180px) { .mini-toc { display: none; } }

/* ---------- STUDY-04：PC 顶栏「我」入口 ---------- */
.pc-me {
  min-width: 36px; min-height: 36px; padding: 0 8px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--accent);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pc-me:hover { background: var(--tint); }
.pc-me:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- STUDY-04：「我」面板身份卡片 ---------- */
.me-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 10px 12px; margin-bottom: 4px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--fg); font-size: 14px;
}
.me-card:hover { border-color: var(--accent-2); }
.me-card-avatar {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--tint); border: 1px solid var(--tint-2); overflow: hidden;
}
.me-card-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-card-name { font-weight: 700; font-size: 15px; }
.me-card-sub { font-size: 11px; color: var(--muted); }

/* ---------- 用户选择面板 ---------- */
.picker-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.picker-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(440px, 94vw); max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow); overflow: hidden;
}
.picker-head { padding: 18px 20px 10px; }
.picker-title { font-weight: 700; font-size: 18px; letter-spacing: 3px; }
.picker-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; letter-spacing: .5px; }
.picker-list {
  overflow-y: auto; padding: 6px 16px 10px;
  display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto;
}
.picker-user {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; min-height: 44px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--fg); font-size: 15px;
}
.picker-user:hover { border-color: var(--accent-2); }
.picker-user.cur { border-color: var(--accent); background: var(--tint); }
.picker-user-nick { flex: 1; font-weight: 600; }
.picker-user-id { color: var(--muted); font-size: 11px; }
.picker-empty { color: var(--muted); font-size: 13px; padding: 22px; text-align: center; }
.picker-wrap { padding: 12px 16px 18px; border-top: 1px dashed var(--line); }
.picker-temp-tip { display: block; font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-bottom: 8px; }
.picker-temp-row { display: flex; gap: 8px; }
.picker-input {
  flex: 1; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-size: 15px;
}
.picker-input:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.picker-go {
  min-height: 40px; padding: 0 18px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700;
}
.picker-go:hover { filter: brightness(1.06); }

/* ---------- 模式开关（阅藏 / 浏览） ---------- */
.modebar {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
}
.modebar-label { font-size: 11px; color: var(--muted); margin-right: 2px; letter-spacing: 1px; }
.modbtn {
  border: 1px solid transparent; background: transparent; color: var(--fg-2);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; min-height: 30px;
}
.modbtn:hover { color: var(--accent); }
.modbtn.active { background: var(--accent); color: var(--on-accent); }
.modbtn.bm-add { border-color: var(--accent-2); color: var(--accent); }
.modbtn.bm-add:hover { background: var(--tint); }
#pos[data-mode="browse"] { color: var(--accent-2); }

/* ---------- 书签面板 ---------- */
.bm-panel {
  position: fixed; right: 16px; top: calc(var(--topbar-h) + 14px); z-index: 45;
  width: min(360px, 92vw); max-height: 70vh;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.bm-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bm-title { font-weight: 700; letter-spacing: 3px; font-size: 15px; }
.bm-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.bm-empty { color: var(--muted); font-size: 13px; padding: 22px; text-align: center; }
.bm-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.bm-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.bm-label { flex: 1; font-size: 13px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-row .iconbtn { min-width: 34px; height: 28px; font-size: 12px; }
.bm-del { color: var(--danger); }

/* ---------- 休息提醒弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.overlay-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(400px, 92vw); padding: 26px 24px 22px; box-shadow: var(--shadow); text-align: center;
}
.overlay-title { font-size: 20px; font-weight: 700; letter-spacing: 2px; margin: 0 0 10px; }
.overlay-sub { color: var(--fg-2); font-size: 14px; line-height: 1.7; margin: 0 0 20px; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; }
.overlay-actions .navbtn { font-size: 15px; padding: 10px 22px; }
.navbtn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }

/* ---------- 首页仪表盘 ---------- */
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 22px; }

/* 首页 portal 大卡片 */
.portal-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  margin: 6px 0 22px; padding: 18px 20px;
  border: 1px solid var(--accent-2); border-radius: 16px;
  background: linear-gradient(135deg, var(--tint), transparent);
  color: var(--fg); text-align: left; box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s;
}
.portal-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.portal-ico { --line-icon-size: 30px; flex: none; }
.portal-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.portal-main { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: 2px; }
.portal-sub { font-size: 12px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-go { flex: none; font-size: 14px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.dash-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 18px 20px; box-shadow: var(--shadow);
}
.dash-title { font-size: 15px; font-weight: 700; letter-spacing: 2px; margin: 0 0 14px; color: var(--fg); display: flex; align-items: center; justify-content: space-between; }

/* 今日任务 */
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.today-cell { text-align: center; }
.today-num { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.today-lab { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.today-goal { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent-2); transition: width .3s; }
.bar.big { margin-top: 10px; }
.today-check { font-size: 13px; color: var(--muted); margin: 14px 0 2px; text-align: center; }
.today-check.met { color: var(--accent); font-weight: 700; }
.today-tip { font-size: 11px; color: var(--muted); text-align: center; margin: 0; }

/* 总进展 */
.sum-row { text-align: center; }
.sum-num { font-size: 30px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.sum-lab { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sum-detail { text-align: center; font-size: 13px; color: var(--fg-2); margin-top: 6px; }
.sum-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; }

/* 计划表单 */
.plan-form { display: flex; flex-direction: column; gap: 10px; }
.plan-form label { font-size: 13px; color: var(--fg-2); display: flex; flex-direction: column; gap: 6px; }
.plan-form input {
  width: 100%; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-size: 15px;
}
.plan-form input:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.plan-form .navbtn { align-self: flex-start; min-height: 36px; }
.plan-msg { font-size: 12px; color: var(--accent); }

/* 日历 */
.cal-nav { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.cal-month { font-size: 13px; color: var(--fg-2); min-width: 92px; text-align: center; }
.cal-nav .iconbtn { min-width: 30px; height: 28px; font-size: 16px; }
.calendar { }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--fg-2); font-variant-numeric: tabular-nums;
  border-radius: 8px; border: 1px solid transparent;
}
.cal-cell.empty { border: none; }
.cal-cell.read { background: var(--tint); }
.cal-cell.met { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 95;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 顶部吸顶条：仅保留最小占位 ---------- */
.work-sticky {
  position: sticky; top: var(--topbar-h); z-index: 23;
  max-width: 46em; margin: 0 auto;
  height: 6px;
  background: transparent;
  pointer-events: none;
}

/* ---------- 卷级批注锚点（仅卷标题，确有批注时显示的小徽标） ---------- */
.para { position: relative; }
.jhead { position: relative; padding-right: 30px; }
.an-mark {
  position: absolute; right: 0; top: 4px;
  display: flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  font-family: var(--sans); font-size: 11px; font-weight: 700; line-height: 1;
  color: var(--on-accent); background: var(--accent); border-radius: 999px;
  cursor: pointer; z-index: 3; box-shadow: 0 1px 4px rgba(60, 45, 20, .25);
  white-space: nowrap;
}
.an-mark:hover { background: var(--accent-2); }
.an-mark[hidden] { display: none; }
.jhead .an-mark { top: 3px; }
/* T03-R1：正文右侧不再预留「批注列」——段旁标记（批注气泡 / 数字角标 / AI 菱形）已全部删除，
   正文始终占满整宽；也不引入任何替代性的右侧悬浮元素。 */
.paras { position: relative; padding-right: 0; }

/* ---------- 段末统一操作栏（T03-R1：PC 与手机同一套，段末文档流内，未选中隐藏） ----------
 * 固定三个入口：加书签 / 批注(N) / AI解读；不使用左侧轨道、Hover 菜单或独立状态行。
 * 位于段落之后的独立块级空间，不覆盖正文，也不改变正文宽度 / 换行 / 字体 / 字号 / 行高。 */
.para-tools {
  display: block;
  margin: 6px 0 2px;
  text-indent: 0; text-align: left;
  font-family: var(--sans);
  z-index: 6;
}
.para-tools[hidden] { display: none; }

.pt-tbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: 100%;
  text-indent: 0; text-align: left;
  font-family: var(--sans);
}
.pt-tbar[hidden] { display: none; }

/* T03-R1 追加：常显态下被隐藏的入口按钮（未选中时的「加书签」、无内容的「批注」/「AI解读」）。
 * .pt-tb 自身的 inline-flex 会压过 UA 的 [hidden]，必须显式声明 display:none，
 * 让隐藏的按钮彻底退出布局（flex gap 也不会为它留空）。 */
.pt-tb[hidden] { display: none; }

/* T03：段落操作按钮压缩尺寸，PC 与手机同款同尺寸（30px 高 / 11px 字，为尺寸上限） */
.pt-tb {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 30px; min-width: 30px; padding: 0 8px;
  max-width: 100%;
  font-size: 11px; font-weight: 500; line-height: 1; letter-spacing: .2px;
  color: var(--fg-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.pt-tb:hover { border-color: var(--accent-2); color: var(--accent); }

/* 已有 AI 解读内容 → 淡绿色背景 / 边框 / 文字；无内容为普通样式 */
.pt-tb-ai-on {
  color: var(--ai-ok);
  background: var(--ai-ok-bg);
  border-color: var(--ai-ok-line);
}
.pt-tb-ai-on:hover { color: var(--ai-ok); background: var(--ai-ok-bg); border-color: var(--ai-ok); }

/* 窄屏：操作栏自动换行、不产生横向溢出；正文保持整宽 */
@media (max-width: 860px) {
  .paras { padding-right: 0; }
  .para-tools { margin: 6px 0 2px; }
  .pt-tbar { gap: 8px; }
}

/* ---------- 批注弹层 ---------- */
.an-panel,
.ai-panel {
  position: fixed; right: 16px; top: calc(var(--topbar-h) + 14px); z-index: 45;
  width: min(360px, 92vw); max-height: 78vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
}
.an-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.an-title { font-weight: 700; font-size: 14px; letter-spacing: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* T03-R1：统一批注弹层的两个 Tab（查看（N） / 写批注）。只切换视图，批注数据 / 权限 / 保存逻辑不变。 */
.an-tabs { display: flex; gap: 6px; padding: 0 14px 10px; }
.an-tab {
  min-height: 30px; min-width: 30px; padding: 0 10px;
  font-size: 11px; font-weight: 500; line-height: 1; letter-spacing: .2px;
  color: var(--fg-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}
.an-tab:hover { border-color: var(--accent-2); color: var(--accent); }
.an-tab.active { color: var(--accent); border-color: var(--accent-2); background: var(--tint); font-weight: 600; }
.an-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.an-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--paper); }
.an-row-head { display: flex; align-items: center; gap: 8px; }
.an-who { font-weight: 600; font-size: 12px; }
.an-tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; letter-spacing: 1px; }
.an-tag.public { color: var(--accent); background: var(--tint); border: 1px solid var(--accent-2); }
.an-tag.private { color: var(--muted); background: var(--hover); border: 1px solid var(--line); }
.an-time { margin-left: auto; font-size: 10px; color: var(--muted); }
.an-row-text { font-size: 13px; line-height: 1.7; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.an-row-ops { display: flex; gap: 6px; margin-top: 6px; }
.an-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }
.an-edit {
  width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-size: 13px; padding: 8px; resize: vertical;
}
.an-foot { border-top: 1px dashed var(--line); padding: 10px 14px 14px; display: flex; flex-direction: column; }
.an-text {
  width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-family: inherit; font-size: 13px;
  padding: 8px 10px; resize: vertical;
}
.an-text:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.an-foot-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.an-vis {
  border: 1px solid var(--line); background: var(--paper); color: var(--fg-2);
  border-radius: 8px; font-size: 12px; padding: 6px 8px;
}
.an-msg { font-size: 12px; color: var(--danger); }

/* ---------- AI 解读弹层 ---------- */
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.ai-title { font-weight: 700; font-size: 14px; letter-spacing: 2px; }
.ai-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.ai-meta { font-size: 12px; color: var(--muted); }
.ai-section h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: 1px; }
.ai-text { font-size: 13px; line-height: 1.7; color: var(--fg); white-space: pre-wrap; word-break: break-word; }
.ai-line { margin: 2px 0; }
.ai-src { color: var(--quote); font-weight: 700; }
.ai-para { color: var(--fg); }
.ai-loading { font-size: 13px; color: var(--muted); text-align: center; padding: 10px 0; }
.ai-error { font-size: 13px; color: var(--danger); padding: 8px; background: var(--err-tint); border-radius: 8px; }

/* ---------- 批注搜索输入（阅读工具「科判 / 批注搜索」弹层复用） ---------- */
.qm-search-input {
  width: 100%; min-height: 32px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-size: 13px; padding: 0 10px;
}
.qm-search-input:focus { outline: 2px solid var(--accent-2); }
.an-hit { text-align: left; }

/* ---------- 顶部经名/作者/索引 + 下方计时 ---------- */
.brand { display: none; }

.work-info {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; padding: 0 12px; gap: 0;
}
.wi-row {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; justify-content: center;
}

.read-stats {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 0;
}
.read-stats[hidden] { display: none; }
.rs-time,
.rs-pct {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 7px; white-space: nowrap;
}
.rs-time.active { color: var(--accent); border-color: var(--accent-2); }

/* ---------- AI 重新生成 ---------- */
.ai-head { gap: 8px; }
.ai-regen {
  margin-left: auto;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg-2);
  border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer;
}
.ai-regen:hover { border-color: var(--accent-2); color: var(--accent); }
.ai-regen[hidden] { display: none; }

/* ---------- 科判面板 ---------- */
.work-wrap {
  display: block;            /* 正文独立块级居中，科判面板为 fixed 不占文档流 */
  width: 100%;               /* 充满 #reader 扣除左侧栏后的可用区 */
  margin: 0;
}
#workBody {
  width: 100%;
  min-width: 0;
}

.outline-panel {
  position: fixed;
  right: 12px;
  top: calc(var(--topbar-h) + 12px);
  width: 224px;
  height: calc(100vh - var(--topbar-h) - 24px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 24;
}
.outline-panel.collapsed {
  width: 36px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.outline-panel.collapsed .op-head {
  justify-content: center;
  padding: 0;
}
.outline-panel.collapsed .op-title,
.outline-panel.collapsed .op-tabs,
.outline-panel.collapsed .outline-tree,
.outline-panel.collapsed .outline-vols { display: none; }
.outline-panel.collapsed #outlineToggle {
  transform: rotate(180deg);
  width: 36px; height: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.op-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.op-title {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#outlineToggle {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  min-width: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform .15s;
}
#outlineToggle:hover { color: var(--accent); }

/* 科判面板子 tab（科判 / 卷号·书签） */
.op-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.op-tab {
  flex: 1 1 0;
  padding: 4px 0;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
}
.op-tab:hover { color: var(--fg); }
.op-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 科判面板内容视图切换（默认科判 active），PC 面板与手机弹层共用 */
.op-view { display: none; }
.op-view.active { flex: 1 1 auto; display: flex; flex-direction: column; overflow: hidden; }

/* 科判取数失败的可见反馈（PNO-08 阶段 B）：面板内、不阻塞正文，自带重试入口 */
.op-fail {
  padding: 14px 12px; margin: 4px 0; text-align: center;
  color: var(--muted); font-size: 12px; line-height: 1.7;
  border: 1px dashed var(--line); border-radius: 8px;
}
.op-fail .navbtn { margin-top: 8px; }

/* 卷号/书签按卷和原书章节分组。 */
.outline-vols.active {
  flex: 1 1 auto;
  display: block;
  overflow-y: auto;
  padding: 8px 10px 10px;
  font-size: 13px;
  line-height: 1.45;
}
.ov-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--fg-2);
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.ov-row:hover { background: var(--bg); color: var(--accent); }
.ov-row.cur {
  background: var(--tint);
  color: var(--accent);
  font-weight: 700;
}
.ov-caret {
  flex: 0 0 auto;
  width: 12px;
  color: var(--muted);
  --line-icon-size: 12px;
  transition: transform .12s;
}
.ov-row.open .ov-caret { transform: rotate(90deg); }
.ov-juan-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-count {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 8px;
  padding: 0 6px;
}
.ov-children {
  display: none;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  margin-left: 6px;
}
.ov-row.open + .ov-children { display: block; }
.ov-bm-row { display: flex; align-items: center; min-width: 0; }
.ov-bm-row .bm-del {
  flex: 0 0 auto;
  color: var(--muted);
  --line-icon-size: 13px;
  min-width: 28px;
  min-height: 28px;
}
.ov-bm-row .bm-del:hover { color: var(--accent); }
.ov-bm {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--fg-2);
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
}
.ov-bm:hover { background: var(--bg); color: var(--accent); }
.ov-bm-dot { flex: 0 0 auto; color: var(--accent-2); }
.ov-bm-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bm-meta { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.ov-empty { padding: 8px 6px; color: var(--muted); font-size: 12px; }
/* 当前卷无书签的等价空状态：不参与 .ov-row.open 联动，恒显示 */
.ov-children.ov-children-empty {
  display: block;
  padding: 2px 6px 4px;
  color: var(--muted);
  font-size: 12px;
}
.ov-empty button {
  border: none; background: transparent; color: var(--accent);
  font-size: 12px; cursor: pointer; padding: 0 2px;
}

.outline-tree {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 0 10px;
  font-size: 13px;
  line-height: 1.45;
}
.outline-nodes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.outline-nodes.nested {
  position: relative;
  padding-left: 12px;
}
.outline-nodes.nested::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.outline-node {
  position: relative;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--fg-2);
  padding: 5px 10px 5px 8px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: baseline;
}
.outline-node:hover { background: var(--bg); color: var(--accent); }
.outline-node.current {
  background: var(--tint);
  color: var(--accent);
  font-weight: 700;
}
.outline-node.current::before {
  content: '●';
  position: absolute;
  left: -4px;
  font-size: 8px;
  color: var(--accent);
}
.on-label { word-break: break-word; }
.on-bm {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 6px;
  color: var(--accent);
  --line-icon-size: 12px;
  cursor: pointer;
  align-self: center;
}
.on-bm:hover { color: var(--accent-2); transform: scale(1.3); }

@media (max-width: 860px) {
  .work-wrap { display: block; }
  /* 手机端本经目录改为底部弹层，原贴右面板彻底隐藏 */
  #outlinePanel { display: none !important; }
  #workBody { padding-right: 16px; }
  .paras { padding-right: 0; }
}

/* ================= STUDY-02B：手机本经科判浮层 =================
 * 居中卡片（桌面适中阅读宽度、移动端近全宽），内容区固定可用高度 min(70vh, 620px)
 * 且内部独立滚动；标题与关闭按钮固定可见。开合为短促克制的 opacity + transform
 * 渐进渐出。覆写全局 [hidden]{display:none!important}，改用 opacity/visibility 控制显隐，
 * 使「关闭」同样有过渡而非突兀闪现（同时 pointer-events:none，隐藏态不拦截交互）。 */
#outlineModal {
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
#outlineModal:not([hidden]) { opacity: 1; visibility: visible; }
#outlineModal[hidden] { display: flex !important; pointer-events: none; }
#outlineModal .sheet {
  width: min(680px, calc(100vw - 28px));
  max-width: min(680px, calc(100vw - 28px));
  height: min(70vh, 620px);
  max-height: min(70vh, 620px);
  border-radius: 16px;
  padding-bottom: 0;
  transform: translateY(16px) scale(.98);
  transition: transform .18s ease;
  animation: none;
}
#outlineModal:not([hidden]) .sheet { transform: none; }
#outlineModal .sheet-head { flex: 0 0 auto; padding: 14px 18px 10px; }
#outlineModal .op-tabs {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 18px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
#outlineModal .outline-tree,
#outlineModal .outline-vols {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 18px calc(14px + env(safe-area-inset-bottom));
}
/* 减少动态效果：取消位移，仅保留即时显隐（不做旋转/位移动画） */
@media (prefers-reduced-motion: reduce) {
  #outlineModal, #outlineModal .sheet { transition: none; }
  #outlineModal .sheet { transform: none; }
}

/* ================= 登录 / 注册 / 找回 / 补全 弹层 ================= */
.auth-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(400px, 94vw);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}
.auth-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  min-width: 0;
}
/* 标题块可收缩但不挤压 Logo（Logo 恒为 48×48 不参与收缩） */
.auth-brand > div { flex: 1 1 auto; min-width: 0; }
/* PRL-01 R3：认证/补全/联系三个弹层统一使用品牌图 logo-small.png（原 Emoji 📖/🔗/✉）。
   flex: 0 0 auto 防窄屏被压缩，aspect-ratio + object-fit 保证等比清晰、不变形、不挤压标题。 */
.auth-logo {
  width: 48px; height: 48px; min-width: 48px; flex: 0 0 auto;
  aspect-ratio: 1 / 1; object-fit: contain;
  display: block; border-radius: 12px;
  background: var(--tint-2);
}
.auth-title { font-weight: 700; font-size: 20px; letter-spacing: 2px; }
.auth-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: .5px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-tip { font-size: 13px; color: var(--muted); text-align: center; letter-spacing: 1px; }
/* PRL-01 R2：注册页两个互斥 Tab（邮箱注册 / 手机号注册）。
   pane 自带 column 布局，保证切 Tab 后字段间距与 .auth-form 一致。 */
.auth-tabs {
  display: flex; gap: 6px; padding: 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
}
.auth-tab {
  flex: 1; min-height: 36px; border: none; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; letter-spacing: 1px; cursor: pointer;
}
.auth-tab:hover { color: var(--fg); }
.auth-tab.active { background: var(--accent); color: var(--on-accent); }
#regPaneEmail, #regPanePhone { display: flex; flex-direction: column; gap: 12px; }
#regPaneEmail[hidden], #regPanePhone[hidden] { display: none; }
.auth-input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper); color: var(--fg); font-size: 15px;
}
.auth-input:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.auth-code-row { display: flex; gap: 8px; }
.auth-code-row .auth-input { flex: 1; }
/* PRL-01：注册页手机号提示与图形验证码 */
.auth-hint { font-size: 11px; line-height: 1.5; color: var(--muted); }
/* +86 固定前缀：与输入框合成一个整体外观，用户只需填 11 位本地号码 */
.phone-field {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  overflow: hidden;
}
.phone-field:focus-within { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.phone-prefix {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--tint); color: var(--muted);
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
  border-right: 1px solid var(--line); user-select: none;
}
.phone-field .auth-input {
  border: none; border-radius: 0; background: transparent;
  min-width: 0;
}
.phone-field .auth-input:focus { outline: none; }
/* 图形验证码：与 lib/captcha.mjs 的 CAPTCHA_SVG_W/CAPTCHA_SVG_H（144×52）保持一致，避免缩放发虚 */
.auth-captcha-img {
  width: 144px; height: 52px; flex: 0 0 auto; border-radius: 9px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
}
.auth-btn {
  min-height: 44px; padding: 0 20px; border: none; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.auth-btn:hover { filter: brightness(1.06); }
.auth-btn:disabled { opacity: .5; cursor: default; }
.auth-btn.sec {
  width: 118px; min-height: 44px; flex: 0 0 auto;
  background: var(--paper); color: var(--accent);
  border: 1px solid var(--accent-2); font-weight: 600; font-size: 13px;
}
.auth-btn.sec:disabled { opacity: .5; }
.auth-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.auth-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  user-select: none; margin-top: -2px;
}
.auth-remember input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.auth-remember input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.auth-link { color: var(--accent); font-size: 13px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-msg { min-height: 18px; font-size: 12px; color: var(--err); text-align: center; }
.auth-msg.ok { color: var(--ok); }
/* PRL-01 R3：545px 级窄屏——Logo 等比略收、弹层内边距微收，
   给标题留足宽度（布局结构不变，仅尺寸微调） */
@media (max-width: 560px) {
  .auth-box { padding: 22px 20px 18px; }
  .auth-logo { width: 44px; height: 44px; min-width: 44px; }
  .auth-brand { gap: 10px; margin-bottom: 16px; }
}

/* ================= 我的信息页 ================= */
.profile-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.profile-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(520px, 96vw); max-height: 86vh;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.profile-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px;
}
.profile-title { font-weight: 700; font-size: 18px; letter-spacing: 3px; }
.iconbtn {
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer; border-radius: 8px;
}
.iconbtn:hover { color: var(--fg); background: var(--hover); }
.profile-body { overflow-y: auto; padding: 4px 22px 22px; }
.profile-user { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 18px; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.profile-name-row { display: flex; align-items: center; gap: 8px; }
.profile-nick {
  min-height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--fg); font-size: 16px; font-weight: 600;
  width: 180px; text-align: center;
}
.profile-nick:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
.profile-email { font-size: 12px; color: var(--muted); }
.profile-msg { font-size: 12px; color: var(--muted); }
.profile-msg.ok { color: var(--ok); }
.profile-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.profile-tab {
  flex: 1; padding: 10px 0; border: none; background: transparent;
  color: var(--muted); font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; letter-spacing: 1px;
}
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.profile-view.active { display: block; }
.profile-list { display: flex; flex-direction: column; gap: 6px; }
.profile-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); text-align: left;
  font-size: 14px; color: var(--fg);
}
button.profile-item { width: 100%; cursor: pointer; }
button.profile-item:hover { border-color: var(--accent-2); }
.pi-main { flex: 1; min-width: 0; }
.pi-title { display: block; font-weight: 600; }
.pi-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-time { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.profile-empty, .loading { color: var(--muted); font-size: 13px; padding: 24px; text-align: center; }
.profile-sec { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 16px; }
.profile-sec-title { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
.navbtn.danger { border-color: var(--err); color: var(--err); }
.navbtn.danger:hover { background: var(--err-tint); border-color: var(--err); color: var(--err); }

/* ================= 联系我 ================= */
.contact-box { width: min(460px, 94vw); }
.contact-items { display: flex; flex-direction: column; gap: 12px; }
.contact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper);
}
.ci-ico { font-size: 22px; line-height: 1; flex: 0 0 auto; }
.ci-body { flex: 1; min-width: 0; }
.ci-label { font-size: 12px; color: var(--muted); }
.ci-value {
  display: block; font-size: 15px; font-weight: 600; color: var(--fg);
  margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.ci-value { text-decoration: none; color: var(--accent); }
a.ci-value:hover { text-decoration: underline; }
.contact-item .navbtn { flex: 0 0 auto; }

/* ================= 手机端：顶栏经名按钮化 / 更多按钮（默认桌面隐藏） ================= */
#wiTitle.wi-title {
  border: 0; background: none; padding: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  min-width: 0;
}
#wiTitle.wi-title:hover { color: var(--accent); }
.rs-juan {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 7px; white-space: nowrap;
}
.rs-juan[hidden] { display: none; }
.mobile-bar { display: none; }

/* ---------- 底部弹层（sheet）共用 ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 72;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
/* ---------- 学而时习：窗口居中固定弹窗（REL-02 整改 · 需求3）---------- */
.sheet-overlay.st-center { align-items: center; padding: 20px 16px; }
.sheet-overlay.st-center .sheet {
  max-width: 640px; max-height: 86vh;
  border-radius: 18px; padding-bottom: 0;
  animation: stSheetIn .18s ease;
}
.sheet-overlay.st-center .sheet-body { flex: 1 1 auto; min-height: 0; }
@keyframes stSheetIn { from { transform: translateY(10px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
@media (max-width: 640px) {
  .sheet-overlay.st-center { padding: 12px 10px; }
  .sheet-overlay.st-center .sheet {
    max-height: 88vh; border-radius: 16px;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
.sheet {
  width: 100%; max-width: 560px; max-height: 78vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  overflow: hidden; padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp .18s ease;
}
@keyframes sheetUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; flex: 0 0 auto;
}
.sheet-title { font-weight: 700; font-size: 15px; letter-spacing: 2px; }
.sheet-close { flex: 0 0 auto; }

/* ---------- 详情面板（批注 / 批注详情 / AI 解读）：复用 T02 底部面板，桌面转侧栏 ---------- */
/* 遮罩透明、不拦截正文点击；面板靠右上角展示，仅 .sheet 可点击 */
@media (min-width: 861px) {
  .detail-sheet {
    background: transparent; pointer-events: none;
    align-items: flex-start; justify-content: flex-end;
    padding: calc(var(--topbar-h) + 14px) 16px 0 0;
  }
}
.detail-sheet .sheet { pointer-events: auto; }
@media (min-width: 861px) {
  .detail-sheet .sheet {
    width: min(360px, 36vw); max-width: 360px;
    border-radius: 14px; box-shadow: var(--shadow);
    padding-bottom: 0; animation: none;
  }
}
/* 详情面板内部滚动区域：内容超出可用高度时滚动，标题固定 */
.an-sheet-body, .ai-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.an-sheet-body .an-list { flex: 0 0 auto; overflow: visible; }
.an-sheet-body .an-foot { flex: 0 0 auto; }
@media (max-width: 860px) {
  .detail-sheet .sheet { max-height: 82vh; }
  .an-sheet-body { padding: 4px 14px calc(10px + env(safe-area-inset-bottom)); }
  .ai-sheet-body { padding: 4px 14px calc(14px + env(safe-area-inset-bottom)); }
}
.sheet-list { overflow-y: auto; padding: 4px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-toolbar { padding: 2px 16px 10px; display: flex; gap: 8px; align-items: center; }
.sheet-toolbar .navbtn { min-height: 40px; margin-left: auto; }
.sheet-toolbar .qm-search-input { flex: 1; min-height: 40px; }
.sheet-sep {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 4px;
  font-size: 11px; color: var(--muted); letter-spacing: 2px;
}
.sheet-sep::before, .sheet-sep::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.sheet-act {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--fg); font-size: 14px;
}
.sheet-act:hover:not(:disabled) { border-color: var(--accent-2); }
.sheet-act:disabled { opacity: .45; cursor: not-allowed; }
.sa-ico {
  flex: 0 0 auto; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.sa-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sa-main { font-weight: 600; }
.sa-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-go, .st-go { --line-icon-size: 16px; flex: 0 0 auto; color: var(--muted); }
.me-card-avatar { --line-icon-size: 24px; }

/* 经文信息 */
.winfo-title { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: 2px; margin: 6px 0 14px; }
.winfo-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.winfo-row:last-of-type { border-bottom: 0; }
#infoModal .sheet-head { gap: 8px; }
#infoExport { margin-inline-start: auto; }
#infoExport .navbtn { min-height: 44px; white-space: nowrap; }
.winfo-lab { flex: 0 0 auto; color: var(--muted); width: 48px; }
.winfo-val { flex: 1; min-width: 0; word-break: break-word; }

/* 设置分组 */
.set-group { padding: 4px 0 14px; }
.set-title { font-size: 12px; color: var(--muted); letter-spacing: 2px; margin: 6px 0 8px; }
.set-fs-row { display: flex; align-items: center; gap: 12px; }
.set-fs-row .iconbtn { width: 46px; height: 46px; font-size: 15px; border: 1px solid var(--line); background: var(--paper); color: var(--fg); }
.set-fs-val { min-width: 44px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.set-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--fg); font-size: 14px; text-align: left;
}
.set-toggle:hover { border-color: var(--accent-2); }
.set-toggle.on { color: var(--accent); }
.st-go { color: var(--muted); }

/* ================= 手机底部常驻导航栏（PC 默认隐藏，见上方 .mobile-bar{display:none}，仅手机媒体内显示） ================= */
.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
  align-items: stretch;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
}
.mb-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 52px; min-width: 44px;
  border: 0; background: transparent; color: var(--fg-2);
  font-size: 11px; letter-spacing: .5px;
}
.mb-item:disabled { opacity: .45; cursor: not-allowed; }
.mb-ico {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  --line-icon-size: 22px;
}
.mb-item.active { color: var(--accent); font-weight: 700; }
.mb-item.active .line-icon, .mb-mode.running .line-icon { --line-icon-stroke: 2; }
/* STUDY-04：阅藏为「图标 + 文字」的计时钮，与 .mb-item 同构（列向 flex），
   热区 ≥44px；图标复用 .mb-ico 既有尺寸（24px）。 */
.mb-modewrap .mb-lab { line-height: 1; }
.mb-modewrap { gap: 4px; min-width: 44px; }
.mb-mode {
  min-height: 44px; min-width: 44px; width: 100%; max-width: 100%;
  padding: 0 2px; border: 0; background: transparent; color: var(--fg-2);
  font-size: 11px; letter-spacing: .5px; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.mb-mode.running { color: var(--accent); font-weight: 700; }
.mb-mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mb-mode:disabled { opacity: .45; cursor: not-allowed; }


/* ================= 手机响应式（断点沿用 860px） ================= */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  body { --topbar-h: 56px; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body.rc-reading { --topbar-h: 84px; }
  #topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: var(--topbar-h); padding: 0 8px; gap: 4px;
  }
  .topbar-left { gap: 4px; }
  .brand, .topbar-script, .topbar-library, #btnContact, #pos, .study-link, .pc-me { display: none; }
  #btnHome.home-logo { width: 44px; height: 44px; min-width: 44px; max-width: 44px; }
  #btnHome .home-logo-img { width: 40px; height: 40px; min-width: 40px; }

  .work-info { width: 100%; min-width: 0; padding: 0 2px; gap: 2px; }
  .wi-row { width: 100%; justify-content: flex-start; gap: 4px; }
  .wi-div, #wiMeta { display: none; }
  #wiTitle.wi-title { max-width: none; flex: 1 1 auto; font-size: 15px; letter-spacing: 0; }
  /* STUDY-00A：阅读页顶部「今日已阅」在窄屏同样必须可见（原先被隐藏），
     依靠 nowrap + 不换行 + 允许收缩保证 320px 下不换行、不遮挡经名。 */
  .read-stats { width: 100%; justify-content: flex-start; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
  .rs-time { display: inline-block; flex: 0 0 auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
  .rs-juan { display: inline-block; flex: 0 0 auto; }
  .rs-pct { flex: 0 0 auto; }
  .read-stats[hidden] { display: none; }

  /* 底部常驻导航栏显示；给阅读区留出底部空间 */
  .mobile-bar { display: flex; }
  #workBody { padding-bottom: calc(24vh + 8px); }
  #reader { padding-bottom: 0; }

  /* 底部弹层覆盖于底部导航之上 */
  .sheet-overlay { z-index: 74; }

  /* 顶栏始终置顶、阅读时两行 */
  .work-sticky { top: var(--topbar-h); }
}

/* ---------- 读经完成：末卷末段后的入口（feat/reading-completion §1） ---------- */
.finish-entry {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 34px auto 8px; padding: 22px 16px 26px;
  border-top: 1px solid var(--line);
}
.finish-entry-hint { font-size: 13px; letter-spacing: 1px; color: var(--muted); }
/* 入口做成一行可点文字（不再有按钮外观）：未登记为强调色虚下划线，已读完转灰 */
.finish-btn {
  font-size: 15px; letter-spacing: 1px; color: var(--accent); cursor: pointer;
  border-bottom: 1px dashed currentColor; padding-bottom: 3px;
}
.finish-btn.done { color: var(--muted); border-bottom-style: solid; }
.finish-btn.busy { opacity: .5; pointer-events: none; }
.finish-btn:hover { opacity: .82; }

/* ---------- 读经完成：回向界面（§4） ---------- */
/* 背景策略：整图展示 + 局部压暗。
   1) 弹层底色用暖褐色，仅用于 contain 留边处填空，不再用深色重遮罩压暗整图；
   2) 弥勒佛图整图铺满弹层、object-fit: contain（不裁切/不变形）、不加任何模糊；
   3) 上方只叠一层很轻的暖褐渐变：中心稍亮、边缘略暗，突出文字卡片但不吃掉画面细节。 */
.finish-overlay {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--letterbox);      /* 暖褐色底：竖屏/宽屏留边时的底色，宁可留白也不裁图 */
  backdrop-filter: none;    /* 明确不使用背景模糊 */
}
.finish-overlay[hidden] { display: none; }
/* 弥勒佛背景：object-fit: contain —— 等比缩放不裁切、不拉伸，绝不压扁变形 */
.finish-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  opacity: 1; filter: none;             /* 整图清晰可见，不压暗、不模糊 */
  pointer-events: none; user-select: none;
}
/* 极轻压暗罩：中心 rgba(...,.06) → 边缘 rgba(...,.18)，尽量让背景图原样清晰 */
.finish-backdrop {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(78% 68% at 50% 50%,
    rgba(42, 28, 18, .06) 0%,
    rgba(42, 28, 18, .10) 58%,
    rgba(42, 28, 18, .18) 100%);
}
/* 卡片做成高透毛玻璃：背景图透过文字区清晰可见，仅保留极轻模糊避免干扰阅读
   —— 兜底先给不透明 --panel，支持 color-mix 的浏览器再叠加透明度。 */
.finish-card {
  position: relative; z-index: 1;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 50%, transparent);
  backdrop-filter: blur(5px) saturate(125%);
  -webkit-backdrop-filter: blur(5px) saturate(125%);
  border: 1px solid var(--line); border-radius: 18px;
  width: min(416px, 90vw); max-height: 92vh; overflow: auto;
  padding: 24px 22px 22px; box-shadow: var(--shadow); text-align: center;
}
.finish-badge { font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--accent); }
.finish-title { font-size: 17px; font-weight: 600; letter-spacing: 1px; margin: 8px 0 16px; color: var(--fg); }
.finish-stats { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.finish-stat {
  flex: 1 1 0; min-width: 0; padding: 10px 6px;
  border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 38%, transparent); /* 与卡同调、更透一层 */
}
.finish-stat b { display: block; font-size: 20px; color: var(--fg); }
.finish-stat span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.finish-merit { color: var(--fg-2); font-size: 14px; line-height: 1.8; margin: 0 0 14px; }
.finish-verse {
  padding: 14px 12px; border-radius: 12px;
  border: 1px dashed var(--line); text-align: center; margin-bottom: 18px;
}
.finish-verse-title { font-size: 13px; letter-spacing: 3px; color: var(--muted); margin-bottom: 8px; }
.finish-verse-line { display: block; font-size: 15px; line-height: 2; letter-spacing: 1px; color: var(--fg); }
/* 底部操作位：一行文字，不再是按钮。
   未登记（滚动到底自动弹出）时点它登记；已登记时点它关闭回向页回目录。 */
.finish-done {
  display: inline-block; margin-top: 2px;
  font-size: 15px; letter-spacing: 2px; color: var(--fg-2); cursor: pointer;
}
.finish-done.pending { color: var(--fg); border-bottom: 1px dashed var(--line); padding-bottom: 2px; }
.finish-done:hover { color: var(--accent); }
.finish-done-hint { margin-top: 7px; font-size: 12px; letter-spacing: 1px; color: var(--muted); }

@media (max-width: 768px) {
  /* 手机端同样 contain：上下留暖褐底色，卡片再收一点、四周尽量露出画面 */
  .finish-card { width: min(416px, 88vw); padding: 20px 16px 18px; max-height: 86vh; }
  .finish-stats { gap: 6px; }
  .finish-stat b { font-size: 17px; }
  .finish-stat span { font-size: 11px; }
}

/* ================================================================
   T09-R8 听经馆与播放器
   ----------------------------------------------------------------
   设计红线：播放条 position:fixed 且不参与文档流，正文的宽度 / 换行 /
   字号 / 段落高度 / 当前阅读位置在开启播放前后必须完全一致；
   只允许给正文容器增加「底部留白」，且该留白在文档末尾、不影响可视区内容。
   ================================================================ */

/* ---------- PC 侧栏「听经馆」面板 ---------- */
.listen-pane {
  padding: 0 10px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.listen-pane[hidden] { display: none; }
.ls-sec { margin: 10px 0 4px; }
.ls-sec-hd {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0 2px 6px;
}
.ls-sec-title { font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.ls-sec-hint { font-size: 11px; color: var(--muted); }
.ls-empty {
  padding: 12px 10px; margin-bottom: 8px;
  border: 1px dashed var(--line); border-radius: 10px;
  font-size: 12.5px; line-height: 1.7; color: var(--muted);
}
/* 继续听卡片：右侧「从头开始」为次级操作 */
.ls-card {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 10px; margin-bottom: 7px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  color: var(--fg); font-family: var(--sans);
}
.ls-card:hover { border-color: var(--accent-2); }
.ls-card-main { flex: 1; min-width: 0; }
.ls-card-t {
  font-size: 13.5px; font-weight: 700; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ls-card-s { margin-top: 2px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ls-track {
  margin-top: 5px; height: 3px; border-radius: 2px;
  background: var(--line); overflow: hidden;
}
.ls-track > i { display: block; height: 100%; background: var(--accent-2); }
.ls-mini {
  flex: none; align-self: center;
  min-height: 30px; padding: 0 9px;
  font-size: 11px; color: var(--fg-2);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap;
}
.ls-mini:hover { border-color: var(--accent-2); color: var(--accent); }
/* 可听经书列表 */
.ls-item {
  display: flex; align-items: baseline; gap: 6px;
  width: 100%; text-align: left;
  padding: 6px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--fg);
  font-size: 13.5px; font-family: var(--sans); line-height: 1.45;
}
.ls-item:hover { background: var(--tint); }
.ls-item.playing { background: var(--tint-2); font-weight: 700; }
.ls-item .no { flex: none; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ls-item .etitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-item .ls-tag { flex: none; font-size: 10px; color: var(--accent); }
.ls-search {
  width: 100%; min-height: 34px; margin-bottom: 6px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 13px;
  -webkit-appearance: none;
}
.ls-search:focus { outline: none; border-color: var(--accent-2); }

/* 手机端听经馆弹层：纵向滚动区 */
.listen-sheet .sheet-body,
.listen-body { overflow-y: auto; padding: 4px 14px calc(14px + env(safe-area-inset-bottom)); }
.listen-body .ls-item { padding: 9px 8px; font-size: 14px; }

/* ---------- 读经页「听经 / ▶」入口（仅在有音频时插入，无音频不渲染） ---------- */
.wlisten {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 2px;
}
.wl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 32px; padding: 0 12px;
  font-size: 12.5px; letter-spacing: 1px;
  color: var(--accent); background: var(--paper);
  border: 1px solid var(--accent-2); border-radius: 999px;
  font-family: var(--sans);
}
.wl-btn:hover { background: var(--accent); color: var(--on-accent); }
.wl-btn.wl-play { min-width: 40px; justify-content: center; }
.wl-hint { font-size: 11px; color: var(--muted); }

/* ---------- PNO-07C 正文加载层 ----------
   fixed 覆盖层，只作提示：不参与文档流、不改正文排版；pointer-events:none 放行滚动与其它入口，
   因此「加载中」也绝不阻塞用户改选另一部经（切经由 app.js 作废旧状态）。 */
.work-load {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 70;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 12px 0;
  pointer-events: none;
}
.work-load[hidden] { display: none; }
.wl-card {
  display: inline-flex; align-items: center; gap: 10px;
  max-width: min(88vw, 420px);
  padding: 11px 15px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 22px rgba(60, 45, 20, .18);
  font-family: var(--sans);
}
.wl-spin {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: wl-spin 900ms linear infinite;
}
@keyframes wl-spin { to { transform: rotate(360deg); } }
.wl-text { min-width: 0; }
.wl-name {
  font-size: 13px; font-weight: 700; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wl-hint { font-size: 12px; color: var(--muted); margin-top: 1px; }
/* 真实字节百分比：只在响应自带可靠 Content-Length 时才出现（不伪造进度） */
.wl-pct { margin-left: 6px; color: var(--accent); font-variant-numeric: tabular-nums; }
.wl-track { height: 3px; margin-top: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.wl-track[hidden] { display: none; }
.wl-track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 160ms linear; }
.wl-slow { font-size: 12px; color: var(--accent); margin-top: 3px; }
.wl-slow[hidden] { display: none; }

/* ---------- 固定播放条 ---------- */
.audio-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 66;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -3px 14px rgba(60, 45, 20, .14);
  font-family: var(--sans);
}
.audio-bar[hidden] { display: none; }
.ab-btn {
  flex: none;
  min-width: 34px; min-height: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--fg-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}
.ab-btn:hover { border-color: var(--accent-2); color: var(--accent); }
.ab-play { min-width: 42px; min-height: 42px; font-size: 15px; color: var(--accent); border-color: var(--accent-2); position: relative; }
/* PNO-07C：缓冲中给播放键加「进行中」角标（不改变按钮尺寸，不禁用暂停能力） */
.ab-play.buffering::after {
  content: ''; position: absolute; right: 5px; bottom: 5px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: ab-blink 900ms ease-in-out infinite;
}
@keyframes ab-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
/* PNO-07C：缓冲状态文字（aria-live），留出固定宽度避免读数抖动 */
.ab-stat {
  flex: none; margin-left: auto; min-width: 5.5em; text-align: right;
  font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ab-stat:empty { min-width: 0; }
.ab-stat.warn { color: var(--danger); }
.ab-follow.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.ab-meta { flex: 1 1 auto; min-width: 0; }
.ab-line1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ab-title {
  min-width: 0; font-size: 13px; font-weight: 700; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ab-seg { flex: none; font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.ab-line2 { display: flex; align-items: baseline; gap: 10px; margin-top: 1px; min-width: 0; }
.ab-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ab-sent { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-close { margin-left: 2px; }

/* 播放条出现时，仅在正文容器末尾补一段留白，保证最后几段不被遮住。
   只加在文档末尾，不改宽度/字号/行高/段高，也不改变当前可视区与滚动位置。 */
body.audio-on #workBody { padding-bottom: 68px; }

/* 手机：播放条浮在底部导航之上，并改为两行（标题行 + 控制行），320px 也放得下 */
@media (max-width: 768px) {
  .audio-bar {
    /* 贴手机底部导航栏上沿：--mb-h 由 JS 实测写入（导航栏高度随字号/安全区变化） */
    bottom: var(--mb-h, 72px);
    flex-wrap: wrap; gap: 6px;
    padding: 6px 10px;
  }
  .ab-meta { flex: 1 1 100%; order: -1; }
  .ab-btn { min-width: 40px; min-height: 40px; padding: 0 10px; font-size: 13px; }
  .ab-play { min-width: 46px; min-height: 46px; font-size: 17px; }
  body.audio-on #workBody { padding-bottom: calc(24vh + 108px); }
  /* 播放条打开时，手机听经弹层不再需要额外底部留白 */
  .listen-body { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  /* PNO-07C：小屏加载层上移、收窄，不压到正文首段与底部播放条 */
  .work-load { padding: 9vh 10px 0; }
  .wl-card { max-width: 94vw; padding: 10px 12px; }
  .wl-name { font-size: 12px; }
  .ab-stat { min-width: 0; font-size: 10px; }
}

/* PNO-07C：尊重系统「减少动态效果」——停掉转圈/闪烁/进度过渡，只保留文字状态 */
@media (prefers-reduced-motion: reduce) {
  .wl-spin { animation: none; border-top-color: var(--line); border-left-color: var(--accent); }
  .wl-track i { transition: none; }
  .ab-play.buffering::after { animation: none; opacity: 1; }
}

/* ================= STUDY-02：PC 顶栏「学而时习」入口 ================= */
.study-link {
  min-height: 44px; padding: 0 12px;
  border: 1px solid var(--accent-2); border-radius: 999px;
  background: transparent; color: var(--accent);
  font-size: 13px; letter-spacing: 1px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.study-link:hover { background: var(--accent); color: var(--on-accent); }

@media (min-width: 861px) {
  #topbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(max-content, 1fr); }
  .topbar-library button, #topbar .topbar-support button {
    min-width: 0; min-height: 36px; padding: 0 8px; border: 0; border-radius: 6px;
    background: transparent; color: var(--accent); font-size: 13px; letter-spacing: normal;
  }
  #topbar .topbar-support button { color: var(--muted); }
  .topbar-library button:hover, #topbar .topbar-support button:hover { background: var(--tint); }
  .topbar-support, #btnMePc { border-inline-start: 1px solid var(--line); border-start-start-radius: 0; border-end-start-radius: 0; }
  .topbar-support { padding-inline-start: 7px; }
  #topbar .read-stats { gap: 0; }
  #topbar .read-stats > div { background: transparent; border: 0; border-radius: 0; padding-inline: 8px; }
  #topbar .read-stats > div + div { border-inline-start: 1px solid var(--line); }
}

/* STUDY-04：确保 PC 专属入口（我 / 学而时习）在手机端隐藏；
   覆盖上面 .study-link 的 display:inline-flex，避免媒体查询后被重新显示。 */
@media (max-width: 860px) {
  .study-link, .pc-me { display: none; }
}

/* ================= STUDY-02：分组底部抽屉 ================= */
.sheet-sep {
  padding: 12px 14px 4px; font-size: 12px; color: var(--muted); letter-spacing: 1px;
}
.study-placeholder { margin: 0; padding: 8px 4px 16px; color: var(--fg-2); font-size: 14px; line-height: 1.9; }

/* ===== STUDY-01C 每日学习单面板 ===== */
#studyBody .st-tab { width: auto; min-height: 36px; padding: 4px 14px; justify-content: center; font-size: 13px; border-radius: 999px; }
#studyBody .st-tab.on { border-color: var(--accent-2); background: var(--accent-soft, rgba(120,150,255,.12)); }
.st-view { padding: 2px 0 8px; }
.st-load, .st-empty, .st-hint { margin: 6px 2px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.st-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--paper); margin-bottom: 10px; }
.st-date { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.st-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-cell { text-align: center; padding: 6px 2px; border-radius: 9px; background: var(--bg-2, rgba(127,127,127,.06)); }
.st-k { font-size: 11px; color: var(--muted); }
.st-v { font-size: 16px; font-weight: 600; margin-top: 2px; word-break: break-all; }
.st-t { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* REL-02 第 2 轮整改（需求5）：经号清单 / 快照摘要整块不再渲染，相关样式一并移除 */
/* ===== REL-02 整改（需求1）：心得置顶 + 单行紧凑指标条 ===== */
.st-refl-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.st-refl-hd .st-date { margin-bottom: 0; font-size: 12px; }
.st-grid-inline {
  display: flex; align-items: stretch; gap: 0; margin: 0 0 8px;
  padding: 5px 4px; border-radius: 10px; background: var(--bg-2, rgba(127, 127, 127, .07));
}
.st-grid-inline .st-cell {
  flex: 1 1 0; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 4px;
  padding: 0 2px; border-radius: 0; background: transparent; text-align: center;
}
.st-grid-inline .st-cell + .st-cell { border-left: 1px solid var(--line); }
.st-grid-inline .st-k { font-size: 11px; }
.st-grid-inline .st-v { font-size: 15px; font-weight: 700; margin-top: 0; white-space: nowrap; }
.st-card-meta { margin-top: 10px; }
/* REL-02 需求2：详情右侧锚点导航 */
#studyModal .sheet { position: relative; }
#studyDetail { padding-right: 40px; }
.st-anchors { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 4; opacity: .92; }
.st-anchor { font-size: 11px; line-height: 1; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); cursor: pointer; }
.st-anchor:hover { color: var(--fg); }
.st-anchor.on { color: var(--accent); border-color: var(--accent-2); background: var(--accent-soft, rgba(120, 150, 255, .12)); }
@media (max-width: 640px) {
  #studyDetail { padding-right: 24px; }
  .st-anchors { right: 1px; gap: 4px; opacity: .45; }
  .st-anchors:hover, .st-anchors:focus-within { opacity: .95; }
  .st-anchor { padding: 5px 3px; font-size: 10px; writing-mode: vertical-rl; }
}
.st-routed { font-weight: 500; }
.st-btn {
  display: block; width: 100%; min-height: 44px; margin: 6px 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  color: var(--fg); font-size: 14px;
}
.st-btn.primary { border-color: var(--accent-2); font-weight: 600; }
.st-btn:hover { border-color: var(--accent-2); }
.st-back { display: inline-block; width: auto; min-height: 32px; margin: 2px 0 8px; padding: 2px 10px; border: none; background: none; color: var(--accent-2); font-size: 13px; text-align: left; }
.st-list { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 6px; }
.st-row { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--fg); }
.st-row:hover { border-color: var(--accent-2); }
.st-row-d { font-size: 14px; }
.st-row-m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.st-refl { margin-top: 10px; }
.st-refl-h { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.st-refl-ta { width: 100%; box-sizing: border-box; min-height: 110px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--fg); font-size: 14px; line-height: 1.7; resize: vertical; }
.st-refl-meta { min-height: 18px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.st-orphan { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.st-orphan-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.st-orphan-i { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.st-orphan-d { flex: 1; font-size: 13px; }
.st-mini { min-height: 32px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--fg); font-size: 12px; }
.st-mini:hover { border-color: var(--accent-2); }
.st-msg { min-height: 18px; margin: 6px 2px 0; font-size: 12px; color: var(--muted); }

/* ===== STUDY-01D AI 归纳板块（REL-02 第 2 轮整改：顺序 总结→建议→引用 + 中文段落排版） ===== */
.st-ai { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.st-ai-h { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.st-ai-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-bottom: 8px; }
.st-ai-chip:empty { display: none; }
/* 小节标题：左侧短竖线，与上一段正文拉开距离 */
.st-ai-sub { display: flex; align-items: center; font-size: 12px; color: var(--muted); letter-spacing: .06em; margin: 18px 0 8px; }
.st-ai-sub::before { content: ''; flex: 0 0 auto; width: 3px; height: 12px; margin-right: 7px; border-radius: 2px; background: var(--accent-2); }
.st-ai-body > .st-ai-sub:first-child { margin-top: 2px; }
/* 列表：汉字行距放宽；摘要按中文习惯首行缩进两字 */
.st-ai-outlines, .st-ai-sugs { margin: 0; padding-left: 22px; font-size: 14px; line-height: 1.85; }
.st-ai-outline { margin-bottom: 12px; }
.st-ai-outline:last-child { margin-bottom: 0; }
.st-ai-outline::marker, .st-ai-sug::marker { color: var(--muted); }
.st-ai-ot { font-weight: 600; line-height: 1.7; }
.st-ai-os { font-size: 13px; color: var(--muted); margin-top: 4px; text-indent: 2em; line-height: 1.9; }
.st-ai-sug { margin-bottom: 8px; line-height: 1.9; }
.st-ai-sug:last-child { margin-bottom: 0; }
/* 引用卡片：左侧加粗竖线，卡片内留白更足 */
.st-ai-quotes { display: flex; flex-direction: column; gap: 10px; }
.st-ai-quote { border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: 10px; padding: 10px 12px; background: var(--paper); }
.st-ai-quote-t { display: block; width: 100%; text-align: left; padding: 0; border: 0; background: none; color: var(--fg); font-size: 14px; line-height: 1.85; cursor: pointer; }
.st-ai-quote-t:hover { color: var(--accent-2); text-decoration: underline; }
.st-ai-quote-m { font-size: 12px; color: var(--muted); margin-top: 6px; }
.st-ai-quote-r { font-size: 13px; color: var(--muted); margin-top: 6px; text-indent: 2em; line-height: 1.85; }
.st-ai-drop { font-size: 12px; color: var(--muted); margin-top: 8px; }
/* 固定提示：虚线之上居中收束（需求5 仅保留这一句） */
.st-ai-disclaimer { margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); line-height: 1.7; text-align: center; }
.st-ai-note { min-height: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.st-ai .st-btn { min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--fg); font-size: 13px; }
.st-ai .st-btn.primary { border-color: var(--accent-2); color: var(--accent-2); }
.st-ai .st-btn:disabled { opacity: .6; }

/* 阅读显示：主题三选（STUDY-03 对接） */
.theme-opts { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.theme-opt {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: 14px; color: var(--fg); cursor: pointer;
}
.theme-opt input { width: 18px; height: 18px; accent-color: var(--accent); }
/* 当前选择标记：除 radio 圆点（形状）外再加粗与左描边，不单靠色相区分 */
.theme-opt:has(input:checked) {
  font-weight: 700; color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* 阅读快捷菜单：保留外圈位置，把导出放在主按钮内侧。 */
.read-fab {
  --arc-radius: clamp(122px, calc((100dvh - 172px) / 2), 168px);
  --fab-bottom: calc(46px + var(--arc-radius));
  position: fixed; right: 28px; bottom: var(--fab-bottom); z-index: 34;
}
.fab-btn {
  position: relative; z-index: 2; width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--accent-2); background: var(--accent); color: var(--on-accent);
  font-size: 26px; line-height: 1; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .46; transition: opacity .18s ease;
}
.fab-btn:hover, .fab-btn:focus-visible { opacity: .82; }
.fab-btn-ico { --line-icon-size: 24px; display: inline-flex; }
.fab-btn[aria-expanded="false"] .fab-btn-ico .line-icon:last-child,
.fab-btn[aria-expanded="true"] .fab-btn-ico .line-icon:first-child { display: none; }
.fab-btn:focus-visible, .fab-item:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.read-fab.open .fab-btn { opacity: 1; }
.fab-scrim { position: fixed; inset: 0; z-index: 1; }
.fab-arc { position: absolute; right: 26px; bottom: 26px; z-index: 2; }
.fab-item {
  position: absolute; right: calc(var(--arc-x) * var(--arc-radius) - 24px);
  bottom: calc(var(--arc-y) * var(--arc-radius) - 23px);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 48px; height: 46px; padding: 2px 1px; box-sizing: border-box;
  border: 1px solid transparent; border-radius: 28px;
  /* 反显：深色半透明底 + 白色线条图标，比浅底药丸更容易在正文上看清。 */
  background: color-mix(in srgb, var(--accent) 62%, transparent); color: var(--on-accent); font-size: 11px; line-height: 1;
  white-space: nowrap; box-shadow: var(--shadow); cursor: pointer;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px) scale(.9);
  transition: transform .18s ease, opacity .16s ease, visibility .18s, border-color .15s ease;
}
.fab-item[hidden] { display: none !important; }
.fab-item .fab-ico { --line-icon-size: 16px; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.fab-item:hover, .fab-item:focus-visible { background: color-mix(in srgb, var(--accent) 76%, transparent); color: var(--on-accent); }
#fabHome { --arc-x: 0; --arc-y: 1; --grid-col: 4; --grid-row: 1; }
#fabSearch { --arc-x: .434; --arc-y: .901; --grid-col: 3; --grid-row: 1; }
#fabTop { --arc-x: .782; --arc-y: .623; --grid-col: 2; --grid-row: 1; }
#fabOutline { --arc-x: .975; --arc-y: .223; --grid-col: 1; --grid-row: 1; }
#fabExport { right: 35px; bottom: -23px; width: 58px; --grid-col: 0; --grid-row: 1; }
#fabRecall { --arc-x: .975; --arc-y: -.223; --grid-col: 3; --grid-row: 0; }
#fabDisplay { --arc-x: .782; --arc-y: -.623; --grid-col: 2; --grid-row: 0; }
#fabFavorites { --arc-x: .434; --arc-y: -.901; --grid-col: 1; --grid-row: 0; }
#fabRecent { --arc-x: 0; --arc-y: -1; --grid-col: 0; --grid-row: 0; }
.read-fab.open .fab-item { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
@media (max-width: 860px) {
  .read-fab {
    --arc-radius: clamp(122px, calc((100dvh - var(--topbar-h) - var(--mb-h, 66px) - 76px) / 2), 168px);
    --fab-bottom: calc(var(--mb-h, 66px) + 16px + var(--arc-radius));
    right: 14px;
  }
  .fab-scrim { bottom: var(--mb-h, 72px); }
}
@media (max-height: 465px) {
  .read-fab { --fab-bottom: calc(var(--mb-h, 0px) + 12px); }
  .fab-item, #fabExport { right: calc(var(--grid-col) * 54px - 24px); bottom: calc(var(--grid-row) * 52px + 29px); }
  #fabExport { right: calc(var(--grid-col) * 54px - 29px); }
}

.reader-favorite-toggle { flex: 0 0 auto; }
#wiFavorite { width: 40px; min-width: 40px; padding: 0; }
.reader-favorite-toggle[aria-pressed="true"] { color: var(--accent); }
.reader-favorite-toggle[aria-pressed="true"] .line-icon { fill: currentColor; }
.favorites-tabs { display: flex; gap: 8px; padding: 0 16px 8px; }
.favorites-tabs .navbtn { min-height: 44px; }
.favorites-tabs [aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#favoritesTitle { margin: 0; }
#favoritesList { min-height: 136px; }
.reader-favorite-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
.reader-favorite-row .favorite-open { flex: 1; min-width: 0; min-height: 44px; text-align: start; overflow-wrap: anywhere; }
.reader-favorite-row .ghost { flex: 0 0 auto; min-height: 44px; }
@media (prefers-reduced-motion: reduce) {
  .fab-item, .fab-btn { transition: none; }
  .fab-item { transform: none; }
}

/* ================= STUDY-01B：学习事件本地缓存提示条 =================
 * 只在「容量闸门满载（停采集，继续上传）」与「释放后自动恢复」两种情况下出现，
 * 文案由 app.js 的 sdRenderNotice 写入（含未同步条数 / 学习日数 / 已暂停采集的说明）。
 * 三主题一律用语义令牌，夜读不刺眼；不遮挡顶栏与底栏。 */
.capbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--topbar-h) + 8px); z-index: 40;
  max-width: min(560px, calc(100vw - 24px));
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--warn); background: var(--paper); color: var(--fg);
  font-size: 13px; line-height: 1.6; text-align: left;
  box-shadow: var(--shadow);
}
.capbar.ok { border-color: var(--ok); }
.capbar strong { color: var(--warn); font-weight: 700; }
.capbar.ok strong { color: var(--ok); }

/* System tools use the existing sheet lifecycle and theme tokens. */
.system-layout { display: flex; flex-wrap: wrap; gap: 12px 20px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.system-layout label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
#systemClientReport { display: block; box-sizing: border-box; width: 100%; margin: 12px 0; padding: 10px; color: var(--fg); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font: 12px/1.6 monospace; }
#systemToolsModal .sheet-body p { font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }

/* 独立搜索，结果区滚动，标题与输入框始终可见。 */
#readingSearchModal .sheet { width: min(760px, 100%); max-width: 760px; height: min(760px, 88dvh); max-height: 88dvh; }
.reading-search-form { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.reading-search-query { display: flex; gap: 8px; }
.reading-search-query input { flex: 1; min-width: 0; padding: 10px; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
.reading-search-query button, #readingSearchMore { padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg); cursor: pointer; }
.reading-search-options { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 14px; }
.reading-search-options select { font-size: 16px; padding: 6px; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; }
.reading-search-hint, #readingSearchStatus { font-size: 13px; color: var(--muted); margin: 8px 0; }
.reading-search-result { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 14px 8px; text-align: left; background: transparent; color: var(--fg); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 16px; line-height: 1.6; }
.reading-search-result:hover { background: var(--tint); }
.reading-search-snippet { overflow-wrap: anywhere; }
.reading-search-snippet mark { background: #dbeafe; color: #1456a0; }
.search-translator { display: block; color: var(--muted); font-size: 12px; }
.search-pop .sp-item { flex-wrap: wrap; }
.search-pop .sp-item .search-translator { flex: 0 0 100%; order: 5; padding-left: 36px; }
@media (max-width: 860px) {
  #readingSearchModal { padding: 8px; }
  #readingSearchModal .sheet { height: 94dvh; max-height: 94dvh; }
}

.search-total { font-size: 12px; color: var(--muted); margin-left: auto; margin-right: 10px; }
#workBody mark.search-hit { font-weight: 700; color: inherit; background: rgba(245,195,68,.3); border-radius: 2px; }
#workBody mark.search-hit-current { background: rgba(238,174,35,.5); box-shadow: inset 0 -2px var(--accent); }
.search-hit-nav { position: fixed; right: 18px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 35; display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 6px; border: 1px solid rgba(145,116,78,.3); border-radius: 18px; background: rgba(255,251,237,.55); background: color-mix(in srgb, var(--panel) 55%, transparent); color: var(--fg); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.search-hit-nav button { border: 0; background: transparent; color: inherit; width: 38px; height: 36px; padding: 0; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.search-hit-nav button:disabled { opacity: .3; cursor: default; }
#searchHitCount { min-width: 54px; text-align: center; font-size: 14px; white-space: nowrap; }
body.drawer-open .search-hit-nav, body.panel-lock .search-hit-nav { visibility: hidden; pointer-events: none; }
@media (max-width: 860px) { .search-hit-nav { bottom: calc(var(--mb-h,66px) + 64px + env(safe-area-inset-bottom)); } }

.search-hit-nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: miter; }

#canonProgressOffer {
  position: fixed;
  z-index: 54;
  inset-inline: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  width: max-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
#canonProgressOffer .canon-progress-countdown {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#canonProgressOffer button { min-height: 44px; }

/* ---------- 备案信息条：贴底的极窄固定条（2026-11 备案上线） ----------
   规定：备案号必须在页面底部以文本形式出现并链接工信部备案系统。
   做成贴底固定条而不是文档流里的横栏，是为了不占正文版面的高度；
   手机端浮在固定底栏 #mobileBar 之上，body 相应补足 padding-bottom，避免遮住末行内容。 */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 33;
  padding: 3px 10px 4px;
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--paper) 97%, var(--bg));
  color: var(--fg-2);
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
  letter-spacing: .01em;
}
.site-footer .sf-inner { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: .5em; }
.site-footer .sf-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-footer .sf-link:hover,
.site-footer .sf-link:focus-visible { border-bottom-color: currentColor; }
.site-footer .sf-sep { color: var(--line); }
.site-footer .sf-copy { white-space: nowrap; }

body { padding-bottom: 24px; }

@media (max-width: 860px) {
  /* #mobileBar 实测高 61px（52 最小高 + 上下 4px 内边距 + 1px 上边框），备案条贴着它上沿，别留缝 */
  body { --mobile-bar-h: 61px; }
  .site-footer {
    bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom));
    padding: 2px 8px 3px;
    font-size: 10px;
    letter-spacing: 0;
  }
  body { padding-bottom: calc(var(--mobile-bar-h) + 24px + env(safe-area-inset-bottom)); }
}
