:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #3b5bdb;
  --accent-soft: #edf1ff;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --danger: #c0392b;

  --topbar-h: 56px;
  --statusbar-h: 30px;
  --editor-font: "PingFang SC", "Microsoft YaHei", Georgia, serif;
  --editor-size: 16px;
  --editor-lh: 2;
  --editor-pad-y: 22px;
  --editor-pad-x: 26px;

  /* T-21：主题相关的派生色统一走变量，避免深色模式下出现硬编码白底 */
  --chip-bg: rgba(59, 91, 219, .13);
  --chip-border: rgba(59, 91, 219, .30);
  --chip-hover: rgba(59, 91, 219, .24);
  --unknown-bg: rgba(180, 83, 9, .09);
  --line-tint: rgba(59, 91, 219, .055);
  --finding-bg: #fff7ed;
  --finding-border: #fed7aa;
  --pill-border: #d9e2ff;
  --pill-hover: #dfe7ff;
  --active-border: #d9e2ff;
  --saved: #2f855a;
  --on-accent: #ffffff;
  --banner-bg: #edf1ff; --banner-border: #d9e2ff; --banner-text: #2f4bb8;
  --error-bg: #fef2f2; --error-border: #fecaca;
  --stage-border: #e9ecf1;
  --directory-border: #c3cad6;
  --paper-shadow: 0 8px 26px rgba(31, 36, 48, .06), 0 1px 3px rgba(31, 36, 48, .04);
  --menu-shadow: 0 10px 30px rgba(24, 32, 56, .14);
  --drawer-shadow: -12px 0 36px rgba(24, 32, 56, .12);

  /* T-27：分类颜色 token（深浅主题共用 soft 透明底，solid 供圆点与描边） */
  --cat-rose: #e11d48;     --cat-rose-soft: rgba(225, 29, 72, .13);
  --cat-violet: #7c3aed;   --cat-violet-soft: rgba(124, 58, 237, .13);
  --cat-sky: #0284c7;      --cat-sky-soft: rgba(2, 132, 199, .13);
  --cat-emerald: #059669;  --cat-emerald-soft: rgba(5, 150, 105, .13);
  --cat-amber: #d97706;    --cat-amber-soft: rgba(217, 119, 6, .15);
  --cat-orange: #ea580c;   --cat-orange-soft: rgba(234, 88, 12, .13);
  --cat-cyan: #0891b2;     --cat-cyan-soft: rgba(8, 145, 178, .13);
  --cat-pink: #db2777;     --cat-pink-soft: rgba(219, 39, 119, .13);
  --cat-lime: #65a30d;     --cat-lime-soft: rgba(101, 163, 13, .15);
  --cat-indigo: #4f46e5;   --cat-indigo-soft: rgba(79, 70, 229, .13);
}

/* ---------- T-21：主题 / 字号（同一组变量驱动 textarea 与镜像层，根治 L-03） ---------- */
:root[data-editor-size="small"] { --editor-size: 15px; }
:root[data-editor-size="large"] { --editor-size: 18px; }

:root[data-theme="sepia"] {
  --bg: #efe9dd; --surface: #fbf6ea; --surface-soft: #f4ecdb;
  --border: #ded3bd; --text: #3b3227; --muted: #7a6c58;
  --accent: #8a5a2b; --accent-soft: #f2e5cf; --warn: #9a5b12; --warn-soft: #faedda;
  --chip-bg: rgba(138, 90, 43, .14); --chip-border: rgba(138, 90, 43, .32);
  --chip-hover: rgba(138, 90, 43, .24); --line-tint: rgba(138, 90, 43, .07);
  --finding-bg: #faedda; --finding-border: #e5cba0;
  --pill-border: #e2cfae; --pill-hover: #efe0c6; --active-border: #e2cfae;
  --stage-border: #e3d8c2; --directory-border: #c9b99c; --saved: #4d7c46;
  --banner-bg: #f2e5cf; --banner-border: #e2cfae; --banner-text: #7a4c1c;
  --error-bg: #f8e6e2; --error-border: #e4b9ad;
  --paper-shadow: 0 8px 26px rgba(78, 62, 40, .10), 0 1px 3px rgba(78, 62, 40, .06);
}

:root[data-theme="dark"] {
  --bg: #171a21; --surface: #20242d; --surface-soft: #272c37;
  --border: #353b48; --text: #e6e9ef; --muted: #aab2c0;
  --accent: #8ea8ff; --accent-soft: #2a3554; --warn: #f0b26b; --warn-soft: #3a2e20;
  --danger: #ff8f85;
  --chip-bg: rgba(142, 168, 255, .18); --chip-border: rgba(142, 168, 255, .42);
  --chip-hover: rgba(142, 168, 255, .30); --unknown-bg: rgba(240, 178, 107, .14);
  --line-tint: rgba(142, 168, 255, .07);
  --finding-bg: #3a2e20; --finding-border: #6b4d2a;
  --pill-border: #3d4a70; --pill-hover: #33406a; --active-border: #3d4a70;
  --saved: #7fd1a0;
  --on-accent: #141824;
  --banner-bg: #2a3554; --banner-border: #3d4a70; --banner-text: #c6d3ff;
  --error-bg: #3b2426; --error-border: #6a3b3d;
  --stage-border: #313746; --directory-border: #4b5465;
  --paper-shadow: 0 10px 32px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .3);
  --menu-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  --drawer-shadow: -12px 0 36px rgba(0, 0, 0, .5);

  /* T-27：深色主题下提高 solid 亮度，soft 提高对比度保证可辨识 */
  --cat-rose: #fb7185;     --cat-rose-soft: rgba(251, 113, 133, .20);
  --cat-violet: #a78bfa;   --cat-violet-soft: rgba(167, 139, 250, .20);
  --cat-sky: #38bdf8;      --cat-sky-soft: rgba(56, 189, 248, .20);
  --cat-emerald: #34d399;  --cat-emerald-soft: rgba(52, 211, 153, .20);
  --cat-amber: #fbbf24;    --cat-amber-soft: rgba(251, 191, 36, .20);
  --cat-orange: #fb923c;   --cat-orange-soft: rgba(251, 146, 60, .20);
  --cat-cyan: #22d3ee;     --cat-cyan-soft: rgba(34, 211, 238, .20);
  --cat-pink: #f472b6;     --cat-pink-soft: rgba(244, 114, 182, .20);
  --cat-lime: #a3e635;     --cat-lime-soft: rgba(163, 230, 53, .20);
  --cat-indigo: #818cf8;   --cat-indigo-soft: rgba(129, 140, 248, .20);
}

* { box-sizing: border-box; }

/* T-21：键盘焦点可见；仅键盘触发，不干扰鼠标点击 */
:where(button, input, textarea, .mention-chip):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

body {
  margin: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h); flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.breadcrumb { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; }
