/* ==========================================================================
   Lexi 组件层 · 重构版
   --------------------------------------------------------------------------
   这份文件对应 desktop/src/styles/app.css 的重构目标。

   架构上的三处改进：
   ① 组件分组：每个组件有自己的「区块」，不再是一份 1400 行的平铺清单
   ② 圆角只用令牌：不再出现裸写的 2px / 4px / 50% / 99px
   ③ 交互态统一：hover / active / focus / disabled 的表现集中在组件定义里
   ========================================================================== */

/* ══════════════════════════════════════════════════════════════
   1 · 应用骨架
   ══════════════════════════════════════════════════════════════ */
.app {
  display: flex; flex-direction: column; height: 100%;
  background: var(--bg); color: var(--text);
  font-size: var(--fs-md); line-height: var(--lh-ui); letter-spacing: var(--ls-ui);
}
.ic { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ══════════════════════════════════════════════════════════════
   2 · 顶栏
   ══════════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: grid; grid-template-columns: calc(var(--sidebar-w) + 5px) minmax(0, 1fr) auto;
  align-items: center; gap: var(--s-4);
  padding: 0 var(--s-4) 0 var(--s-5);
  background: var(--bg-elev); border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}

.brand {
  justify-self: start; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.2px;
  cursor: pointer; border-radius: var(--r-2);
  padding: 3px 7px 3px 4px;
  transition: background var(--dur), color var(--dur);
}
.brand:hover { background: var(--hover); }
.brand:active { background: var(--active); }

