/* AI 版 Obsidian · 界面样式
 * 默认「玻璃」配色取自个人网站 liyucheng.me（268_我的个人网站/me.html）：
 *   #fbfbfd 白底、半透明玻璃卡（白描边 + 细黑轮廓 + 内高光）、
 *   墨黑选中胶囊、#ff9500 燃烧橙点缀、Sora 英文与数字、800/900 粗标题
 * 另保留「简约」（苹果式设计规范）与「秋日 Topaz」（仓库在用的 Blue Topaz）两套配色
 */
@font-face { font-family: 'Sora'; font-weight: 400; font-display: swap; src: url(../vendor/fonts/sora-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 600; font-display: swap; src: url(../vendor/fonts/sora-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url(../vendor/fonts/sora-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 800; font-display: swap; src: url(../vendor/fonts/sora-latin-800-normal.woff2) format('woff2'); }

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro SC', 'Segoe UI', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --en: 'Sora', var(--font);
  --mono: 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --ui-size: 14px;
  --note-size: 18px;
  --line-width: 800px;
  --ribbon-w: 52px;
  --gap: 10px;
  --radius-panel: 22px;
  --on-primary: #fff;
  --accent: #ff9500;
  --accent-ink: #c86a00;
  --accent-soft: rgba(255, 149, 0, 0.12);
  --selection: rgba(0, 113, 227, 0.18);
  --link-line: color-mix(in srgb, var(--primary) 40%, transparent);
  --h-color: var(--text);
  --h2-color: var(--text);
  --graph-line: rgba(0, 0, 0, 0.14);
  --graph-node: #aeaeb2;
  --mark-bg: rgba(255, 214, 10, 0.42);
  --glass: var(--panel);
  --glass-strong: var(--panel);
  --glass-solid: var(--panel);
  --glass-border: transparent;
  --glass-outline: transparent;
  --glass-hi: 0 0 0 transparent;
  --blur: none;
  --side-bg: var(--bg);
  --heat-1: #9be9a8; --heat-2: #40c463; --heat-3: #30a14e; --heat-4: #216e39;
  --gradient-em: linear-gradient(92deg, var(--primary), var(--primary));
}
:root[data-theme='dark'] { --graph-line: rgba(255, 255, 255, 0.16); --graph-node: #636366; --mark-bg: rgba(255, 214, 10, 0.3); }

/* ---------- 玻璃（个人网站） ---------- */
:root[data-scheme='glass'] {
  --bg: #fbfbfd; --panel: rgba(255, 255, 255, 0.72); --panel-2: rgba(255, 255, 255, 0.55); --canvas: rgba(246, 246, 249, 0.7);
  --fill: rgba(120, 120, 128, 0.1); --fill-hover: rgba(120, 120, 128, 0.18);
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #86868b; --text-4: #aeaeb2;
  --line: rgba(0, 0, 0, 0.08); --line-strong: rgba(0, 0, 0, 0.14); --border: rgba(0, 0, 0, 0.08); --border-strong: rgba(0, 0, 0, 0.14);
  --hover: rgba(0, 0, 0, 0.045); --active: rgba(0, 0, 0, 0.08);
  --primary: #1d1d1f; --primary-hover: #000; --primary-soft: rgba(29, 29, 31, 0.07); --on-primary: #fff;
  --selection: #ffd9b0;
  --link-line: rgba(255, 149, 0, 0.6);
  --mark-bg: rgba(255, 149, 0, 0.22);
  --glass: rgba(255, 255, 255, 0.42); --glass-strong: rgba(255, 255, 255, 0.74); --glass-solid: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.7); --glass-outline: rgba(0, 0, 0, 0.09);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --blur: blur(22px) saturate(1.6);
  --side-bg: transparent;
  --shadow-card: 0 10px 34px -16px rgba(0, 0, 0, 0.14);
  --shadow-lift: 0 18px 40px -16px rgba(0, 0, 0, 0.2);
  --shadow: 0 40px 110px -40px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 18px 48px -14px rgba(0, 0, 0, 0.22);
  --heat-1: #ffe2b8; --heat-2: #ffbf70; --heat-3: #ff9500; --heat-4: #d97706;
  --gradient-em: linear-gradient(92deg, #ff9500, #ff2d55 55%, #af52de);
  --graph-node: #b8b8bf;
}
:root[data-scheme='glass'][data-theme='dark'] {
  --bg: #0a0a0c; --panel: rgba(30, 30, 34, 0.72); --panel-2: rgba(44, 44, 48, 0.55); --canvas: rgba(18, 18, 21, 0.7);
  --fill: rgba(120, 120, 128, 0.2); --fill-hover: rgba(120, 120, 128, 0.3);
  --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93; --text-4: #636366;
  --line: rgba(255, 255, 255, 0.09); --line-strong: rgba(255, 255, 255, 0.16); --border: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.06); --active: rgba(255, 255, 255, 0.1);
  --primary: #f5f5f7; --primary-hover: #fff; --primary-soft: rgba(255, 255, 255, 0.09); --on-primary: #1d1d1f;
  --selection: rgba(255, 149, 0, 0.32);
  --accent: #ff9f0a; --accent-ink: #ffb340;
  --glass: rgba(28, 28, 32, 0.5); --glass-strong: rgba(28, 28, 32, 0.74); --glass-solid: rgba(36, 36, 40, 0.96);
  --glass-border: rgba(255, 255, 255, 0.08); --glass-outline: rgba(0, 0, 0, 0.5);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-card: 0 10px 34px -16px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  --shadow: 0 40px 110px -40px rgba(0, 0, 0, 0.8);
  --shadow-pop: 0 18px 48px -14px rgba(0, 0, 0, 0.7);
  --graph-node: #5a5a60; --graph-line: rgba(255, 255, 255, 0.14);
}

/* ---------- 秋日 Topaz ---------- */
:root[data-scheme='topaz'] {
  --bg: #f1ebe0; --panel: #fbf8f2; --panel-2: #f4eee3; --fill: #e8dfcd; --fill-hover: #ded3bd; --canvas: #efe8db;
  --text: #3b3127; --text-2: #6c5f50; --text-3: #8d806e; --text-4: #b3a796;
  --line: rgba(90, 64, 30, 0.1); --line-strong: #d9ccb6; --border: #e3d8c4; --hover: rgba(90, 64, 30, 0.05); --active: rgba(90, 64, 30, 0.09);
  --primary: #b4612a; --primary-hover: #a5561f; --primary-soft: #f5e4d3;
  --accent: #b4612a; --accent-ink: #9a4f1d; --accent-soft: #f5e4d3;
  --h-color: #8f4a1f; --h2-color: #a9592a; --selection: #f2d6bc;
  --shadow-card: 0 1px 2px rgba(80, 50, 20, 0.05), 0 4px 16px rgba(80, 50, 20, 0.05);
  --graph-node: #c2b29b; --graph-line: rgba(90, 64, 30, 0.16);
}
:root[data-scheme='topaz'][data-theme='dark'] {
  --bg: #1b1815; --panel: #24201c; --panel-2: #2c2723; --fill: #342e28; --fill-hover: #3e3730; --canvas: #1f1c18;
  --text: #ede3d4; --text-2: #bcae9b; --text-3: #978a78; --text-4: #6f6457;
  --line: rgba(255, 235, 205, 0.09); --line-strong: #4a4239; --border: #3d362f; --hover: rgba(255, 235, 205, 0.05); --active: rgba(255, 235, 205, 0.09);
  --primary: #e3904e; --primary-hover: #eda265; --primary-soft: rgba(227, 144, 78, 0.16); --on-primary: #1b1815;
  --accent: #e3904e; --accent-ink: #f0a868;
  --h-color: #f0a868; --h2-color: #e3904e; --selection: rgba(227, 144, 78, 0.3);
  --shadow-card: 0 0 0 1px rgba(255, 235, 205, 0.06);
  --graph-node: #6f6457; --graph-line: rgba(255, 235, 205, 0.14);
}

::selection { background: var(--selection); color: inherit; }
body { font-family: var(--font); font-size: var(--ui-size); letter-spacing: 0; background: var(--bg); }
.tabular, .tree-count, .count, .stat-num, .hm-sum, .st-item { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.14); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.26); }
:root[data-theme='dark'] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); }