.crumb-project { color: var(--muted); white-space: nowrap; }
.crumb-sep { color: #b9bec8; }
.crumb-chapter { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 7px; padding: 7px 12px; font-size: 13px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.06); }
.btn-icon {
  width: 32px; height: 32px; padding: 0; font-size: 16px;
  display: grid; place-items: center; color: var(--muted);
}
.btn-small { padding: 6px 11px; font-size: 12px; }
.more-wrap { position: relative; }
.more-menu {
  position: absolute; right: 0; top: 38px; z-index: 40;
  min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; box-shadow: var(--menu-shadow);
}
.menu-item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; border-radius: 6px;
  padding: 8px 10px; font-size: 13px;
}
.menu-item:hover { background: var(--accent-soft); color: var(--accent); }
.menu-item-pro { color: var(--warn); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }

.banner {
  flex: none;
  padding: 9px 18px; background: var(--banner-bg);
  border-bottom: 1px solid var(--banner-border); color: var(--banner-text); font-size: 13px;
}
.banner.error { background: var(--error-bg); border-color: var(--error-border); color: var(--danger); }
.hidden { display: none !important; }

/* ---------- 三栏骨架 ---------- */
.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 320px;
  /* T-21：改用 flex 剩余高度，顶部提示条出现时不再把底栏挤出视口 */
  flex: 1; min-height: 0;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  overflow: auto;
  display: flex; flex-direction: column;
}
.search-wrap {
  position: relative; display: block; margin-bottom: 14px;
}
.search-icon {
  position: absolute; left: 9px; top: 6px; color: var(--muted); font-size: 15px;
}
.nav-search {
  width: 100%; border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 9px 7px 27px; font-size: 12px; background: var(--surface-soft);
  outline: none;
}
.nav-search:focus { border-color: var(--accent); background: var(--surface); }
.nav-group { margin-bottom: 18px; }
.nav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 4px; }
.nav-head h2 { font-size: 11px; margin: 0; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; width: 28px; height: 28px; line-height: 1; color: var(--accent);
}
.icon-btn:hover { background: var(--accent-soft); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 8px; padding: 0 4px; }
.hint strong { color: var(--text); }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  padding: 7px 9px; border-radius: 7px; margin-bottom: 3px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border: 1px solid transparent;
}
.list li:hover { background: var(--surface-soft); }
.list li.active { background: var(--accent-soft); border-color: var(--active-border); }
.list li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.list li .meta-small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.list .empty { color: var(--muted); font-size: 12px; padding: 10px 6px; display: block; }
.mini-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 5px; color: var(--accent); font-size: 12px;
  padding: 5px 9px; min-height: 28px; white-space: nowrap;
}
.mini-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 6px; }
.nav-add {
  width: 100%; margin-top: 6px; text-align: left;
  border: 1px dashed var(--border); background: transparent;
  border-radius: 7px; padding: 7px 9px; font-size: 12px; color: var(--muted);
}
.nav-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.sidebar-foot {
  margin-top: auto; padding: 10px 6px 2px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 11px; line-height: 1.7;
}
.sidebar-foot-title { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sidebar-foot p { margin: 0; }

/* ---------- 中栏 ---------- */
.editor-area {
  background: var(--surface); display: flex; flex-direction: column; min-width: 0; min-height: 0;
}
.editor-head { padding: 14px 26px 8px; }
.title-input {
  width: 100%; border: none; outline: none; font-size: 18px; font-weight: 700;
  background: transparent; font-family: var(--editor-font);
}
.mention-pill {
  border: 1px solid var(--pill-border); background: var(--accent-soft); color: var(--accent);
  border-radius: 20px; padding: 4px 11px; min-height: 28px; font-size: 12px;
}
.mention-pill:hover { background: var(--pill-hover); }

.editor-scroll {
  flex: 1; min-height: 0; display: flex; justify-content: center;
  padding: 16px 24px 24px; background: var(--bg);
}
.editor-stage {
  position: relative; height: 100%; width: min(720px, 100%); min-width: 0;
  background: var(--surface);
  border: 1px solid var(--stage-border); border-radius: 6px;
  box-shadow: var(--paper-shadow);
}
/* 稿纸淡行线：纯装饰层，位于 textarea(z2) 与镜像层(z3) 之下，不改变任何排版值 */
.editor-stage::before {
  content: ''; position: absolute;
  top: var(--editor-pad-y); bottom: 0;
  left: var(--editor-pad-x); right: var(--editor-pad-x);
  pointer-events: none; z-index: 0; border-radius: inherit;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--editor-size) * var(--editor-lh) - 1px),
    var(--line-tint) calc(var(--editor-size) * var(--editor-lh) - 1px),
    var(--line-tint) calc(var(--editor-size) * var(--editor-lh))
  );
}
/* textarea 与镜像层必须逐项同值，否则 chip 与文字错位 */
.editor, .editor-mirror {
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: var(--editor-pad-y) var(--editor-pad-x);
  font-family: var(--editor-font);
  font-size: var(--editor-size);
  line-height: var(--editor-lh);
  letter-spacing: 0;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  border: none;
}
.editor {
  z-index: 2; resize: none; outline: none;
  background: transparent; color: var(--text); caret-color: var(--accent);
  overflow: auto; scrollbar-width: none;
}
.editor::-webkit-scrollbar { display: none; }
.editor-mirror {
  z-index: 3; overflow: hidden; color: transparent;
  pointer-events: none; background: transparent;
}
.mention-chip {
  pointer-events: auto; cursor: pointer;
  border-radius: 4px;
  background: var(--chip-bg);
  box-shadow: 0 0 0 1px var(--chip-border);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.mention-chip:hover { background: var(--chip-hover); }
.mention-unknown {
  border-radius: 4px; background: var(--unknown-bg);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- 右栏：连续性控制台 ---------- */
.inspector {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.inspector-tabs {
  display: flex; gap: 2px; padding: 8px 10px 0;
  border-bottom: 1px solid var(--border); flex: none;
}
.tab {
  border: none; background: transparent; color: var(--muted);
  padding: 8px 11px; font-size: 12px; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 5px;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.badge {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 10px; padding: 1px 6px; font-size: 10px;
}
.badge.has-findings { background: var(--warn-soft); color: var(--warn); }
.inspector-body { overflow: auto; padding: 12px; flex: 1; min-height: 0; }
.tab-panel .hint { padding: 0; margin-bottom: 10px; }

.findings { display: flex; flex-direction: column; gap: 7px; }
.finding {
  border: 1px solid var(--finding-border); background: var(--finding-bg);
  border-radius: 8px; padding: 9px; font-size: 12px; cursor: pointer;
}
.finding:hover { border-color: var(--warn); }
.finding .term { color: var(--warn); font-weight: 700; }
.finding .preview { color: var(--muted); margin-top: 5px; word-break: break-all; line-height: 1.6; }
.finding .finding-foot { margin-top: 6px; font-size: 10px; color: var(--warn); }
.empty-state {
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 14px 10px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7;
}
.empty-state strong { display: block; color: var(--text); margin-bottom: 4px; }

.entity-detail h3 { margin: 0 0 4px; font-size: 16px; }
.detail-type { color: var(--muted); font-size: 11px; margin: 0 0 12px; }
.detail-block { border-top: 1px solid var(--border); padding: 10px 0; }
.detail-label { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { border-radius: 5px; padding: 2px 7px; font-size: 11px; background: var(--surface-soft); border: 1px solid var(--border); }
.tag.deprecated { background: var(--warn-soft); border-color: var(--finding-border); color: var(--warn); }
.detail-note { font-size: 12px; line-height: 1.8; color: var(--text); }
.detail-actions { display: flex; gap: 6px; margin-top: 10px; }
.entity-picker { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.entity-pick {
  text-align: left; border: 1px solid var(--border); background: var(--surface);
  border-radius: 7px; padding: 8px 9px; font-size: 12px;
}
.entity-pick:hover { border-color: var(--accent); background: var(--accent-soft); }

#snapshotList { margin-top: 10px; }
#snapshotList li { border: 1px solid var(--border); }
.snapshot-tag { font-size: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; }
.snapshot-tag.protect { color: var(--warn); background: var(--warn-soft); }

/* ---------- 底栏 ---------- */
.statusbar {
  height: var(--statusbar-h); flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  background: var(--surface); border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
.save-status { font-weight: 600; color: var(--saved); }
.save-status.saving { color: var(--warn); }
.save-status.error { color: var(--danger); }
.sep { color: #c6cbd4; }
.status-note { margin-left: auto; }
.status-right { padding-left: 12px; border-left: 1px solid var(--border); }

/* ---------- 帮助抽屉 ---------- */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 360px; z-index: 60;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--drawer-shadow);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-body { padding: 14px 18px; overflow: auto; }
.drawer-body h3 { font-size: 12px; color: var(--muted); margin: 16px 0 7px; }
.drawer-body h3:first-child { margin-top: 0; }
.steps, .boundary { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.boundary strong { color: var(--text); }
.drawer-body .hint { padding: 0; }

/* ---------- T-20：提示忽略 / 可操作空状态 / 版本轨迹 ---------- */
.finding-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.finding-ignore {
  flex: none; border: 1px solid var(--finding-border); background: transparent; color: var(--warn);
  border-radius: 5px; font-size: 11px; padding: 3px 7px; min-height: 26px;
}
.finding-ignore:hover { background: var(--finding-bg); }
.ignored-restore {
  width: 100%; text-align: left; border: 1px dashed var(--border);
  background: var(--surface-soft); color: var(--muted);
  border-radius: 7px; padding: 6px 9px; font-size: 11px;
}
.ignored-restore:hover { border-color: var(--accent); color: var(--accent); }

.empty-state .btn { margin-top: 10px; }
.empty-state > span { display: block; }

.version-timeline { display: flex; flex-direction: column; gap: 5px; }
.version-step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.version-index {
  min-width: 26px; text-align: center; font-size: 10px; color: var(--muted);
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.version-name { color: var(--text); }
.version-step.deprecated .version-name { text-decoration: line-through; color: var(--warn); }
.version-step.current .version-name { font-weight: 700; color: var(--accent); }
.version-flag { font-size: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; }

/* ---------- T-20：焦点模式（只隐藏左右栏，顶/底栏保留以便随时退出） ---------- */
.focus-toggle {
  margin-left: 10px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; padding: 3px 9px; font-size: 11px; color: var(--muted);
}
.focus-toggle:hover, body.focus-mode .focus-toggle {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
body.focus-mode .layout { grid-template-columns: minmax(0, 1fr); }
body.focus-mode .sidebar, body.focus-mode .inspector { display: none; }
body.focus-mode .editor-scroll { padding-left: 48px; padding-right: 48px; }
body.focus-mode .editor-stage { width: min(760px, 100%); }
body.focus-mode .status-note, body.focus-mode .status-right { display: none; }
body.focus-mode .focus-toggle { margin-left: auto; }

/* ---------- T-21：显示设置 / AI 结果卡空插槽 / 1280px 适配 / 可访问性 ---------- */
.status-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; padding: 3px 9px; min-height: 24px;
  font-size: 11px; color: var(--muted);
}
.status-btn:hover, .status-btn[aria-expanded="true"] {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.display-panel {
  position: fixed; z-index: 55; right: 14px;
  bottom: calc(var(--statusbar-h) + 8px); width: 300px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--menu-shadow); padding: 12px;
}
.display-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.display-label { flex: none; width: 56px; font-size: 12px; color: var(--muted); }
.seg { display: flex; gap: 4px; flex: 1; }
.seg-btn {
  flex: 1; min-height: 30px; border: 1px solid var(--border);
  background: var(--surface-soft); color: var(--muted);
  border-radius: 6px; font-size: 12px;
}
.seg-btn:hover { border-color: var(--accent); color: var(--accent); }
.seg-btn.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent); font-weight: 700;
}
.display-note { margin: 2px 0 0; font-size: 11px; line-height: 1.7; color: var(--muted); }
.display-note strong { color: var(--text); }

.ai-slot {
  margin-top: 14px; padding: 10px;
  border: 1px dashed var(--border); border-radius: 8px;
  background: var(--surface-soft); color: var(--muted);
}
.ai-slot-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text); }
.ai-slot-badge {
  font-size: 10px; font-weight: 400; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.ai-slot p { margin: 6px 0 0; font-size: 11px; line-height: 1.7; }

/* ---------- T-25 / T-26：一级模式切换 / 灵感 / 设定管理 / AI 对话 ---------- */
.mode-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin-bottom: 14px; padding: 3px;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 9px;
}
.mode-btn {
  min-height: 34px; border: 1px solid transparent; background: transparent;
  border-radius: 6px; color: var(--muted); font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.mode-btn:hover { color: var(--accent); }
.mode-btn.active {
  background: var(--surface); color: var(--accent);
  border-color: var(--active-border); font-weight: 700;
  box-shadow: 0 1px 3px rgba(31, 36, 48, .06);
}
.mode-glyph { font-size: 13px; }
.mode-panel { display: flex; flex-direction: column; }

/* ---------- T-27：设定分类（彩色标签云 + 内联编辑器） ---------- */
.category-group { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.category-bar {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.category-chip {
  --cat-solid: var(--muted); --cat-soft: var(--surface-soft);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-soft);
  color: var(--text); font-size: 12px; line-height: 1.2;
  background: var(--cat-soft); border-color: var(--cat-solid);
  transition: box-shadow .12s ease, transform .12s ease;
}
.category-chip:hover { box-shadow: 0 1px 5px rgba(0, 0, 0, .12); }
.category-chip.active {
  box-shadow: 0 0 0 2px var(--cat-solid); font-weight: 700;
}
.cat-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  background: var(--cat-solid); border: 1px solid rgba(0, 0, 0, .12);
}
.category-chip .cat-more {
  margin-left: 2px; padding: 0 2px; opacity: .55; font-size: 13px; line-height: 1;
}
.category-chip .cat-more:hover { opacity: 1; }
.category-editor {
  margin-top: 10px; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface);
}
.category-editor .manage-input { margin-bottom: 8px; }
.category-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.color-swatch {
  --cat-solid: var(--muted);
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; background: var(--cat-solid);
  padding: 0; transition: transform .1s ease;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--cat-solid); }
.category-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.cat-inline {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--cat-soft); color: var(--cat-solid);
  font-weight: 700; margin-right: 8px;
}

/* 中栏 · 设定 / 灵感管理视图 */
.manage-area, .idea-area { background: var(--surface); }
.manage-scroll {
  overflow: auto; padding: 24px 32px; min-height: 0; flex: 1;
  max-width: 760px; width: 100%; margin: 0 auto;
}
.manage-head { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.manage-head h2 { margin: 0 0 4px; font-size: 20px; color: var(--text); }
.manage-field { display: block; margin-bottom: 16px; }
.manage-field .detail-label { display: block; margin-bottom: 6px; }
.manage-field-grow { flex: 1; display: flex; flex-direction: column; }
.manage-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-soft); color: var(--text); font-size: 14px;
}
.manage-input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.manage-title { font-size: 17px; font-weight: 700; }
.manage-textarea {
  width: 100%; padding: 11px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-soft); color: var(--text);
  font-size: 14px; line-height: 1.8; resize: vertical; font-family: var(--editor-font);
}
.manage-textarea:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.manage-idea-body { min-height: 240px; flex: 1; }
.idea-area .manage-scroll { display: flex; flex-direction: column; max-width: 860px; }
.manage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.mini-danger { color: var(--danger); }
.mini-danger:hover { background: var(--error-bg); border-color: var(--danger); }

/* 右栏 · AI 对话 */
#panelAI { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ai-context {
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 10px; margin-bottom: 10px; flex: none;
}
.ai-context-title { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ai-context-pill {
  display: inline-block; font-size: 10px; color: var(--accent);
  background: var(--accent-soft); border-radius: 10px; padding: 2px 7px; margin: 0 4px 4px 0;
}
.ai-context-note { font-size: 10px; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.ai-thread { flex: 1; min-height: 120px; overflow: auto; margin-bottom: 10px; }
.ai-msg { border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.7; }
.ai-msg-user { background: var(--accent-soft); margin-left: 28px; }
.ai-msg-assistant { background: var(--surface-soft); border: 1px solid var(--border); margin-right: 16px; }
.ai-msg-role { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.ai-msg-body { font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.ai-prompt-chip {
  display: block; width: 100%; text-align: left; margin-top: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  border-radius: 6px; padding: 6px 9px; font-size: 11px;
}
.ai-prompt-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-compose { flex: none; border-top: 1px solid var(--border); padding-top: 8px; }
.ai-input {
  width: 100%; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-soft); color: var(--text); padding: 8px 10px;
  font-size: 12px; line-height: 1.6; resize: none;
}
.ai-input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.ai-compose-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.ai-mock-tag { font-size: 10px; color: var(--muted); }

/* 1280px 笔记本：三栏全部保留，收窄两侧，正文列仍 ≥600px */
@media (max-width: 1360px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr) 288px; }
  .editor-scroll { padding-left: 16px; padding-right: 16px; }
  .inspector-body { padding: 10px; }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr); }
  .inspector { display: none; }
  .status-note { display: none; }
}