.brand .slogan {
  font-family: var(--font-sans);
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.brand .slogan[data-lang="zh"] { font-size: var(--fs-xl); }
.brand .slogan[data-lang="en"] { font-size: var(--fs-lg); }

.topbar-center {
  justify-self: center; display: flex; align-items: center;
  width: 100%; max-width: 460px; min-width: 0;
}
@media (max-width: 1080px) {
  .topbar { grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto; gap: var(--s-3); }
  .brand .slogan { display: none; }
}

/* ── 搜索组合控件 ────────────────────────────────────────────
   把「分类选择器 / 搜索框 / 新建」合成一个控件。
   旧版是三个独立元素（圆形 ＋ 按钮 + 搜索框），视觉上互不相干。
   新版：外层一个 10px 圆角容器，内部用分隔线划分三段。 */
.search-combo {
  display: flex; align-items: center;
  width: 100%; height: 38px;
  background: var(--bg-sunken);
  border: 1px solid transparent;
  border-radius: var(--r-3);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.search-combo:focus-within {
  background: var(--bg-elev);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.combo-cat {
  display: inline-flex; align-items: center; gap: 6px; height: 100%;
  padding: 0 10px 0 12px; border: 0; background: transparent;
  border-radius: var(--r-3) 0 0 var(--r-3);
  font-family: inherit; font-size: var(--fs-sm); font-weight: 550;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: color var(--dur), background var(--dur);
}
.combo-cat:hover { color: var(--text); background: var(--hover); }
.combo-swatch { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--accent); flex-shrink: 0; }
.combo-cat .ic { width: 12px; height: 12px; color: var(--text-3); }

.combo-search { position: relative; flex: 1; min-width: 0; height: 100%; }
.combo-search .ic {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.combo-search input {
  width: 100%; height: 100%; padding: 0 8px 0 32px;
  border: 0; background: transparent; color: var(--text);
  font-family: inherit; font-size: var(--fs-md); outline: none;
}
.combo-search input::placeholder { color: var(--text-3); }
.combo-search input::-webkit-search-cancel-button,
.combo-search input::-webkit-search-decoration,
.combo-search input::-webkit-search-results-button,
.combo-search input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* 新建按钮：唯一的橙色实心控件，贴在组合框右端 */
.combo-new {
  width: 34px; height: 34px; margin-right: 2px; flex-shrink: 0;
  border: 0; border-radius: var(--r-2);
  background: var(--accent); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--dur), transform var(--dur);
}
.combo-new:hover { background: var(--accent-hover); }
.combo-new:active { transform: scale(.93); }
.combo-new .ic { width: 17px; height: 17px; }

.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 34px; height: 34px; border: none; border-radius: var(--r-3);
  background: transparent; color: var(--text-2);
  cursor: pointer; display: grid; place-items: center;
  position: relative;
  transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { background: var(--active); }
.icon-btn .ic { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: var(--r-full); background: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   3 · 工作区 / 侧栏
   ══════════════════════════════════════════════════════════════ */
.workspace { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg-elev); border-right: 1px solid var(--line);
  padding: var(--s-2) var(--s-2) var(--s-6);
}

.sidebar-foot { padding: 10px 10px 0; font-size: var(--fs-xs); color: var(--text-3); }
.sidebar-foot .meter { height: 4px; border-radius: var(--r-full); background: var(--hover); overflow: hidden; margin-top: 6px; }
.sidebar-foot .meter i { display: block; height: 100%; background: var(--accent); width: 0%; transition: width var(--dur-3); }
.sidebar-foot.warn .meter i { background: var(--warn); }

/* ── 侧栏对齐：全文只有一条文字线（--sb-text = 55px） ──────────
   旧版分类名在 55px、分组标题在 48px、词条却在 32px ——
   子级反而比父级更靠左，层级是反的。
   新版把分类名 / 分组 / 词条 / 文章行全部对齐到 55px，
   左侧 10–52px 留给「展开箭头 + 分类图标」这条导轨。 */
.cat { margin-bottom: 2px; }
.cat-head {
  width: 100%; display: flex; align-items: center; gap: var(--s-2);
  padding: 7px 10px; border: none; border-radius: var(--r-2);
  background: transparent; cursor: pointer; text-align: left;
  color: var(--text-2); font-family: inherit; font-size: var(--fs-md); font-weight: 550;
  transition: background var(--dur), color var(--dur);
}
.cat-head:hover { background: var(--hover); color: var(--text); }
.cat-head .caret { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur) var(--ease); flex-shrink: 0; }
.cat.open > .cat-head .caret { transform: rotate(90deg); }
.cat-head .cicon { width: 15px; height: 15px; color: var(--text-3); flex-shrink: 0; }
.cat-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-head .count {
  font-size: var(--fs-xs); color: var(--text-3);
  background: var(--hover); border-radius: var(--r-full);
  padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.cat.open > .cat-head { background: var(--hover); color: var(--text); }
.cat.has-active > .cat-head .name { color: var(--accent); }
.cat-body { display: none; padding: 2px 0 6px 0; }
.cat.open > .cat-body { display: block; }

/* 时间分组头：文字回到 55px 主线，箭头退到左侧导轨 */
.tg { margin: 0 0 2px; }
.tg-head {
  position: relative;
  width: 100%; display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px var(--sb-text); border: none; background: transparent;
  cursor: pointer; color: var(--text-3);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .04em;
  border-radius: var(--r-2);
  transition: color var(--dur), background var(--dur);
}
.tg-head:hover { color: var(--text-2); background: var(--hover); }
.tg-head .tcaret {
  position: absolute; left: 42px; top: 50%; margin-top: -6px;
  width: 12px; height: 12px; transition: transform var(--dur) var(--ease);
}
.tg.open .tg-head .tcaret { transform: rotate(90deg); }
.tg-head .n { margin-left: auto; opacity: .8; }
.tg-body { display: none; }
.tg.open .tg-body { display: block; }

/* 词条行 */
.item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer;
  padding: 8px 10px 8px var(--sb-text); border-radius: var(--r-2);
  position: relative; transition: background var(--dur);
}
.item:hover { background: var(--hover); }
.item.active { background: var(--accent-soft); }
.item.active::before {
  content: ''; position: absolute; left: 44px; top: 10px; bottom: 10px;
  width: 3px; border-radius: var(--r-full); background: var(--accent);
}
.item .t { display: block; font-size: var(--fs-md); font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.45; }
.item .m { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.item .badge-err { color: var(--err); }

.side-empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.8; }
.side-empty svg { width: 34px; height: 34px; opacity: .3; display: block; margin: 0 auto 8px; }

.resizer { width: 5px; cursor: col-resize; flex-shrink: 0; background: transparent; transition: background var(--dur); }
.resizer:hover, .resizer.dragging { background: var(--accent-soft-2); }

/* 文章区 */
.art-sec { margin-top: var(--s-2); border-top: 1px solid var(--line); padding-top: var(--s-1); }
.art-folder { margin: 2px 0; }
.art-folder-head {
  position: relative;
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 7px 10px 7px var(--sb-text); border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--text-2); text-align: left; cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  transition: background var(--dur), color var(--dur);
}
.art-folder-head:hover { background: var(--hover); color: var(--text); }
.art-folder-head .fcaret { position: absolute; left: 43px; width: 10px; flex-shrink: 0; color: var(--text-3); font-size: 11px; }
.art-folder-head .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-folder-head .fcount { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.art-folder-body { padding-left: 0; }
.art-row.in-folder { padding-left: var(--sb-text); }
.art-sublabel { padding: var(--s-2) 10px var(--s-1) var(--sb-text); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; color: var(--text-3); }
.art-empty { padding: var(--s-1) 10px 6px var(--sb-text); font-size: var(--fs-xs); color: var(--text-3); }

.art-row {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 8px 10px 8px var(--sb-text); border: 0; background: transparent; cursor: pointer;
  font-family: inherit; border-radius: var(--r-2);
  transition: background var(--dur);
}
.art-row:hover { background: var(--hover); }
.art-row.active { background: var(--accent-soft); }
.art-row.active .t { color: var(--accent); }
.art-row .t { font-size: var(--fs-sm); font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-row .m { font-size: var(--fs-xs); color: var(--text-3); }

/* ══════════════════════════════════════════════════════════════
   4 · 右栏容器
   ══════════════════════════════════════════════════════════════ */
.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.pane-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.pane-inner { max-width: var(--pane-w); margin: 0 auto; padding: var(--s-8) var(--pane-px) var(--s-20); }

/* 返回导航条 */
.m-back {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 16px; padding: 0 0 12px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-family: inherit; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: color var(--dur);
}
.m-back:hover { color: var(--accent); }
.m-back .ic { width: 17px; height: 17px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   5 · 生成条（composer）
   ══════════════════════════════════════════════════════════════ */
.composer {
  border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: var(--r-4); overflow: hidden;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.composer-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; }

.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-2); font-family: inherit; font-weight: 550; cursor: pointer;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.cat-chip:hover { border-color: var(--line-strong); color: var(--text); }
.cat-chip .swatch { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--accent); }

.composer textarea {
  width: 100%; border: none; background: transparent;
  padding: 10px 14px; resize: none; outline: none;
  font-family: inherit; font-size: var(--fs-lg); line-height: 1.55;
  min-height: 46px; max-height: 220px; color: var(--text);
}
.composer textarea::placeholder { color: var(--text-3); font-size: var(--fs-md); }

.composer-import { display: flex; align-items: center; padding: 11px 14px 0; }
.composer-import .btn { gap: 7px; }
.composer-import .btn .ic { width: 15px; height: 15px; opacity: .8; }

.composer-bottom {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 10px 14px; border-top: 1px solid var(--line);
}
.composer-bottom .hint { font-size: var(--fs-xs); color: var(--text-3); flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.chip {
  font-size: var(--fs-sm); padding: 3px 10px; border-radius: var(--r-2);
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text-2);
}
.chip.dup { opacity: .5; text-decoration: line-through; }

/* ══════════════════════════════════════════════════════════════
   6 · 按钮（核心组件）
   ══════════════════════════════════════════════════════════════ */
:root { --fs-btn: calc(14px * var(--ui-scale)); }
button, .btn, input[type="button"], input[type="submit"] {
  font-family: var(--font-sans);
  font-size: var(--fs-btn);
}

.btn {
  height: 34px; padding: 0 16px; border-radius: var(--r-3);
  border: 1px solid transparent; cursor: pointer;
  font-size: var(--fs-btn); font-weight: 550;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur), border-color var(--dur), transform var(--dur), color var(--dur), box-shadow var(--dur);
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ic { width: 15px; height: 15px; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* 描边按钮：中性，用于次要动作 */
.btn-line { background: var(--bg-elev); border-color: var(--line); color: var(--text); }
.btn-line:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }

/* 幽灵按钮：无边框，用于第三级动作 */
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }

