/* 配色只在这一处定义，其余全部引用变量——深色主题才只需要重写这一段。
   三种状态：显式选浅色 / 显式选深色 / 跟随系统（不打 data-theme）。
   深色写两遍是必须的：媒体查询管「跟随系统」，[data-theme] 管「手动选」，
   少任何一条，某个方向的切换就会失灵。 */
:root {
  --paper: #f7f4ec;
  --paper-deep: #f1ede1;
  --ink: #2b2b28;
  --ink-mid: #4a463c;
  --ink-soft: #6e6a5e;
  --accent: #8a5a2b;
  --accent-deep: #7a5330;
  --accent-soft: #efe4d3;
  --rule: #ddd6c4;
  --edge: #b9b09a;
  --edge-soft: #9a927e;
  --danger: #a1442f;
  --warn-bg: #f7e3dd; --warn-bd: #e5c6bd; --warn-fg: #8c3a26;
  --ok-bg: #e3ece0;   --ok-bd: #c8d9ca;   --ok-fg: #3f6047;
  --node-paper: #7d7869;
  --node-paper-on: #3c3a34;
  --overlay: rgba(43, 43, 40, 0.42);
  --shadow: 0 10px 40px rgba(43, 43, 40, 0.18);
  --hover: rgba(0, 0, 0, 0.028);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1815;
    --paper-deep: #232019;
    --ink: #e9e3d4;
    --ink-mid: #c2bba7;
    --ink-soft: #968f7e;
    --accent: #d3a166;
    --accent-deep: #e0b988;
    --accent-soft: #392f21;
    --rule: #3b372d;
    --edge: #5c5647;
    --edge-soft: #4a4538;
    --danger: #e0907a;
    --warn-bg: #3a2b22; --warn-bd: #5c4234; --warn-fg: #e8b8a2;
    --ok-bg: #24301f;   --ok-bd: #3d5138;   --ok-fg: #a8c9a8;
    --node-paper: #8a8371;
    --node-paper-on: #d2ccba;
    --overlay: rgba(0, 0, 0, 0.62);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --hover: rgba(255, 255, 255, 0.04);
  }
}
:root[data-theme="dark"] {
  --paper: #1a1815;
  --paper-deep: #232019;
  --ink: #e9e3d4;
  --ink-mid: #c2bba7;
  --ink-soft: #968f7e;
  --accent: #d3a166;
  --accent-deep: #e0b988;
  --accent-soft: #392f21;
  --rule: #3b372d;
  --edge: #5c5647;
  --edge-soft: #4a4538;
  --danger: #e0907a;
  --warn-bg: #3a2b22; --warn-bd: #5c4234; --warn-fg: #e8b8a2;
  --ok-bg: #24301f;   --ok-bd: #3d5138;   --ok-fg: #a8c9a8;
  --node-paper: #8a8371;
  --node-paper-on: #d2ccba;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --hover: rgba(255, 255, 255, 0.04);
}
html { background: var(--paper); color-scheme: light dark; }
/* 原生部分（滚动条、日期选择器）也要跟着手动选的主题走，不然深色页面上会冒出浅色滚动条 */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; }

/* 视图切换的进场动画。只在 route() 里给刚显示的那块加 class，
   不做退场——退场要等动画放完才能换内容，点快了就会看到上一页残影。
   --view-dx 由 route() 按标签顺序设：往右边的栏切就从右边滑进来，往左就从左边，
   子页面（确认入库、Issue 详情、后台的栏）不设，只轻轻上浮。 */