/* ---------- T-14：验证看板 + 假门留资 ---------- */
.drawer-wide { width: 560px; max-width: 92vw; }
/* T-23：存储信息条（只显示载体/容量/迁移状态，不含作品内容） */
.dash-storage {
  font-size: 11px; color: var(--muted); line-height: 1.6;
  margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface-soft); border: 1px solid var(--border);
}
.dash-storage.warn { color: #c0563f; border-color: #c0563f; background: rgba(192, 86, 63, .08); }
.metric-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px;
}
.metric-card {
  border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px;
  background: var(--surface-soft); display: flex; flex-direction: column; gap: 3px;
}
.metric-card.danger { border-color: #c0563f; background: rgba(192, 86, 63, .08); }
.metric-label { font-size: 12px; font-weight: 700; color: var(--text); }
.metric-value { font-size: 20px; font-weight: 700; color: var(--accent, var(--text)); letter-spacing: .3px; }
.metric-card.danger .metric-value { color: #c0563f; }
.metric-basis { font-size: 10px; color: var(--muted); line-height: 1.5; }
.metric-threshold { font-size: 10px; color: var(--muted); font-style: italic; }
.dash-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.dash-stats { font-size: 11px; color: var(--muted); margin-right: auto; }
.note-small { font-size: 10px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.btn-danger { color: #c0563f; border-color: #c0563f; }
.btn-danger:hover { background: rgba(192, 86, 63, .08); }

.modal {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 16, 10, .38);
}
.modal-card {
  width: 440px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 20px 22px; box-shadow: var(--drawer-shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.lead-field { display: flex; flex-direction: column; gap: 5px; margin: 14px 0 10px; font-size: 12px; color: var(--text); }
.lead-field input {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-soft); color: var(--text); font-size: 13px;
}
.lead-check { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.lead-check input { margin-top: 2px; }
.lead-actions { display: flex; gap: 8px; margin-top: 16px; }
.lead-status { font-size: 11px; color: var(--accent, var(--text)); margin: 12px 0 0; min-height: 16px; }


/* ---------- T-33：分类与内容目录（纯文本目录，无分组卡片 / 无行内操作） ---------- */
/* 目录外框占满左栏剩余高度：顶部「分类」标题框 + 右侧＋，下面是分类 → 内容两层纯文本 */
.mode-panel[data-mode-panel="cards"] { flex: 1; min-height: 0; }
.tree-directory {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  margin-bottom: 6px; padding: 10px 10px 16px;
  border: 1px solid var(--directory-border, var(--border)); border-radius: 8px; background: var(--surface);
  overflow: auto;
}
.tree-directory-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 0 2px; flex: none; }
.tree-directory-title {
  flex: 1; min-width: 0; margin: 0; padding: 5px 9px;
  border: 1.5px solid var(--text); border-radius: 3px; background: var(--surface);
  font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text);
}
.tree-add {
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  font-size: 17px; line-height: 1; min-width: 28px; min-height: 28px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.tree-add:hover { color: var(--accent); }
.tree-list { list-style: none; margin: 0; padding: 0 0 0 20px; flex: 1; min-height: 0; }

/* 每个分类只是目录里的一行文字，不再是一个带边框/底色的卡片 */
#entityList > .tree-group { position: relative; margin: 0 0 18px; padding: 0 0 18px; border: 0; background: transparent; }
.tree-group-head {
  display: flex; align-items: center; gap: 6px; padding: 2px 0;
  font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; user-select: none;
}
.tree-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#entityList > .tree-group.selected > .tree-group-head .tree-group-name { color: var(--accent); font-weight: 600; }
.tree-group-add {
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  font-size: 15px; line-height: 1; min-width: 28px; min-height: 28px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.tree-group-add:hover { color: var(--accent); }
/* 分类的编辑 / 删除只在悬停时浮出，默认目录行右侧只留一个 ＋ */
.tree-group-tools {
  position: absolute; right: 30px; top: 0; display: flex; gap: 2px;
  padding-left: 6px; background: var(--surface); opacity: 0; pointer-events: none;
}
.tree-group-head:hover .tree-group-tools, .tree-group-tools:focus-within { opacity: 1; pointer-events: auto; }
.tree-group-more {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; min-width: 24px; min-height: 28px; padding: 0;
}
.tree-group-more:hover { color: var(--accent); }

/* 分类色引导竖线：从分类名下方延伸到内容末尾，点击可折叠 / 展开 */
#entityList > .tree-group > .cat-dot.cat-rail {
  position: absolute; left: 0; top: 32px; bottom: 2px;
  width: 3px; height: auto; border: 0; border-radius: 1px; flex: none;
  background-color: var(--cat-solid, var(--muted)); opacity: .8; cursor: pointer;
}
#entityList > .tree-group > .cat-dot.cat-rail:hover { opacity: 1; width: 4px; }
.tree-cards { list-style: none; margin: 0; padding: 7px 0 0 26px; }
.tree-card {
  display: flex; align-items: center; padding: 8px 2px; cursor: pointer;
  font-size: 12.5px; line-height: 1.5; color: var(--text); background: transparent;
}
.tree-card .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-card:hover .name { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tree-card.active .name { color: var(--accent); font-weight: 700; }

/* ---------- T-30 / CR-24：中栏子视图切换 + 常驻保存 + 连接管理 ---------- */
.entity-viewbar {
  display: flex; align-items: center; gap: 6px; padding: 8px 24px;
  border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.card-subswitch { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
/* CR-24：保存按钮不属于画布，靠 margin-left:auto 常驻「编辑 / 画布」最右侧 */
.save-tool { margin-left: auto; flex: none; }
.subtab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 700;
}
.subtab.active { background: var(--surface-soft); color: var(--accent); }
/* T-36：设定模式「编辑 / 画布」双视图容器，编辑页复用稿纸样式 */
.entity-editor-view, .entity-canvas-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.entity-editor-view .editor-head { padding-top: 10px; }
/* 画布底部的＋添加卡片入口：在画布区域之外，始终可见 */
.canvas-add-foot {
  flex: none; display: flex; justify-content: center; padding: 9px 16px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.link-section {
  margin: 18px 0; padding: 14px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-soft);
}
.link-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.link-head h3 { margin: 0; font-size: 14px; color: var(--text); }
.link-list { list-style: none; margin: 0 0 10px; padding: 0; }
.link-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 4px;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.link-text { flex: 1; min-width: 0; color: var(--text); }
.link-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.link-form .manage-input { width: auto; flex: 1 1 130px; }
.link-directed { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }

/* ---------- T-32 / Q4：右栏只保留 AI 对话 ---------- */
.inspector-head { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); flex: none; }
.inspector-title { font-weight: 700; font-size: 14px; }
.inspector-body .ai-context { margin-bottom: 10px; }
.inspector-body .ai-thread { flex: 1; min-height: 120px; }
.inspector-body .ai-compose { margin-top: auto; }
.classic-tabs { display: flex; gap: 2px; padding: 6px 16px 0; border-bottom: 1px solid var(--border); flex: none; }
.drawer .tab-panel .hint { padding: 0; }

/* ---------- T-32：卡片画布 ---------- */
.card-canvas { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 0 0 24px; background: var(--bg); }
.canvas-crumb { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: 13px; background: var(--surface); border-bottom: 1px solid var(--border); }
.canvas-crumb-current { font-weight: 700; color: var(--text); }
.canvas-layer { position: relative; min-height: 720px; margin: 16px; }
.canvas-card { position: absolute; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.canvas-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--bg)); flex: none; }
.canvas-card-title { font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-card-badge { font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 1px 6px; flex: none; }
.canvas-card-del { border: none; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; flex: none; }
.canvas-card-del:hover { color: var(--danger, #c0392b); }
.attr-card { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.canvas-attr-field { display: flex; flex-direction: column; gap: 3px; padding: 0 10px; }
.canvas-attr-field .detail-label { font-size: 10px; color: var(--muted); }
.canvas-attr-field .manage-input { font-size: 12px; padding: 5px 7px; }
.canvas-attr-actions { display: flex; gap: 6px; padding: 8px 10px; margin-top: auto; }
.drag-handle { cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.free-card { border-left: 4px solid var(--cat-solid, var(--border)); }
.canvas-card-input { margin: 8px 10px 0; padding: 5px 7px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); flex: none; }
.canvas-card-body { flex: 1; min-height: 0; margin: 6px 10px 10px; padding: 6px 7px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); resize: none; line-height: 1.6; }
.link-card { margin: 0 16px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px; }

/* ---------- T-32：极简通用对话框 ---------- */
.dlg-card { width: 420px; max-width: 94vw; }
.dlg-body { padding: 16px 18px 8px; }
.dlg-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.dlg-field .manage-input { font-size: 13px; padding: 8px 10px; }
.dlg-hint { font-size: 11px; color: var(--muted); margin: 0 0 6px; line-height: 1.6; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg); }

/* T-27：分类色 token → 变量映射。必须放在组件样式之后，否则会被组件里的 --cat-solid 默认值覆盖。 */
.cat-rose    { --cat-solid: var(--cat-rose);    --cat-soft: var(--cat-rose-soft); }
.cat-violet  { --cat-solid: var(--cat-violet);  --cat-soft: var(--cat-violet-soft); }
.cat-sky     { --cat-solid: var(--cat-sky);     --cat-soft: var(--cat-sky-soft); }
.cat-emerald { --cat-solid: var(--cat-emerald); --cat-soft: var(--cat-emerald-soft); }
.cat-amber   { --cat-solid: var(--cat-amber);   --cat-soft: var(--cat-amber-soft); }
.cat-orange  { --cat-solid: var(--cat-orange);  --cat-soft: var(--cat-orange-soft); }
.cat-cyan    { --cat-solid: var(--cat-cyan);    --cat-soft: var(--cat-cyan-soft); }
.cat-pink    { --cat-solid: var(--cat-pink);    --cat-soft: var(--cat-pink-soft); }
.cat-lime    { --cat-solid: var(--cat-lime);    --cat-soft: var(--cat-lime-soft); }
.cat-indigo  { --cat-solid: var(--cat-indigo);  --cat-soft: var(--cat-indigo-soft); }
.cat-slate   { --cat-solid: var(--muted);       --cat-soft: var(--surface); }
/* T-32：画布自由卡左侧色条（跟随内容标识色，需放在 token 映射之后） */
.cat-border-rose    { --cat-solid: var(--cat-rose); }
.cat-border-violet  { --cat-solid: var(--cat-violet); }
.cat-border-sky     { --cat-solid: var(--cat-sky); }
.cat-border-emerald { --cat-solid: var(--cat-emerald); }
.cat-border-amber   { --cat-solid: var(--cat-amber); }
.cat-border-orange  { --cat-solid: var(--cat-orange); }
.cat-border-cyan    { --cat-solid: var(--cat-cyan); }
.cat-border-pink    { --cat-solid: var(--cat-pink); }
.cat-border-lime    { --cat-solid: var(--cat-lime); }
.cat-border-indigo  { --cat-solid: var(--cat-indigo); }

/* ---------- CR-25：灵感页卡片画布（只新增中栏 ideas 面板的选择器） ---------- */
.idea-viewbar {
  display: flex; align-items: center; gap: 6px; padding: 8px 24px;
  border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.idea-tabs { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.idea-auto { margin-left: auto; flex: none; }
.idea-add { flex: none; }
.idea-canvas {
  position: relative; flex: 1; min-height: 0; min-width: 0; overflow: auto;
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) .7px, transparent .7px);
  background-size: 20px 20px;
}
.idea-layer { position: relative; min-width: 100%; min-height: 100%; }
.idea-card {
  position: absolute; display: flex; flex-direction: column;
  min-width: 180px; min-height: 120px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--cat-solid, var(--border));
  border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  overflow: visible;
}
.idea-card.dirty { box-shadow: 0 0 0 2px var(--accent-soft), 0 2px 8px rgba(0, 0, 0, .08); }
.idea-card-highlight { animation: idea-flash 1.5s ease-out; }
@keyframes idea-flash {
  0%, 60% { box-shadow: 0 0 0 3px var(--accent), 0 2px 12px rgba(0, 0, 0, .12); }
  100% { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
}
.idea-card-head {
  display: flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  border-radius: 11px 11px 0 0;
  background: var(--cat-soft, var(--surface-soft));
  cursor: grab; user-select: none; touch-action: none;
}
.idea-card-head:active { cursor: grabbing; }
.idea-color-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--cat-solid, var(--muted)); border: 1px solid rgba(0, 0, 0, .12);
}
.idea-card-time {
  flex: 1; min-width: 0; font-size: 10px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.idea-card-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.idea-tool-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  min-width: 24px; min-height: 24px; padding: 0 4px; border-radius: 5px;
  font-size: 11px; line-height: 1;
}
.idea-tool-btn:hover { background: var(--surface); color: var(--text); }
.idea-tool-btn.idea-tool-del:hover { color: var(--danger); background: var(--error-bg); }
.idea-card-title, .idea-card-tags {
  flex: none; margin: 8px 10px 0; padding: 5px 7px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text);
  min-width: 0;
}
.idea-card-title { font-weight: 700; }
.idea-card-title:focus, .idea-card-tags:focus, .idea-card-body:focus {
  border-color: var(--accent); background: var(--surface); outline: none;
}
.idea-card-body {
  flex: 1; min-height: 0; margin: 6px 10px; padding: 6px 7px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text);
  resize: none; line-height: 1.6; font-family: var(--editor-font);
}
.idea-card-tags { margin: 0 10px 6px; }
.idea-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; flex: none;
  padding: 6px 10px; border-top: 1px solid var(--border); background: var(--surface-soft);
  border-radius: 0 0 11px 11px;
}
.idea-card-state { font-size: 10px; color: var(--muted); }
.idea-card.dirty .idea-card-state { color: var(--accent); font-weight: 700; }
.idea-card-foot .btn { min-height: 24px; padding: 2px 10px; font-size: 11px; }
.idea-empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-width: 260px; max-width: 360px; text-align: center;
}
.idea-empty .empty-state { padding: 18px; }