/* 危险按钮：文字型（列表末尾） */
.btn-danger { color: var(--err); background: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--err-soft); }

/* 危险按钮：实心型（确认弹窗）—— 替代旧的内联 style.background */
.btn-danger-solid { background: var(--err); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: color-mix(in srgb, var(--err) 85%, #000); }

/* 文字按钮 */
.link-btn {
  border: 0; background: transparent; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  padding: 4px 8px; border-radius: var(--r-2); white-space: nowrap;
  transition: background var(--dur);
}
.link-btn:hover { background: var(--accent-soft); }

/* ══════════════════════════════════════════════════════════════
   7 · 首页成长面板
   ══════════════════════════════════════════════════════════════ */
.home { padding: var(--s-1) 0 var(--s-12); }

.home-hero { display: flex; align-items: center; gap: var(--s-6); margin-bottom: var(--s-8); }
.home-nest { width: 150px; height: 130px; flex-shrink: 0; }
.nest { width: 100%; height: 100%; overflow: visible; }
.nest .tw { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 0; }
.nest .tw.off { display: none; }
.nest .egg { fill: var(--accent-soft-2); stroke: var(--accent); stroke-width: 1.4; }
.nest .tw { animation: twigIn .5s var(--ease) backwards; animation-delay: calc(var(--i, 0) * .014s); }
.nest .egg { animation: eggIn .5s var(--spring) backwards; animation-delay: .5s; transform-origin: 60px 67px; }
@keyframes twigIn { from { stroke-dashoffset: 220 } to { stroke-dashoffset: 0 } }
@keyframes eggIn { from { opacity: 0; transform: scale(.4) } to { opacity: 1; transform: scale(1) } }

.nest { animation: nestBreathe 8s ease-in-out infinite; transform-origin: 60px 78px; }
@keyframes nestBreathe { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.005) } }
.nest-lv5 { animation: nestRise 7s ease-in-out infinite, nestTilt 11s ease-in-out infinite; transform-origin: 60px 92px; }
.nest-lv5 .egg { animation: eggRock 5s ease-in-out infinite; }
@keyframes nestRise { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-2.5px) } }
@keyframes nestTilt { 0%, 100% { transform: rotate(-.8deg) } 50% { transform: rotate(.8deg) } }
@keyframes eggRock { 0%, 100% { transform: rotate(-2.5deg) scale(1) } 50% { transform: rotate(2.5deg) scale(1.02) } }

.home-hero-text { min-width: 0; }
.home-big { display: flex; align-items: baseline; gap: var(--s-2); }
.home-big b { font-size: var(--fs-display); font-weight: 700; letter-spacing: -.035em; line-height: .98; font-variant-numeric: tabular-nums; color: var(--text); }
.home-big span { font-size: var(--fs-lg); color: var(--text-2); }
.home-sub { margin-top: var(--s-2); font-size: var(--fs-md); color: var(--text-3); }

/* 统计：无框分区，靠发丝线分隔 */
.home-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-bottom: var(--s-8);
  border-top: 1px solid var(--line);
}
.home-stat {
  padding: var(--s-4) var(--s-5) var(--s-4) 0;
  border-right: 1px solid var(--line);
  transition: background var(--dur);
}
.home-stat:last-child { border-right: 0; }
.home-stat:not(:first-child) { padding-left: var(--s-5); }
.home-stat:hover { background: var(--hover); }
.home-stat .v { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.home-stat.accent .v { color: var(--accent); }
.home-stat .l { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--s-1); line-height: 1.4; }

