/* 契约（改这个文件前先读这 6 行）
   1. 这个文件同时喂「工作台」和「生成站」，两端加载的是同一份；不要写只给某一端的样式。
   2. 加载顺序 shell.css → studio.css：同特异性时 studio.css 会赢。
      样式「看起来没生效」先查是不是被后加载的同名规则盖掉（本项目栽过两次，见踩坑清单 P2）。
   3. 块与块之间的垂直距离只有一个来源：--block-gap。所有块自身 margin 归零；
      新增块类型时写 margin-block: 0，不要自带上下 margin。
   4. 颜色 / 字号 / 间距一律用变量，变量由 studio.js#applyTypes() 和 build.mjs 同时写进 <html>，
      改一处必须改另一处（否则两端不一致）。
   5. 不许用 CSS 隐藏编辑端专属元素：阅读端是运行时 remove() 掉的（红线 10）。
   6. 构建期会按产物 JS/HTML 裁剪 CSS（css-purge.mjs）：动态类名必须能在产物里找到，注释说明挡不住裁剪。
*/
/* ---------------------------------------------------------------
   思源 → 静态站 · 阅读器外壳
   同一套气质：米白纸面、宋体、暗红点缀、大留白；
   内容块沿用思源的类名（.protyle-wysiwyg / .p / .h2 / .callout），
   所以以后可以直接把 XYS 主题的内容段贴进来。
   --------------------------------------------------------------- */

:root {
  --paper: #f2f2ef;
  --paper-hi: #fbfaf6;
  --paper-lo: #e9e8e2;
  --desk: #e3e2dc;
  --ink: #171717;
  --ink-2: #525252;
  --ink-3: #8b8b84;
  --line: rgba(23, 23, 23, .09);
  --line-soft: rgba(23, 23, 23, .055);
  --accent: #7a0a0a;
  --accent-2: #a33a2a;
  --accent-soft: rgba(122, 10, 10, .075);
  --serif: "WenYuanSerifSC", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  /* 界面字体（左栏、标签条、面包屑、右栏、按钮）永远用系统字体：
     站点里 --serif 会指向按页切出来的网页字体，界面不该为它多下载几百 KB。 */
  --ui-serif: "WenYuanSerifSC", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "JetBrainsMono-Regular", Consolas, "Courier New", monospace;
  --rail: 258px;
  --rel: 306px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 23, 23, .05), 0 18px 50px -34px rgba(23, 23, 23, .45);
  /* 思源的行内配色：正文里很多 <span style="color:var(--b3-…)">，
     这里按思源 daytime 主题的原值补上，站点才能还原作者标的颜色。 */
  --b3-theme-primary: #3575f0;
  --b3-theme-secondary: #ff9200;
  --b3-theme-error: #d23f31;
  --b3-theme-background: #fff;
  --b3-theme-on-background: #222;
  --b3-theme-on-surface: #5f6368;
  --b3-theme-surface: #f6f6f6;
  --b3-card-error-color: #790600;
  --b3-card-error-background: #f5d1cf;
  --b3-card-warning-color: #8a4f00;
  --b3-card-warning-background: #ffe8c8;
  --b3-card-info-color: #005599;
  --b3-card-info-background: #d6eaf9;
  --b3-card-success-color: #006b04;
  --b3-card-success-background: #d7eed8;
  --b3-font-color1: var(--b3-card-error-color);
  --b3-font-color2: var(--b3-card-warning-color);
  --b3-font-color3: var(--b3-card-info-color);
  --b3-font-color4: var(--b3-card-success-color);
  --b3-font-color5: var(--b3-theme-on-surface);
  --b3-font-color6: var(--b3-theme-primary);
  --b3-font-color7: var(--b3-theme-secondary);
  --b3-font-color8: var(--b3-theme-error);
  --b3-font-color9: #a40074;
  --b3-font-color10: #007080;
  --b3-font-color11: #006e2a;
  --b3-font-color12: #6b5a00;
  --b3-font-color13: var(--b3-theme-background);
  --b3-font-background1: var(--b3-card-error-background);
  --b3-font-background2: var(--b3-card-warning-background);
  --b3-font-background3: var(--b3-card-info-background);
  --b3-font-background4: var(--b3-card-success-background);
  --b3-font-background5: #e2e3e4;
  --b3-font-background6: #acd0fc;
  --b3-font-background7: #fddaab;
  --b3-font-background8: #ffb0a9;
  --b3-font-background9: #fdbfff;
  --b3-font-background10: #b1ffff;
  --b3-font-background11: #affad1;
  --b3-font-background12: #fff88f;
  --b3-font-background13: var(--b3-theme-on-background);
}

* { box-sizing: border-box; }
/* 表单控件默认不继承字体（浏览器会给 Arial）：界面字体统一从 body 继承。 */
button, input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink-2);
  font-family: var(--ui-serif);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* 纸面颗粒，很淡 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

::selection { background: rgba(122, 10, 10, .14); color: var(--ink); }

/* ============================== 布局 ============================== */

.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  transition: grid-template-columns .25s ease;
}

.app > * { min-height: 0; }

.app.is-rel { grid-template-columns: var(--rail) minmax(0, 1fr) var(--rel); }
.app.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.is-collapsed.is-rel { grid-template-columns: 0 minmax(0, 1fr) var(--rel); }

.rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 12px 10px;
  overflow: hidden;
  background: var(--paper);
  border-right: 1px solid var(--line-soft);
}

.rail--right {
  border-right: 0;
  border-left: 1px solid var(--line-soft);
  padding: 18px 16px 16px;
  overflow-y: auto;
}

.app.is-collapsed .rail { opacity: 0; pointer-events: none; }

/* 启动期：首帧就按上次的开合状态画，别让读者看到「先收起再展开」的伸缩。
   head 里的内联脚本会读 localStorage 并把状态打在 <html data-rail / data-rel> 上，
   core.js 恢复完状态后把这些标记摘掉（之后一切照常走 class）。 */
html[data-rail="open"] .app.is-collapsed { grid-template-columns: var(--rail) minmax(0, 1fr); }
html[data-rail="open"] .app.is-collapsed > .rail:not(.rail--right) { opacity: 1; pointer-events: auto; }
html[data-rail="shut"] .app { grid-template-columns: 0 minmax(0, 1fr); }
html[data-rail="shut"] .app.is-rel { grid-template-columns: 0 minmax(0, 1fr) var(--rel); }
html[data-rail="shut"] .app > .rail:not(.rail--right) { opacity: 0; pointer-events: none; }
html[data-rel="open"] .app { grid-template-columns: var(--rail) minmax(0, 1fr) var(--rel); }
html[data-rel="open"] .app.is-collapsed { grid-template-columns: 0 minmax(0, 1fr) var(--rel); }
html[data-rel="open"] .app .rail--right { display: block; animation: none; }

/* 启动期一律不做过渡：状态类名是 JS 补上的，动画不该被看到 */
html[data-booting] *,
html[data-booting] *::before,
html[data-booting] *::after {
  transition: none !important;
  animation-duration: 0s !important;
}

.app.is-rel .rail--right { animation: railIn .22s ease both; }
@keyframes railIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

.stage {
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: flex;
}

.panes { display: flex; gap: 0; width: 100%; min-width: 0; min-height: 0; }
.panes > .pane + .pane { border-left: 1px solid var(--line-soft); }
/* 双栏之间的拖动条：拖动改两侧比例（工作台与阅读端共用） */
.pane-resizer {
  flex: 0 0 7px;
  margin: 0 -3px;
  position: relative;
  z-index: 6;
  cursor: col-resize;
}
.pane-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: var(--line-soft);
  transition: background .15s;
}
.pane-resizer:hover::before { background: rgba(122, 10, 10, .38); }
body.is-resizing { cursor: col-resize; }
body.is-resizing * { user-select: none !important; }

.app:not(.is-rel) .rail--right { display: none; }

@media (max-width: 1180px) {
  .app.is-rel { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .rail--right {
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--rel);
    background: var(--paper); border: 0; border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px -42px rgba(23, 23, 23, .55); z-index: 40;
  }
}

/* ============================== 侧栏 ============================== */

.rail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand__mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #f6f3ea;
  font-size: 14px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.brand__text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .01em;
  white-space: nowrap;
}

.brand__text em {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}