@keyframes view-in {
  from { opacity: 0; transform: translate(var(--view-dx, 0px), 6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes row-in  { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.view-anim { animation: view-in 0.24s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.row-anim  { animation: row-in 0.18s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  .view-anim, .row-anim { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
body {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
}
/* 兜底：没单独定型的链接会掉回浏览器默认的蓝色下划线，深色主题下尤其刺眼。
   各组件里更具体的规则照旧覆盖它。 */
a { color: var(--accent); }
/* 竖向 flex + 最小高度一屏：页脚由 margin-top:auto 推到最底下，内容短的页面它也不会浮在半空 */
.container { max-width: 1180px; margin: 0 auto; padding: 26px 30px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.container > * { flex: 0 0 auto; }
/* 不给正文设行长上限。之前按「英文一行别超过 74 字」收过，结果版心 1180px、
   段落只占左边 610px，右边空一大片——在这个宽度下，留白比长行更难看。 */
@media (max-width: 640px) { .container { padding: 16px 14px 48px; } }

/* ---------- 头部 ---------- */
header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
  margin-bottom: 0;
}
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-auth { font-size: 13px; color: var(--ink-soft); padding-top: 6px; text-align: right; }
.head-auth b { color: var(--ink); font-weight: 700; }
.head-auth .sub-act { margin-left: 10px; }
header h1 { font-size: 30px; font-weight: 700; letter-spacing: 2px; }
header p {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-style: italic;
}

/* ---------- 控制区 ---------- */
.controls {
  border-bottom: 1px solid var(--rule);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.controls-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* 各栏顶部的搜索框长一个样：论文、Wiki、帖子、后台都用这个类，别再按 id 各写一份 */
.search-box {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}
.search-box::placeholder { color: var(--ink-soft); }
.search-box:focus { outline: none; border-bottom-color: var(--accent); }
select {
  padding: 4px 6px;
  border: 1px solid var(--rule);
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}
/* 原生 select 由 core.enhanceSelect 藏起来、换成 .sel 按钮 + 浮层列表（下拉的样子才归我们管）。
   下面各处对 select 的定型都同时写给 .sel。 */
.sel-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sel {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 10px;
  border: 1px solid var(--rule); background: transparent; font: inherit; font-size: 13px;
  color: var(--ink); cursor: pointer; white-space: nowrap; max-width: 100%;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sel > span { overflow: hidden; text-overflow: ellipsis; }
.sel i { font-style: normal; font-size: 10px; color: var(--ink-soft); }
.sel:hover, .sel:focus-visible { border-color: var(--accent); outline: none; }
.sel:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.flist {
  position: fixed; z-index: 65; display: none; max-height: 264px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--rule); box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.5; max-width: min(420px, calc(100vw - 16px));
  animation: fade-only 0.1s ease-out both;
}
.flist-item { padding: 6px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.flist-item:hover, .flist-item.active { background: var(--accent-soft); color: var(--accent-deep); }
.flist-item.on { font-weight: 700; }
.flist-empty { padding: 6px 12px; color: var(--ink-soft); font-style: italic; }

/* 复选框：原生的是系统画的，换成和 .pick / .btn 一路的方块 */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 15px; height: 15px; margin: 0 6px 0 0;
  border: 1px solid var(--edge); border-radius: 3px; background: var(--paper); vertical-align: -3px;
  cursor: pointer; position: relative; flex: none; transition: background 0.12s, border-color 0.12s;
}
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
input[type=checkbox]:disabled { opacity: 0.4; cursor: default; }

/* ---------- 站内对话框（core.dialog）：确认 / 提示 / 输入 ---------- */
.dlg-mask {
  position: fixed; inset: 0; background: var(--overlay); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-only 0.14s ease-out both;
}
.dlg {
  background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--accent);
  box-shadow: var(--shadow); width: min(460px, 100%); padding: 18px 22px 16px;
  animation: pop-in 0.18s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.dlg-title { font-size: 16px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.dlg-body { font-size: 14px; line-height: 1.7; color: var(--ink-mid); white-space: pre-line; word-break: break-word; }
.dlg-body b { color: var(--ink); }
.dlg-code {
  display: inline-block; margin: 6px 0 2px; padding: 2px 9px; font-size: 14px; user-select: all;
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 3px; color: var(--ink);
}
.dlg-input {
  width: 100%; margin-top: 12px; padding: 6px 10px; font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: none; border-bottom: 1px solid var(--rule);
}
.dlg-input:focus { outline: none; border-bottom-color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.dlg-mask.closing { animation: fade-only 0.14s ease-in reverse both; pointer-events: none; }
.dlg-mask.closing .dlg { animation: pop-in 0.14s ease-in reverse both; }
@media (prefers-reduced-motion: reduce) { .dlg, .dlg-mask, .dlg-mask.closing, .dlg-mask.closing .dlg, .flist { animation: none; } }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
  font-size: 12.5px;
  padding: 1px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}
.tag-chip { transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.08s; }
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip:active { transform: scale(0.96); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.stats { font-size: 12.5px; color: var(--ink-soft); }
.stats span { color: var(--accent); font-weight: 600; }

/* ---------- 论文列表：arxiv 式密排 ---------- */
.paper-list { counter-reset: paper; }
.paper {
  padding: 16px 10px 14px;
  margin: 0 -10px;
  border-bottom: 1px solid var(--rule);
  counter-increment: paper;
  transition: background 0.15s;
}
.paper:hover { background: var(--hover); }
.paper::before {
  content: "[" counter(paper) "]";
  float: left;
  margin-right: 10px;
  margin-top: 3px;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.paper-body { overflow: hidden; }
/* 赞踩挂在条目右上角。float 而不是 flex：.paper 的序号本来就是 float 出来的，
   换成 flex 布局会把那个 counter 的位置一起搅乱。 */
.paper-side { float: right; margin: 2px 0 6px 14px; }
.feat-filter {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13.5px; color: var(--ink-mid); cursor: pointer; white-space: nowrap;
}
.vote { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.vote.busy { opacity: 0.5; pointer-events: none; }
.vote-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; font: inherit; font-size: 12.5px; line-height: 1.4;
  color: var(--ink-mid); background: var(--paper-deep);
  border: 1px solid var(--rule); border-radius: 3px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .12s, color .12s, border-color .12s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.on { border-color: var(--accent); color: var(--accent); background: var(--paper); font-weight: 700; }
.vote-btn.down.on { border-color: var(--warn-bd); color: var(--warn-fg); background: var(--warn-bg); }
.feat-badge {
  display: inline-block; margin-right: 6px; padding: 0 6px;
  font-size: 11.5px; font-weight: 700; vertical-align: 2px;
  color: var(--ok-fg); background: var(--ok-bg); border: 1px solid var(--ok-bd); border-radius: 3px;
}
.paper-title { font-size: 16.5px; font-weight: 700; line-height: 1.5; }
.paper-title a { color: var(--ink); text-decoration: none; }
.paper-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.paper-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.paper-meta .sep { margin: 0 8px; color: var(--rule); }
.paper-tag {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  margin-right: 8px;
}
.paper-tag::before { content: "#"; opacity: 0.6; }
.paper-tag:hover { text-decoration: underline; text-underline-offset: 2px; }
.paper-note {
  font-size: 14px;
  color: var(--ink-mid);
  margin-top: 6px;
  text-align: justify;
}
/* 解读 / 定义现在按 Markdown 渲染：段落间距压小，字号跟着所在区块，不套评论区那套小一号 */
.paper-note.md p, .entry-lede .md p, .ent-sum .md p { margin: 0 0 4px; }
.entry-lede .md { font-size: inherit; }
.ent-sum .md { display: inline; }
.ent-sum .md p { display: inline; }
.ent-sum .md ul, .ent-sum .md ol { margin: 2px 0 2px 0; }

/* ---------- ⓘ 悬浮提示 ---------- */
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin: 0 2px; vertical-align: 1px;
  border: 1px solid var(--edge); border-radius: 50%; color: var(--ink-soft);
  font-size: 10px; font-style: italic; font-family: Georgia, serif; line-height: 1;
  cursor: help; user-select: none; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tip i { font-style: italic; }
.tip:hover, .tip:focus { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); outline: none; }
h3 .tip, .entry-title .tip { font-weight: 400; }
.tip-box {
  position: fixed; z-index: 70; display: none;
  width: max-content; max-width: min(340px, calc(100vw - 16px));
  padding: 8px 11px; font-size: 12.5px; line-height: 1.6; font-weight: 400; text-align: left;
  color: var(--ink-mid); background: var(--paper); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); box-shadow: var(--shadow); pointer-events: none;
  animation: fade-only 0.12s ease-out both;
}
.tip-box b { color: var(--ink); }
.tip-box code { background: var(--paper-deep); padding: 0 4px; border-radius: 2px; font-size: 12px; }

/* ---------- 文件选择：藏掉原生控件，按钮 + 文件名 ---------- */
.file-pick { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-pick .btn { padding: 4px 14px; }
.file-pick:focus-within .btn { box-shadow: 0 0 0 2px var(--accent-soft); }
.file-name { font-size: 13px; color: var(--ink-mid); word-break: break-all; }
.file-name.none { color: var(--ink-soft); font-style: italic; }
.file-clear { color: var(--ink-soft); cursor: pointer; font-size: 14px; line-height: 1; }
.file-clear:hover { color: var(--danger); }
.att-list { list-style: none; font-size: 13px; }
.att-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--rule); }
.att-list li:last-child { border-bottom: none; }
.att-list a { color: var(--accent); text-decoration: none; cursor: pointer; }
.att-list a:hover { text-decoration: underline; }
.att-size { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.att-kind {
  display: inline-block; min-width: 38px; text-align: center; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; padding: 0 5px; border-radius: 2px;
  color: var(--accent-deep); background: var(--accent-soft); border: 1px solid var(--rule);
}
.att-list .drop { color: var(--danger); cursor: pointer; margin-left: auto; font-size: 12.5px; }
.att-list .drop:hover { text-decoration: underline; }

.empty { text-align: center; color: var(--ink-soft); padding: 64px 0; font-style: italic; }

/* ---------- 视图切换 ---------- */
.view-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule); align-items: center; position: relative; }
/* 当前栏的下划线是一条会滑动的指示条，位置由 placeTabInk() 量出来；
   没量过（脚本没跑、或减少动态）时退回按钮自己的 border-bottom。 */
.tab-ink {
  position: absolute; bottom: -1px; height: 2px; background: var(--accent);
  left: 0; width: 0; opacity: 0; pointer-events: none;
  transition: left 0.28s cubic-bezier(0.2, 0.7, 0.3, 1), width 0.28s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.15s;
}
.view-tabs.inked .tab-ink { opacity: 1; }
.view-tabs.inked .view-tab.active { border-bottom-color: transparent; }
.view-tabs .spacer { flex: 1 1 auto; }
.view-tab.side { font-size: 13.5px; }
.icon-btn {
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  width: 30px; height: 30px; cursor: pointer; color: var(--ink-soft);
  font-family: inherit; font-size: 14px; line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.view-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 2px;
  cursor: pointer;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.view-tab { transition: color 0.15s, border-color 0.2s, transform 0.08s; }
.view-tab:hover { color: var(--accent); }
.view-tab:active { transform: translateY(1px); }
.view-tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

/* ---------- 概念视图 ---------- */
.concept {
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--rule);
}
.concept-head { cursor: pointer; }
.concept-name { font-size: 16px; font-weight: 700; }
a.concept-name { color: var(--ink); text-decoration: none; }
a.concept-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.concept-name .en { font-weight: 400; font-size: 13px; color: var(--ink-soft); margin-left: 8px; }
.concept-count {
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 8px;
}
.concept-summary { font-size: 14px; color: var(--ink-mid); margin-top: 4px; }
.concept-detail { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--rule); }
.concept-papers { list-style: none; font-size: 14px; }
.concept-papers li { margin: 4px 0; }
.concept-papers a { color: var(--ink); text-decoration: none; }
.concept-papers a:hover { color: var(--accent); text-decoration: underline; }
.concept-related { font-size: 13px; margin-top: 10px; color: var(--ink-soft); }
.concept-related a { color: var(--accent); text-decoration: none; cursor: pointer; }
.concept-related a:hover { text-decoration: underline; }
.rel-list { list-style: none; }
.rel-list li { margin: 6px 0; }
.rel-type {
  display: inline-block;
  font-size: 11.5px;
  padding: 0 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.rel-why { font-size: 12.5px; color: var(--ink-mid); margin: 2px 0 0 4px; padding-left: 8px; border-left: 2px solid var(--rule); }
.concept-wiki-link { font-size: 12.5px; margin-left: 10px; color: var(--ink-soft); text-decoration: none; }
.concept-wiki-link:hover { color: var(--accent); text-decoration: underline; }
.paper-concept {
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  margin-right: 8px;
}
.paper-concept::before { content: "◇ "; opacity: 0.6; }
.paper-concept:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 概念图 ---------- */
.graph-panel { border-bottom: 1px solid var(--rule); padding: 12px 0 8px; }
.graph-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.graph-bar label { cursor: pointer; user-select: none; }
.graph-bar input[type=checkbox] { vertical-align: -1px; margin-right: 4px; accent-color: var(--accent); }
.graph-bar select, .graph-bar .sel { margin-left: 4px; font-size: 12.5px; }
.graph-hint { margin-left: auto; font-style: italic; opacity: 0.8; }
.graph-stage { position: relative; }

/* ---------- 图例 ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding: 12px 2px 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.legend-block { display: flex; flex-direction: column; gap: 4px; }
.legend-title { font-weight: 700; color: var(--ink); }
.legend-row { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.legend-line { display: inline-block; width: 26px; height: 0; border-top: 1.5px solid var(--edge-soft); flex: none; }
.legend-line.dashed { border-top-style: dashed; }
.legend-dots { display: flex; align-items: center; gap: 5px; }
.legend-dots i { display: inline-block; border-radius: 50%; background: var(--ink-soft); flex: none; }

/* ---------- 词条页头部的小件（概念簇色点、别名、英文名） ---------- */
.popup-en { font-size: 12.5px; color: var(--ink-soft); font-style: italic; }
.popup-cluster { display: inline-flex; align-items: center; gap: 4px; }
.popup-cluster i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.popup-alias { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.popup-alias code { background: var(--paper-deep); padding: 0 4px; border-radius: 3px; font-size: 11.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- Wiki 栏 ---------- */
.wiki-bar { padding: 16px 0 12px; border-bottom: 1px solid var(--rule); }
.wiki-cluster-head {
  margin: 22px 0 2px;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}
.wiki-cluster-head i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.concept-hier { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.concept-hier b { color: var(--ink); font-weight: 700; }
.concept-hier a { color: var(--accent); text-decoration: none; cursor: pointer; }
.concept-hier a:hover { text-decoration: underline; }
#concept-graph {
  width: 100%;
  height: 520px;
  display: block;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  touch-action: none;
  cursor: grab;
}
#concept-graph.dragging { cursor: grabbing; }
#concept-graph .edge { stroke: var(--edge); fill: none; }
#concept-graph .edge.cooc { stroke-dasharray: 3 3; }
#concept-graph .node circle {
  stroke: var(--paper);
  stroke-width: 1.5;
  cursor: pointer;
  transition: opacity 0.15s;
}
#concept-graph .node text {
  font-family: inherit;
  font-size: 11.5px;
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--paper-deep);
  stroke-width: 3;
  stroke-linejoin: round;
  transition: opacity 0.15s;
}
#concept-graph .node.dim circle,
#concept-graph .node.dim text { opacity: 0.18; }
#concept-graph .edge.dim { opacity: 0.12; }
#concept-graph .edge.hot { stroke: var(--accent); stroke-width: 1.8; }
#concept-graph .node:hover circle { stroke: var(--accent); stroke-width: 3; }

/* ---------- 词条页：文章 wiki 与知识 wiki 共用 ---------- */
.crumbs { font-size: 12.5px; color: var(--ink-soft); padding: 15px 0 12px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.entry-title { font-size: 25px; font-weight: 700; line-height: 1.35; }
.entry-en { font-size: 15px; color: var(--ink-soft); font-style: italic; margin-top: 2px; }
.entry-meta { font-size: 13px; color: var(--ink-soft); margin-top: 9px; display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; }
.entry-meta .sep { color: var(--rule); }
.entry-lede {
  font-size: 15px; color: var(--ink); margin-top: 15px; padding: 11px 14px;
  background: var(--paper-deep); border-left: 3px solid var(--accent); text-align: justify;
}
.entry-lede b { display: block; font-size: 11.5px; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 3px; }
.entry-sec { margin-top: 26px; }
.entry-sec > h3 { font-size: 15px; border-bottom: 1px solid var(--ink); padding-bottom: 4px; margin-bottom: 10px; }
.entry-sec > h3 span { font-size: 12px; color: var(--ink-soft); font-weight: 400; font-style: italic; margin-left: 8px; }
.abs { font-size: 14px; color: var(--ink-mid); text-align: justify; line-height: 1.75; }
.abs.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.abs-toggle { font-size: 12.5px; color: var(--accent); cursor: pointer; margin-top: 5px; display: inline-block; }
.abs-toggle:hover { text-decoration: underline; }
.ent-list { list-style: none; }
.ent-list > li { padding: 11px 0; border-bottom: 1px solid var(--rule); }
.ent-list > li:last-child { border-bottom: none; }
/* 继承 .form-row textarea 的观感，但那条规则的 flex/min-width 在这里不是 flex 项，撑不开也收不住 */
.ent-notes textarea { width: 100%; min-width: 0; min-height: 44px; margin-top: 5px; }
.entry-sec + .entry-sec { border-top: 1px solid var(--rule); padding-top: 4px; }
.crumb { font-size: 14px; }
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb b { color: var(--ink); }
.crumb-sep { color: var(--ink-soft); margin: 0 5px; opacity: 0.65; }
.ent-sum { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.ent-sum i { opacity: 0.75; }
.kin-title { font-size: 14.5px; font-weight: 700; }
.kin-title a { color: var(--ink); text-decoration: none; }
.kin-title a:hover { color: var(--accent); text-decoration: underline; }
.extlinks { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; }
.extlinks a { color: var(--accent); text-decoration: none; }
.extlinks a:hover { text-decoration: underline; }
.extlinks .none { color: var(--ink-soft); font-style: italic; font-size: 12.5px; }
.paper-src { font-size: 12px; color: var(--ink-soft); text-decoration: none; }
.paper-src:hover { color: var(--accent); text-decoration: underline; }

.mini-graph {
  width: 100%; height: 330px; display: block;
  background: var(--paper-deep); border: 1px solid var(--rule);
}
.mini-graph .edge { stroke: var(--edge); fill: none; }
.mini-graph .edge.kin { stroke-dasharray: 2 3; }
.mini-graph .edge.related { stroke: var(--accent); }
.mini-graph .node { cursor: pointer; }
.mini-graph .node circle, .mini-graph .node rect { stroke: var(--paper); stroke-width: 1.5; }
.mini-graph .node.is-center circle, .mini-graph .node.is-center rect { stroke: var(--ink); stroke-width: 2.5; }
.mini-graph .node:hover circle, .mini-graph .node:hover rect { stroke: var(--accent); stroke-width: 2.5; }
.mini-graph .node text {
  font-family: inherit; font-size: 11px; fill: var(--ink); text-anchor: middle;
  pointer-events: none; paint-order: stroke;
  stroke: var(--paper-deep); stroke-width: 3; stroke-linejoin: round;
}

/* ---------- 投稿与审核 ---------- */
.stats-bar {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
  font-size: 12.5px; color: var(--ink-soft);
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.stats-bar b { color: var(--accent); font-size: 14px; }
.stats-bar .grow { flex: 1 1 auto; }
.stats-bar a { color: var(--accent); text-decoration: none; }
.stats-bar a:hover { text-decoration: underline; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.form-row > label { flex: 0 0 108px; font-size: 13px; color: var(--ink-soft); }
/* 复选框自己就是个 label，不放开就会被上面那条 108px 挤成三行 */
.form-row > label.agree { flex: 1 1 auto; font-size: 13.5px; color: var(--ink); }
.form-row > label i { color: var(--accent); font-style: normal; }
.form-row input[type=url], .form-row input[type=text], .form-row input[type=password],
.form-row input[type=date] {
  flex: 1; min-width: 240px; padding: 6px 10px; font-family: inherit; font-size: 14px;
  color: var(--ink); background: transparent; border: none; border-bottom: 1px solid var(--rule);
}
.form-row input[type=file] { font: inherit; font-size: 13px; max-width: 100%; }
.form-row input:focus, .form-row textarea:focus { outline: none; border-bottom-color: var(--accent); }
.form-row textarea {
  flex: 1; min-width: 260px; padding: 7px 10px; font-family: inherit; font-size: 13.5px;
  line-height: 1.7; color: var(--ink); background: var(--paper-deep);
  border: 1px solid var(--rule); resize: vertical;
}
.form-row .chip-row { flex: 1; min-width: 260px; }
.btn {
  font-family: inherit; font-size: 13.5px; padding: 5px 18px; cursor: pointer;
  color: var(--paper); background: var(--accent); border: 1px solid var(--accent);
}
.btn { transition: opacity 0.15s, transform 0.08s, box-shadow 0.15s; }
.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.btn.ghost { color: var(--accent); background: transparent; }
.form-msg { font-size: 12.5px; color: var(--ink-soft); }
.agree input { margin-right: 6px; vertical-align: -1px; accent-color: var(--accent); }
.form-msg.bad { color: var(--danger); }
.pick {
  font-size: 12.5px; padding: 1px 10px; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink-soft); cursor: pointer; user-select: none; background: transparent;
}
.pick { transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.08s; }
.pick:hover { border-color: var(--accent); color: var(--accent); }
.pick:active { transform: scale(0.96); }
.pick.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.sub-state { color: var(--accent); }
.sub-state.s-failed, .sub-state.s-rejected { color: var(--danger); }
.sub-state.s-archived { color: var(--ok-fg); }
.sub-act { color: var(--accent); cursor: pointer; margin-left: 10px; text-decoration: none; }
.sub-act:hover { text-decoration: underline; }
.sub-err { font-size: 12px; color: var(--danger); margin-top: 3px; white-space: pre-wrap; }
.err-detail { margin-top: 4px; }
.err-detail summary { cursor: pointer; font-size: 11px; opacity: 0.7; }
.err-detail pre { margin: 4px 0 0; font-size: 11px; white-space: pre-wrap; opacity: 0.8;
  max-height: 220px; overflow: auto; }
.rv-warn {
  font-size: 12.5px; color: var(--accent-deep); background: var(--accent-soft);
  border-left: 3px solid var(--accent); padding: 8px 12px; margin: 10px 0;
}

/* ---------- 翻页 ---------- */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 20px 0 4px; font-size: 13px; color: var(--ink-soft);
}
.pager button {
  font-family: inherit; font-size: 13px; min-width: 30px; padding: 3px 9px;
  border: 1px solid var(--rule); background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pager button:hover:not(:disabled):not(.on) { border-color: var(--accent); color: var(--accent); }
.pager button.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.pager button:disabled { opacity: 0.32; cursor: default; }
.pager .gap { padding: 0 3px; opacity: 0.6; }
.pager .of { margin-left: 8px; }

/* ---------- Wiki 层级树 ---------- */
.tree-kids { margin-left: 9px; padding-left: 15px; border-left: 1px solid var(--rule); }
.tree-item { padding: 9px 0 8px; border-bottom: 1px dotted var(--rule); }
.tree-item:last-child { border-bottom: none; }
/* 顶层实体之间要有明确的分界，否则一串概念糊成一片，看不出哪些是同一棵树。
   用和论文列表同一根实线，两处的节奏才对得上。 */
.tree-root { margin-top: 4px; padding: 14px 0 12px; border-bottom: 1px solid var(--rule); }
.tree-root:first-child { padding-top: 6px; }
.tree-root:last-child { border-bottom: none; }
.tree-root > .tree-item { padding-top: 0; border-bottom: none; }
.tree-root > .tree-item > .tree-name { font-size: 16.5px; }
.tree-item .concept-summary { margin-top: 2px; font-size: 13px; }
.tree-name { font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; }
.tree-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tree-name .en { font-weight: 400; font-size: 12.5px; color: var(--ink-soft); margin-left: 7px; }
.tree-rel { font-size: 11.5px; color: var(--ink-soft); margin-left: 7px; opacity: 0.85; }
.tree-echo { font-size: 11.5px; color: var(--ink-soft); font-style: italic; }

/* ---------- 管理列表：搜索 + 行内展开编辑 ---------- */
.mgr-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0 10px; }
.mgr-bar input[type=text], .mgr-bar select, .mgr-bar .sel {
  padding: 5px 9px; font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: transparent; border: 1px solid var(--rule);
}
.mgr-bar input[type=text] { flex: 1; min-width: 190px; border-width: 0 0 1px; }
.mgr-bar input[type=text]:focus { outline: none; border-bottom-color: var(--accent); }
.mgr-count { font-size: 12.5px; color: var(--ink-soft); margin-left: auto; }
.mgr-row { border-bottom: 1px solid var(--rule); }
.mgr-head {
  display: flex; gap: 10px; align-items: baseline; padding: 10px 8px; margin: 0 -8px;
  cursor: pointer; transition: background 0.15s;
}
.mgr-head:hover { background: var(--hover); }
.mgr-head:hover .mgr-name, .mgr-row.open .mgr-name { color: var(--accent); }
.mgr-name { font-size: 14.5px; font-weight: 700; flex: 1; min-width: 0; transition: color 0.15s; }
.mgr-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; font-weight: 400; }
.mgr-side { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.mgr-caret { color: var(--ink-soft); font-size: 12px; white-space: nowrap; opacity: 0.55; transition: opacity 0.15s, color 0.15s; }
.mgr-head:hover .mgr-caret { opacity: 1; color: var(--accent); }
.mgr-edit { padding: 2px 0 20px; animation: view-in 0.18s ease-out both; }
.badge {
  display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--accent-soft); color: var(--accent-deep);
}
.badge.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.badge.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.rel-edit {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start;
  margin: 7px 0; padding: 9px 11px; background: var(--paper-deep); border: 1px solid var(--rule);
}
.rel-edit select, .rel-edit .sel, .rel-edit input[type=text] {
  font-family: inherit; font-size: 13px; padding: 3px 7px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.rel-edit textarea {
  flex: 1 1 100%; min-height: 46px; font-family: inherit; font-size: 13px; line-height: 1.6;
  padding: 6px 8px; border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); resize: vertical;
}
.rel-edit .drop { color: var(--danger); cursor: pointer; font-size: 12.5px; margin-left: auto; }
.rel-edit .drop:hover { text-decoration: underline; }
.card {
  border: 1px solid var(--rule); background: var(--paper-deep);
  padding: 14px 16px 4px; margin: 12px 0;
}
.card > h4 { font-size: 14px; margin-bottom: 2px; }
.card > .ent-sum { margin-bottom: 8px; }
/* MCP 接入命令：长得一定会超出一行，让它自己横向滚，别把整页撑宽 */
.mcp-cmd {
  background: var(--paper); border: 1px solid var(--rule); padding: 9px 11px;
  overflow-x: auto; margin: 4px 0 10px; font-size: 12px; line-height: 1.65;
  white-space: pre; user-select: all;
}
#mcp-plain { font-size: 12px; word-break: break-all; }
.sticky-save {
  position: sticky; bottom: 0; z-index: 2; background: var(--paper);
  border-top: 1px solid var(--rule); padding: 10px 0; margin-top: 10px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
/* 表单里的链接没有专门的类，不兜一下就会掉回浏览器默认的蓝色下划线，
   整页配色立刻破功 */
.ent-sum a, .mgr-edit a, .card a { color: var(--accent); text-decoration: none; }
.ent-sum a:hover, .mgr-edit a:hover, .card a:hover { text-decoration: underline; }
.mgr-edit .crumbline { display: block; margin-top: 3px; }

/* ---------- 弹层：后台的编辑器开在上面，而不是把列表撑开 ---------- */
/* 滚动条挂在 .modal-body 上，不是整个遮罩。表头因此是真正固定的——
   用 position:sticky 会受遮罩 padding 与 auto margin 的影响，
   滚起来正文第一行会从表头上方露出来。 */
.modal-mask {
  position: fixed; inset: 0; background: var(--overlay); z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 20px; overflow: hidden;
  animation: fade-only 0.16s ease-out both;
}
@keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal {
  background: var(--paper); border: 1px solid var(--rule); box-shadow: var(--shadow);
  width: min(980px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  animation: pop-in 0.2s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.modal-head {
  flex: 0 0 auto; background: var(--paper);
  border-bottom: 1px solid var(--ink); padding: 16px 22px 12px;
  display: flex; align-items: baseline; gap: 12px;
}
.modal-title { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; line-height: 1.4; }
.modal-title .sub { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 400; margin-top: 3px; }
.modal-close {
  background: none; border: none; font-family: inherit; font-size: 20px; line-height: 1;
  color: var(--ink-soft); cursor: pointer; padding: 0 2px; transition: color 0.15s;
}
.modal-close:hover { color: var(--accent); }
.modal-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 22px 18px; }
/* 关闭：把进场动画倒放一遍。closing 期间不响应点击，免得关到一半又点开一层。 */
.modal-mask.closing { animation: fade-only 0.14s ease-in reverse both; pointer-events: none; }
.modal-mask.closing .modal { animation: pop-in 0.16s ease-in reverse both; }
@media (prefers-reduced-motion: reduce) { .modal, .modal-mask, .modal-mask.closing, .modal-mask.closing .modal { animation: none; } }

/* ---------- ⑥ 进度与气泡提示 ---------- */
.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px));
}
@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.toast {
  background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow); padding: 10px 12px; font-size: 13px; color: var(--ink);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.out { opacity: 0; transform: translateX(18px); }
.toast.bad { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok-fg); }
.toast b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.toast .muted { color: var(--ink-soft); font-size: 12px; }
.toast a { color: var(--accent); cursor: pointer; text-decoration: none; }
.toast a:hover { text-decoration: underline; }
.toast-close {
  float: right; background: none; border: none; color: var(--ink-soft);
  cursor: pointer; font-size: 15px; line-height: 1; font-family: inherit;
}
.prog {
  height: 3px; background: var(--rule); margin-top: 8px; overflow: hidden;
}
.prog > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.4s ease; }
.prog.pulse > i {
  width: 40% !important; animation: prog-slide 1.1s ease-in-out infinite;
}
@keyframes prog-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.task-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-soft);
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  background: var(--paper-deep); padding: 9px 12px; margin: 12px 0;
}
.task-bar .grow { flex: 1 1 200px; }

/* ---------- ② 概念网络的筛选面板 ---------- */
.gf-panel {
  border: 1px solid var(--rule); background: var(--paper-deep);
  padding: 10px 12px; margin-bottom: 10px; font-size: 12.5px;
}
.gf-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 5px 0; }
.gf-row > b { font-size: 12px; color: var(--ink-soft); font-weight: 400; flex: 0 0 62px; }
.gf-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.gf-panel input[type=text] {
  flex: 1; min-width: 160px; padding: 4px 8px; font-family: inherit; font-size: 13px;
  border: none; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink);
}
.gf-panel input[type=text]:focus { outline: none; border-bottom-color: var(--accent); }

/* ---------- 大模型的提议 ---------- */
.prop {
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  background: var(--paper-deep); padding: 9px 12px; margin: 6px 0;
}
.prop-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.prop-head b { font-size: 14px; }
.prop-head code { font-size: 12px; }
.prop-head .grow { flex: 1; }
.prop-why { font-size: 12.5px; color: var(--ink-mid); margin-top: 3px; }
.prop-def { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.prop .btn { padding: 2px 12px; font-size: 12.5px; }

/* ---------- 词条弹层的工具条与评论 ---------- */
.entry-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entry-tools .btn { padding: 3px 12px; font-size: 12.5px; }
.cmt { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.cmt:last-child { border-bottom: none; }
.cmt-head { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 8px; align-items: baseline; }
.cmt-head b { color: var(--ink); font-size: 13.5px; font-weight: 700; }
.cmt-head .grow { flex: 1; }
/* 正文现在是渲染好的 HTML，不能再 pre-wrap——那会把标签之间的换行也画出来 */
.cmt-body { font-size: 14px; line-height: 1.75; margin-top: 4px; word-break: break-word; }

/* Markdown 渲染结果。刻意压得比正文小一号：这是评论区，
   一条留言里的 # 标题不该比页面自己的标题还抢眼。 */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md h4, .md h5, .md h6 { margin: 12px 0 5px; line-height: 1.45; font-weight: 700; }
.md h4 { font-size: 15px; }
.md h5 { font-size: 14px; }
.md h6 { font-size: 13.5px; color: var(--ink-mid); }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code {
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 2px;
  padding: 0 4px; font-size: 12.5px; word-break: break-all;
}
.md pre {
  background: var(--paper-deep); border: 1px solid var(--rule);
  padding: 9px 11px; margin: 8px 0; overflow-x: auto; font-size: 12.5px; line-height: 1.6;
}
.md pre code { background: none; border: none; padding: 0; word-break: normal; }
.md blockquote {
  border-left: 3px solid var(--rule); margin: 8px 0; padding: 2px 0 2px 11px;
  color: var(--ink-mid);
}
.md hr { border: none; border-top: 1px solid var(--rule); margin: 12px 0; }
.md-tablewrap { overflow-x: auto; margin: 8px 0; }
.md table { border-collapse: collapse; font-size: 13px; }
.md th, .md td { border: 1px solid var(--rule); padding: 4px 9px; text-align: left; }
.md th { background: var(--paper-deep); font-weight: 700; }
/* 公式不排版，只标出来。真排版要 KaTeX，那就不再是零依赖的单文件了 */
.md-math { color: var(--accent); font-style: normal; }
.md-tabs { display: flex; gap: 12px; align-items: baseline; margin-bottom: 6px; font-size: 12.5px; }
.md-tabs .grow { flex: 1; }
.md-tab {
  cursor: pointer; color: var(--ink-soft); padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}
.md-tab:hover { color: var(--accent); }
.md-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.md-hint { color: var(--ink-soft); font-size: 11.5px; font-style: normal; }
.char-count {
  font-size: 11.5px; color: var(--ink-soft); text-align: right;
  margin-top: 3px; font-variant-numeric: tabular-nums;
}
.char-count.warn { color: var(--accent); }
.char-count.over { color: var(--warn-fg); font-weight: 700; }
textarea.over, input.over { border-color: var(--warn-bd) !important; }
.md-preview {
  min-height: 76px; padding: 8px 10px; font-size: 13.5px;
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 3px;
}
/* form-row 是 flex，textarea 那条规则靠 flex:1 撑开；套一层之后要自己接住 */
.md-field { flex: 1; min-width: 240px; }
.md-field textarea { width: 100%; min-width: 0; }
.cmt-empty { font-size: 13px; color: var(--ink-soft); padding: 10px 0; font-style: italic; }
.cmt-form textarea {
  width: 100%; min-height: 76px; padding: 8px 10px; font-family: inherit; font-size: 13.5px;
  line-height: 1.7; color: var(--ink); background: var(--paper-deep);
  border: 1px solid var(--rule); resize: vertical;
}
.cmt-form textarea:focus { outline: none; border-color: var(--accent); }
.hist-list { list-style: none; font-size: 13px; }
.hist-list li { padding: 7px 0; border-bottom: 1px dotted var(--rule); }
.hist-list li:last-child { border-bottom: none; }
.hist-list code { font-size: 12px; color: var(--accent); }

/* ---------- 使用手册 ---------- */
.manual-wrap { display: flex; gap: 30px; align-items: flex-start; }
.manual-toc {
  flex: 0 0 190px; position: sticky; top: 16px; max-height: 88vh; overflow-y: auto;
  font-size: 12.5px; border-left: 1px solid var(--rule); padding-left: 12px;
}
.manual-toc a { display: block; color: var(--ink-soft); text-decoration: none; padding: 2px 0; }
.manual-toc a:hover { color: var(--accent); }
.manual-toc a.lv3 { padding-left: 12px; font-size: 12px; opacity: 0.85; }
.manual-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.8; }
.manual-body h1 { font-size: 24px; margin: 4px 0 10px; }
.manual-body h2 { font-size: 18px; margin: 30px 0 10px; border-bottom: 1px solid var(--ink); padding-bottom: 5px; }
.manual-body h3 { font-size: 15px; margin: 22px 0 8px; color: var(--accent); }
.manual-body h4 { font-size: 14px; margin: 16px 0 6px; }
.manual-body p { margin: 9px 0; text-align: justify; }
.manual-body ul, .manual-body ol { margin: 8px 0 8px 22px; }
.manual-body li { margin: 4px 0; }
.manual-body code { background: var(--paper-deep); padding: 0 4px; font-size: 12.5px; border-radius: 2px; }
.manual-body pre {
  background: var(--paper-deep); border: 1px solid var(--rule); padding: 11px 13px;
  overflow-x: auto; margin: 11px 0; font-size: 12.5px; line-height: 1.6;
}
.manual-body pre code { background: none; padding: 0; }
.manual-body blockquote {
  border-left: 3px solid var(--accent); background: var(--paper-deep);
  padding: 8px 13px; margin: 11px 0; color: var(--ink-mid); font-size: 13.5px;
}
.manual-body .tablewrap { overflow-x: auto; margin: 12px 0; }
.manual-body table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.manual-body th, .manual-body td {
  border: 1px solid var(--rule); padding: 5px 9px; text-align: left; vertical-align: top;
}
.manual-body th { background: var(--paper-deep); font-weight: 700; white-space: nowrap; }
.manual-body a { color: var(--accent); }
.manual-body hr { border: none; border-top: 1px solid var(--rule); margin: 26px 0; }
@media (max-width: 700px) { .manual-toc { display: none; } }

footer {
  margin-top: auto;          /* 贴着页面底部，不跟着最后一个组件走（.container 是竖向 flex） */
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- 评论楼层 ---------- */
.cmt-replies { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--rule); }
.cmt-replies .cmt { padding: 8px 0; border-bottom: none; }
.cmt-floor { color: var(--ink-soft); font-weight: 400; font-size: 12px; }
.cmt-at { color: var(--accent); font-style: normal; }
.cmt-reply-form { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--accent-soft); }
.cmt-reply-form textarea {
  width: 100%; min-width: 0; min-height: 54px; padding: 7px 9px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  resize: vertical;
}
.cmt-reply-form textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- 后台：标签管理与重新推荐 ---------- */
.tagm-group { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--rule); background: var(--paper-deep); }
.tagm-group > b { display: block; font-size: 13px; margin-bottom: 6px; }
.tagm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tagm-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 1px 6px 1px 10px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink);
}
.tagm-chip.new { border-color: var(--ok-bd); background: var(--ok-bg); color: var(--ok-fg); }
.tagm-chip.renamed { border-color: var(--accent); }
.tagm-chip .n { font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tagm-chip i { font-style: normal; cursor: pointer; color: var(--ink-soft); padding: 0 2px; }
.tagm-chip i:hover { color: var(--accent); }
.tagm-chip i.x:hover { color: var(--danger); }
.tagm-chip input { font: inherit; font-size: 12.5px; width: 120px; border: none; border-bottom: 1px solid var(--accent); background: transparent; color: var(--ink); }
.tagm-chip input:focus { outline: none; }
.tagm-add { font-size: 12.5px; padding: 2px 10px; }
.tagm-diff { font-size: 12.5px; color: var(--ink-mid); margin: 8px 0; }
.tagm-diff del { color: var(--danger); }
.tagm-diff ins { color: var(--ok-fg); text-decoration: none; }
.retag-row { display: grid; grid-template-columns: 22px 1fr; gap: 6px 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.retag-row:last-child { border-bottom: none; }
.retag-row input[type=checkbox] { margin-top: 5px; accent-color: var(--accent); }
.retag-row .why { font-size: 12.5px; color: var(--ink-soft); }
.retag-row .same { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.retag-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 12.5px; margin-top: 3px; }
.retag-tags .arrow { color: var(--ink-soft); margin: 0 4px; }

/* ---------- Issue ---------- */
.iss-row { display: flex; gap: 10px; align-items: baseline; }
.iss-row .grow { flex: 1; }
.iss-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.iss-kind {
  font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 999px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
}
.iss-kind.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.iss-body { font-size: 14px; line-height: 1.75; word-break: break-word; }

/* ---------- 右下角问答气泡 ---------- */
/* 在词条弹层遮罩（40）之上、toast（60）之下：弹层开着也能问，但报错还是压在最上面 */
/* hidden 属性等于 display:none，没法做过渡；用 visibility 才能淡出。
   visibility 的过渡延迟到动画跑完再生效，收起途中仍然可见、不会提前失焦。 */
.ask-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 45;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--accent);
  background: var(--accent); color: var(--paper);
  display: flex; align-items: center; justify-content: center; padding: 0;
  cursor: pointer; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
  opacity: 0; visibility: hidden; transform: scale(0.8);
  transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1),
              box-shadow 0.15s, visibility 0s 0.18s;
}
.ask-fab.on {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.15s;
}
.ask-fab.on:hover { transform: translateY(-2px); box-shadow: 0 5px 18px rgba(0, 0, 0, 0.28); }
.ask-fab.on:active { transform: translateY(0) scale(0.94); }
.ask-fab svg { width: 21px; height: 21px; display: block; }
.ask-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 46;
  width: min(390px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 8px 34px rgba(0, 0, 0, 0.26);
}
.ask-panel {
  /* 从右下角长出来，和气泡是同一个位置，看起来就是气泡展开成了面板 */
  transform-origin: 100% 100%;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1),
              visibility 0s 0.2s;
}
.ask-panel.on {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .ask-fab, .ask-fab.on, .ask-panel, .ask-panel.on { transition: none; transform: none; }
}
.ask-head {
  display: flex; gap: 8px; align-items: baseline;
  padding: 11px 12px; border-bottom: 1px solid var(--rule);
}
.ask-head b { font-size: 14px; }
.ask-head span { font-size: 12px; color: var(--ink-soft); flex: 1; }
.ask-head .icon-btn { width: 24px; height: 24px; line-height: 1; padding: 0; }
.ask-log { flex: 1; overflow-y: auto; padding: 12px; font-size: 13.5px; line-height: 1.7; }
.ask-msg { margin-bottom: 12px; word-break: break-word; }
.ask-msg.me { text-align: right; }
.ask-msg.me span {
  display: inline-block; max-width: 85%; text-align: left; padding: 6px 10px;
  border-radius: 10px 10px 2px 10px; background: var(--accent-soft); color: var(--ink);
}
.ask-msg.ai { white-space: pre-wrap; }
.ask-msg.bad { color: var(--danger); }
.ask-hint { font-size: 12.5px; color: var(--ink-soft); font-style: italic; }
.ask-seed {
  display: block; margin-top: 6px; font-size: 12.5px; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.ask-seed:hover { text-decoration: underline; }
.ask-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rule); }
.ask-foot textarea {
  flex: 1; min-width: 0; max-height: 110px; padding: 7px 9px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  resize: none;
}
.ask-foot textarea:focus { outline: none; border-color: var(--accent); }
@media (max-width: 560px) { .ask-panel { right: 12px; left: 12px; width: auto; } }

/* 键盘能够到的非按钮元素：图里的节点、role=button 的链接和标签 */
#concept-graph .node:focus-visible circle,
.mini-graph .node:focus-visible circle,
.mini-graph .node:focus-visible rect { stroke: var(--accent); stroke-width: 3; }
.node:focus { outline: none; }
.paper-src[data-pdf] { cursor: pointer; }
.pick:focus-visible, .md-tab:focus-visible, .sub-act:focus-visible,
.paper-tag:focus-visible, .paper-concept:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 1px; }