/* 玻璃材质：浮在底色上的面板共用 */
.glass, .sidebar, .workspace, .modal, .popover, .card, .vault-btn, .cm-tooltip, .toast-host .toast {
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}

#app { position: relative; z-index: 1; height: 100%; }

/* ---------- 通用控件 ---------- */
.btn { height: 34px; padding: 0 18px; font-size: 13.5px; font-weight: 600; letter-spacing: .02em; background: var(--fill); color: var(--text); border-radius: 99px; }
.btn:hover { background: var(--fill-hover); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { height: 30px; padding: 0 13px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; }
.input { height: 36px; padding: 0 13px; font-size: 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--glass-solid); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
:root:not([data-scheme='glass']) .input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.chip { height: 32px; padding: 0 15px; font-size: 13px; font-weight: 500; letter-spacing: .02em; border-radius: 99px; color: var(--text-2); background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); }
.chip:hover { color: var(--text); }
.chip.active { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.popover { background: var(--glass-solid); border-radius: 16px; box-shadow: var(--shadow-pop), 0 0 0 1px var(--glass-outline); padding: 6px; }
.menu { min-width: 210px; }
.menu-item { height: 34px; font-size: 13.5px; border-radius: 9px; }
.menu-item:hover { background: var(--primary); color: var(--on-primary); }
.menu-item:hover .menu-icon, .menu-item:hover .menu-shortcut { color: color-mix(in srgb, var(--on-primary) 80%, transparent); }
.menu-header { font-family: var(--en); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); }
.modal-overlay { background: rgba(120, 120, 128, 0.2); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); align-items: flex-start; padding-top: 11vh; }
.modal { background: var(--glass-solid); border-radius: 26px; box-shadow: var(--shadow), 0 0 0 1px var(--glass-outline); animation: panelUp .45s var(--ease-out); }
.modal-header { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; padding: 22px 22px 6px 26px; }
.modal-body { padding: 14px 26px; }
.modal-footer { padding: 14px 26px 24px; }
.modal-msg { font-size: 14.5px; color: var(--text-2); }
.form-label { font-size: 14px; color: var(--text-2); }
.toast { font-size: 13.5px; background: rgba(29, 29, 31, 0.9); }
.toast::before { background: var(--accent); }
.eyebrow, .props-head, .home-eyebrow, .set-eyebrow { font-family: var(--en); font-size: 10.5px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--accent-ink); }
.em { background: var(--gradient-em); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 布局 ---------- */
.workspace-row { flex: 1; min-height: 0; display: flex; padding: var(--gap) var(--gap) var(--gap) 0; gap: 0; }
.ribbon { width: var(--ribbon-w); flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; }
.ribbon-btn { width: 38px; height: 38px; border: 0; background: transparent; border-radius: 12px; color: var(--text-2); display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s, transform .2s var(--spring); }
.ribbon-btn:hover { background: var(--glass-strong); color: var(--text); box-shadow: 0 0 0 1px var(--glass-outline), var(--glass-hi); transform: translateY(-1px); }
.ribbon-btn:active { transform: scale(.92); }
.ribbon-spacer { flex: 1; }
.ribbon-logo { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-family: var(--en); font-weight: 800; font-size: 15px; color: var(--on-primary); background: var(--primary); margin-bottom: 6px; letter-spacing: -0.02em; }

.sidebar { flex: none; display: flex; flex-direction: column; min-width: 0; background: var(--glass); border-radius: var(--radius-panel); box-shadow: 0 0 0 1px var(--glass-outline), var(--shadow-card), var(--glass-hi); overflow: hidden; }
:root:not([data-scheme='glass']) .sidebar { background: var(--side-bg); box-shadow: none; border-radius: 0; }
.sidebar.is-collapsed { display: none; }
.sidebar-left.is-collapsed + .resizer, .resizer:has(+ .sidebar-right.is-collapsed) { display: none; }
.resizer { width: var(--gap); flex: none; cursor: col-resize; position: relative; }
.resizer::after { content: ''; position: absolute; top: 30%; bottom: 30%; left: calc(50% - 1px); width: 2px; border-radius: 2px; background: transparent; transition: background .2s; }
.resizer:hover::after, body.is-resizing .resizer::after { background: var(--accent); }
body.is-resizing { cursor: col-resize; user-select: none; }

.side-tabs { display: flex; gap: 2px; margin: 10px 10px 8px; padding: 3px; flex: none; background: var(--fill); border-radius: 12px; }
.side-tab { flex: 1; min-width: 0; height: 30px; border: 0; background: transparent; border-radius: 9px; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; font-weight: 600; transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.side-tab:hover { color: var(--text); }
.side-tab.active { background: var(--glass-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .04); }
:root[data-theme='dark'] .side-tab.active { background: var(--fill-hover); }
.side-body { flex: 1; min-height: 0; position: relative; }
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; }
.panel[hidden] { display: none; }
.panel-scroll { flex: 1; min-height: 0; overflow: auto; }
.panel-pad { padding: 4px 12px 8px; }
.panel-bar { display: flex; justify-content: center; gap: 4px; padding: 0 8px 6px; flex: none; }
.vault-btn { margin: 6px 10px 10px; height: 44px; border: 0; border-radius: 14px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--glass-outline), var(--glass-hi); display: flex; align-items: center; gap: 9px; padding: 0 14px; color: var(--text); font-weight: 700; font-size: 14px; text-align: left; transition: transform .25s, box-shadow .25s; }
.vault-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--glass-outline), var(--shadow-card); }
.vault-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; margin-left: 8px; vertical-align: middle; letter-spacing: .04em; }
.vault-btn .pill { margin-left: 0; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--glass-strong); border-radius: 24px; box-shadow: 0 0 0 1px var(--glass-outline), var(--shadow-card), var(--glass-hi); overflow: hidden; }
:root:not([data-scheme='glass']) .workspace { background: var(--panel); }