.icon {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  width: 26px; height: 26px;
  padding: 0;                /* 别用浏览器给 <button> 的默认内边距：会把里面的 SVG 挤偏 */
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon:hover { background: rgba(23, 23, 23, .055); color: var(--ink); }
.icon--tiny { width: 18px; height: 18px; font-size: 11px; border: 1px solid var(--line); border-radius: 50%; }
.icon--tiny svg { width: 12px; height: 12px; display: block; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 16px 0 6px;
  padding: 0 8px;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, .42);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search:focus-within {
  border-color: rgba(122, 10, 10, .3);
  background: rgba(255, 255, 255, .7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { appearance: none; }
.search kbd {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px;
}

.tree { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px 8px; }

.tree__label {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 12px 8px 4px;
}

.tree__item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5d5d57;
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.tree__item:hover { background: rgba(23, 23, 23, .045); color: var(--ink); }
.tree__item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree__glyph {
  flex: none;
  width: 15px; height: 15px;
  display: grid; place-items: center;
  font-size: 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: rgba(255, 255, 255, .45);
}
.tree__glyph .emoji-img { width: 10px; height: 10px; }
.tree__item.is-active .tree__glyph { border-color: rgba(122, 10, 10, .25); color: var(--accent); }
.tree__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree__count { font-family: var(--sans); font-size: 10.5px; color: var(--ink-3); }
.tree__item.is-active .tree__count { color: rgba(122, 10, 10, .65); }

/* 搜索结果 */
.hit {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px;
  cursor: pointer;
  transition: background .14s;
}
.hit:hover { background: rgba(23, 23, 23, .045); }
.hit__kicker { font-family: var(--sans); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.hit__text { display: block; margin-top: 3px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.hit__text mark { background: var(--accent-soft); color: var(--accent); padding: 0 1px; border-radius: 2px; }
.hit__doc { display: block; margin-top: 4px; font-size: 11px; color: var(--ink-3); }

.rail__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 6px 2px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.foot__tools { display: flex; align-items: center; gap: 6px; }

.foot-toggle {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 6px 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: transparent;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.foot-toggle::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
  transition: opacity .2s, background .2s;
}
.foot-toggle:hover { color: var(--ink-2); border-color: var(--line); }
.foot-toggle.is-on { color: var(--accent); border-color: rgba(122, 10, 10, .22); background: var(--accent-soft); }
.foot-toggle.is-on::before { opacity: 1; }

/* 页脚「源码」入口：只在把「?」改成别的地址时出现（AGPL 第 13 条仍然满足） */
.foot-src {
  display: inline-flex; align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
  text-decoration: none;
  transition: color .2s, border-color .2s, background .2s;
}
.foot-src:hover { color: var(--accent); border-color: rgba(122, 10, 10, .22); background: var(--accent-soft); }

/* ============================== 标签页 / 分栏 ============================== */

.pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.pane__tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 8px 0 9px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0));
}

.tabs__list { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }

.tab {
  display: flex; align-items: center; gap: 7px;
  flex: none;
  max-width: 220px;
  height: 30px;
  padding: 0 6px 0 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #6f6f69;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.tab:hover { background: rgba(23, 23, 23, .04); color: var(--ink); }
.tab.is-active {
  background: var(--paper-hi);
  border-color: var(--line-soft);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 23, 23, .05);
}
.tab__dot { width: 6px; height: 6px; border-radius: 2px; background: var(--ink-3); opacity: .55; flex: none; }
.tab.is-active .tab__dot { background: var(--accent); opacity: 1; }
.tab__icon {
  flex: none;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .45);
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1;
}
.tab.is-active .tab__icon {
  border-color: rgba(122, 10, 10, .22);
  background: var(--accent-soft);
  color: var(--accent);
}
.tab__icon .twemoji { width: 12px; height: 12px; }
.tab__pin { color: var(--accent); font-size: 7px; line-height: 1; opacity: .75; }
.tab.is-tab-drop-before { box-shadow: inset 2px 0 0 var(--accent); }
.tab.is-tab-drop-after { box-shadow: inset -2px 0 0 var(--accent); }
.tab.is-tab-drag { opacity: .45; }
.tab-overflow {
  flex: none;
  position: sticky;
  right: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 24px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: -10px 0 12px -10px rgba(23, 23, 23, .28);
}
.tab-overflow svg { width: 14px; height: 14px; }
.tab-overflow:hover {
  /* 悬停时也要保持不透明：直接用半透明色会把后面的标签文字透出来 */
  background: linear-gradient(rgba(23, 23, 23, .07), rgba(23, 23, 23, .07)), var(--paper);
  color: var(--ink);
}
.tab-menu { width: 240px; max-height: 60vh; overflow-y: auto; }
.tab-menu__item {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 2px 3px 2px 0;
  border-radius: 6px;
  color: var(--ink-2);
  font: 11px/1.5 var(--sans);
}
.tab-menu__item:hover { background: rgba(23, 23, 23, .05); }
.tab-menu__item.is-on { background: var(--accent-soft); color: var(--accent); }
.tab-menu__jump {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 5px 6px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tab-menu__jump .tab__icon { width: 14px; height: 14px; font-size: 9px; }
.tab-menu__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-menu__close {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--ink-3); font-size: 13px; line-height: 1; cursor: pointer;
  opacity: .55; transition: opacity .15s, background .15s, color .15s;
}
.tab-menu__close:hover { background: rgba(23, 23, 23, .1); color: var(--ink); opacity: 1; }
.tab-menu__pin { margin-left: auto; color: var(--accent); font-size: 8px; }
.tab__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab__close {
  width: 17px; height: 17px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--ink-3); font-size: 13px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
/* 图标按钮不吃浏览器默认内边距（默认 1px 6px，会把里面的 × / SVG 挤偏）。
   这一组都是纯图标按钮，宽度写死 17–28px，加了内边距就只剩几像素放图标。 */
.tab__close, .tab-overflow, .tab-menu__close, .tool, .tab-add { padding: 0; }
.tab:hover .tab__close, .tab.is-active .tab__close { opacity: 1; }
.tab__close:hover { background: rgba(23, 23, 23, .09); color: var(--ink); }

.tabs__tools { display: flex; align-items: center; gap: 1px; flex: none; }

.tool {
  appearance: none;
  border: 0; background: transparent;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tool:hover { background: rgba(23, 23, 23, .055); color: var(--ink); }
.tool.is-on { background: var(--accent-soft); color: var(--accent); }
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }

.pane__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* 滚动条 */
.pane__body::-webkit-scrollbar, .rail::-webkit-scrollbar, .rail--right::-webkit-scrollbar, .tree::-webkit-scrollbar { width: 9px; height: 9px; }
.pane__body::-webkit-scrollbar-thumb, .rail::-webkit-scrollbar-thumb, .rail--right::-webkit-scrollbar-thumb, .tree::-webkit-scrollbar-thumb {
  background: rgba(23, 23, 23, .13); border-radius: 99px; border: 3px solid transparent; background-clip: content-box;
}
.pane__body::-webkit-scrollbar-thumb:hover, .tree::-webkit-scrollbar-thumb:hover { background: rgba(23, 23, 23, .25); background-clip: content-box; }
.pane__body::-webkit-scrollbar-track { background: transparent; }

/* ============================== 文档 ============================== */

.doc {
  width: min(var(--content-w, 748px), calc(100% - 72px));
  margin: 0 auto;
  padding: 34px 0 140px;
}
html[data-width="full"] .doc:not(.doc--wide) {
  width: calc(100% - 48px);
}

.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.crumbs i { font-style: normal; color: rgba(122, 10, 10, .55); }

.doc__title {
  margin: 12px 0 16px;
  font-family: var(--serif);
  font-size: var(--doc-title-font-size, 32px);
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ink);
}
.doc--notags .doc__title { margin-bottom: 34px; }