/* 8 向边缘缩放把手：只在卡片 hover 时给出视觉反馈，命中区始终存在 */
.idea-resize-handle { position: absolute; z-index: 3; touch-action: none; }
.idea-resize-handle:hover { background: var(--accent-soft); }
.idea-resize-handle[data-dir="n"], .idea-resize-handle[data-dir="s"] {
  left: 12px; right: 12px; height: 8px; cursor: ns-resize;
}
.idea-resize-handle[data-dir="w"], .idea-resize-handle[data-dir="e"] {
  top: 12px; bottom: 12px; width: 8px; cursor: ew-resize;
}
.idea-resize-handle[data-dir="n"] { top: -4px; }
.idea-resize-handle[data-dir="s"] { bottom: -4px; }
.idea-resize-handle[data-dir="w"] { left: -4px; }
.idea-resize-handle[data-dir="e"] { right: -4px; }
.idea-resize-handle[data-dir="ne"], .idea-resize-handle[data-dir="nw"],
.idea-resize-handle[data-dir="se"], .idea-resize-handle[data-dir="sw"] {
  width: 12px; height: 12px;
}
.idea-resize-handle[data-dir="ne"] { top: -5px; right: -5px; cursor: nesw-resize; }
.idea-resize-handle[data-dir="nw"] { top: -5px; left: -5px; cursor: nwse-resize; }
.idea-resize-handle[data-dir="se"] { bottom: -5px; right: -5px; cursor: nwse-resize; }
.idea-resize-handle[data-dir="sw"] { bottom: -5px; left: -5px; cursor: nesw-resize; }