.home-sec-title { font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); letter-spacing: .06em; margin-bottom: var(--s-3); }

.home-bars { display: flex; gap: var(--s-3); margin-bottom: var(--s-8); }
.home-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.home-bar .track {
  width: 100%; height: 58px; border-radius: var(--r-2);
  background: var(--bg-sunken); display: flex; align-items: flex-end; overflow: hidden;
}
.home-bar .track i {
  display: block; width: 100%; border-radius: var(--r-2);
  background: var(--accent); opacity: var(--o, .42);
  transition: height var(--dur-4) var(--ease), opacity var(--dur);
}
.home-bar:hover .track i { opacity: .95; }
.home-bar .track i.zero { height: 3px !important; background: var(--line-strong); opacity: 1; }
.home-bar .d { font-size: var(--fs-2xs); color: var(--text-3); line-height: 1.3; }

/* 寄语：唯一的大块软容器 */
.home-quote {
  display: flex; gap: var(--s-3); padding: var(--s-5) var(--s-6); border-radius: var(--r-5);
  background: var(--accent-soft); margin-bottom: var(--s-6);
  animation: quoteIn .6s .3s var(--ease) backwards;
}
@keyframes quoteIn { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.home-quote .mark { color: var(--accent); font-size: 22px; line-height: 1.15; flex-shrink: 0; }
.home-quote .qtext { font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--ls-ui); color: var(--text); line-height: 1.55; }

/* CTA：从虚线框改成实心主色 */
.home-cta {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 42px; padding: 0 var(--s-5); border-radius: var(--r-3);
  font-family: inherit; font-size: var(--fs-md); font-weight: 650;
  border: 1px solid transparent; background: var(--accent); color: #fff;
  cursor: pointer; box-shadow: var(--sh-1);
  transition: background var(--dur), transform var(--dur), box-shadow var(--dur);
}
.home-cta:hover { background: var(--accent-hover); box-shadow: var(--sh-2); }
.home-cta:active { transform: scale(.98); }

@media (prefers-reduced-motion: reduce) {
  .nest, .nest-lv5, .nest .tw, .nest .egg, .nest-lv5 .egg, .home-quote { animation: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   8 · 详情页
   ══════════════════════════════════════════════════════════════ */
.detail {
  margin-top: var(--s-8);
  /* 阅读轨道：词条页不借用 UI 字号，也不再用 +5px 局部放大 */
  --fs-xs:  var(--read-xs);
  --fs-sm:  var(--read-sm);
  --fs-md:  var(--read-md);
  --fs-lg:  var(--read-lg);
  --fs-xl:  var(--read-h3);
  --fs-2xl: var(--read-h2);
  --fs-3xl: var(--read-h1);
}
.detail-head { margin-bottom: 6px; }
.detail-head-top { display: flex; align-items: baseline; gap: 20px; }
.detail-head-top .sp { flex: 0 0 auto; }
.lang-switch, .fontscale { flex: 0 0 auto; }

.fontscale { display: inline-flex; align-items: center; gap: 2px; align-self: center; }
.fsbtn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg-elev);
  color: var(--text-2); line-height: 1; cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.fsbtn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.fsbtn:disabled { opacity: .35; cursor: default; }
.fsdots { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; cursor: default; }
.fsdots i { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--line-strong); display: block; }
.fsdots i.on { background: var(--accent); }

.detail-title {
  font-size: var(--read-h1); font-weight: 650; letter-spacing: var(--ls-title);
  line-height: 1.15; margin: 0 0 8px; word-break: break-word;
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-title.editing {
  border-bottom: 1px dashed var(--accent); border-radius: var(--r-1);
  padding: 0 2px; cursor: text; outline: none;
}
.detail-title.editing:hover { background: var(--accent-soft); }
.detail-title.editing:focus { background: var(--bg-elev); border-bottom-style: solid; }

/* 语言切换：外底板 10px，内按钮 6px —— 避免「外方内圆」 */
.lang-switch { flex: 0 0 auto; display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-3); background: var(--bg-sunken); }
.lang-btn {
  border: 0; background: transparent; color: var(--text-3);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
  line-height: 1.5; padding: 3px 10px; border-radius: var(--r-2); cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.lang-btn:hover { color: var(--text-2); }
.lang-btn.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--sh-1); }

.lang-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 12px 0 2px; padding: 11px 14px; border-radius: var(--r-3);
  background: var(--accent-soft); color: var(--text-2); font-size: var(--fs-sm);
}
.detail-meta { font-size: var(--fs-sm); color: var(--text-3); display: flex; flex-wrap: wrap; gap: 6px 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }

.detail-stats { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0 var(--s-6); }