.doc__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--tag-body-gap, 30px); }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid rgba(122, 10, 10, .12);
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;   /* 阅读端里标签是 <a>，别吃浏览器默认下划线 */
  transition: background .16s, border-color .16s, transform .16s, color .16s;
}
.tag-pill:hover { background: rgba(122, 10, 10, .13); transform: translateY(-1px); }
.tag-pill.is-on { background: var(--accent); border-color: var(--accent); color: #f7f4ea; }
.tag-pill i { font-style: normal; font-size: 9px; opacity: .55; }

.tag-inline {
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .94em;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;   /* 同上：阅读端的标签是 <a> */
}
/* 正文里的超链接有波浪下划线（.protyle-wysiwyg a[href]:not(...)，特异性很高），
   标签胶囊不该继承它——这里只能上 !important，否则压不住那条规则。 */
.tag-pill[href],
.tag-inline[href],
.protyle-wysiwyg a.tag-inline,
.protyle-wysiwyg a.tag-pill { text-decoration: none !important; }
.tag-inline:hover { background: rgba(122, 10, 10, .14); }

.doc--wide { width: min(1000px, calc(100% - 72px)); }

.tag-head {
  margin-bottom: 26px;
  padding: 6px 0 22px;
  border-bottom: 1px solid var(--line-soft);
}
.tag-title {
  margin: 12px 0 6px;
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.tag-sub {
  margin: 0 0 18px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-3);
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-blocks { margin-top: 36px; }
.tag-blocks__head {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tag-block {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, .35);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.tag-block:hover { border-color: rgba(122, 10, 10, .22); background: rgba(255, 255, 255, .62); transform: translateY(-1px); }
.tag-block__doc { font-family: var(--sans); font-size: 9.5px; letter-spacing: .08em; color: var(--ink-3); }
.tag-block__text { display: block; margin-top: 3px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }

/* 内容块：沿用思源类名 */
.protyle-wysiwyg { font-family: var(--serif); font-size: 16px; color: var(--body-color, #171717); }

.protyle-wysiwyg > * { position: relative; scroll-margin-top: 40px; }

.protyle-wysiwyg .p { margin: 0; line-height: 1.5; }
.protyle-wysiwyg .p + .p { margin-top: 0; }

.protyle-wysiwyg strong { color: var(--ink); font-weight: 700; }
.protyle-wysiwyg em { font-style: normal; color: var(--accent); }

.protyle-wysiwyg .h2 {
  margin: 0;
  font-size: 24.5px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
.protyle-wysiwyg .h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink);
}
.protyle-wysiwyg .h2 + .p, .protyle-wysiwyg .h3 + .p { color: var(--ink-2); }

.protyle-wysiwyg .list {
  margin: 0;
  padding-left: 22px;
  line-height: 1.5;
}
.protyle-wysiwyg .list li { margin: 2px 0; padding-left: 2px; margin-left: calc(var(--level, 0) * 22px); }
.protyle-wysiwyg .list li::marker { color: rgba(122, 10, 10, .55); }

.protyle-wysiwyg .bq {
  margin: 0;
  padding: 6px 0 6px 18px;
  border-left: 2px solid rgba(122, 10, 10, .35);
  color: #6b6b64;
  font-size: 16.5px;
  line-height: 1.85;
}

.callout {
  --co: #6b7280;
  display: flex;
  gap: 12px;
  margin: 18px 0;
  padding: 13px 16px 14px;
  border-radius: 12px;
  background: rgba(227, 227, 222, .45);
  background: color-mix(in srgb, var(--co) 7%, transparent);
  border: 1px solid rgba(23, 23, 23, .05);
  border-color: color-mix(in srgb, var(--co) 16%, transparent);
  box-shadow: inset 2px 0 0 rgba(23, 23, 23, .08);
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--co) 55%, transparent);
  line-height: 1.8;
  color: var(--ink-2);
}
.callout--tip { --co: #5b7a5c; }
.callout--note { --co: #5c6b7a; }
.callout--warning { --co: #a1783f; }
.callout--important { --co: #7a5680; }
.callout--caution { --co: #a04a40; }

.callout__icon {
  flex: none;
  width: auto;
  min-width: 26px;
  height: 26px;
  margin: 0;
  padding: 0 2px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s, transform .16s;
}
.callout__icon:hover { background: rgba(23, 23, 23, .06); transform: translateY(-1px); }
.callout__icon .emoji-img { width: 18px; height: 18px; object-fit: contain; border-radius: 3px; }
.callout__body { min-width: 0; }
.callout__body .ref { text-decoration-color: rgba(122, 10, 10, .28); }

.widget {
  margin: 20px 0;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .6);
}
.widget iframe { display: block; width: 100%; border: 0; }

.ref.is-broken {
  color: var(--ink-3);
  text-decoration: underline wavy rgba(160, 74, 64, .45);
  text-underline-offset: 3px;
  cursor: help;
}

/* 同步块 */
.embed { display: block; }
.embed--broken,
.embed--cycle {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(23, 23, 23, .02);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}

.protyle-wysiwyg mark {
  padding: 0 2px;
  border-radius: 2px;
  background: rgba(240, 200, 80, .34);
  color: inherit;
}
.protyle-wysiwyg sup,
.protyle-wysiwyg sub { font-size: .74em; line-height: 0; }

.code-block {
  position: relative;
  margin: 20px 0;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(23, 23, 23, .035);
  overflow: hidden;
}.code-block__lang {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 0;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.code-copy {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.code-copy:hover { border-color: rgba(122, 10, 10, .3); color: var(--accent); }
.code-block pre { margin: 0; padding: 10px 16px 18px; overflow-x: auto; }
.code-block code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  color: #3d3d38;
  white-space: pre;
}
.tok-com { color: #9b9b92; font-style: italic; }
.tok-str { color: #8a4b2f; }
.tok-key { color: #7a0a0a; font-weight: 600; }
.tok-num { color: #4f6b53; }

.protyle-wysiwyg :not(pre) > code {
  font-family: var(--mono);
  font-size: 13.2px;
  background: rgba(23, 23, 23, .06);
  border-radius: 5px;
  padding: 1px 5px;
  color: #3d3d38;
}

.table-wrap { margin: 20px 0; overflow-x: auto; }
.protyle-wysiwyg table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.protyle-wysiwyg thead th {
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.protyle-wysiwyg tbody td { padding: 10px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); }
.protyle-wysiwyg tbody tr:hover td { background: rgba(23, 23, 23, .02); }

.figure { margin: 26px 0; }
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--paper-hi);
}
.figure figcaption {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--ink-3);
  text-align: center;
}

.protyle-wysiwyg .hr { height: 1px; margin: 0; background: var(--line-soft); border: 0; }

.ref {
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(122, 10, 10, .32);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  border-radius: 3px;
  transition: color .15s, background .15s, text-decoration-color .15s;
}
.ref:hover { color: var(--accent); background: var(--accent-soft); text-decoration-color: var(--accent); }
.ref.is-broken,
.ref.is-broken:hover {
  color: var(--ink-3);
  text-decoration: underline wavy rgba(160, 74, 64, .45);
  cursor: not-allowed;
  background: transparent;
}
.block-hyperlink,
.protyle-wysiwyg a[href^="siyuan://blocks/"] {
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(122, 10, 10, .32);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  border-radius: 3px;
  transition: color .15s, background .15s, text-decoration-color .15s;
}
.block-hyperlink:hover,
.protyle-wysiwyg a[href^="siyuan://blocks/"]:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration-color: var(--accent);
}
.block-hyperlink.is-broken {
  color: var(--ink-3);
  text-decoration: underline wavy rgba(160, 74, 64, .45);
  cursor: not-allowed;
  background: transparent;
}

/* 文末反链 / 未链接提及（默认折叠） */
.doc-backlinks {
  margin-top: 64px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.doc-backlinks__head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  margin: 20px 0 8px;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.doc-backlinks__head::-webkit-details-marker { display: none; }
.doc-backlinks__head::after {
  content: "›";
  margin-left: auto;
  font-size: 13px;
  letter-spacing: 0;
  transition: transform .18s ease;
}
.doc-backlinks[open] .doc-backlinks__head::after { transform: rotate(90deg); }
.doc-backlinks__head:hover { color: var(--ink-2); }
.doc-backlinks__head b { font-weight: 500; color: var(--ink-2); }
.doc-backlinks__body { margin-top: 4px; }
.doc-backlinks__label {
  margin: 14px 0 6px;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.backlink {
  display: block;
  margin-bottom: 5px;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, .32);
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .15s;
}
.backlink:hover {
  border-color: rgba(122, 10, 10, .2);
  background: rgba(255, 255, 255, .62);
  transform: translateY(-1px);
}
.backlink__kicker {
  display: block;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .06em;
  color: var(--accent);
}
.backlink__text {
  display: block;
  margin-top: 2px;
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* 块链接按钮（hover 出现） */
.block-link {
  position: absolute;
  left: -26px;
  top: 2px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.protyle-wysiwyg > *:hover > .block-link { opacity: .55; }
.block-link:hover { opacity: 1; background: rgba(23, 23, 23, .06); color: var(--accent); }
.block-link[data-ref-count]:not([data-ref-count="0"])::after {
  content: attr(data-ref-count);
  position: absolute;
  top: -5px; right: -5px;
  min-width: 10px; height: 10px;
  padding: 0 2px;
  border-radius: 99px;
  background: var(--accent);
  color: #f7f4ea;
  font-family: var(--sans);
  font-size: 7px;
  line-height: 10px;
  text-align: center;
}
@media (hover: none) { .block-link { display: none; } }

/* 引用块（transclusion） */
.block-ref {
  margin: 24px 0;
  padding: 10px 16px 14px;
  border-left: 2px solid rgba(122, 10, 10, .3);
  border-radius: 0 10px 10px 0;
  background: rgba(23, 23, 23, .022);
}
.block-ref__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.block-ref__source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
}
.block-ref__source span { opacity: .45; }
.block-ref__source:hover { text-decoration: underline; text-underline-offset: 3px; }
.block-ref__body > .p { margin: 0; }
.block-ref__body .h2 { margin: 0; font-size: 19px; }
.block-ref__body .h3 { margin: 0; font-size: 17px; }
.block-ref__body .callout { margin: 0; }
.block-ref__body .block-link { display: none; }

.muted { color: var(--ink-3); font-size: 14px; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
}

/* 块定位闪光 */
.is-flash { animation: flash 1.8s ease-out both; }
@keyframes flash {
  0% { background: rgba(122, 10, 10, .11); box-shadow: inset 2px 0 0 var(--accent); }
  60% { background: rgba(122, 10, 10, .05); box-shadow: inset 2px 0 0 rgba(122, 10, 10, .35); }
  100% { background: transparent; box-shadow: inset 2px 0 0 transparent; }
}

/* 空面板 */
.empty {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 40px;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
}
.empty__list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 360px; }
.empty__list button {
  border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .5);
  border-radius: 99px; padding: 6px 12px;
  font-family: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.empty__list button:hover { border-color: rgba(122, 10, 10, .3); color: var(--accent); }

/* ============================== 关系栏 ============================== */

.rail__title {
  font-family: var(--sans);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 6px;
}

.rel-group + .rel-group { margin-top: 26px; }
/* 每组可折叠（<details>）：标题行就是 summary，右边一个小箭头 */
.rel-group > summary { list-style: none; cursor: pointer; user-select: none; }
.rel-group > summary::-webkit-details-marker { display: none; }
.rel-group__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 22px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.rel-group__head::after {
  content: "›";
  margin-left: 6px;
  font-size: 13px;
  letter-spacing: 0;
  transition: transform .18s ease;
}
.rel-group[open] > summary .rel-group__head::after { transform: rotate(90deg); }
.rel-group > summary:hover .rel-group__head { color: var(--ink-2); }
.rel-group__body { padding-top: 2px; }
.rel-group__head b { font-weight: 500; color: var(--ink-2); letter-spacing: 0; text-transform: none; font-size: 11px; }

.rel-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 9px;
  margin-bottom: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, .34);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}
.rel-item:hover {
  border-color: rgba(122, 10, 10, .22);
  background: rgba(255, 255, 255, .66);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -16px rgba(23, 23, 23, .5);
}
.rel-item__thumb {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, .9);
  background: linear-gradient(135deg, var(--c1), var(--c2));
  overflow: hidden;
}
.rel-item__thumb--plain { background: rgba(23, 23, 23, .05); color: var(--ink-3); }
.rel-item__main { min-width: 0; }
.rel-item__kicker { display: block; font-family: var(--sans); font-size: 9.5px; letter-spacing: .08em; color: var(--ink-3); }
.rel-item__text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12.6px; line-height: 1.55; color: var(--ink-2);
}
.rel-item__arrow { color: var(--ink-3); font-size: 14px; opacity: 0; transform: translateX(-2px); transition: opacity .18s, transform .18s; }
.rel-item:hover .rel-item__arrow { opacity: 1; transform: none; color: var(--accent); }
.rel-empty { font-family: var(--sans); font-size: 11.5px; color: var(--ink-3); padding: 8px 2px; }

/* 空状态：没有任何可显示的页面时（不再有「全部文档」卡片墙） */
.empty-state { padding: 84px 0 120px; text-align: center; }
.empty-state__title { font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.empty-state__hint { margin-top: 10px; font-family: var(--sans); font-size: 12px; color: var(--ink-3); }

/* ============================== 悬浮预览 ============================== */

.preview {
  position: fixed;
  z-index: 60;
  width: 348px;
  max-height: 62vh;
  overflow: hidden;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fdfcf8;
  box-shadow: 0 22px 60px -24px rgba(23, 23, 23, .45), 0 2px 8px rgba(23, 23, 23, .06);
  font-size: 13.6px;
  line-height: 1.75;
  color: #46463f;
  animation: pvIn .14s ease both;
}
@keyframes pvIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.preview__head {
  display: flex; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.preview__title { font-weight: 500; color: var(--ink); letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.preview__body p { margin: 0 0 6px; }
.preview__body .callout, .preview__body .bq { margin: 6px 0; padding: 8px 10px; }
.preview__body .code-block { margin: 6px 0; }
.preview__body .figure { display: none; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(251, 250, 246, .94);
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px -16px rgba(23, 23, 23, .35);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-2);
  animation: pvIn .2s ease both;
}
.toast b { font-weight: 600; color: var(--accent); }
.toast button { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 13px; }

/* ============================== 封面 / 索引 / 动效 ============================== */

.cover--clay { --c1: #a97355; --c2: #c8a488; --c3: #e9d8c4; }
.cover--sage { --c1: #6d7d64; --c2: #a7b29a; --c3: #dfe3d2; }
.cover--ink  { --c1: #23262b; --c2: #434850; --c3: #7d828b; }
.cover--sand { --c1: #a3854f; --c2: #cbb98d; --c3: #eee2c8; }

/* 文档封面 */
.cover {
  position: relative;
  height: calc(var(--cover-vh, 26) * 1vh);
  overflow: hidden;
  background:
    radial-gradient(90% 120% at 16% 6%, rgba(255, 255, 255, .34), transparent 54%),
    radial-gradient(72% 120% at 88% 104%, rgba(20, 20, 20, .22), transparent 62%),
    linear-gradient(112deg, var(--c1) 0%, var(--c2) 58%, var(--c3) 128%);
  box-shadow: inset 0 -1px 0 rgba(23, 23, 23, .12);
  animation: coverIn .7s cubic-bezier(.2, .8, .2, 1) both;
}
.cover__img, .hero__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.cover--image::after, .hero--image::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(18, 18, 18, .42), rgba(18, 18, 18, 0) 58%);
  pointer-events: none;
}
.cover--image .cover__glyph { display: none; }

/* Hero 式页面封面 */
.cover--hero {
  display: flex;
  align-items: flex-end;
  height: auto;
  min-height: calc(var(--cover-vh, 26) * 1vh);
}
.cover--hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(12, 12, 12, .55), rgba(12, 12, 12, 0) 62%);
  pointer-events: none;
}
.cover__hero {
  position: relative;
  z-index: 3;
  min-width: 0;
  max-width: 900px;
  padding: 56px 56px 42px;
  overflow-wrap: anywhere;
}
.cover__hero-kicker {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(248, 245, 236, .62);
}
.cover__hero-title {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #f8f5ec;
}
.cover__hero-sub {
  max-width: 640px;
  margin: 14px 0 26px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.85;
  color: rgba(248, 245, 236, .72);
}
.cover__hero-cta { margin-top: 2px; }
.cover__hero-art {
  position: absolute;
  right: -10px;
  bottom: -90px;
  z-index: 1;
  font-size: 300px;
  line-height: 1;
  font-weight: 700;
  color: rgba(247, 244, 234, .06);
  user-select: none;
  pointer-events: none;
}
.cover__hero-art .twemoji { width: 1em; height: 1em; opacity: .15; }
.doc--hero { padding-top: 26px; }
.cover::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 72px);
  opacity: .45;
}
.cover__grain, .hero__grain, .card__cover::before {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: .3;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.cover__glyph {
  position: absolute;
  right: 30px; bottom: -54px;
  font-size: 200px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.05em;
  color: rgba(255, 255, 255, .2);
  user-select: none;
}
.cover__glyph--emoji { font-size: 124px; bottom: 6px; opacity: .9; }

/* 索引页封面 */
.hero {
  position: relative;
  min-height: clamp(240px, calc(var(--cover-vh, 36) * 1vh), 82vh);
  display: flex;
  align-items: flex-end;
  padding: 56px 56px 46px;
  overflow: hidden;
  background:
    radial-gradient(80% 120% at 12% 4%, rgba(255, 255, 255, .18), transparent 55%),
    radial-gradient(70% 120% at 92% 100%, rgba(12, 12, 12, .3), transparent 62%),
    linear-gradient(125deg, var(--c1) 0%, var(--c2) 62%, var(--c3) 138%);
  box-shadow: inset 0 -1px 0 rgba(23, 23, 23, .15);
  animation: coverIn .7s cubic-bezier(.2, .8, .2, 1) both;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .12) 0 1px, transparent 1px 88px);
  opacity: .4;
}
.hero__inner { position: relative; z-index: 2; max-width: 660px; }
.hero__glyph {
  position: absolute;
  right: -10px; bottom: -96px;
  z-index: 1;
  font-size: 320px;
  line-height: 1;
  font-weight: 700;
  color: rgba(247, 244, 234, .055);
  user-select: none;
}
.hero__glyph--emoji { font-size: 200px; bottom: -30px; color: rgba(247, 244, 234, .14); }
.crumbs--hero { color: rgba(247, 244, 234, .5); }
.hero__title {
  margin: 16px 0 16px;
  font-family: var(--serif);
  font-size: 46px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #f8f5ec;
}
.hero__sub {
  margin: 0 0 28px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(248, 245, 236, .55);
}
.hero__cta {
  display: inline-flex; align-items: center;
  padding: 10px 20px;
  border: 1px solid rgba(248, 245, 236, .3);
  border-radius: 99px;
  background: rgba(248, 245, 236, .04);
  color: #f8f5ec;
  font-family: var(--serif);
  font-size: 13.5px;
  text-decoration: none;   /* 阅读端这个按钮是 <a>，不能带下划线 */
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.hero__cta span { margin-left: 9px; transition: transform .2s; }
.hero__cta:hover { background: rgba(248, 245, 236, .12); border-color: rgba(248, 245, 236, .5); transform: translateY(-1px); }
.hero__cta:hover span { transform: translateX(3px); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: var(--db-card-gap, 16px);
}
.cards-block { margin: 0; }
.db-located-record { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); font: 12px/1.6 var(--sans); }
.db-located-record strong { display: block; color: var(--ink); font-size: 14px; margin: 3px 0; }
.cards-block-group { margin: 0; }
.db-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
}
.db-view-tab {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, .55);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.db-view-tab:hover { border-color: rgba(122, 10, 10, .25); color: var(--accent); }
.db-view-tab.is-on {
  border-color: rgba(122, 10, 10, .22);
  background: var(--accent-soft);
  color: var(--accent);
}
.db-view-panel[hidden] { display: none; }
.cards-block__head { margin: 0 0 12px; }
/* 顶栏保留（以后放筛选 / 分类）；现在没有内容时不占高度、不留白。 */
.cards-block__head.is-empty { margin: 0; min-height: 0; padding: 0; overflow: hidden; }
/* 预览（阅读态）：标题与视图标签左对齐，标签在上方左侧 */
.cards-block__head.is-reading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.cards-block__head.is-reading .db-views { justify-content: flex-start; flex-wrap: wrap; }
/* 顶栏左侧：筛选 / 排序（都可以多条件，改完立刻重画卡片） */
.cards-block__tools { display: flex; align-items: center; gap: 6px; margin-left: 0; }
.cards-block__head.is-reading.has-tools {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; width: 100%;
}
.cards-block__head.is-reading.is-empty.has-tools { margin: 0 0 10px; min-height: 0; overflow: visible; }
.db-tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border: 1px solid var(--line-soft); border-radius: 999px;
  background: #fff; color: var(--ink-2); font: 11.5px/1 var(--sans); cursor: pointer;
}
/* 图标（漏斗 / 上下箭头）：13px，颜色跟着文字走 */
.db-tool > svg { width: 13px; height: 13px; flex: none; }
.db-tool:hover { border-color: var(--accent); color: var(--accent); }
.db-tool.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.db-tool i { font-style: normal; font-size: 10px; opacity: .8; }
.cards-block__title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}
/* 卡片数据库（表格 / 列表 / 卡片） */
.db-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}
.cards-block__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.db-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
}
.db-count {
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  white-space: nowrap;
}
.db-search,
.db-sort {
  height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, .65);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 11.5px;
  outline: 0;
}
.db-search {
  width: 130px;
  padding: 0 8px;
}
.db-sort { padding: 0 4px; }
.db-search:focus,
.db-sort:focus { border-color: rgba(122, 10, 10, .3); box-shadow: 0 0 0 3px var(--accent-soft); }
.db-table {
  margin: 2px 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: auto;
  max-height: 62vh;
  background: rgba(255, 255, 255, .25);
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 10, 10, .38) rgba(23, 23, 23, .06);
}
.db-table::-webkit-scrollbar { width: 10px; height: 10px; }
.db-table::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 99px;
  background: rgba(122, 10, 10, .36);
  background-clip: padding-box;
}
.db-table::-webkit-scrollbar-thumb:hover { background: rgba(122, 10, 10, .5); background-clip: padding-box; }
.db-table::-webkit-scrollbar-track { background: rgba(23, 23, 23, .05); }
.db-table-shell { position: relative; }
.db-table-fade {
  position: absolute;
  top: 0;
  bottom: 10px;
  z-index: 4;
  width: 30px;
  pointer-events: none;
  opacity: 0;
  transition: none;
}
.db-table-fade--left {
  left: 0;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(to right, rgba(247, 245, 239, .96), rgba(247, 245, 239, 0));
}
.db-table-fade--right {
  right: 0;
  border-radius: 0 10px 10px 0;
  background: linear-gradient(to left, rgba(247, 245, 239, .96), rgba(247, 245, 239, 0));
}
.db-table-shell.is-scroll-left .db-table-fade--left,
.db-table-shell.is-scroll-right .db-table-fade--right { opacity: 1; }
.db-table__head,
.db-table__row {
  display: flex;
  min-width: max-content;
}
.db-table__head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f5ef;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .04em;
}
.db-table__row { border-top: 1px solid var(--line-soft); }
.db-table__row:hover { background: rgba(23, 23, 23, .018); }
.db-th,
.db-cell {
  flex: 0 0 132px;
  min-width: 0;
  box-sizing: border-box;
  padding: var(--db-cell-pad-y, 10px) var(--db-cell-pad-x, 12px);
  border-right: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
}
/* 表头：类型图标与字段名同排，不再折成两行 */
.db-table__head .db-th {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.db-table__head .db-th .db-field-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 列脚「计算」默认不显示，悬停列脚才出现，避免一排空心按钮 */
.db-foot__add { opacity: 0; transition: opacity .12s ease; }
.db-table__foot:hover .db-foot__add { opacity: .55; }
.db-foot__cell:hover .db-foot__add { opacity: 1; }
.db-celltext {
  display: block;
  min-height: 20px;
  overflow: hidden;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-celltext.is-empty { color: var(--line); }
.db-celltext--title { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.db-table .db-cell:not(.is-wrap) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-table .db-cell--date:not(.is-wrap),
.db-table .db-cell--datefield:not(.is-wrap) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.45;
}
.db-cell--datefield .db-celltext { white-space: normal; overflow-wrap: anywhere; }
.db-table--compact .db-th,
.db-table--compact .db-cell { padding-top: 4px; padding-bottom: 4px; }
.db-table--comfortable .db-th,
.db-table--comfortable .db-cell { padding-top: 14px; padding-bottom: 14px; }
.db-cell.is-wrap,
.db-th.is-wrap { white-space: normal; overflow-wrap: anywhere; }
.db-cell.is-wrap .db-celltext {
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}
.db-cell.is-wrap .db-target { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
.db-th.is-wrap .db-field-name { white-space: normal; }
/* 系统列的宽度一律由内联样式（fit 计算）决定，这里不再写死，避免表头与数据行错位 */

.db-th:last-child,
.db-cell:last-child { border-right: 0; }
.db-th--ops { flex: 0 0 104px; }
.db-th--check,
.db-cell--check { flex: 0 0 34px; min-width: 34px; }
/* 名称列：冻结在左侧；宽度只由内联 fit 决定，这里不写死任何 flex 值 */
.db-cell--name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fbfaf6;
}
.db-cell--name .db-celltext--title { padding-right: 16px; }
/* 名称就是双链：点击直接跳目标；右侧小按钮改名 */
.db-name-link { cursor: pointer; }
.db-name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.db-row-edit {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}
.db-cell--name:hover .db-row-edit { opacity: 1; }
.db-row-edit:hover { color: var(--accent); }
.db-table__head .db-th:first-child { background: #f7f5ef; }
/* 行操作列吸收剩余宽度，避免右侧出现一大片空白 */
.db-th--ops,
.db-cell--ops { flex: 1 1 104px; min-width: 104px; }
.db-table__body { min-width: max-content; }
.db-group { border-top: 1px solid var(--line-soft); }
.db-group:first-child { border-top: 0; }
.db-group__head {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: max-content;
  padding: 7px 10px;
  border: 0;
  background: #f7f5ef;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.db-group__head b { color: var(--ink-3); font-weight: 500; }
.db-group__chev { color: var(--ink-3); font-size: 10px; }
.db-list .db-group { border-top: 1px solid var(--line-soft); }
.db-list .db-group:first-child { border-top: 0; }
.db-list .db-group__head {
  position: static;
  min-width: 0;
  border-radius: 0;
}
.db-board__col-add {
  flex: 0 0 140px;
  height: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10px;
  cursor: pointer;
}
.db-board__col-add:hover { border-color: rgba(122, 10, 10, .3); color: var(--accent); }
.db-static-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
}
.db-static-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.db-static-filter + .db-static-filter {
  padding-left: 14px;
  border-left: 1px solid var(--line-soft);
}
.db-static-filter__label {
  margin-right: 3px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
}
.db-static-filter__btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
}
.db-static-filter__btn:hover {
  border-color: rgba(122, 10, 10, .25);
  color: var(--accent);
}
.db-static-filter__btn.is-on {
  border-color: rgba(122, 10, 10, .2);
  background: var(--accent-soft);
  color: var(--accent);
}
.db-static-count {
  margin-left: auto;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}
.db-static-empty {
  padding: 16px 4px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 12px;
}
.db-static-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.db-static-search {
  flex: 1 1 200px;
  max-width: 280px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 11.5px;
  outline: 0;
}
.db-static-search:focus { border-color: rgba(122, 10, 10, .35); }
.db-static-page {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}
.db-static-pager { display: flex; align-items: center; gap: 4px; }
.db-static-pager button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
}
.db-static-pager button:disabled { opacity: .35; cursor: default; }
.db-static-pager span {
  min-width: 50px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  text-align: center;
}
.db-static-tools__count {
  margin-left: auto;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}
.db-table__foot {
  display: flex;
  min-width: max-content;
  border-top: 1px solid var(--line-soft);
  background: #f7f5ef;
}
.db-foot__cell {
  display: flex;
  flex: 0 0 132px;
  flex-direction: column;
  gap: 1px;
  padding: 5px 10px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: none;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
  text-align: left;
}
.db-foot__cell:last-child { border-right: 0; }
.db-foot__cell b {
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.db-foot__cell small { color: var(--ink-3); font-size: 10px; }
.db-foot__cell:first-child { flex: 0 0 34px; background: #f7f5ef; }
.db-foot__cell--name {
  flex: 1 1 210px;
  min-width: 175px;
  background: #f7f5ef;
}
.db-cal {
  margin: 10px 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, .35);
}
.db-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.db-cal__month { color: var(--ink); font-family: var(--serif); font-size: 16px; }
.db-cal__tools { display: flex; align-items: center; gap: 4px; }
.db-cal__field-label { color: var(--ink-3); font-family: var(--sans); font-size: 10.5px; }
.db-cal .db-tool-btn {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #fff;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
}
.db-cal .db-tool-btn:hover { border-color: rgba(122, 10, 10, .3); color: var(--accent); }
.db-cal__weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
  background: #f7f5ef;
}
.db-cal__weekdays span {
  padding: 6px 7px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
  text-align: center;
}
.db-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.db-cal__day {
  min-height: 88px;
  padding: 5px 6px 6px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #fbfaf6;
}
.db-cal__day:nth-child(7n) { border-right: 0; }
.db-cal__day.is-outside { background: rgba(23, 23, 23, .022); }
.db-cal__day.is-outside .db-cal__num { color: var(--line); }
.db-cal__day.is-today { box-shadow: inset 0 0 0 1px rgba(122, 10, 10, .32); }
.db-cal__num {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}
.db-cal__add {
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}
.db-cal__day:hover .db-cal__add { opacity: 1; }
.db-cal__events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  max-height: 70px;
  overflow-y: auto;
}
.db-cal__event {
  display: block;
  width: 100%;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 10.5px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
button.db-cal__event:hover,
a.db-cal__event:hover { background: rgba(122, 10, 10, .14); }
.db-cal__undated {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--line-soft);
}
.db-cal__undated-label {
  margin-right: 2px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
}
.db-cal__undated .db-cal__event { width: auto; }
.db-cal__empty {
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  text-align: center;
}
.db-cal__empty b { display: block; margin-bottom: 4px; color: var(--ink-2); font-size: 12px; }
.db-cal__empty p { margin: 0 0 12px; }
.db-table__row.db-tint--clay,
.db-list__row.db-tint--clay,
.card.db-tint--clay,
.db-board-card.db-tint--clay,
.db-cal__event.db-tint--clay { background: rgba(122, 10, 10, .05); }
.db-table__row.db-tint--sage,
.db-list__row.db-tint--sage,
.card.db-tint--sage,
.db-board-card.db-tint--sage,
.db-cal__event.db-tint--sage { background: rgba(74, 103, 65, .07); }
.db-table__row.db-tint--sand,
.db-list__row.db-tint--sand,
.card.db-tint--sand,
.db-board-card.db-tint--sand,
.db-cal__event.db-tint--sand { background: rgba(164, 133, 79, .1); }
.db-table__row.db-tint--ink,
.db-list__row.db-tint--ink,
.card.db-tint--ink,
.db-board-card.db-tint--ink,
.db-cal__event.db-tint--ink { background: rgba(23, 23, 23, .05); }
.db-cell--tint--clay { background: rgba(122, 10, 10, .06); }
.db-cell--tint--sage { background: rgba(74, 103, 65, .08); }
.db-cell--tint--sand { background: rgba(164, 133, 79, .11); }
.db-cell--tint--ink { background: rgba(23, 23, 23, .06); }
.db-table__foot .db-foot__cell[data-col-key="__name"] {
  flex: 1 1 210px;
  min-width: 175px;
}
.db-table__foot .db-foot__cell[data-col-key="__target"] { flex: 0 0 150px; }
.db-table__foot .db-foot__cell[data-col-key="__updated"] { flex: 0 0 96px; }
.db-foot__cell--ops { flex: 0 0 104px; }
.db-cell--target { flex: 0 0 150px; }
.db-cell--tags { flex: 0 0 150px; }
.db-cell--date { flex: 0 0 96px; color: var(--ink-3); font-size: 11.5px; font-family: var(--sans); }
.db-cell--ops {
  flex: 0 0 104px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding-left: 4px;
  padding-right: 8px;
}
.db-input {
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  outline: 0;
}
.db-input:focus {
  background: #fff;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.db-input--title { color: var(--ink); font-weight: 600; }
.db-title { color: var(--ink); font-weight: 600; }
.db-table .db-title,
.db-list .db-title { font-family: var(--sans); font-size: 12.5px; }
.db-target {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-target:hover { text-decoration: underline; text-underline-offset: 3px; }
.db-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.db-chip {
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 10.5px;
  white-space: nowrap;
}
.db-chip--clay { background: rgba(122, 10, 10, .09); color: #7a0a0a; }
.db-chip--sage { background: rgba(74, 103, 65, .12); color: #4a6741; }
.db-chip--sand { background: rgba(164, 133, 79, .16); color: #856530; }
.db-chip--ink { background: rgba(23, 23, 23, .08); color: #3a3a38; }
.db-chip--relation { background: rgba(23, 23, 23, .055); color: var(--ink-2); }
.db-rollup {
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.db-empty { color: var(--ink-3); opacity: .55; }
.db-check { accent-color: var(--accent); }
.db-op {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.db-op:hover { background: rgba(23, 23, 23, .06); color: var(--ink); }
.db-op--danger:hover { background: rgba(160, 74, 64, .1); color: #a04a40; }
.db-add-row {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-top: 1px dashed var(--line-soft);
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.db-add-row:hover { background: rgba(122, 10, 10, .035); color: var(--accent); }
.db-list {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
}
.db-list__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-top: 1px solid var(--line-soft);
}
.db-list__row:first-child { border-top: 0; }
.db-list__row:hover { background: rgba(23, 23, 23, .018); }
.db-list__glyph {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--ink-3);
  font-size: 12px;
}
.db-list__main { flex: 1; min-width: 0; }
.db-list__meta {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
}
.db-list__props { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; }
.db-list-prop { color: var(--ink-2); font-size: 12px; }
.db-list-prop i { margin-right: 4px; color: var(--ink-3); font-style: normal; font-family: var(--sans); font-size: 10.5px; }
.db-card-props {
  display: flex;
  flex-direction: column;
  gap: var(--card-field-gap, 5px);
  margin: 3px 0 0;
}
/* B 方案（用户指着样图的 B 定的）：一行一个字段，字段名在左、值在右。
   左边那列宽度跟着「字段名字号」一起缩放（可以放 4 个汉字），所以每一行的值都从同一个 x 开始；
   值太长就在右半边换行，chip 多的会自然排成一行。 */
.db-card-prop {
  display: grid;
  grid-template-columns: calc(var(--card-field-label-size, 10px) * var(--card-label-cols, 4.6)) minmax(0, 1fr);
  gap: var(--card-field-label-gap, 8px);
  align-items: baseline;
  min-width: 0;
  color: var(--ink-3);
  font-size: var(--card-field-size, 11.5px);
}
.db-card-prop i { flex: none; min-width: 0; margin-right: 0; font-style: normal; font-family: var(--sans); font-size: var(--card-field-label-size, 10px); color: var(--ink-3); opacity: .85; white-space: nowrap; }
.db-card-prop__v { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-width: 0; color: var(--ink-2); }
.db-card-prop__v .db-chip { font-size: 10px; padding: 1px 6px; }
/* 只有一两个字段时：一行放得下两个就并排。
   宽度按内容算（flex-basis:auto，不拉伸），放不下就自动换行，长值不会被挤窄或截掉；
   并排时**长的靠左、短的靠右**（顺序在 cardItemHTML 里按显示宽度排），行末不再留一块空白。
   并排时字段名那一列改成「按自己名字的宽度」，不再留固定 4.6em 的空隙。 */
.db-card-props--pair { flex-direction: row; flex-wrap: wrap; column-gap: 22px; justify-content: space-between; }
.db-card-props--pair .db-card-prop { flex: 0 1 auto; min-width: 0; grid-template-columns: auto minmax(0, 1fr); }
.db-card-prop--number .db-card-prop__v,
.db-card-prop--rollup .db-card-prop__v,
.db-card-prop--formula .db-card-prop__v { color: var(--ink); font-weight: 500; }
.db-num, .db-date { font-variant-numeric: tabular-nums; }
.db-date { color: var(--ink-3); }
.db-check { color: var(--accent); font-weight: 600; }
.db-card-prop--text .db-text {
  /* 长文本只留一行，尾巴用省略号；完整内容在 title 里，悬停可见 */
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  overflow-wrap: normal; min-width: 0; flex: 0 1 auto; max-width: 100%;
}
.db-card-prop--url .db-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.db-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.db-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}
.db-board__col {
  flex: 0 0 210px;
  min-height: 90px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(23, 23, 23, .018);
  transition: background .12s, border-color .12s;
}
.db-board__col.is-over {
  border-color: rgba(122, 10, 10, .35);
  background: var(--accent-soft);
}
.db-board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 7px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}
.db-board__head b { font-weight: 400; }
.db-board__cards { display: flex; flex-direction: column; gap: 5px; }
.db-board-card {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.db-board-card:hover { border-color: rgba(122, 10, 10, .28); }
.db-board-card b {
  display: block;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.db-board-card span {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
}
.db-board__add {
  width: 100%;
  margin-top: 6px;
  padding: 5px 6px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
  cursor: pointer;
}
.db-board__add:hover { border-color: rgba(122, 10, 10, .28); color: var(--accent); }
.db-board-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-hi);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  animation: cardIn .55s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 65ms);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, border-color .3s;
}
.card:hover {
  transform: translateY(-5px);
  border-color: rgba(122, 10, 10, .18);
  box-shadow: 0 22px 44px -28px rgba(23, 23, 23, .55), 0 2px 6px rgba(23, 23, 23, .04);
}
.card:active { transform: translateY(-2px); }

.card__cover {
  position: relative;
  height: 116px;
  overflow: hidden;
  background:
    radial-gradient(120% 160% at 10% 0%, var(--c3) 0%, transparent 60%),
    linear-gradient(120deg, var(--c1), var(--c2));
}
.card__cover::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .18), transparent 55%);
  opacity: 0;
  transition: opacity .35s;
}
/* 被引用文档有封面图时，卡片封面直接用它（与文档封面同一张）。 */
.card__cover-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.card__cover-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 12, .34), rgba(20, 16, 12, .04) 46%, rgba(20, 16, 12, .36));
}
.card__cover--image .card__glyph { color: rgba(255, 255, 255, .26); z-index: 1; }
.card:hover .card__cover::after { opacity: 1; }
.card__glyph {
  position: absolute;
  right: 12px; bottom: -26px;
  font-size: 108px;
  line-height: 1;
  font-weight: 700;
  color: rgba(255, 255, 255, .18);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.card:hover .card__glyph { transform: translateY(-4px) rotate(-2deg); }
.card__group {
  position: absolute; left: 14px; top: 12px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .8);
}
.card__tags { position: absolute; top: 10px; right: 12px; z-index: 2; display: flex; gap: 4px; }
/* 非文档卡片的封面设置入口：右上角三个点，悬停才显形；**不要底色**，只靠一点投影压住浅色封面 */
.card__cover-menu {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  width: 22px; height: 22px; display: grid; place-items: center;
  padding: 0; border: 0;
  background: transparent; color: rgba(255, 255, 255, .95);
  font: 15px/1 var(--sans); cursor: pointer; opacity: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55), 0 0 1px rgba(0, 0, 0, .4);
  transition: opacity .15s;
}
.card:hover .card__cover-menu,
.card__cover-menu:focus-visible { opacity: 1; }
.card__cover-menu:hover { background: transparent; color: #fff; }
@media (hover: none) { .card__cover-menu { opacity: .85; } }
.card__cover:has(.card__cover-menu) .card__tags { right: 38px; }
.card__tag {
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .18);
  color: rgba(255, 255, 255, .86);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .02em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .15s;
}
.card__tag:hover { background: rgba(0, 0, 0, .34); }