/* 卡片内取色浮层：复用 T-27 的 .color-swatch + 10 色 token */
.idea-palette {
  position: absolute; top: 34px; right: 8px; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 22px); gap: 6px;
  padding: 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
}
.idea-palette .color-swatch { width: 22px; height: 22px; }
.idea-palette-neutral {
  grid-column: 1 / -1; border: 1px solid var(--border); background: var(--surface-soft);
  color: var(--muted); border-radius: 6px; min-height: 24px; font-size: 11px; cursor: pointer;
}
.idea-palette-neutral:hover { color: var(--text); background: var(--surface); }


/* ---------- CR-26：主页（项目启动器） ---------- */
body.home-mode .topbar,
body.home-mode .layout,
body.home-mode .statusbar { display: none !important; }

.home-view {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.home-topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 32px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex: 0 0 auto;
}
.home-topbar .top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.home-topbar .seg { flex: none; display: flex; gap: 4px; }
.home-brand-name { font-weight: 600; letter-spacing: .3px; }
.home-profile {
  display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
  border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--text); cursor: pointer; font-family: inherit; font-size: 13px;
}
.home-profile:hover { border-color: var(--border); background: var(--surface-soft); }
.home-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft, rgba(122, 92, 46, .15));
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.home-profile-input {
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
  font-family: inherit; font-size: 13px; background: var(--surface); color: var(--text);
  width: 120px;
}
.home-body { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 32px 24px; }
.home-date { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.home-hero h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.home-hero h1 .home-greet-name { color: var(--accent); font-style: normal; }
.home-week { font-size: 13px; color: var(--muted); margin-top: 6px; }
.home-actions { display: flex; gap: 12px; margin-top: 20px; }
.home-new-form { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.home-new-input {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-family: inherit; font-size: 14px; background: var(--surface); color: var(--text); width: 280px;
}
.home-new-input:focus { outline: none; border-color: var(--accent); }
.home-projects { margin-top: 34px; }
.home-sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.home-sec-head h2 { font-size: 15px; font-weight: 600; }
.home-count { font-size: 12.5px; color: var(--muted); }
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px;
}
.home-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
}
.home-card:hover { border-color: var(--accent); }
.home-cover { height: 64px; display: flex; align-items: flex-end; padding: 0 14px; }
.home-glyph {
  width: 36px; height: 36px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; transform: translateY(18px); color: var(--text);
}
.home-card-body { padding: 24px 14px 10px; }
.home-card-title { font-size: 14.5px; font-weight: 600; margin-bottom: 5px; }
.home-card-title-input {
  width: 100%; border: 1px solid var(--accent); border-radius: 6px; padding: 3px 8px;
  font-family: inherit; font-size: 14px; background: var(--surface); color: var(--text);
}
.home-card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.home-card-foot {
  padding: 8px 14px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
}
.home-card-tools { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.home-card:hover .home-card-tools, .home-card:focus-within .home-card-tools { opacity: 1; }
.home-tool {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 11px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-family: inherit;
}
.home-tool:hover { color: var(--accent); border-color: var(--accent); }
.home-card-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 176px; border-style: dashed; color: var(--muted); background: transparent;
}
.home-card-add .home-plus { font-size: 22px; color: var(--accent); }
.home-card-add span.home-add-label { font-size: 13px; }
.home-empty {
  grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 13px;
  padding: 28px 0; border: 1px dashed var(--border); border-radius: 12px;
}
.home-foot {
  text-align: center; padding: 14px; font-size: 11.5px; color: var(--muted); flex: 0 0 auto;
}
.home-modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.home-modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; width: min(420px, 90vw); color: var(--text);
}
.home-modal-box h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.home-modal-box p { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.home-modal-actions { display: flex; align-items: center; gap: 8px; }
.home-modal-spacer { flex: 1; }

/* ---------- CR-27：AI 设置抽屉 / 右栏状态化 ---------- */
.home-settings-btn { flex: none; }
.ai-head { flex-direction: column; align-items: stretch; gap: 7px; }
.ai-head-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ai-head-btn { margin-left: auto; flex: none; }
.ai-role-select {
  flex: 1; min-width: 0; padding: 4px 6px; font-size: 11px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-soft); color: var(--text);
}
.ai-role-select:focus { border-color: var(--accent); outline: none; }
.ai-scope-tag {
  flex: none; font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px; padding: 2px 6px;
}
.ai-foot-actions { display: flex; gap: 6px; align-items: center; }
.ai-foot-btn { font-size: 11px; }
.ai-msg-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.ai-msg-save {
  font-size: 10px; color: var(--accent); background: transparent;
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; cursor: pointer;
}
.ai-msg-save:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-slot-badge.is-live { color: var(--accent); }