/* 统计胶囊：真胶囊语义 + 去阴影 */
.stat {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: var(--r-full);
  background: var(--bg-elev); border: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--text-2);
}
.stat .ic { width: 14px; height: 14px; color: var(--text-3); }
.stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.tag-mini { font-size: 10px; padding: 1px 7px; border-radius: var(--r-2); font-weight: 600; letter-spacing: .3px; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

.field { margin-bottom: var(--s-6); }
/* 字段标签：3×14 的圆头短条 */
.field-label {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .9px;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 9px;
}
.field-label::before {
  content: ''; width: 3px; height: 14px; border-radius: var(--r-full);
  background: var(--accent); flex-shrink: 0;
}
.field-body {
  font-size: var(--fs-lg); line-height: var(--lh-read); color: var(--text);
  max-width: var(--measure-read);
}
.field-body:focus { outline: none; }
.field-body[contenteditable="true"] {
  background: var(--bg-sunken); border-radius: var(--r-3);
  padding: 12px 16px; box-shadow: inset 0 0 0 1px var(--line);
}
.field-error {
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
  background: var(--err-soft);
  padding: 13px 16px; border-radius: var(--r-2);
  font-size: var(--fs-md); color: var(--text);
}

.streaming .field-body::after { content: '▍'; color: var(--accent); animation: blink 1s steps(2) infinite; }
.skeleton { margin: 20px 0 14px; }
.sk-bar {
  height: 14px; border-radius: var(--r-full); margin-bottom: 13px;
  background: linear-gradient(90deg, var(--hover) 25%, var(--line-strong) 37%, var(--hover) 63%);
  background-size: 400% 100%; animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.stream-status { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.stream-status::before {
  content: ''; width: 8px; height: 8px; border-radius: var(--r-full);
  background: var(--accent); animation: pulse 1.1s ease-in-out infinite; flex-shrink: 0;
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }

/* 操作按钮行：一个主流程 + 三个次要，危险动作推到最右端
   —— 位置本身表达层级：左边是「继续」，右边是「销毁」。 */
.detail-actions {
  display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center;
  margin-top: var(--s-8); padding-top: var(--s-5); border-top: 1px solid var(--line);
}
.detail-actions .btn-danger { margin-left: auto; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-3); padding: 80px 20px; text-align: center; }
.empty .ic { width: 46px; height: 46px; opacity: .28; }
.empty .lead { font-size: var(--fs-lg); color: var(--text-2); }

/* ══════════════════════════════════════════════════════════════
   9 · Markdown
   ══════════════════════════════════════════════════════════════ */
.md-p { margin: 0 0 12px; } .md-p:last-child { margin-bottom: 0; }
.md-h1,.md-h2,.md-h3,.md-h4,.md-h5,.md-h6 { margin: 22px 0 10px; line-height: var(--lh-tight); font-weight: 650; letter-spacing: -.3px; }
.md-h1 { font-size: var(--read-h2); } .md-h2 { font-size: var(--read-h3); } .md-h3 { font-size: var(--read-md); } .md-h4 { font-size: var(--read-sm); }
.md-h5,.md-h6 { font-size: var(--fs-sm); color: var(--text-2); }
.md-list { margin: 8px 0 12px; padding-left: 22px; } .md-list li { margin: 4px 0; }
.md-quote { margin: 10px 0; padding: 10px 14px; border-left: 3px solid var(--accent-soft-2); background: var(--bg-sunken); border-radius: 0 var(--r-2) var(--r-2) 0; color: var(--text-2); }
.md-hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md-pre { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--r-3); padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.md-pre code { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--text); white-space: pre; }
.field-body code { font-family: var(--mono); font-size: .88em; background: var(--bg-sunken); border: 1px solid var(--line); padding: 1px 5px; border-radius: var(--r-1); }
.md-table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r-3); }
.md-table { border-collapse: collapse; width: 100%; font-size: var(--fs-md); }
.md-table th, .md-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.md-table th { background: var(--bg-sunken); font-weight: 600; color: var(--text-2); font-size: var(--fs-sm); }
.md-table tr:last-child td { border-bottom: none; }
.field-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft-2); }
.field-body a:hover { border-bottom-color: var(--accent); }
.field-body a.term-link { border-bottom: 1px dashed var(--accent-soft-2); color: var(--accent); cursor: pointer; }
.field-body a.term-link:hover { border-bottom-color: var(--accent); background: var(--accent-soft); border-radius: var(--r-1); }

/* ══════════════════════════════════════════════════════════════
   10 · 文章工作台
   ══════════════════════════════════════════════════════════════ */
.pane-scroll.reader-open { display: flex; flex-direction: column; overflow: hidden; }
.pane-inner.reader-open {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  width: 100%; max-width: var(--pane-w);
  padding: 16px var(--pane-px) 20px;
}
#reader { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#reader[hidden] { display: none; }
.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.reader-nav {
  position: relative; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 13px; border-bottom: 1px solid var(--line);
}

/* 导航行按钮：统一 8px 圆角描边，不再用全圆胶囊 */
.reader-back, .reader-del, .reader-cat {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 34px; padding: 0 13px; flex-shrink: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-3);
  background: var(--bg-sunken); color: var(--text);
  font-family: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.reader-back:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.reader-back:active { background: var(--active); }
.reader-cat { color: var(--text-3); background: transparent; border-color: var(--line); margin-left: auto; }
.reader-cat:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.reader-del { color: var(--text-2); }
.reader-del:hover { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.reader-back .ic { width: 16px; height: 16px; }

.reader-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.2px;
  color: var(--accent); white-space: nowrap;
}