.card__body { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 11px; }
.card__title { margin: 0 0 3px; font-size: var(--card-title-size, 17px); font-weight: 600; letter-spacing: -.005em; color: var(--ink); }
.card__desc {
  margin: 0 0 6px;
  font-size: 13.5px; line-height: 1.62; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; min-height: 21px; }
.chip {
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  border: 1px solid rgba(122, 10, 10, .1);
  color: var(--accent);
  cursor: pointer;
  transition: background .16s, transform .16s, border-color .16s;
}
.chip:hover { background: rgba(122, 10, 10, .14); border-color: rgba(122, 10, 10, .24); transform: translateY(-1px); }
.card__foot {
  display: flex; align-items: center; gap: 9px;
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
}
.card__foot span + span::before { content: "·"; margin-right: 9px; opacity: .7; }

/* 面包屑：封面左上角 / 无封面时正文上方 */
.cover__crumb {
  position: absolute;
  top: 14px; left: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 99px;
  background: rgba(20, 20, 20, .26);
  backdrop-filter: blur(10px) saturate(1.1);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .03em;
  color: rgba(255, 255, 255, .82);
  white-space: nowrap;
  overflow: hidden;
}
.cover__crumb .crumb-link {
  border: 0; padding: 0; background: none;
  color: inherit; font: inherit;
  text-decoration: none;   /* 悬停时才出下划线（见下一行），两端一致 */
  cursor: pointer;
  transition: color .15s;
}
.cover__crumb .crumb-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.cover__crumb i { font-style: normal; color: rgba(255, 255, 255, .45); }