.settings-drawer .drawer-body { padding: 16px 20px 28px; }
.settings-tabs {
  display: flex; gap: 2px; padding: 6px 16px 0;
  border-bottom: 1px solid var(--border); flex: none;
}
.settings-tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 8px 12px; border-bottom: 2px solid transparent;
}
.settings-tab:hover { color: var(--accent); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-panel { padding-top: 2px; }
.settings-field {
  display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px;
  font-size: 12px; color: var(--text);
}
.settings-input {
  width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-soft); color: var(--text);
}
.settings-input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.settings-textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.settings-key-row { display: flex; gap: 6px; }
.settings-key-row .settings-input { flex: 1; min-width: 0; }
.settings-key-row .btn { flex: none; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.settings-note { font-size: 11px; color: var(--muted); line-height: 1.65; margin: 4px 0 12px; }
.settings-consent {
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; margin-bottom: 14px;
}
.settings-check { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.65; color: var(--text); }
.settings-check input { margin-top: 3px; flex: none; }
.settings-consent .settings-note { margin: 8px 0 0; }
.settings-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings-spacer { flex: 1; }
.settings-status {
  font-size: 11px; color: var(--accent); min-height: 16px;
  margin: 10px 0 0; line-height: 1.65; word-break: break-word;
}
.settings-status.error { color: var(--danger); }
.settings-role-layout { display: grid; grid-template-columns: 156px 1fr; gap: 14px; }
.settings-role-list {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--border);
  border-radius: 9px; overflow: auto; max-height: 348px;
}
.settings-role-item {
  padding: 8px 10px; font-size: 12px; cursor: pointer;
  border-bottom: 1px solid var(--border); line-height: 1.5;
}
.settings-role-item:last-child { border-bottom: 0; }
.settings-role-item:hover { background: var(--surface-soft); }
.settings-role-item.active { background: var(--accent-soft); color: var(--accent); }
.settings-role-item small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.settings-role-pack { margin-top: 14px; }
.settings-privacy-state {
  border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 14px; margin-bottom: 16px; font-size: 12px; line-height: 1.9;
}
.settings-privacy-row { display: flex; justify-content: space-between; gap: 12px; }
.settings-privacy-row span:first-child { color: var(--muted); }
.settings-privacy-row strong { font-weight: 600; }
@media (max-width: 1100px) {
  .settings-role-layout { grid-template-columns: 1fr; }
  .settings-role-list { max-height: 160px; }
}