.reader-leadrow { flex-shrink: 0; display: flex; align-items: flex-start; gap: 16px; margin: 14px 0 13px; }
.reader-leadrow .reader-lead { flex: 1; min-width: 0; margin: 0; }

.reader-input { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.reader-lead { margin: 0 0 13px; font-size: var(--fs-md); color: var(--text-2); line-height: 1.7; }
.reader-text {
  flex: 1; min-height: 0; width: 100%; resize: none; padding: var(--s-5) var(--s-6);
  border: 1px solid var(--line); border-radius: var(--r-4);
  background: var(--bg-elev); color: var(--text);
  font-family: inherit; font-size: var(--read-md); line-height: 1.8;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.reader-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.reader-text::placeholder { color: var(--text-3); }

.reader-bar { flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 13px 0 2px; }
.reader-count { font-size: var(--fs-xs); color: var(--text-3); }
.reader-max { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); margin-left: auto; }
.reader-max select {
  font-family: inherit; font-size: var(--fs-sm); padding: 4px 8px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text); cursor: pointer;
}
.reader-status {
  flex-shrink: 0; margin-top: 11px; padding: 11px 14px; border-radius: var(--r-3);
  background: var(--accent-soft); color: var(--text-2); font-size: var(--fs-sm);
}
.reader-status.err { background: var(--err-soft); color: var(--err); }

/* 双栏 */
.reader-split { flex: 1; min-height: 0; display: flex; gap: 20px; }
.reader-src, .reader-picks { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reader-colhead {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding-bottom: 9px;
  font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); letter-spacing: .3px;
}
.reader-src-body {
  flex: 1; min-height: 0; overflow: auto; padding: var(--s-5) var(--s-6); border-radius: var(--r-4);
  background: var(--bg-sunken); color: var(--text-2);
  font-size: var(--read-md); line-height: 1.9; white-space: pre-wrap; word-break: break-word;
}
.reader-list {
  flex: 1; min-height: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-4);
  background: var(--bg-elev); padding: 4px;
}

/* 候选行：hover 用左侧指示条，不用整块背景 */
.pick {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 9px 12px; border-radius: var(--r-2);
  cursor: pointer; position: relative;
  transition: background var(--dur);
}
.pick:hover { background: var(--hover); }
.pick::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 2px; border-radius: var(--r-full); background: var(--accent);
  opacity: 0; transition: opacity var(--dur);
}
.pick:hover::before { opacity: 1; }
.pick input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.pick-text { flex: 1; min-width: 0; }
.pick-term { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-gloss { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick.exists .pick-term { color: var(--text-3); }
.pick-badge {
  flex-shrink: 0; font-size: var(--fs-xs); color: var(--text-3);
  background: var(--bg-sunken); padding: 3px 10px; border-radius: var(--r-full);
}

/* 手动补词：虚线添加行 */
.reader-add { flex-shrink: 0; padding: 12px 0 4px; }
.reader-add-label { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 7px; }
.reader-add-row {
  display: flex; gap: 8px; padding: 6px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-3);
  transition: border-color var(--dur), background var(--dur);
}
.reader-add-row:focus-within { border-color: var(--accent); border-style: solid; background: var(--bg-elev); }
.reader-add-input {
  flex: 1; min-width: 0; height: 32px; padding: 0 11px;
  border: 0; background: transparent; color: var(--text);
  font-family: inherit; font-size: var(--fs-md); outline: none;
}
.reader-add-input:focus { border-color: var(--accent); }
.pick-badge.manual { color: var(--accent); background: var(--accent-soft); }

.reader-foot { flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 12px 0 2px; }
.reader-foot .btn { margin-left: auto; }

.reader-urlrow { flex-shrink: 0; display: flex; gap: 9px; margin-bottom: 10px; }
.reader-url {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--bg-elev); color: var(--text);
  font-family: inherit; font-size: var(--fs-md);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.reader-url:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.reader-url::placeholder { color: var(--text-3); }
.reader-or { flex-shrink: 0; display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; font-size: var(--fs-xs); color: var(--text-3); }
.reader-or::before, .reader-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ══════════════════════════════════════════════════════════════
   11 · 弹窗 / 浮层 / 菜单 / Toast
   ══════════════════════════════════════════════════════════════ */
.scrim.show { opacity: 1; }

.modal-wrap {
  position: fixed; inset: 0; display: grid; place-items: start center;
  align-content: start; padding: 12vh 20px 40px; z-index: 110;
}
.modal {
  position: relative; z-index: 120; width: 520px; max-width: 94vw;
  background: var(--bg-elev); border-radius: var(--r-4);
  box-shadow: var(--sh-3); border: 1px solid var(--line); overflow: hidden;
}
.modal-head {
  padding: var(--s-5) var(--s-6) 0; font-size: var(--fs-2xl); font-weight: 650;
  letter-spacing: -.01em; line-height: 1.25; color: var(--accent); text-align: center;
}
.modal-body { padding: var(--s-3) var(--s-6); color: var(--text-2); line-height: 1.6; }
.modal-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.modal-link:hover { color: var(--accent-hover); }
.modal-foot { padding: var(--s-3) var(--s-6) var(--s-5); display: flex; justify-content: flex-end; gap: var(--s-2); }

.menu {
  position: fixed; min-width: 200px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-3); box-shadow: var(--sh-3);
  padding: 5px; z-index: 120;
}
.menu button {
  display: block; width: 100%; text-align: left; padding: 9px 11px;
  border: none; background: transparent; border-radius: var(--r-2); cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm);
}
.menu button:hover { background: var(--hover); }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 0; }
.menu button.menu-heading {
  color: var(--text-3); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .5px; cursor: default; padding: 7px 11px 3px;
}
.menu button.menu-heading:hover { background: transparent; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px); z-index: 200;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: var(--r-full); font-size: var(--fs-md);
  box-shadow: var(--sh-3); opacity: 0; pointer-events: none;
  transition: opacity var(--dur), transform var(--dur); max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ══════════════════════════════════════════════════════════════
   12 · 任务面板 / 更新提示
   ══════════════════════════════════════════════════════════════ */