.doc__crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.doc__crumb .crumb-link {
  border: 0; padding: 0; background: none;
  color: var(--ink-3); font: inherit;
  text-decoration: none;   /* 悬停时才出下划线，两端一致 */
  cursor: pointer;
  transition: color .15s;
}
.doc__crumb .crumb-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc__crumb i { font-style: normal; color: rgba(122, 10, 10, .45); }
.doc__crumb + .doc__title, .doc__crumb + .tag-title { margin-top: 2px; }

.pane__progress {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  opacity: .4;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .12s linear;
  pointer-events: none;
}

/* 动效 */
@keyframes coverIn { from { opacity: 0; transform: scale(1.035); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes paneIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.doc { animation: docIn .38s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes docIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.panes.is-split-in .pane:last-child { animation: paneIn .36s cubic-bezier(.2, .8, .2, 1) both; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) .doc,
  html:not([data-motion="on"]) .cover,
  html:not([data-motion="on"]) .hero,
  html:not([data-motion="on"]) .card,
  html:not([data-motion="on"]) .panes.is-split-in .pane:last-child { animation: none !important; }
}



/* ============================== 面板（封面 / emoji） ============================== */

.pop {
  position: fixed;
  z-index: 70;
  width: 320px;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fdfcf8;
  box-shadow: 0 26px 60px -28px rgba(23, 23, 23, .5), 0 2px 8px rgba(23, 23, 23, .06);
  font-family: var(--sans);
  animation: popIn .16s ease both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.99); } to { opacity: 1; transform: none; } }