/* ==================== CR-28：右栏双页签 + 本章 Inspector + 卡片墙 ==================== */

/* 右栏页签行：只在写作模式可见（switchMode 控制 .hidden） */
.right-tabs {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); flex: none;
}
.chapter-inspector {
  flex: 1; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 12px;
}
.ai-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.insp-section { display: flex; flex-direction: column; gap: 6px; }
.insp-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.insp-synopsis { min-height: 88px; font-size: 13px; }
.insp-synopsis:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.insp-palette { gap: 7px; margin-bottom: 0; }
.insp-swatch-none {
  background: var(--surface-soft);
  border: 2px dashed var(--border);
}
.insp-stats { display: flex; gap: 8px; }
.insp-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px 6px;
  background: var(--surface-soft);
}
.insp-stat b { font-size: 15px; color: var(--text); }
.insp-stat-label { font-size: 10px; color: var(--muted); }
.insp-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.insp-refs .mention-pill { min-height: 24px; padding: 2px 9px; font-size: 11px; }
.insp-empty { font-size: 11px; color: var(--muted); }
.insp-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 写作中栏：稿纸 / 卡片墙双视图 */
.chapter-viewbar {
  display: flex; align-items: center; gap: 6px; padding: 8px 24px;
  border-bottom: 1px solid var(--border); flex: 0 0 auto; background: var(--surface);
}
.chapter-subswitch { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.chapter-draft-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chapter-draft-view .editor-head { padding-top: 10px; }
.chapter-cards-view {
  flex: 1; min-height: 0; overflow: auto; background: var(--bg);
  padding: 18px 22px 26px;
}
.chapter-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 220px);
  gap: 16px; align-items: start; justify-content: center;
}
.ch-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 0 0 8px; overflow: hidden; cursor: pointer;
  box-shadow: var(--paper-shadow); user-select: none; touch-action: none;
  display: flex; flex-direction: column; min-height: 132px;
}
.ch-card.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.ch-card.dragging { opacity: .55; outline: 2px dashed var(--accent); }
.ch-card.dim { opacity: .38; }
.ch-card.match { outline: 2px solid var(--warn); outline-offset: 1px; }
body.wall-dragging { cursor: grabbing; }
body.wall-dragging * { cursor: grabbing !important; }
.ch-bar {
  height: 6px; flex: none; background: var(--cat-solid, var(--muted));
}
.ch-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 2px;
}
.ch-title { font-weight: 700; font-size: 13px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-tools { display: none; gap: 2px; flex: none; }
.ch-card:hover .ch-tools, .ch-card:focus-within .ch-tools { display: inline-flex; }
.ch-tool {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 2px 5px; border-radius: 4px; line-height: 1.2;
}
.ch-tool:hover { background: var(--surface-soft); color: var(--accent); }
.ch-body {
  flex: 1; padding: 2px 10px 6px; font-size: 12px; line-height: 1.65;
  color: var(--text); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.ch-body.faint { color: var(--muted); font-style: italic; }
.ch-synopsis-edit {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1px solid var(--accent); border-radius: 6px; padding: 6px 8px;
  background: var(--surface-soft); color: var(--text);
  font-size: 12px; line-height: 1.6; font-family: var(--editor-font);
}
.ch-foot {
  display: flex; align-items: center; gap: 6px; padding: 0 10px;
  font-size: 11px; color: var(--muted);
}
.ch-foot .ch-meta:first-child { margin-right: auto; }
.ch-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
}
.ch-badge.st-draft { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--border); }
.ch-badge.st-rev { background: var(--warn-soft); color: var(--warn); }
.ch-badge.st-final { background: var(--accent-soft); color: var(--ok, var(--accent)); }
.ch-badge.st-other { background: var(--surface-soft); color: var(--text); border: 1px solid var(--border); }
.ch-add {
  border: 1.5px dashed var(--border); background: var(--surface-soft);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  min-height: 132px; font-size: 13px; cursor: pointer;
}
.ch-add:hover { color: var(--accent); border-color: var(--accent); }