/* 标签栏 */
.tabbar { height: 50px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { height: 34px; min-width: 100px; max-width: 230px; display: flex; align-items: center; gap: 7px; padding: 0 5px 0 12px; border-radius: 99px; color: var(--text-2); cursor: default; flex: none; transition: background .2s, color .2s, box-shadow .2s; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--glass-solid); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 4px 14px -6px rgba(0, 0, 0, 0.12); }
.tab.is-new { animation: tabIn .3s var(--spring); }
.tab-ico { display: flex; opacity: .8; }
.tab.active .tab-ico { color: var(--accent); opacity: 1; }
.tab-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.tab-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s, background .15s; }
.tab:hover .tab-x, .tab.active .tab-x { opacity: .6; }
.tab-x:hover { background: var(--active); opacity: 1 !important; }
.tab-add { width: 30px; height: 30px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.tab-add:hover { background: var(--hover); color: var(--text); }
.tabbar-spacer { flex: 1; }
.tabbar-right { flex: none; }
@keyframes tabIn { from { transform: scale(.85); opacity: 0; } }

.view-host { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.view-header { height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px 0 24px; }
.crumbs { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.crumb { cursor: default; overflow: hidden; text-overflow: ellipsis; }
.crumb:not(.is-last):hover { color: var(--text); }
.crumb.is-last { color: var(--text-2); font-weight: 600; }
.crumb-sep { opacity: .45; }
.crumb-ico { display: flex; color: var(--accent); }
.view-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.view-scroll { flex: 1; min-height: 0; overflow: auto; }
.view-content { padding: 22px 64px 160px; margin: 0 auto; }
.readable .view-content { max-width: calc(var(--line-width) + 128px); }
.view-content.wide { max-width: none; }
.view-loading { flex: 1; display: flex; align-items: center; justify-content: center; }
.statusbar { height: 32px; flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 18px; padding: 0 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
.st-item { display: inline-flex; align-items: center; gap: 5px; }
.st-save .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.st-save.is-dirty .dot, .st-save.is-saving .dot { background: var(--accent); }
.st-save.is-error .dot { background: var(--danger); }

/* 分段控件 */
.seg { display: inline-flex; background: var(--fill); border-radius: 99px; padding: 3px; gap: 2px; }
.seg-btn { height: 28px; border: 0; background: transparent; border-radius: 99px; padding: 0 12px; display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 13px; font-weight: 600; transition: background .2s, color .2s, box-shadow .2s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--primary); color: var(--on-primary); }
:root:not([data-scheme='glass']) .seg-btn.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.04); }
.btn-ai { gap: 5px; background: var(--accent-soft); color: var(--accent-ink); }
.btn-ai:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- 笔记 ---------- */
.inline-title { display: block; width: 100%; border: 0; outline: none; background: transparent; padding: 12px 0 8px; font-size: calc(var(--note-size) * 1.9); font-weight: 800; letter-spacing: -0.02em; color: var(--h-color); line-height: 1.25; font-family: var(--font); }
.note-cover { float: right; margin: 16px 0 12px 32px; }
.note-cover img { display: block; width: 140px; max-height: 210px; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow-lift), 0 0 0 1px var(--line); }
.note-cover:empty { display: none; }
.view-content:has(.note-cover img) .inline-title { width: calc(100% - 180px); }
.properties { margin: 6px 0 22px; }
.properties:empty { display: none; }
.props-box { font-size: 14.5px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.props-box:not(:has(.prop-row)) { border: 0; padding: 0; }
.props-head { margin: 8px 0 8px; }
.prop-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; min-height: 36px; gap: 10px; }
.prop-key { display: flex; align-items: center; gap: 8px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prop-values { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; align-items: center; padding: 2px 8px; border-radius: 10px; }
.prop-values.is-editable { cursor: text; }
.prop-values.is-editable:hover { background: var(--hover); }
.prop-chip { display: inline-flex; align-items: center; height: 27px; padding: 0 12px; border-radius: 99px; background: var(--fill); font-size: 13.5px; color: var(--text); }
a.prop-chip.internal-link { color: var(--text); background: var(--accent-soft); text-decoration: none !important; }
.prop-text { color: var(--text); }
.prop-input { height: 32px; width: 100%; }
.prop-add { margin-top: 4px; border: 0; background: transparent; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 8px; border-radius: 9px; font-size: 13.5px; }
.prop-add:hover { background: var(--hover); color: var(--text); }

.view-note .editor-host { display: none; }
.view-note[data-mode='edit'] .editor-host, .view-note[data-mode='source'] .editor-host { display: block; }
.view-note[data-mode='edit'] .note-body > .markdown-rendered, .view-note[data-mode='source'] .note-body > .markdown-rendered { display: none; }
.view-note.is-ai-writing .view-header { position: relative; }
.view-note.is-ai-writing .view-header::after { content: 'AI 正在写入…'; position: absolute; left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
.md-editor { display: block; width: 100%; min-height: 60vh; border: 0; outline: none; resize: none; background: transparent; color: var(--text); font-family: var(--font); font-size: var(--note-size); line-height: 1.85; padding: 4px 0; }
.code-editor { font-family: var(--mono); font-size: 14px; line-height: 1.7; min-height: 80vh; }

/* ---------- CodeMirror：实时预览 / 源码 ---------- */
.cm-editor { background: transparent; color: var(--text); font-size: var(--note-size); }
.cm-editor.cm-focused { outline: none; }
.cm-editor .cm-scroller { font-family: var(--font); line-height: 1.85; overflow: visible !important; }
.cm-editor .cm-content { padding: 2px 0 30vh; caret-color: var(--accent); }
.cm-editor .cm-line { padding: 0; }
.cm-editor .cm-cursor, .cm-editor .cm-dropCursor { border-left: 2px solid var(--accent); }
.cm-editor .cm-selectionBackground, .cm-editor.cm-focused .cm-selectionBackground, .cm-editor .cm-content ::selection { background: var(--selection) !important; }
.cm-editor .cm-placeholder { color: var(--text-4); }
.cm-editor .cm-selectionMatch { background: var(--accent-soft); }
.cm-tok-mark { color: var(--text-4); }
.cm-tok-quote { color: var(--text-2); }
.cm-tok-comment { color: var(--text-4); font-style: italic; }
.cm-tok-url { color: var(--text-3); }
.cm-tok-link, .cm-lp-wikilink, .cm-lp-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.is-live .cm-lp-wikilink, .is-live .cm-lp-link { cursor: pointer; }
.is-live .cm-lp-wikilink:hover, .is-live .cm-lp-link:hover { color: var(--accent-ink); text-decoration-color: var(--accent); }
.cm-lp-wikilink.is-unresolved { opacity: .55; }
.cm-tok-code, .cm-lp-code { font-family: var(--mono); font-size: .86em; background: var(--fill); border-radius: 6px; padding: .1em .35em; }
.cm-tok-keyword { color: #c2185b; } .cm-tok-string { color: #2e7d32; } .cm-tok-number { color: #b26a00; } .cm-tok-fn { color: #1565c0; } .cm-tok-type { color: #6a1b9a; } .cm-tok-prop { color: #00838f; }
:root[data-theme='dark'] .cm-tok-keyword { color: #ff7ab2; } :root[data-theme='dark'] .cm-tok-string { color: #a5d6a7; } :root[data-theme='dark'] .cm-tok-number { color: #ffcc80; } :root[data-theme='dark'] .cm-tok-fn { color: #90caf9; } :root[data-theme='dark'] .cm-tok-type { color: #ce93d8; } :root[data-theme='dark'] .cm-tok-prop { color: #80deea; }
.cm-fm, .cm-fm * { font-family: var(--mono) !important; font-size: 13.5px !important; font-weight: 400 !important; font-style: normal !important; color: var(--text-2) !important; text-decoration: none !important; letter-spacing: 0 !important; }
.cm-lp-h { color: var(--h-color); }
.cm-lp-h1, .cm-lp-h2 { padding-top: .55em !important; }
.cm-lp-h2 { color: var(--h2-color); }
.cm-lp-h3, .cm-lp-h4 { padding-top: .35em !important; }
.cm-lp-hl { background: var(--mark-bg); border-radius: 3px; }
.cm-lp-tag { display: inline; padding: .1em .55em; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-size: .84em; font-weight: 600; cursor: pointer; }
.rainbow-tags .cm-lp-tag { background: hsl(var(--tag-hue, 30) 80% 93%); color: hsl(var(--tag-hue, 30) 55% 34%); }
:root[data-theme='dark'].rainbow-tags .cm-lp-tag { background: hsl(var(--tag-hue, 30) 35% 22%); color: hsl(var(--tag-hue, 30) 75% 76%); }
.cm-lp-quote { border-left: 3px solid var(--line-strong); padding-left: 1em !important; color: var(--text-2); }
.cm-lp-bullet { display: inline-block; width: 1em; color: var(--accent); font-weight: 800; text-align: center; }
.cm-lp-listmark { color: var(--text-3); font-family: var(--en); font-size: .92em; }
.cm-line.cm-lp-done { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.cm-lp-check { margin: 0 .45em 0 0 !important; vertical-align: -2px; }
.cm-lp-hr-line { line-height: 1.2 !important; }
.cm-lp-hr { display: inline-block; width: 100%; height: 1px; background: var(--line-strong); vertical-align: middle; }
.cm-lp-codeline { font-family: var(--mono); font-size: 14px; background: var(--fill); padding: 0 18px !important; line-height: 1.7; }
.cm-lp-codeline.is-first { border-radius: 12px 12px 0 0; padding-top: 8px !important; }
.cm-lp-codeline.is-last { border-radius: 0 0 12px 12px; padding-bottom: 8px !important; }
.cm-lp-codeline.is-fence, .cm-lp-codeline.is-fence * { color: var(--text-4) !important; font-size: 12.5px; }
.cm-lp-tableline { font-family: var(--mono); font-size: 14px; }
.cm-lp-imgblock { padding: 6px 0; }
.cm-lp-img { max-width: 100%; border-radius: 12px; vertical-align: middle; }
.cm-lp-imginline .cm-lp-img { max-height: 1.6em; }
.cm-lp-block, .cm-lp-props { white-space: normal; }
.cm-lp-block { margin: .25em 0; cursor: text; font-size: var(--note-size); }
.cm-lp-block > :first-child { margin-top: 0; }
.cm-lp-block > :last-child { margin-bottom: 0; }
.cm-lp-block:hover { box-shadow: 0 0 0 1px var(--line); border-radius: 12px; }
.cm-lp-embed .embed-note { margin: 0; }
.cm-lp-props { position: relative; padding-bottom: 6px; margin-bottom: 10px; font-size: 14.5px; line-height: 1.5; cursor: default; }
.cm-lp-props-src { position: absolute; top: 4px; right: 0; height: 24px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--fill); color: var(--text-3); font-size: 12px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.cm-lp-props:hover .cm-lp-props-src { opacity: 1; }
.cm-lp-props-src:hover { color: var(--text); }
.cm-tooltip { border: 0 !important; background: var(--glass-solid) !important; border-radius: 14px; box-shadow: var(--shadow-pop), 0 0 0 1px var(--glass-outline); overflow: hidden; }
.cm-tooltip.cm-tooltip-autocomplete > ul { font-family: var(--font) !important; max-height: 340px !important; min-width: 300px; padding: 5px !important; }
.cm-tooltip.cm-tooltip-autocomplete > ul > li { padding: 7px 10px !important; border-radius: 9px; font-size: 14px; line-height: 1.35; display: flex; flex-direction: column; }
.cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] { background: var(--primary) !important; color: var(--on-primary) !important; }
.cm-completionLabel { font-weight: 500; }
.cm-completionDetail { margin: 2px 0 0 !important; font-size: 11.5px; font-style: normal !important; color: var(--text-3); }
li[aria-selected] .cm-completionDetail { color: color-mix(in srgb, var(--on-primary) 75%, transparent); }
.cm-panels { background: var(--glass-solid) !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; color: var(--text); font-family: var(--font); }
.cm-panel.cm-search { padding: 8px 12px !important; font-size: 13px; }
.cm-panel.cm-search input, .cm-panel.cm-search button { font-family: var(--font); font-size: 13px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--glass-solid); color: var(--text); padding: 3px 8px; }
.cm-panel.cm-search label { font-size: 12.5px; color: var(--text-2); }

/* 渲染后的 Markdown */
.markdown-rendered { font-size: var(--note-size); line-height: 1.85; color: var(--text); overflow-wrap: anywhere; }
.markdown-rendered > :first-child { margin-top: 0; }
.markdown-rendered h1, .markdown-rendered h2, .markdown-rendered h3, .markdown-rendered h4, .markdown-rendered h5, .markdown-rendered h6 { font-weight: 800; letter-spacing: -0.015em; line-height: 1.4; margin: 1.5em 0 .5em; color: var(--h-color); scroll-margin-top: 16px; }
.markdown-rendered h1 { font-size: 1.62em; }
.markdown-rendered h2 { font-size: 1.34em; color: var(--h2-color); }
.markdown-rendered h3 { font-size: 1.15em; font-weight: 700; }
.markdown-rendered h4, .markdown-rendered h5, .markdown-rendered h6 { font-size: 1em; font-weight: 700; }
.markdown-rendered .flash, .tree-item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } }
.markdown-rendered p { margin: .6em 0; }
.markdown-rendered ul, .markdown-rendered ol { padding-left: 1.6em; margin: .45em 0; }
.markdown-rendered li { margin: .18em 0; }
.markdown-rendered ul > li::marker { color: var(--accent); }
.markdown-rendered ol > li::marker { color: var(--text-3); font-family: var(--en); font-size: .92em; }
.markdown-rendered li:has(> .task-checkbox), .markdown-rendered li:has(> p > .task-checkbox) { list-style: none; margin-left: -1.35em; }
.task-checkbox { width: 16px; height: 16px; margin: 0 .45em 0 0; vertical-align: -2px; cursor: pointer; accent-color: var(--accent); }
li:has(> .task-checkbox:checked) { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.markdown-rendered blockquote { margin: .9em 0; padding: .2em 1.1em; border-left: 3px solid var(--line-strong); color: var(--text-2); }
.markdown-rendered code { font-family: var(--mono); font-size: .86em; background: var(--fill); padding: .12em .42em; border-radius: 6px; }
.markdown-rendered pre { position: relative; background: var(--fill); border-radius: 14px; padding: 16px 18px; overflow: auto; font-size: 14px; line-height: 1.65; }
.markdown-rendered pre code { background: none; padding: 0; font-size: 1em; }
.code-copy { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 9px; background: var(--glass-solid); color: var(--text-2); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; box-shadow: 0 0 0 1px var(--line); }
pre:hover .code-copy { opacity: 1; }
.markdown-rendered table { border-collapse: separate; border-spacing: 0; margin: 1em 0; font-size: .9em; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.markdown-rendered th, .markdown-rendered td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.markdown-rendered th { background: var(--fill); font-weight: 700; }
.markdown-rendered tr:last-child td { border-bottom: 0; }
.markdown-rendered hr { border: 0; height: 1px; background: var(--line-strong); margin: 2em 0; }
.markdown-rendered img { max-width: 100%; border-radius: 12px; }
.markdown-rendered mark { background: var(--mark-bg); color: inherit; padding: 0 .15em; border-radius: 3px; }
.markdown-rendered a { color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.markdown-rendered a:hover { color: var(--accent-ink); text-decoration-color: var(--accent); }
:root:not(.link-underline) .markdown-rendered a.internal-link, :root:not(.link-underline) .cm-lp-wikilink { text-decoration: none; color: var(--accent-ink); }
:root:not([data-scheme='glass']) .markdown-rendered a, :root:not([data-scheme='glass']) .cm-lp-wikilink, :root:not([data-scheme='glass']) .cm-lp-link { color: var(--primary); }
a.internal-link.is-unresolved { opacity: .55; }
a.external-link::after { content: '↗'; font-size: .75em; margin-left: 2px; opacity: .6; }
.empty-hint { font-size: 15px; }

/* 标签 */
.tag { display: inline-flex; align-items: center; height: 1.65em; padding: 0 .65em; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink) !important; font-size: .82em; font-weight: 600; text-decoration: none !important; vertical-align: .08em; cursor: pointer; letter-spacing: .02em; }
.rainbow-tags .tag { background: hsl(var(--tag-hue, 30) 80% 93%); color: hsl(var(--tag-hue, 30) 55% 34%) !important; }
:root[data-theme='dark'].rainbow-tags .tag { background: hsl(var(--tag-hue, 30) 35% 22%); color: hsl(var(--tag-hue, 30) 75% 76%) !important; }

/* Callout：默认是个人网站「引言卡」的橙粉紫渐变底 */
.callout { --c: var(--accent-ink); margin: 1em 0; border-radius: 16px; background: color-mix(in srgb, var(--c) 8%, transparent); border: 1px solid color-mix(in srgb, var(--c) 20%, transparent); padding: 12px 18px; }
:root[data-scheme='glass'] .callout[data-kind='primary'] { background: linear-gradient(115deg, rgba(255, 149, 0, .1), rgba(255, 45, 85, .07), rgba(175, 82, 222, .07)); border-color: rgba(255, 149, 0, .22); }
.callout[data-kind='success'] { --c: var(--success); }
.callout[data-kind='warning'] { --c: var(--warning); }
.callout[data-kind='danger'] { --c: var(--danger); }
.callout[data-kind='neutral'] { --c: var(--text-3); }
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--c); }
.callout-title > span { flex: 1; }
.callout.is-foldable .callout-title { cursor: pointer; }
.callout.is-foldable .callout-title > .ico:last-child { transition: transform .2s; }
.callout.is-collapsed .callout-title > .ico:last-child { transform: rotate(-90deg); }
.callout.is-collapsed .callout-content { display: none; }
.callout-content { margin-top: 4px; }
.callout-content > :last-child { margin-bottom: 2px; }

/* 嵌入 */
.embed-note { display: block; margin: .8em 0; padding: 10px 18px 12px; border-left: 3px solid var(--accent); background: var(--fill); border-radius: 0 14px 14px 0; }
.embed-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.embed-body { font-size: .95em; }
.embed-missing { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 13.5px; background: var(--fill); padding: 2px 10px; border-radius: 9px; }
.embed-loading { color: var(--text-3); font-size: 13.5px; }
.embed-pdf { width: 100%; height: 70vh; border: 0; border-radius: 14px; }
.embed-img { display: inline-block; }
.x-plugin-block { margin: 1em 0; }
.x-plugin-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.base-embed { display: block; margin: 1em 0; padding: 14px; border-radius: 18px; background: var(--fill); font-size: 14px; line-height: 1.5; }
.base-embed-open { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; margin-right: 6px; }

/* 悬停预览 */
.hover-preview { width: 460px; max-height: 380px; overflow: auto; padding: 16px 20px; z-index: 3500; }
.hover-preview .markdown-rendered { font-size: 14.5px; line-height: 1.75; }
.hp-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }

/* ---------- 文件列表 ---------- */
.tree { padding: 0 8px 24px; font-size: 14px; }
.tree-item { height: 32px; display: flex; align-items: center; gap: 7px; padding-right: 8px; border-radius: 10px; margin: 1px 0; color: var(--text-2); cursor: default; user-select: none; transition: background .15s; white-space: nowrap; }
.tree-item:hover { background: var(--hover); }
.tree-item.is-active { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.tree-item.is-active .tree-ico, .tree-item.is-active .tree-ext { color: var(--on-primary); opacity: .8; }
:root:not([data-scheme='glass']) .tree-item.is-active { background: var(--primary-soft); color: var(--primary); }
:root:not([data-scheme='glass']) .tree-item.is-active .tree-ico { color: var(--primary); }
.tree-item.is-drop { box-shadow: inset 0 0 0 2px var(--accent); }
.tree-item.folder { color: var(--text); font-weight: 600; }
.tree-caret { display: flex; width: 14px; color: var(--text-4); transition: transform .2s var(--ease-out); flex: none; }
.tree-item.is-open .tree-caret { transform: rotate(90deg); }
.tree-ico { display: flex; color: var(--text-3); flex: none; }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-count { margin-left: auto; font-family: var(--en); font-size: 11px; color: var(--text-3); font-weight: 600; padding: 0 7px; height: 19px; line-height: 19px; border-radius: 99px; background: var(--fill); }
.tree-ext { font-family: var(--en); font-size: 9.5px; font-weight: 700; color: var(--text-3); background: var(--fill); padding: 1px 5px; border-radius: 5px; letter-spacing: .04em; }
.tree-more { font-size: 13px; color: var(--accent-ink); height: 28px; display: flex; align-items: center; cursor: pointer; }
/* 彩色文件夹：仓库 file-color 的颜色只落在图标小方块上，并向中性灰收敛，
 * 行本身保持干净，和玻璃主题的「墨黑 + 灰 + 一点点颜色」一致 */
.tree-item.folder.has-color { --fc: color-mix(in oklab, var(--folder-color) 60%, var(--text-2)); }
:root[data-theme='dark'] .tree-item.folder.has-color { --fc: color-mix(in oklab, var(--folder-color) 68%, var(--text-2)); }
.tree-item.folder.has-color .tree-ico { width: 24px; height: 24px; margin-left: -3px; border-radius: 7px; align-items: center; justify-content: center; color: var(--fc); background: color-mix(in oklab, var(--fc) 12%, transparent); transition: background .2s; }
.tree-item.folder.has-color .tree-ico svg { width: 15px; height: 15px; }
.tree-item.folder.has-color.is-open .tree-ico { background: color-mix(in oklab, var(--fc) 20%, transparent); }
.tree-item.folder.has-color + .tree-children:not(:empty) { margin: 2px 0 6px; }
.no-folder-colors .tree-item.folder.has-color .tree-ico { color: var(--text-3); background: var(--fill); }
/* 秋日 Topaz 仍沿用 Blue Topaz 的「浅色底 + 左侧色条」，但更克制 */
:root[data-scheme='topaz'] .tree-item.folder.has-color { background: color-mix(in srgb, var(--folder-color) 8%, transparent); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--folder-color) 70%, transparent); }
:root[data-scheme='topaz'] .tree-item.folder.has-color .tree-ico { width: auto; height: auto; margin-left: 0; background: none; color: var(--folder-color); }
.tree-children { position: relative; }