.pop__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3);
}
.pop__close {
  width: 22px; height: 22px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.pop__close:hover { background: rgba(23, 23, 23, .06); color: var(--ink); }

.pop__row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pop__label { width: 32px; flex: none; font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; }
.pop__range { flex: 1; min-width: 0; accent-color: var(--accent); height: 18px; }
.pop__val { width: 38px; text-align: right; font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

.swatches { display: flex; align-items: center; gap: 6px; flex: 1; }
.swatch {
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid rgba(23, 23, 23, .14);
  border-radius: 7px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  cursor: pointer;
  transition: transform .15s, outline-color .15s;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.is-on { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch--auto {
  width: auto; padding: 0 7px;
  font-family: var(--sans); font-size: 9px;
  letter-spacing: .06em;
  color: var(--ink-3);
  background: rgba(23, 23, 23, .04);
}

.pop__url {
  flex: 1; min-width: 0; height: 27px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 0 8px;
  font-family: var(--sans); font-size: 10.5px;
  color: var(--ink-2);
  background: #fff;
}
.pop__url:focus { outline: 0; border-color: rgba(122, 10, 10, .3); box-shadow: 0 0 0 3px var(--accent-soft); }
.pop__file {
  flex: none;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  font-size: 10px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pop__file:hover { border-color: rgba(122, 10, 10, .28); color: var(--accent); }

.pop__emoji {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.pop__emoji:hover { border-color: rgba(122, 10, 10, .3); transform: translateY(-1px); }
.pop__hint { font-size: 9.5px; color: var(--ink-3); }
.pop__hint--block { margin: -4px 0 10px 42px; }

.cover-styles { display: flex; gap: 6px; flex: 1; }
.cover-style {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 4px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.cover-style:hover { border-color: rgba(122, 10, 10, .25); }
.cover-style.is-on { border-color: rgba(122, 10, 10, .45); box-shadow: 0 0 0 2px var(--accent-soft); }
.cover-style em {
  font-style: normal;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.cover-style__art {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
}
.cover-style__art--hero { background: linear-gradient(130deg, #23262b, #7d828b); }
.cover-style__art--hero::after {
  content: "";
  position: absolute; left: 5px; bottom: 5px;
  width: 58%; height: 3px;
  border-radius: 2px;
  background: rgba(248, 245, 236, .75);
}
.cover-style__art--doc { background: linear-gradient(120deg, #a97355, #e9d8c4); }
.cover-style__art--doc::after {
  content: "";
  position: absolute; right: 5px; bottom: -2px;
  width: 11px; height: 11px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .35);
  transform: rotate(8deg);
}
.cover-style__art--image { background: linear-gradient(160deg, #cdd3c5, #8a9a86); }
.cover-style__art--image::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 12px;
  background: #59684f;
  clip-path: polygon(0 100%, 30% 35%, 55% 70%, 75% 45%, 100% 100%);
  opacity: .65;
}

.pop__foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.pop__reset { border: 0; background: transparent; color: var(--accent); font-size: 10.5px; cursor: pointer; padding: 0; }
.pop__saved { font-size: 9.5px; color: var(--ink-3); }

.pop--emoji { width: 300px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-cell {
  aspect-ratio: 1;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
.emoji-cell:hover { background: rgba(23, 23, 23, .05); }
.emoji-cell.is-on { border-color: rgba(122, 10, 10, .35); background: var(--accent-soft); }
.emoji-custom { display: flex; gap: 6px; margin-top: 10px; }
.emoji-field { display: flex; gap: 6px; margin-top: 2px; }
.emoji-custom input, .emoji-field input {
  flex: 1; min-width: 0; height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 0 8px;
  font-family: var(--sans); font-size: 11px;
  background: #fff;
}
.emoji-custom input:focus, .emoji-field input:focus { outline: 0; border-color: rgba(122, 10, 10, .3); box-shadow: 0 0 0 3px var(--accent-soft); }
.emoji-custom button, .emoji-field button {
  flex: none;
  border: 1px solid rgba(122, 10, 10, .16);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  padding: 0 11px;
  cursor: pointer;
}
.emoji-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 10px;
  border-radius: 9px;
  background: rgba(23, 23, 23, .045);
}
.emoji-tab {
  flex: 1;
  padding: 5px 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.emoji-tab:hover { color: var(--ink-2); }
.emoji-tab.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 23, 23, .08);
}
.emoji-now {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 7px 9px;
  border: 1px dashed var(--line-soft);
  border-radius: 9px;
}
.emoji-now__icon { display: grid; place-items: center; width: auto; min-width: 30px; height: 30px; padding: 0 4px; font-size: 20px; }
.emoji-now__icon .twemoji { width: 24px; height: 24px; }
.emoji-now__meta { font-family: var(--sans); font-size: 9.5px; letter-spacing: .08em; color: var(--ink-3); }
.emoji-hint {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 9.5px;
  line-height: 1.7;
  color: var(--ink-3);
}
.emoji-foot {
  display: flex; justify-content: space-between;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 9.5px; color: var(--ink-3);
}
.emoji-foot button {
  border: 0; background: transparent; padding: 0;
  color: var(--ink-3); font-size: 9.5px;
  text-decoration: underline; cursor: pointer;
}

.emoji-img { width: 1em; height: 1em; vertical-align: -0.12em; object-fit: contain; }
.twemoji {
  width: 1em; height: 1em;
  display: inline-block;
  vertical-align: -0.14em;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.twemoji-fallback { line-height: 1; }

.icon-text {
  display: inline-grid;
  place-items: center;
  font-family: var(--serif);
  font-size: .95em;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  color: inherit;
}
.icon-text[data-len="2"] { font-size: .72em; letter-spacing: .02em; }
.icon-text[data-len="3"] { font-size: .56em; }
.icon-text[data-len="4"] { font-size: .46em; }
.icon-text[data-len="5"], .icon-text[data-len="6"] { font-size: .4em; letter-spacing: .02em; }

/* 英文/数字在图标里用无衬线，并做一次视觉基线校正 */
.icon-text[data-latin="1"] {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .02em;
  transform: translateY(.06em);
}
/* 封面、卡片封面、Hero 上的水印仍然用宋体，不做校正 */
.cover__glyph .icon-text,
.hero__glyph .icon-text,
.card__glyph .icon-text {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -.02em;
  transform: none;
}

.callout__icon .twemoji { width: 18px; height: 18px; }
.tree__glyph .twemoji { width: 12px; height: 12px; }
.rel-item__thumb .twemoji { width: 16px; height: 16px; }
.emoji-cell .twemoji { width: 18px; height: 18px; }
.pop__emoji .twemoji { width: 18px; height: 18px; }

@media (max-width: 900px) {
  .app, .app.is-rel { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--rail);
    background: var(--paper); border-right: 1px solid var(--line);
    z-index: 50; box-shadow: 0 0 40px rgba(23, 23, 23, .12);
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  .app.is-drawer .rail { transform: none; }
  /* 站点（只读）在窄屏要留一个能打开文档树的按钮：工作台有自己的 dock，阅读端没有。 */
  .static #railToggle { display: grid !important; }
  .stage { padding: 0; }
  .panes { gap: 0; }
  .doc { width: calc(100% - 44px); padding-top: 24px; }
  .doc__title { font-size: var(--doc-title-font-size, 32px); }
  .pane + .pane { display: none; }
  .tab__close { opacity: 1; }
  .cover__glyph { font-size: 150px; bottom: -40px; }
  .hero { padding: 36px 28px 30px; }
  .hero__title { font-size: 32px; }
  .hero__glyph { font-size: 220px; bottom: -64px; }
  .cards { grid-template-columns: 1fr; }
  .doc--wide { width: calc(100% - 40px); }
  .tag-title { font-size: 32px; }
  .cover__crumb { top: 10px; left: 10px; padding: 5px 9px; font-size: 10px; }
  .cover__hero { padding: 56px 28px 30px; }
  .cover__hero-title { font-size: 34px; }
  .cover__hero-sub { font-size: 14px; margin: 10px 0 20px; }
  .cover__hero-art { font-size: 200px; bottom: -60px; }
  .pop { width: min(320px, calc(100vw - 24px)); }
  .pop--emoji { width: min(300px, calc(100vw - 24px)); }
}

@media (max-width: 720px) {
  .cards-block__title { font-size: 18px; }
  .db-head-tools { flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .db-view-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .db-view-tabs::-webkit-scrollbar { display: none; }
  .db-views {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .db-views::-webkit-scrollbar { display: none; }
  .db-toolbar { gap: 6px 8px; }
  .db-tools { flex-wrap: wrap; gap: 6px; }
  .db-search { flex: 1 1 150px; width: auto; }
  .db-static-filters { padding: 8px 10px; gap: 6px 10px; }
  .db-static-filter { width: 100%; }
  .db-static-filter + .db-static-filter {
    margin-top: 6px;
    padding-top: 6px;
    padding-left: 0;
    border-left: 0;
    border-top: 1px dashed var(--line-soft);
  }
  .db-static-filter__label { min-width: 40px; }
  .db-static-tools { gap: 6px; }
  .db-static-search { flex: 1 1 100%; max-width: none; }
  .db-static-page { height: 28px; }
  .db-static-pager button { width: 28px; height: 28px; }
  .db-static-tools__count { margin-left: 0; }
  .db-table { max-height: 70vh; }
  .db-list__row { padding: 10px; gap: 8px; }
  .db-card-props { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .pane__body { scroll-behavior: auto; }
}

.cover__hero .doc__tags { margin: 10px 0 12px; }
.cover__hero .tag-pill { background:rgba(255,255,255,.12); color:inherit; border-color:rgba(255,255,255,.2); }

.cover--hero[data-tag-color="glass"] .tag-pill { background:rgba(255,255,255,.18); color:#fff; border-color:rgba(255,255,255,.35); }
.cover--hero[data-tag-color="accent"] .tag-pill { background:#7a0a0a; color:#fff; border-color:#a54444; }
.cover--hero[data-tag-color="sage"] .tag-pill { background:#536c50; color:#fff; border-color:#83987e; }
.cover--hero[data-tag-color="gold"] .tag-pill { background:#8b713e; color:#fff; border-color:#bca675; }

.doc--hero[data-tag-color="accent"] > .doc__tags .tag-pill { background:#7a0a0a; color:#fff; border-color:#a54444; }
.doc--hero[data-tag-color="sage"] > .doc__tags .tag-pill { background:#536c50; color:#fff; border-color:#83987e; }
.doc--hero[data-tag-color="gold"] > .doc__tags .tag-pill { background:#8b713e; color:#fff; border-color:#bca675; }

.hero__cta:hover, .hero__cta:hover span { transform:none; }
.hero__cta[data-cta-size="small"] { padding:6px 13px; font-size:12px; }
.hero__cta[data-cta-size="large"] { padding:13px 25px; font-size:15px; }
.hero__cta[data-cta-style="filled"] { background:#f8f5ec; color:#252525; }
.hero__cta[data-cta-style="filled"]:hover { background:#fff; }
.hero__cta[data-cta-style="text"] { background:transparent; border-color:transparent; padding-left:0; }

.cover--ocean { --c1:#183c50; --c2:#315b6c; --c3:#7899a1; }
.cover--plum { --c1:#44303e; --c2:#735b6e; --c3:#b6a0ad; }
.cover--forest { --c1:#263e31; --c2:#4c6754; --c3:#96aa8f; }
.cover--rose { --c1:#754b4c; --c2:#ad7e7c; --c3:#dfc3b9; }
.cover--hero .cover__hero-title { font-size:clamp(20px,5vw,var(--hero-title-size,62px)); color:var(--hero-title-color,#f8f5ec); }
.cover--hero .cover__hero-sub { font-size:var(--hero-sub-size,15.5px); color:var(--hero-sub-color,#f8f5ec); }
.cover--hero .cover__hero-kicker { font-size:var(--hero-kicker-size,10px); color:var(--hero-kicker-color,#c4c2bb); }
.cover-tags-corner { position:absolute; z-index:4; top:18px; right:56px; max-width:55%; }
.cover-tags-corner .doc__tags { justify-content:flex-end; margin:0; }
.cover--hero[data-tag-shape="square"] .tag-pill { border-radius:3px; }
.cover--hero[data-tag-shape="outline"] .tag-pill { background:transparent; border:1px solid currentColor; }
.cover--hero[data-tag-shape="plain"] .tag-pill { background:transparent; border-color:transparent; padding-left:0; padding-right:4px; }
.hero__cta[data-cta-style="square"] { border-radius:4px; }
.hero__cta[data-cta-style="glass"] { background:rgba(255,255,255,.18); border-color:rgba(255,255,255,.25); }
.hero__cta[data-cta-style="line"] { border:0; border-bottom:1px solid currentColor; border-radius:0; background:transparent; padding-left:0; padding-right:0; }
.hero__cta span:empty { display:none; }

.doc--hero[data-tag-shape="square"] > .doc__tags .tag-pill { border-radius:3px; }
.doc--hero[data-tag-shape="outline"] > .doc__tags .tag-pill { background:transparent; border:1px solid currentColor; }
.doc--hero[data-tag-shape="plain"] > .doc__tags .tag-pill { background:transparent; border-color:transparent; }

/* 用户可选的网站文字样式；默认值保持原来的纸感。
   注意顺序：可变字体（Noto …）必须排在前面。本机同时装了静态的
   "Source Han Serif SC"，它没有 wght 轴，排前面会让字重调节完全失效。 */
html[data-site-font="sans"] { --serif: "Microsoft YaHei", "PingFang SC", sans-serif; --ui-serif: "Microsoft YaHei", "PingFang SC", sans-serif; }
html[data-site-font="system"] { --serif: system-ui, sans-serif; --ui-serif: system-ui, sans-serif; }
.protyle-wysiwyg { font-size:var(--body-font-size,16px); }
.protyle-wysiwyg .p, .protyle-wysiwyg .list { line-height:var(--body-line-height,1.5); }

html[data-site-font="source-serif"] { --serif: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", "思源宋体", "Songti SC", serif; --ui-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif; }
html[data-site-font="source-sans"] { --serif: "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Source Han Sans CN", "思源黑体", "Microsoft YaHei", sans-serif; --ui-serif: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }

.db-table__row[hidden],
.db-group[hidden] { display: none !important; }

/* 图片封面不添加黑色渐变遮罩，保留原图亮度。 */
.cover--image::after, .hero--image::after, .cover--hero.cover--image::after { background:none; }

/* 六级标题：编号只用于显示，不改写思源正文。编号字号跟标题一致（显式写 inherit，避免被继承链上的字号带跑）。 */
.protyle-wysiwyg :is(.h1,.h2,.h3,.h4,.h5,.h6)[data-heading-number]::before { content: attr(data-heading-number) "  "; color:var(--accent); margin-right:.28em; font-variant-numeric:tabular-nums; font-size:var(--heading-number-size, inherit); line-height:inherit; }
.protyle-wysiwyg .h1 { margin:0; font-size:28px; line-height:1.35; font-weight:700; color:var(--ink); }
/* 跳转到某个块（引用 / 关系 / 大纲）时，块停在视口顶部并留一点空隙，不要顶死。 */
.protyle-wysiwyg .eblock,
.protyle-wysiwyg [data-id],
.db-record-target,
#blocks [id] { scroll-margin-top: 20px; }

/* 跳转落点高亮：点引用块 / 块链接 / 大纲后，目标块闪一下，1.6 秒后自动消失。
   用一层「向外扩开的浮动框」（::after 绝对定位）来画，所以框比正文略大、文字四周
   留出内边距，看起来像一张卡片；因为不占布局，块间距和排版一个像素都不动。
   和左栏文档树（treeLocate）、数据库卡片行同一个节奏。 */
.protyle-wysiwyg .eblock.is-located { z-index: 1; }
.protyle-wysiwyg .eblock.is-located::after {
  content: "";
  position: absolute;
  inset: -12px -26px;
  min-height: 44px;
  border-radius: 14px;
  pointer-events: none;
  animation: blockLocate 1.6s ease;
}
@keyframes blockLocate {
  0%, 100% { background: transparent; box-shadow: inset 0 0 0 0 rgba(122, 10, 10, 0); }
  14%, 62% {
    background: rgba(122, 10, 10, .05);
    box-shadow: inset 0 0 0 2px rgba(122, 10, 10, .26);
  }
}
/* 系统开了「减少动态效果」：不做闪烁，静态描边停 1.6 秒 */
@media (prefers-reduced-motion: reduce) {
  .protyle-wysiwyg .eblock.is-located::after {
    animation: none;
    background: rgba(122, 10, 10, .05);
    box-shadow: inset 0 0 0 2px rgba(122, 10, 10, .26);
  }
}
.protyle-wysiwyg .h4 { margin:0; font-size:17px; line-height:1.5; font-weight:600; color:var(--ink); }
.protyle-wysiwyg .h5 { margin:0; font-size:15.5px; line-height:1.5; font-weight:600; color:var(--ink); }
.protyle-wysiwyg .h6 { margin:0; font-size:14px; line-height:1.5; font-weight:600; color:var(--ink-2); }
/* 六级标题的字号与思源一致（1.75 / 1.55 / 1.38 / 1.25 / 1.13 / 1em），
   跟着正文字号缩放；不再提供逐级自定义（文档标题仍可单独设置）。 */
.protyle-wysiwyg .h1 { font-size:1.75em; }
.protyle-wysiwyg .h2 { font-size:1.55em; }
.protyle-wysiwyg .h3 { font-size:1.38em; }
.protyle-wysiwyg .h4 { font-size:1.25em; }
.protyle-wysiwyg .h5 { font-size:1.13em; }
.protyle-wysiwyg .h6 { font-size:1em; }
/* 标题不再有专属的上下间距：和正文、分割线、数据库一样，只吃统一的 --block-gap。 */

/* 正文普通超链接：常态跟正文同色，只用一条细实线下划线；悬停才变成暗红并加深下划线（不再有底色）。 */
.protyle-wysiwyg a[href]:not(.ref):not(.block-hyperlink):not([href^="siyuan://blocks/"]):not(.tag-inline):not(.tag-pill) {
  color: inherit;
  border-bottom: 0;
  text-decoration: underline;
  text-decoration-color: rgba(122, 10, 10, .45);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
.protyle-wysiwyg a[href]:not(.ref):not(.block-hyperlink):not([href^="siyuan://blocks/"]):not(.tag-inline):not(.tag-pill):hover {
  color: var(--accent);
  background: transparent;
  text-decoration-color: var(--accent);
}
/* 数据库里的卡片 / 表格行 / 标题本身就是链接：一律不要下划线（包括波浪线） */
.cards-block a[href],
.cards-block a[href]:hover,
.cards-block a[href]:focus,
.cards-block a[href]:active { text-decoration: none !important; border-bottom: 0; }

/* 文档标题 / 标签 / 正文三段间距，分别由工作台设置控制。 */
.doc__title { margin-bottom: var(--title-body-gap, 12px); }
.doc--notags .doc__title { margin-bottom: var(--title-body-gap, 12px); }
.doc:not(.doc--hero) > .doc__title:has(+ .doc__tags) { margin-bottom: var(--title-tag-gap, 8px); }
.doc:not(.doc--hero) > .doc__title + .doc__tags { margin-bottom: var(--tag-body-gap, var(--title-body-gap, 12px)); }
.document-icon { display:inline-block; width:1em; height:1em; vertical-align:-.13em; flex:none; }
.tree__glyph .document-icon, .tab__icon .document-icon, .db-list__glyph .document-icon { width:14px; height:14px; }
.cover__glyph .document-icon, .cover__hero-art .document-icon, .card__glyph .document-icon { width:.8em; height:.8em; }

/* 思源里的行内字号照原样保留（2026-11-01 用户确认：富文本要同步过来）。
   标题序号的字号由 JS 按「标题里最大那段文字」单独设定，见 --heading-number-size。 */
.protyle-wysiwyg :is(.bq,.callout__body) { line-height:var(--body-line-height,1.5); }
.protyle-wysiwyg > :is(.h1,.h2,.h3,.h4,.h5,.h6):first-child { margin-top:0; }
.protyle-wysiwyg > .eblock:first-child > :is(.h1,.h2,.h3,.h4,.h5,.h6) { margin-top:0; }
/* 统一块间距：所有块（段落 / 标题 / 分割线 / 数据库 / 表格 / 图片 / 引用…）之间的
   垂直距离只由 --block-gap 决定。各块自身的外边距一律清零，否则会叠加出不同的间距
   （以前段落 4px、标题 7/24px、分割线 20/40px，同一个值调不出统一节奏）。 */
.protyle-wysiwyg > * + * { margin-top: var(--block-gap, 10px); }
/* .eblock 在 studio.css 里写了 margin:0（两端共用），特异性相同、后加载会盖掉上面那行，
   所以这里用 > .eblock + .eblock 把它压回来。 */
.protyle-wysiwyg > .eblock + .eblock { margin-top: var(--block-gap, 10px); }
.protyle-wysiwyg .eblock > :not(.eblock__tools) { margin-block: 0; }
/* 引用 / 提示框 / 超级块内部的块也用同一个间距 */
.protyle-wysiwyg :is(.bq, .callout, .sb) > * + * { margin-top: var(--block-gap, 10px); }
.db-title--link { border:0; padding:0; background:none; text-align:left; cursor:pointer; color:inherit; font:inherit; }

/* 阅读端多级文档目录。 */
.tree__branch { margin:0; }
.tree__branch > summary { list-style:none; padding-left:calc(8px + var(--tree-depth, 0) * 14px); }
.tree__branch > summary::-webkit-details-marker { display:none; }
.tree__branch > summary .tree__caret { flex:none; width:13px; height:13px; display:grid; place-items:center; color:var(--ink-3); }
.tree__branch[open] > summary .tree__caret { transform:rotate(90deg); }
.tree__branch-link { display:flex; align-items:center; flex:1; min-width:0; gap:8px; padding:0; border:0; background:transparent; color:inherit; font:inherit; text-align:left; text-decoration:none; cursor:pointer; }
.tree__nested-leaf { padding-left:calc(8px + var(--tree-depth, 0) * 14px); }

.tree__nested-leaf > .tree__caret { flex:none; width:13px; height:13px; opacity:0; }

/* 阅读端把工作台里的按钮换成了 <a>：这些元素两端都不该有下划线，颜色也不该吃浏览器默认值。
   只用单个类名（最低优先级）写，:hover 的下划线规则仍然能覆盖它。 */
.rel-item { color: var(--ink-2); }
.brand, .tree__item, .tool, .rel-item, .card, .tree__branch-link, .tree__folder-name,
.icon, .foot-toggle, .tree__tags-bottom .tree__item { text-decoration: none; }

/* ---------- 字重：正文与标题分开（300–800，跟随可变字体的 wght 轴） ---------- */
.protyle-wysiwyg { font-weight: var(--body-weight, 400); }
.protyle-wysiwyg .h1,
.protyle-wysiwyg .h2,
.protyle-wysiwyg .h3,
.protyle-wysiwyg .h4,
.protyle-wysiwyg .h5,
.protyle-wysiwyg .h6,
.protyle-wysiwyg .doc__title { font-weight: var(--heading-weight, 600); }

/* ============================== 灯箱：放大看图 ==============================
   点正文图片 / 封面大图 → 从原图位置长成全屏；左右连续翻（循环），底部缩略图条直接跳，
   Ctrl + 滚轮以鼠标为锚点缩放。两端共用（工作台 + 生成站）。 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  /* 深底带一点暖调，和纸面气质一致；不透明，避免正文透上来干扰看片 */
  background: #121110;
  overscroll-behavior: contain;
  user-select: none;
}
.lightbox[hidden] { display: none; }

/* 暗角：四周压暗，视线聚到图片上 */
.lightbox__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, .5) 100%);
}
body.is-lightbox { cursor: default; }
/* 纸面颗粒（body::after，z-index 9999）在灯箱里会糊在照片上：打开时先摘掉 */
body.is-lightbox::after { opacity: 0; }
/* 封面 / 正文图片给个「可放大」的手型提示 */
.cover__img, .figure img { cursor: zoom-in; }

/* 顶部：计数 · 尺寸 · 关闭，收进居中的胶囊条 */
.lightbox__bar {
  position: relative;
  z-index: 4;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 18px 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: .05em;
  color: rgba(255, 255, 255, .66);
  pointer-events: none;
}
.lightbox__bar > * { pointer-events: auto; }
.lightbox__count,
.lightbox__size {
  font-variant-numeric: tabular-nums;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  white-space: nowrap;
}
.lightbox__count:empty,
.lightbox__size:empty { display: none; }
.lightbox__btn {
  width: 28px; height: 27px;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .3); color: #fff; }

/* 中间：舞台 + 两侧箭头 */
.lightbox__frame {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.lightbox__stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 84px 10px;
  overflow: hidden;
}
/* 生长动画的过渡由 JS 写在行内（必须先固定起点、下一帧再放开），这里不设 transition 以免打架 */
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .62);
  cursor: zoom-in;
  opacity: 0;
  transition: opacity .16s ease;
  -webkit-user-drag: none;
}
.lightbox__img.is-ready { opacity: 1; }
/* 交叉淡化：切图瞬间先淡出，换完地址再淡入 */
.lightbox.is-swapping .lightbox__img { opacity: 0; }
/* 放大后（1:1 起）舞台可滚动，按住可拖动。
   注意这里必须 flex-start：居中会让溢出部分落到负向坐标，scrollLeft 到不了，左半边永远看不到。 */
.lightbox.is-zoomed .lightbox__stage {
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 4px 84px 10px;
}
.lightbox__img.is-actual {
  max-width: none;
  max-height: none;
  /* 比舞台小的时候仍然居中，比舞台大时从左上开始排，滚动范围才完整 */
  margin: auto;
  cursor: grab;
  border-radius: 0;
  box-shadow: none;
}
.lightbox.is-panning .lightbox__img.is-actual { cursor: grabbing; }

/* 加载中：底部一条很淡的细进度条，不转圈 */
.lightbox__loading {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 120px;
  height: 2px;
  margin-left: -60px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
}
.lightbox__loading[hidden] { display: none; }
.lightbox__loading i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .62);
  animation: lightboxLoad 1.1s ease-in-out infinite;
}
@keyframes lightboxLoad {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

/* 左右箭头 */
.lightbox__nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 42px;
  display: grid; place-items: center;
  padding: 0 0 3px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  background: rgba(20, 20, 20, .5);
  color: rgba(255, 255, 255, .82);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .18s, background .18s, border-color .18s, color .18s;
}
.lightbox__nav[hidden] { display: none; }
.lightbox__nav:hover,
.lightbox__nav:focus-visible { opacity: 1; background: rgba(40, 40, 40, .82); border-color: rgba(255, 255, 255, .3); color: #fff; }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

/* 底部：图注 + 缩略图条 */
.lightbox__foot {
  position: relative;
  z-index: 4;
  flex: none;
  padding: 6px 18px 14px;
}
/* 操作提示：贴在图片下沿之上（用 JS 按底部块实际高度算 bottom，避免压住图注 / 缩略图） */
.lightbox__hint {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 96px; /* JS 会按底部块的实际高度再校准一次 */
  transform: translateX(-50%) translateY(6px);
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  /* 深底半透明：可能浮在图片上，要保证任何底色下都读得清 */
  background: rgba(12, 12, 12, .78);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .42);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .05em;
  color: rgba(255, 255, 255, .86);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
.lightbox__hint.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.lightbox__caption {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .68);
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lightbox__caption[hidden] { display: none; }

/* 缩略图条：两侧渐隐，暗示还能滚 */
.lightbox__thumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 4px;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.lightbox__thumbs[hidden] { display: none; }
.lightbox__thumbs::-webkit-scrollbar { height: 5px; }
.lightbox__thumbs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 99px; }
.lightbox__thumb {
  flex: none;
  width: 50px; height: 50px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, .05);
  cursor: pointer;
  opacity: .48;
  transition: opacity .16s, border-color .16s, transform .16s, box-shadow .16s;
}
.lightbox__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox__thumb:hover { opacity: .8; transform: scale(1.06); }
.lightbox__thumb.is-on {
  opacity: 1;
  border-color: rgba(255, 255, 255, .82);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3), 0 10px 24px rgba(0, 0, 0, .45);
}

/* 键盘焦点：深底上要看得见 */
.lightbox :is(button, [tabindex]):focus-visible {
  outline: 2px solid rgba(255, 255, 255, .8);
  outline-offset: 2px;
}

/* 手机上收窄：箭头贴边、缩略图变小 */
@media (max-width: 820px) {
  .lightbox__stage,
  .lightbox.is-zoomed .lightbox__stage { padding: 2px 8px 8px; }
  .lightbox__nav { width: 36px; height: 36px; font-size: 18px; }
  .lightbox__nav--prev { left: 6px; }
  .lightbox__nav--next { right: 6px; }
  .lightbox__thumb { width: 42px; height: 42px; }
  .lightbox__hint { bottom: 88px; font-size: 10px; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
}

/* 系统开了「减少动态效果」：不做生长、不做交叉淡化 */
@media (prefers-reduced-motion: reduce) {
  .lightbox__img { transition: none; }
  .lightbox__loading i { animation: none; width: 100%; }
  .lightbox__thumb { transition: none; }
  .lightbox__thumb:hover { transform: none; }
  .lightbox__thumb.is-on { transform: none; }
  .lightbox__hint { transition: none; }
}