/* 窄屏：右栏整体隐藏沿用 L-04；卡片墙降为单列由 auto-fill 自适应 */

/* CR-28.2/28.3：Inspector 章节名称（整行输入）；复制 / 删除在快照下方操作行 */
#inspTitle { font-weight: 700; }
.insp-actions + .insp-actions { margin-top: 6px; }

/* ==================== CR-29：专注模式（聚焦粒度 / 打字机滚动 / 真沉浸） ==================== */

/* 变暗强度：data-focus-dim 三档驱动遮罩块透明度（盖在非当前段上，值越大文字越「沉」） */
html[data-focus-dim='light'] { --focus-dim-block: .55; }
html[data-focus-dim='medium'] { --focus-dim-block: .72; }
html[data-focus-dim='heavy'] { --focus-dim-block: .85; }

/* 专注遮罩层：位于 textarea(z2)/镜像层(z3) 之上；稿纸色块把非当前段「褪进纸里」。
   正文在 textarea 显示、镜像层文字透明——对镜像做 opacity 变暗对正文无效，必须用遮罩。 */
.focus-dim-layer {
  position: absolute; inset: 0; z-index: 4;
  pointer-events: none; overflow: hidden;
}
.focus-dim-block {
  position: absolute;
  background: var(--surface);
  opacity: var(--focus-dim-block, .72);
  border-radius: 3px;
}
/* 镜像层分段类名保留（逻辑标记 / 冒烟断言用），不做视觉变暗 */
.focus-seg { opacity: 1; }
.focus-seg.focus-cur { opacity: 1; }

/* 专注控制条：仅专注模式可见，固定顶部居中 */
.focus-bar {
  display: none;
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 70; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px;
  box-shadow: var(--paper-shadow, 0 8px 26px rgba(0, 0, 0, .12));
}
body.focus-mode .focus-bar { display: flex; }

/* 真·沉浸：顶栏上移、底栏下移移出视口（保留 DOM）；控制条淡出、悬停浮现 */
.topbar, .statusbar { transition: transform .25s ease; }
body.focus-mode.deep .topbar { transform: translateY(-110%); }
body.focus-mode.deep .statusbar { transform: translateY(110%); }
body.focus-mode.deep .focus-bar { opacity: .06; transition: opacity .25s ease; }
body.focus-mode.deep .focus-bar:hover,
body.focus-mode.deep .focus-bar:focus-within { opacity: 1; }

/* 沉浸时稿纸满宽（沿用加宽稿纸），编辑区获得额外呼吸空间 */
body.focus-mode.deep .editor-scroll { padding-top: 18px; padding-bottom: 18px; }

/* ==================== CR-30：Zen 全屏写作（第三层：整屏只剩稿纸正文） ==================== */

/* zen 蕴含 focus-mode + deep；控制条完全隐藏（设置仍按 prefs 生效，只是不可见） */
body.zen #focusBar { display: none; }

/* 退出浮层：默认 opacity 0 + pointer-events none（静止时屏幕零元素）；
   mousemove 加 .visible 浮现 2.5s；键盘 Tab 聚焦强制可见 */
.zen-exit {
  position: fixed; top: 14px; right: 14px; z-index: 90;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .12);
}
body.zen .zen-exit.visible,
body.zen .zen-exit:focus-visible { opacity: .85; pointer-events: auto; }
body.zen .zen-exit:hover { opacity: 1; color: var(--accent); }

/* zen 稿纸呼吸边距（宽度沿用居中稿纸，可读性优先） */
body.zen .editor-scroll { padding-top: 24px; padding-bottom: 24px; }

/* CR-30 补遗：zen 下隐藏中栏内部的「稿纸/卡片墙」视图条与「新增章节」——deep 只隐藏顶底栏，中栏自己的 chrome 也要收掉 */
body.zen .chapter-viewbar { display: none; }