.job {
  position: fixed; right: 20px; bottom: 20px; width: 380px; max-width: 92vw; z-index: 80;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--sh-3); overflow: hidden;
}
.job.min .job-body, .job.min .job-foot { display: none; }
.job-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; }
.job-head .ttl { font-weight: 600; font-size: var(--fs-md); }
.job-head .st { font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; }
.bar { height: 3px; background: var(--hover); }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width var(--dur-3) var(--ease); }
.job-body { max-height: 300px; overflow-y: auto; padding: 6px; }
.job-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-2); font-size: var(--fs-sm); }
.job-item:hover { background: var(--hover); }
.job-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-item .er { color: var(--err); font-size: var(--fs-xs); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-s { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--text-3); flex-shrink: 0; }
.dot-s.waiting { background: var(--text-3); }
.dot-s.running { background: var(--accent); animation: pulse 1.1s infinite; }
.dot-s.done { background: var(--ok); }
.dot-s.failed { background: var(--err); }
.dot-s.skipped { background: var(--warn); }
.job-foot { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.job-foot .btn { height: 30px; font-size: var(--fs-sm); padding: 0 12px; border-radius: var(--r-2); }

.upd-bar {
  position: fixed; right: 20px; bottom: 20px; width: 328px; z-index: 300;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--sh-3); padding: 17px 19px;
  animation: updIn var(--dur-3) var(--spring) backwards;
}
@keyframes updIn { from { opacity: 0; transform: translateY(14px) scale(.96) } to { opacity: 1; transform: none } }
.upd-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.upd-dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex-shrink: 0; }
.upd-title { flex: 1; font-size: var(--fs-md); font-weight: 650; }
.upd-x { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 0 2px; border-radius: var(--r-1); }
.upd-x:hover { color: var(--text); }
.upd-meta { font-size: var(--fs-xs); color: var(--text-3); }
.upd-notes {
  margin-top: 9px; padding: 9px 11px; max-height: 84px; overflow: auto;
  background: var(--bg-sunken); border-radius: var(--r-2);
  font-size: var(--fs-xs); color: var(--text-2); line-height: 1.7; white-space: pre-wrap;
}
.upd-acts { margin-top: 13px; }
.upd-acts .btn { width: 100%; justify-content: center; }
.upd-prog { margin-top: 13px; }
.upd-track { height: 6px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; }
.upd-prog-fill { height: 100%; width: 0%; border-radius: var(--r-full); background: var(--accent); transition: width var(--dur) ease; }
.upd-prog-meta { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.upd-hint { margin-top: 9px; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.6; }

.usage-chip {
  font-size: var(--fs-xs); color: var(--text-3); background: var(--bg-sunken);
  padding: 4px 11px; border-radius: var(--r-full); white-space: nowrap;
}
.usage-chip.warn { color: var(--warn); background: var(--warn-soft); }
.usage-chip.danger { color: var(--err); background: var(--err-soft); }

/* ══════════════════════════════════════════════════════════════
   13 · 表单 / 分组 / 标签
   ══════════════════════════════════════════════════════════════ */
.section { margin-bottom: 26px; }
.section > h3 { margin: 0 0 12px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); }
.row { margin-bottom: 12px; }
.row > label { display: block; font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); margin-bottom: 5px; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg);
  font-family: inherit; font-size: var(--fs-md); outline: none;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--bg-elev);
}
.textarea { resize: vertical; min-height: 130px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.hint { font-size: var(--fs-xs); color: var(--text-3); margin-top: 5px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }

.seg { display: flex; gap: 3px; background: var(--bg-sunken); padding: 3px; border-radius: var(--r-2); }
.seg button {
  flex: 1; min-height: 30px; height: auto; padding: 6px 8px; line-height: 1.35;
  border: none; background: transparent; border-radius: var(--r-1); cursor: pointer;
  font-family: inherit; color: var(--text-2);
  transition: background var(--dur), color var(--dur);
}
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--sh-1); font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button {
  height: 30px; padding: 0 12px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-family: inherit; color: var(--text-2);
  transition: border-color var(--dur), background var(--dur), color var(--dur);
}
.tabs button:hover { border-color: var(--line-strong); color: var(--text); }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.about-name {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 0 0 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.about-name b { font-size: var(--fs-lg); font-weight: 650; color: var(--text); }
.about-name span { font-size: var(--fs-sm); color: var(--text-3); }
.about-made {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--text-2);
}
.about-made a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft-2); }
.about-made a:hover { border-bottom-color: var(--accent); }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); padding: 5px 0; }
.kv b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════
   14 · 设置（居中弹窗）
   ══════════════════════════════════════════════════════════════ */