/* ---------- 搜索 / 标签 / 链接 ---------- */
.search-input { width: 100%; height: 38px; border-radius: 99px; padding: 0 16px; }
.search-help { font-size: 12px; margin: 10px 2px 0; line-height: 2; }
.search-help code { font-family: var(--mono); font-size: 11.5px; background: var(--fill); padding: 1px 6px; border-radius: 6px; color: var(--text-2); }
.search-info { font-size: 12.5px; margin: 8px 2px 0; }
.search-results { padding: 0 8px 20px; }
.sr-item { padding: 9px 11px; border-radius: 12px; cursor: default; margin-bottom: 2px; }
.sr-item:hover { background: var(--hover); }
.sr-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; }
.sr-ico { display: flex; color: var(--text-3); }
.sr-path { font-size: 11.5px; margin: 2px 0 0 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-snippet { font-size: 13px; color: var(--text-2); margin: 4px 0 0 22px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-snippet mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.tag-tree { padding: 4px 8px 20px; }
.tag-row { display: flex; align-items: center; height: 34px; border-radius: 10px; padding-right: 6px; }
.tag-row:hover { background: var(--hover); }
.tag-pill { font-size: 13px; }
.outline { padding: 4px 8px 20px; font-size: 14px; }
.outline-item { padding: 6px 10px; border-radius: 10px; color: var(--text-2); cursor: default; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-item:hover { background: var(--hover); color: var(--text); }
.links-sec { padding: 0 8px; }
.links-head { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text-2); cursor: default; border-radius: 10px; }
.links-head:hover { background: var(--hover); }
.links-head .tree-caret { transform: rotate(90deg); }
.links-head.is-collapsed .tree-caret { transform: none; }
.links-head.is-collapsed + .links-body { display: none; }
.links-head .tree-count { margin-left: auto; }
.links-body { padding: 0 0 8px; }
.links-empty { font-size: 13px; padding: 4px 12px 8px; }
.link-item { padding: 7px 10px; border-radius: 12px; font-size: 14px; cursor: default; }
.link-item:hover { background: var(--hover); }
.link-item.is-unresolved { opacity: .6; }
.link-title { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.link-ctx { font-size: 12.5px; color: var(--text-2); margin: 4px 0 0 20px; line-height: 1.6; padding: 5px 9px; background: var(--glass-strong); border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.link-ctx b { color: var(--accent-ink); font-weight: 600; }
.graph-mini { height: 340px; margin: 0 10px 8px; border-radius: 18px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.graph-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.graph-host { flex: 1; min-height: 0; background: var(--canvas); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 16px; color: var(--text-3); text-align: center; font-size: 14px; }
.empty-state.small { padding: 30px 12px; }
.empty-state p { margin: 0; }

/* ---------- Bases ---------- */
.base-wrap { padding: 6px 28px 60px; }
.base-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 18px; }
.base-tabs .chip { display: inline-flex; align-items: center; gap: 4px; }
.base-search { width: 190px; height: 32px; border-radius: 99px; }
.base-count { font-size: 12.5px; }
.group-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; margin: 22px 0 12px; }
.group-head:first-child { margin-top: 0; }
.count { font-family: var(--en); font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--fill); padding: 1px 8px; border-radius: 99px; margin-left: 6px; }
.card-grid { display: grid; gap: 16px; }
.base-card { display: flex; flex-direction: column; background: var(--glass-solid); border-radius: 16px; box-shadow: 0 0 0 1px var(--line), var(--shadow-card); overflow: hidden; color: var(--text) !important; text-decoration: none !important; transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out); }
.base-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line), var(--shadow-lift); }
.card-img { background: var(--fill); overflow: hidden; }
.card-img img { width: 100%; height: 100%; display: block; transition: transform .4s; }
.base-card:hover .card-img img { transform: scale(1.04); }
.card-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; color: var(--text-4); }
.card-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: 13.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-ico { display: inline-flex; color: var(--text-3); vertical-align: -2px; margin-right: 4px; }
.card-prop { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-more { margin: 18px auto 0; display: flex; }
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { flex: none; background: var(--fill); border-radius: 18px; padding: 10px; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; padding: 2px 4px 10px; }
.kanban-list { display: flex; flex-direction: column; gap: 10px; }
.table-scroll { overflow: auto; border-radius: 16px; box-shadow: 0 0 0 1px var(--line); }
.base-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.base-table th { text-align: left; font-weight: 700; color: var(--text-2); background: var(--fill); padding: 10px 14px; position: sticky; top: 0; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.base-table td { padding: 9px 14px; border-top: 1px solid var(--line); }
.base-table tr:hover td { background: var(--hover); }
.base-table a { color: var(--text); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.group-row td { background: var(--fill); font-weight: 700; }
.base-list { margin: 0; padding-left: 20px; line-height: 2.1; }
.base-list a { color: var(--text); }
.base-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }

/* ---------- 首页 ---------- */
.view-home .view-scroll { position: relative; }
.home-wrap { position: relative; max-width: 1100px; margin: 0 auto; padding: 34px 36px 90px; display: flex; flex-direction: column; gap: 18px; }
.home-hero { padding: 8px 4px 6px; animation: riseIn .6s var(--ease-out); }
.home-eyebrow { margin-bottom: 10px; }
.home-title { font-size: clamp(40px, 5vw, 60px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 10px; color: var(--h-color); }
.home-sub { margin: 0; color: var(--text-3); font-size: 15px; letter-spacing: .14em; }
.home-sub b { color: var(--text); font-weight: 700; }
.home-watermark { position: absolute; right: -10px; top: -18px; font-family: var(--en); font-weight: 800; font-size: clamp(90px, 13vw, 190px); letter-spacing: -0.04em; line-height: 1; color: var(--text); opacity: .03; pointer-events: none; user-select: none; white-space: nowrap; }
.card { background: var(--glass); border-radius: 20px; box-shadow: 0 0 0 1px var(--glass-outline), var(--shadow-card), var(--glass-hi); }
:root:not([data-scheme='glass']) .card { background: var(--panel); }
.quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.quick { border: 0; display: flex; align-items: center; gap: 13px; padding: 16px 18px; text-align: left; color: var(--text); transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), background .3s; }
.quick:hover { transform: translateY(-3px); background: var(--glass-strong); box-shadow: 0 0 0 1px var(--glass-outline), var(--shadow-lift), var(--glass-hi); }
.quick:active { transform: scale(.98); }
.quick-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.quick-text { display: flex; flex-direction: column; gap: 2px; }
.quick-text b { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.quick-text small { color: var(--text-3); font-size: 12.5px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 12px; }
.stat { padding: 15px 17px; }
.stat-top { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.stat-num { font-family: var(--en); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.heat-card { padding: 20px 22px 16px; }
.home-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.home-sec { padding: 18px 20px; }
.sec-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15.5px; margin-bottom: 14px; color: var(--text); }
.sec-head .ico { color: var(--accent); }
.sec-note { margin-left: auto; font-weight: 400; font-size: 12.5px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.theme-item { display: flex; align-items: center; gap: 11px; padding: 7px; border-radius: 14px; color: var(--text) !important; text-decoration: none !important; font-size: 14px; transition: background .2s; }
.theme-item:hover { background: var(--hover); }
.theme-item img, .theme-ph { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; flex: none; }
.theme-ph { background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 9px; border-radius: 11px; color: var(--text) !important; text-decoration: none !important; font-size: 14px; }
.recent-item:hover { background: var(--hover); }
.recent-ico { display: flex; color: var(--text-3); }
.recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { font-size: 12.5px; flex: none; }
.base-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.base-tile { height: 44px; border: 0; border-radius: 14px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); display: flex; align-items: center; gap: 8px; padding: 0 14px; font-weight: 600; font-size: 14px; color: var(--text); transition: background .2s, color .2s, transform .2s; white-space: nowrap; overflow: hidden; }
.base-tile:hover { background: var(--primary); color: var(--on-primary); transform: translateY(-1px); }
.base-tile:hover .tile-ico { color: var(--on-primary); }
.tile-ico { display: flex; color: var(--accent); }

/* 热力图 */
.heatmap { display: block; }
.hm-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.hm-title { font-weight: 800; font-size: 15px; }
.hm-sum { font-family: var(--en); font-size: 12px; color: var(--text-3); font-weight: 600; }
.hm-scroll { overflow-x: auto; padding-bottom: 4px; }
.hm-inner { display: inline-flex; flex-direction: column; gap: 4px; min-width: 100%; }
.hm-months { display: flex; gap: 3px; height: 15px; }
.hm-month { width: 13px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: visible; }
.hm-grid { display: flex; gap: 3px; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { display: block; width: 13px; height: 13px; border-radius: 4px; background: var(--fill); }
.hm-cell.is-future { opacity: 0; }
.hm-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.hm-legend span { margin: 0 4px; }
.markdown-rendered .heatmap { margin: 1em 0; padding: 18px; border-radius: 18px; background: var(--fill); line-height: 1.4; font-size: 13px; }

/* ---------- AI 助手 ---------- */
.ai-head { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; flex: none; }
.ai-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; }
.ai-title .ico { color: var(--accent); }
.ai-model { margin-left: auto; min-width: 0; max-width: 200px; height: 28px; border: 0; border-radius: 99px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; font-size: 12px; color: var(--text-2); overflow: hidden; white-space: nowrap; }
.ai-model span:last-child { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot-ok { background: var(--success); }
.dot-warn { background: var(--accent); }
.ai-ctx { display: flex; gap: 6px; padding: 0 12px 8px; flex: none; }
.ai-ctx .chip, .ai-quick .chip { height: 29px; padding: 0 11px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 3px; }
.ai-ctx .chip.active { background: var(--primary); color: var(--on-primary); }
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; flex: none; }
.ai-quick .chip:hover { color: var(--accent-ink); }
.ai-scroll { padding: 6px 12px 12px; }
.ai-messages { display: flex; flex-direction: column; gap: 16px; }
.ai-msg.user { align-self: flex-end; max-width: 88%; }
.ai-msg.user .ai-bubble { background: var(--primary); color: var(--on-primary); padding: 9px 15px; border-radius: 20px 20px 6px 20px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.ai-msg.assistant .ai-bubble { font-size: 15px; line-height: 1.8; padding: 2px 2px; }
.ai-msg.assistant .ai-bubble h1, .ai-msg.assistant .ai-bubble h2, .ai-msg.assistant .ai-bubble h3 { font-size: 1.06em; margin: 1em 0 .3em; }
.ai-msg.is-error .ai-bubble { color: var(--danger); }
.ai-panel.is-busy .ai-msg.assistant:last-child .ai-bubble::after { content: ''; display: inline-block; width: 8px; height: 16px; margin-left: 2px; background: var(--accent); vertical-align: -2px; border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ai-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ai-tool { height: 27px; border: 0; border-radius: 99px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); color: var(--text-2); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; transition: background .2s, color .2s; }
.ai-tool:hover { color: var(--text); }
.ai-tool.primary { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.ai-refs { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 8px; font-size: 12px; }
.ref-chip { background: var(--accent-soft); padding: 2px 9px; border-radius: 99px; color: var(--accent-ink); text-decoration: none; cursor: pointer; font-weight: 600; }
.ai-composer { flex: none; margin: 6px 12px 12px; display: flex; align-items: flex-end; gap: 6px; background: var(--glass-strong); border-radius: 26px; box-shadow: 0 0 0 1px var(--glass-outline), 0 10px 34px -14px rgba(0, 0, 0, .12), var(--glass-hi); padding: 6px 6px 6px 16px; transition: box-shadow .3s; }
.ai-composer:focus-within { box-shadow: 0 0 0 1px var(--glass-outline), 0 14px 44px -14px rgba(0, 0, 0, .18), var(--glass-hi); background: var(--glass-solid); }
.ai-input { flex: 1; border: 0; outline: none; resize: none; background: transparent; font-size: 14.5px; line-height: 1.55; padding: 6px 0; max-height: 170px; }
.ai-send { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; flex: none; transition: transform .3s var(--spring), background .2s; }
.ai-send:hover { transform: scale(1.08); }
.ai-send:active { transform: scale(.9); }
.ai-send.is-busy { background: var(--accent); color: #fff; }
.ai-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 8px; color: var(--text-2); font-size: 14px; }
.ai-empty-ico { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.ai-empty p { margin: 0 0 14px; line-height: 1.7; }
.ai-examples { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.ai-example { border: 0; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); border-radius: 14px; padding: 10px 14px; text-align: left; font-size: 13.5px; color: var(--text); transition: transform .25s var(--ease-out), box-shadow .25s; }
.ai-example:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line), var(--shadow-card); }
.inline-sel { margin: 0; padding: 9px 13px; border-left: 3px solid var(--accent); background: var(--fill); border-radius: 0 12px 12px 0; color: var(--text-2); font-size: 14px; max-height: 120px; overflow: auto; white-space: pre-wrap; }
.inline-out { min-height: 60px; max-height: 42vh; overflow: auto; background: var(--fill); border-radius: 14px; padding: 12px 16px; font-size: 15px; }
.inline-out:empty { display: none; }

/* ---------- 弹层：选择器、模板、设置 ---------- */
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger); color: #fff; }
.modal-picker { overflow: hidden; }
.modal-picker .modal-body { padding: 0; }
.picker-input { width: 100%; height: 60px; border: 0; outline: none; background: transparent; padding: 0 24px; font-size: 18px; border-bottom: 1px solid var(--line); }
.picker-list { max-height: 52vh; overflow: auto; padding: 7px; }
.picker-item { display: flex; align-items: center; gap: 11px; padding: 9px 13px; border-radius: 12px; cursor: default; }
.picker-item.is-selected { background: var(--primary); color: var(--on-primary); }
.picker-item.is-selected .picker-note, .picker-item.is-selected .picker-ico, .picker-item.is-selected .picker-kbd { color: color-mix(in srgb, var(--on-primary) 78%, transparent); }
.picker-ico { display: flex; color: var(--text-3); }
.picker-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.picker-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-note { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-kbd { font-size: 11.5px; color: var(--text-3); }
.picker-empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 14px; }
.picker-hints { display: flex; gap: 18px; padding: 9px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
kbd { font-family: var(--en); font-size: 11px; font-weight: 600; background: var(--fill); padding: 2px 7px; border-radius: 6px; color: var(--text-2); }
.picker-item.is-selected kbd { background: rgba(255, 255, 255, .2); color: inherit; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; margin-bottom: 4px; }
.tpl-card { height: 80px; border: 0; border-radius: 16px; background: var(--glass-strong); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: background .2s, color .2s, transform .2s; }
.tpl-card:hover { color: var(--text); transform: translateY(-2px); }
.tpl-card.active { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.tpl-ico { display: flex; }
.ai-check { margin-top: 4px; color: var(--text); font-weight: 600; font-size: 14px; }
.ai-check .ico { color: var(--accent); }
.info-grid { display: grid; grid-template-columns: 84px 1fr; gap: 9px 12px; font-size: 14px; word-break: break-all; }
.modal-settings .modal-body { padding: 0 0 8px; }
.settings { display: grid; grid-template-columns: 180px 1fr; min-height: 480px; }
.settings-nav { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 8px 18px; border-right: 1px solid var(--line); }
.settings-tab { height: 38px; border: 0; background: transparent; border-radius: 12px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--text-2); font-weight: 600; font-size: 14px; text-align: left; }
.settings-tab:hover { background: var(--hover); color: var(--text); }
.settings-tab.active { background: var(--primary); color: var(--on-primary); }
.settings-pane { padding: 4px 26px 12px; overflow: auto; max-height: 68vh; }
.set-title { font-size: 19px; font-weight: 800; margin: 6px 0 12px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.set-text { flex: 1; min-width: 0; }
.set-label { font-weight: 600; font-size: 14.5px; }
.set-desc { color: var(--text-3); font-size: 12.5px; margin-top: 3px; line-height: 1.6; }
.set-ctl { flex: none; display: flex; align-items: center; }
.set-ctl .input { width: 270px; }
.set-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 16px; }
.test-result { flex: 1; font-size: 13px; color: var(--text-3); }
.test-result.ok { color: var(--success); }
.test-result.err { color: var(--danger); }
.path-code { font-family: var(--mono); font-size: 12.5px; background: var(--fill); padding: 4px 9px; border-radius: 8px; max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.recent-vault { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 9px 11px; border-radius: 11px; text-align: left; font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.recent-vault:hover { background: var(--hover); color: var(--text); }
.keys-grid { display: grid; grid-template-columns: max-content 1fr; gap: 11px 18px; align-items: center; font-size: 14px; }
.about-list { font-size: 14px; line-height: 1.95; color: var(--text-2); padding-left: 18px; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--fill-hover); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .3s var(--spring); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- Canvas / 图片 ---------- */
.cv-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; background: var(--canvas); background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1px); background-size: 22px 22px; cursor: grab; }
.cv-stage.is-dragging { cursor: grabbing; }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; overflow: visible; pointer-events: none; color: var(--text-3); }
.cv-edges path { fill: none; stroke: currentColor; stroke-width: 2; }
.cv-node { position: absolute; background: var(--glass-solid); border-radius: 16px; box-shadow: 0 0 0 1px var(--line), var(--shadow-card), inset 0 0 0 2px color-mix(in srgb, var(--cv-color, transparent) 70%, transparent); padding: 12px 14px; overflow: auto; font-size: 14px; }
.cv-node .markdown-rendered { font-size: 14px; line-height: 1.65; }
.cv-group { background: color-mix(in srgb, var(--cv-color, var(--text-3)) 7%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cv-color, var(--text-3)) 40%, transparent); overflow: visible; padding: 0; }
.cv-group-label { position: absolute; top: -28px; left: 4px; font-weight: 800; font-size: 15px; color: var(--text-2); white-space: nowrap; }
.cv-file img { width: 100%; height: 100%; object-fit: contain; }
.cv-file-title { display: block; font-weight: 800; font-size: 15px; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.cv-edge-label { position: absolute; transform: translate(-50%, -50%); background: var(--glass-solid); padding: 2px 9px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); }
.image-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--canvas); overflow: auto; }
.image-stage img { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: var(--shadow-lift); }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  :root { --ribbon-w: 0px; --note-size: 17px; }
  .workspace-row { padding: 0; }
  .ribbon { display: none; }
  .sidebar { position: fixed; top: 8px; bottom: 8px; z-index: 2000; width: min(86vw, 340px) !important; box-shadow: var(--shadow), 0 0 0 1px var(--glass-outline); background: var(--glass-solid); }
  .sidebar-left { left: 8px; }
  .sidebar-right { right: 8px; }
  .resizer { display: none; }
  .workspace { border-radius: 0; }
  .view-content { padding: 14px 20px 120px; }
  .view-header { padding: 0 8px 0 16px; }
  .seg-btn span { display: none; }
  .home-wrap { padding: 20px 16px 60px; }
  .home-cols { grid-template-columns: 1fr; }
  .note-cover img { width: 96px; }
  .view-content:has(.note-cover img) .inline-title { width: calc(100% - 140px); }
  .prop-row { grid-template-columns: 100px 1fr; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .set-row { flex-direction: column; align-items: stretch; }
  .set-ctl .input { width: 100%; }
  .base-wrap { padding: 4px 14px 40px; }
  .base-search { width: 120px; }
  .mobile-nav { display: flex !important; }
}
.mobile-nav { display: none; }