#settings {
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 15.5px; --fs-lg: 17px;
  --fs-xl: 19px; --fs-2xl: 24px; --fs-3xl: 32px;
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 4vh 24px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
#settings.open { opacity: 1; pointer-events: auto; }
#settings .drawer-inner {
  width: min(880px, 100%); max-height: 92vh;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--sh-3);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(10px) scale(.99);
  transition: transform var(--dur-2) var(--ease-out-quint, var(--ease));
}
#settings.open .drawer-inner { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 17px 88px; border-bottom: 1px solid var(--line);
  flex-shrink: 0; position: relative;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 88px; }
.drawer-foot { padding: 14px 88px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.drawer-foot .spacer { flex: 1; }
.drawer-head h2 {
  position: absolute; left: 50%; transform: translateX(-50%);
  margin: 0; font-size: var(--fs-xl); font-weight: 650;
  color: var(--accent); white-space: nowrap;
}
.drawer-head::before { content: ''; flex: 1; }

/* ══════════════════════════════════════════════════════════════
   15 · 阅读态 + 问 Lexi 浮层
   ══════════════════════════════════════════════════════════════ */
.read-wrap { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.read-bar { display: flex; align-items: center; gap: 12px; }
.read-hint { flex: 1; font-size: var(--fs-xs); color: var(--text-3); }
.read-body {
  flex: 1; min-height: 0; overflow: auto;
  padding: 22px 24px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-4);
  font-size: calc(var(--read-lg) * var(--read-scale, 1)); line-height: 1.9; color: var(--text);
  user-select: text; -webkit-user-select: text;
}
.read-para { margin: 0 0 15px; }
.read-para:last-child { margin-bottom: 0; }
.read-layout {
  margin: 0; white-space: pre; overflow-x: auto;
  font-family: "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace;
  font-size: calc(var(--read-sm) * var(--read-scale, 1));
  line-height: 1.85; tab-size: 4; color: var(--text);
}
.read-layout::selection { background: var(--selection); }
.read-layout-toggle { flex-shrink: 0; }
.pane-inner.reading-open { max-width: var(--pane-w-read); }
.reading-open .read-bar,
.reading-open .read-para { width: 100%; max-width: var(--measure-read); margin-left: auto; margin-right: auto; }
.reading-open .read-body { padding: 30px 56px; flex: 0 1 auto; max-height: 100%; }
html[lang="en"] .reading-open .read-bar,
html[lang="en"] .reading-open .read-para { max-width: 660px; }
@media (max-width: 1240px) { .reading-open .read-body { padding: 20px 22px; } .reading-open .read-bar { max-width: none; } }
.read-term { background: var(--accent-soft); color: inherit; border-radius: var(--r-1); padding: 0 2px; }

.explain-pop {
  position: fixed; z-index: 330; width: min(368px, calc(100vw - 24px));
  max-height: min(72vh, 580px); display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--sh-3); overflow: hidden;
}
.explain-pop[hidden] { display: none; }
.explain-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px 8px; }
.explain-dot { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--accent); flex: none; }
.explain-kicker { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.explain-x {
  margin-left: auto; border: 0; background: transparent; color: var(--text-3);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; border-radius: var(--r-1);
}
.explain-x:hover { color: var(--text); }
.explain-body { padding: 0 18px 13px; overflow: auto; }
.explain-term { margin: 4px 0 5px; font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; color: var(--text); word-break: break-word; }
.explain-source { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.explain-label { margin: 14px 0 4px; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.explain-def { font-size: var(--fs-sm); line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.explain-plain { font-size: var(--fs-xs); line-height: 1.75; color: var(--text-2); white-space: pre-wrap; }
.explain-quote { border-left: 3px solid var(--line); padding-left: 11px; font-size: var(--fs-xs); line-height: 1.75; color: var(--text-2); white-space: pre-wrap; }
.explain-note { margin-top: 10px; font-size: var(--fs-xs); color: var(--text-3); }
.explain-acts {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line); background: var(--bg-sunken);
}
.explain-acts[hidden] { display: none; }
.explain-act {
  padding: 7px 14px; border-radius: var(--r-2); border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text-2);
  font-family: inherit; font-size: var(--fs-sm); cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.explain-act:hover { background: var(--hover); color: var(--text); border-color: var(--line-strong); }

.reader-filerow { flex-shrink: 0; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.reader-filehint { font-size: var(--fs-xs); color: var(--text-3); }
#reader { position: relative; }
#reader.dragging::after {
  content: ''; position: absolute; inset: 6px; z-index: 10; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: var(--r-4); background: var(--accent-soft);
}

/* 额度墙 */
.quota-meter { height: 8px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; }
.quota-meter i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-full); }
.quota-plan { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.quota-bars { display: flex; gap: 4px; margin: 10px 0 14px; }
.quota-bars i { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--bg-sunken); }
.quota-wall-note { font-size: var(--fs-sm); color: var(--text-3); margin: 8px 0 0; }
.quota-wall-foot { justify-content: center; }
.quota-wall-main { min-width: 160px; }
