/* style.css —— 双主题（暗色展馆风 / 亮色明亮风），由 <html data-theme> 切换
   主题键与首页 portal.html 统一（localStorage: tf3d_theme），见 theme.js
   ⚠️ 暗色值 = 历史硬编码值，逐项平移过来，保证暗色主题视觉零变化 */
:root {
  --bg: #0a0d13;
  --panel: rgba(15, 20, 30, 0.92);
  --line: #1f2a3c;
  --line-soft: #182334;
  --txt: #e2eaf6;
  --dim: #8d9bb1;
  --accent: #5aa7ff;
  --accent2: #b98cff;
  --ok: #5fd6a5;
  --radius: 10px;
  /* ---- 以下为新增语义变量（暗色 = 原硬编码值） ---- */
  --txt2: #9fb2cb;            /* 次级文字（芯片/表格/下拉项） */
  --txt3: #c9d6e8;            /* 表格正文 */
  --txt-strong: #dceaff;      /* 强文字（提示框/滑动条读数） */
  --th: #64748b;              /* 表头 */
  --btn-bg: #121a26;          /* 按钮/输入框底 */
  --btn-bg-hov: #16222f;
  --btn-bd: #3a5a86;          /* 悬停描边 */
  --cell-bg: #0d1520;         /* 统计胶囊/单元格底 */
  --cell-bd: #1b2536;
  --tbl-bd: #131c28;
  --th-bg: #0d131c;
  --vig: rgba(2, 4, 8, 0.5);  /* 画面暗角 */
  --topbar-bg: linear-gradient(180deg, rgba(10, 14, 21, 0.96), rgba(10, 14, 21, 0.7));
  --subbar-bg: #0e1520;
  --input-bg: rgba(9, 13, 20, 0.9);
  --list-bg: rgba(13, 19, 29, 0.98);
  --list-bd: #2a3c58;
  --list-ci: #c6d4e8;
  --list-dim: #5f7a99;
  --list-hov: rgba(90, 167, 255, 0.18);
  --sw-track: #1b2635;
  --sw-bd: #2c3d55;
  --sw-knob: #55617a;
  --chip-bg: rgba(18, 26, 38, 0.9);
  --chip-txt: #9fb2cb;
  --chip-on-bg: rgba(90, 167, 255, 0.16);
  --chip-on-txt: #cfe4ff;
  --stag-on-bg: rgba(185, 140, 255, 0.16);
  --stag-on-txt: #dcc8ff;
  --ol-hov: rgba(20, 30, 44, 0.85);
  --ol-on: #122640;
  --ol-dot: #55617a;
  --loop-c: #9fd0ff;
  --loop-bg: rgba(90, 167, 255, 0.08);
  --loop-bd: rgba(90, 167, 255, 0.32);
  --loop-hov-bd: #5aa7ff;
  --loop-hov-bg: rgba(90, 167, 255, 0.2);
  --loop-on-bg: rgba(90, 167, 255, 0.42);
  --loop-on-txt: #eaf4ff;
  --cap-bg: rgba(10, 15, 22, 0.82);
  --cap-txt: #d5e4f7;
  --note-bg: rgba(15, 32, 54, 0.93);
  --note-bd: #2b5c8f;
  --note-txt: #dceaff;
  --keyhint-txt: #66788f;
  --keyhint-bg: rgba(10, 15, 22, 0.65);
  --lbl-bg: rgba(8, 12, 19, 0.5);
  --lbl-txt: #dbe7f7;
  --gate-bg: rgba(10, 16, 24, 0.88);
  --gate-bd: #3a5a86;
  --gate-txt: #ffffff;
  --title-strong: #eaf3ff;
  --mark: #a9bcd6;
  --mark-head: #cfe2ff;
  --mark-arrow: #8fc0f0;
  --mark-mask: #ffc46a;
  --mark-cache: #8ff0c0;
  --lane-bg: rgba(12, 18, 26, 0.6);
  --lane-txt: #a9bdd8;
  --inscell-bg: rgba(8, 12, 20, 0.95);
  --inscell-bd: #3a5378;
  --prim1: #17548f;           /* 主按钮渐变（两主题通用：蓝底白字） */
  --prim2: #1f6cb8;
  --prim-bd: #2f7ec4;
  --grad1: #2c6cb0;           /* 进度条渐变（两主题通用） */
  --grad2: #6cc4ff;
  --verify-bg: rgba(13, 31, 25, 0.85);
  --verify-bd: #1f4a3a;
  --bad: #ff8080;
  --gen-on: #12293f;
  --gen-pick: #8ff0c0;
  --gen-p: #ffdf8f;
  --gen-idx: #a9bad0;
  --mask-bg: rgba(5, 7, 11, 0.92);
  --loadtitle: #cfe0f5;
  --loadtrack: #131c28;
  --vbox-bg: rgba(10, 15, 23, 0.97);
  --vbox-bd: #2a3f5c;
  --fs-bg: rgba(6, 9, 14, 0.975);
  --fstok: #b8c8de;
  --fstok-hl: rgba(255, 255, 255, 0.30);
  --fscanvas-bg: #0a0d13;
  --fstrack: #1c2739;
  --fshandle: #dbe9ff;
  --fshandle-bd: #2f7ec4;
  --wv-tbl: #1a2434;
  --wv-th: #101a28;
  --wv-rh: #0e1622;
  --wv-td: #0b111b;
  --wv-thumb: #0a0f18;
  --wv-thumb-bd: #131e2e;
  --wv-lab: #b9c8dd;
  --wv-lab2: #98a9c0;
  --wv-wait: #55657c;
  --gold: #ffd479;            /* 动画入口金 */
  --gold-bd: rgba(255, 212, 121, 0.35);
  --gold-hov-bd: #ffd479;
  --gold-hov-bg: rgba(255, 212, 121, 0.14);
  --gold-on-bg: rgba(255, 212, 121, 0.22);
  --gold-on-txt: #ffe9be;
  --gdsa: #ffcf8a;            /* 掩码入口橙 */
  --gdsa-bd: rgba(255, 177, 74, 0.38);
  --gdsa-hov-bd: #ffb14a;
  --gdsa-hov-bg: rgba(255, 177, 74, 0.14);
  --gdsa-on-bg: rgba(255, 177, 74, 0.22);
  --gdsa-on-txt: #ffe2b8;
  --gdca: #8fe3da;            /* 交叉入口青 */
  --gdca-bd: rgba(95, 208, 200, 0.38);
  --gdca-hov-bd: #5fd0c8;
  --gdca-hov-bg: rgba(95, 208, 200, 0.14);
  --gdca-on-bg: rgba(95, 208, 200, 0.22);
  --gdca-on-txt: #c0f3ec;
  --ab-txt: #ffe08a;          /* 动画播放条 */
  --ab-bd: rgba(255, 224, 138, 0.45);
  --ab-bg: rgba(8, 12, 19, 0.85);
  --ab-hov-bg: rgba(255, 224, 138, 0.15);
  --ab-track: rgba(255, 255, 255, 0.16);
  --ab-seg: rgba(255, 224, 138, 0.55);
  --ab-slash: #ff9a6a;
  --ab-focus: rgba(255, 224, 138, 0.9);
  --ab-hint-bd: rgba(255, 224, 138, 0.35);
  --ab-thumb: #ffe08a;
  --buildtag: #3d4f68;
  --topk-bd: #24314a;
  --topk-bd2: #1a2334;
  --topk-txt: #eaf2ff;
  --topk-th: #9db0c9;
  --scroll-thumb: #223047;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.55);
}
/* 亮色主题：只覆盖变量值，规则全部复用（与首页 portal.html 同口径） */
[data-theme="light"] {
  --bg: #eef1f6;
  --panel: rgba(255, 255, 255, 0.92);
  --line: #dde3ec;
  --line-soft: #e6ebf2;
  --txt: #16203a;
  --dim: #5c6b87;
  --accent: #1157d8;
  --accent2: #7c3aed;
  --ok: #0c8a5b;
  --txt2: #4a5b78;
  --txt3: #2c3c5a;
  --txt-strong: #16203a;
  --th: #7d8ba5;
  --btn-bg: #ffffff;
  --btn-bg-hov: #eef2f8;
  --btn-bd: #b9c8e4;
  --cell-bg: #f2f5fa;
  --cell-bd: #ccd7e8;
  --tbl-bd: #e3e9f2;
  --th-bg: #eef2f8;
  --vig: rgba(120, 132, 155, 0.16);
  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72));
  --subbar-bg: #dde3ec;
  --input-bg: #ffffff;
  --list-bg: rgba(255, 255, 255, 0.99);
  --list-bd: #c9d4e6;
  --list-ci: #2c3c5a;
  --list-dim: #8b99b5;
  --list-hov: rgba(17, 87, 216, 0.10);
  --sw-track: #e3e9f2;
  --sw-bd: #c9d4e6;
  --sw-knob: #97a5bd;
  --chip-bg: rgba(255, 255, 255, 0.9);
  --chip-txt: #4a5b78;
  --chip-on-bg: rgba(17, 87, 216, 0.10);
  --chip-on-txt: #1157d8;
  --stag-on-bg: rgba(124, 58, 237, 0.10);
  --stag-on-txt: #6d28d9;
  --ol-hov: rgba(17, 87, 216, 0.06);
  --ol-on: #e4edfb;
  --ol-dot: #97a5bd;
  --loop-c: #1157d8;
  --loop-bg: rgba(17, 87, 216, 0.06);
  --loop-bd: rgba(17, 87, 216, 0.28);
  --loop-hov-bd: #1157d8;
  --loop-hov-bg: rgba(17, 87, 216, 0.12);
  --loop-on-bg: rgba(17, 87, 216, 0.85);
  --loop-on-txt: #ffffff;
  --cap-bg: rgba(255, 255, 255, 0.86);
  --cap-txt: #1c2b45;
  --note-bg: rgba(255, 255, 255, 0.96);
  --note-bd: #9dbfe8;
  --note-txt: #12305e;
  --keyhint-txt: #7d8ba5;
  --keyhint-bg: rgba(255, 255, 255, 0.72);
  --lbl-bg: rgba(255, 255, 255, 0.78);
  --lbl-txt: #1c2b45;
  --gate-bg: rgba(255, 255, 255, 0.9);
  --gate-bd: #b9c8e4;
  --gate-txt: #16203a;
  --title-strong: #0f1b30;
  --mark: #4a5b78;
  --mark-head: #1157d8;
  --mark-arrow: #1f6fd0;
  --mark-mask: #b45309;
  --mark-cache: #0c8a5b;
  --lane-bg: rgba(255, 255, 255, 0.72);
  --lane-txt: #4a5b78;
  --inscell-bg: rgba(255, 255, 255, 0.96);
  --inscell-bd: #b9c8e4;
  --verify-bg: rgba(12, 138, 91, 0.10);
  --verify-bd: rgba(12, 138, 91, 0.35);
  --bad: #d63030;
  --gen-on: #e4edfb;
  --gen-pick: #0c8a5b;
  --gen-p: #b45309;
  --gen-idx: #4a5b78;
  --mask-bg: rgba(238, 241, 246, 0.94);
  --loadtitle: #2c3c5a;
  --loadtrack: #dde3ec;
  --vbox-bg: rgba(255, 255, 255, 0.97);
  --vbox-bd: #c9d4e6;
  --fs-bg: rgba(240, 243, 249, 0.98);
  --fstok: #4a5b78;
  --fstok-hl: rgba(22, 32, 58, 0.30);
  --fscanvas-bg: #ffffff;
  --fstrack: #dde3ec;
  --fshandle: #ffffff;
  --gold: #a16207;
  --gold-bd: rgba(161, 98, 7, 0.35);
  --gold-hov-bd: #a16207;
  --gold-hov-bg: rgba(161, 98, 7, 0.10);
  --gold-on-bg: rgba(161, 98, 7, 0.16);
  --gold-on-txt: #7c4a03;
  --gdsa: #b45309;
  --gdsa-bd: rgba(180, 83, 9, 0.38);
  --gdsa-hov-bd: #b45309;
  --gdsa-hov-bg: rgba(180, 83, 9, 0.10);
  --gdsa-on-bg: rgba(180, 83, 9, 0.16);
  --gdsa-on-txt: #92400e;
  --gdca: #0f766e;
  --gdca-bd: rgba(15, 118, 110, 0.38);
  --gdca-hov-bd: #0f766e;
  --gdca-hov-bg: rgba(15, 118, 110, 0.10);
  --gdca-on-bg: rgba(15, 118, 110, 0.16);
  --gdca-on-txt: #115e59;
  --ab-txt: #a16207;
  --ab-bd: rgba(161, 98, 7, 0.4);
  --ab-bg: rgba(255, 255, 255, 0.9);
  --ab-hov-bg: rgba(161, 98, 7, 0.10);
  --ab-track: rgba(22, 32, 58, 0.14);
  --ab-seg: rgba(161, 98, 7, 0.45);
  --ab-slash: #b91c1c;
  --ab-focus: rgba(161, 98, 7, 0.55);
  --ab-hint-bd: rgba(161, 98, 7, 0.35);
  --buildtag: #97a5bd;
  --topk-bd: #dde3ec;
  --topk-bd2: #e6ebf2;
  --topk-txt: #16203a;
  --topk-th: #4a5b78;
  --scroll-thumb: #c9d4e6;
  --shadow: 0 10px 30px rgba(22, 32, 58, 0.14);
  --shadow-sm: 0 1px 6px rgba(22, 32, 58, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--txt);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
#canvasHost { position: fixed; inset: 0; }
/* touch-action: none —— 触屏手势全交给 OrbitControls（防「双击缩放 / 页面滚动」与视角操作打架） */
#canvasHost canvas { display: block; touch-action: none; }
/* 轻微暗角：画面四角压暗，视线向中心聚焦（纯装饰，不挡交互；亮色主题为浅灰暗角） */
#canvasHost::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 42%, transparent 55%, var(--vig) 100%); }

/* 顶栏 */
/* flex-wrap + height auto：空间不足时自动折行（高度经 --topbar-h 被其他元素跟随），
   不折行时高度 = 原 50px（31 内容 + 9.5×2 padding），视觉零变化 */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: auto;
  min-height: calc(50px + env(safe-area-inset-top, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px; row-gap: 9px;
  padding: calc(9.5px + env(safe-area-inset-top, 0px)) 16px 9.5px; background: var(--topbar-bg);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: baseline; font-size: 15px; font-weight: 700; letter-spacing: .4px; white-space: nowrap; }
.brand::before { content: ''; align-self: center; width: 11px; height: 11px; margin-right: 9px; border-radius: 3.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 0 10px rgba(90, 167, 255, .45); }
#topbar input { width: 150px; height: 31px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--input-bg); color: var(--txt); font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
#topbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90, 167, 255, .14); }
#topbar input:disabled { opacity: .38; cursor: not-allowed; }
#topbar button { height: 31px; min-width: 34px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--btn-bg); color: var(--txt); font-size: 13px;
  white-space: nowrap; transition: border-color .15s, background .15s; }
#topbar button:hover { border-color: var(--btn-bd); background: var(--btn-bg-hov); }
#topbar button.primary { background: linear-gradient(135deg, var(--prim1), var(--prim2)); border-color: var(--prim-bd); color: #fff; }
#topbar button.primary:hover { filter: brightness(1.12); }
/* 主题切换按钮（太阳/月亮随 data-theme 反转，与 portal.html 同行为） */
#themeToggle { display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; }
#themeToggle svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
#themeToggle .i-moon { display: none; }
[data-theme="dark"] #themeToggle .i-sun { display: none; }
[data-theme="dark"] #themeToggle .i-moon { display: block; }
.spacer { flex: 1; }
/* 右侧工具组（全景/权重矩阵/全屏/自检）：包裹整体，折行时整组移动 */
.toolwrap { display: flex; align-items: center; gap: 9px; flex: none; }

/* 批次输入区：3 个 combobox + 开关 + 确定 + 「演示第几句」 */
.sent-wrap { display: flex; align-items: center; gap: 7px; flex: none; }
.combo { position: relative; }
.combo-list { position: absolute; top: 36px; left: 0; min-width: 100%; max-height: 220px; overflow-y: auto;
  background: var(--list-bg); border: 1px solid var(--list-bd); border-radius: 8px; z-index: 40;
  box-shadow: var(--shadow); padding: 4px; }
.combo-list .ci { padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--list-ci); cursor: pointer;
  white-space: nowrap; }
.combo-list .ci:hover, .combo-list .ci.on { background: var(--list-hov); color: var(--txt); }
.combo-list .ci .dim { color: var(--list-dim); }
/* 开关（第 2/3 句启用开关） */
.sw { position: relative; width: 30px; height: 17px; flex: none; cursor: pointer; }
/* ⚠️ 必须压过 #topbar input 的 150×31（ID 优先级高），否则隐形 checkbox 会撑大盖住开关 */
#topbar .sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track { position: absolute; inset: 0; border-radius: 9px; background: var(--sw-track); border: 1px solid var(--sw-bd);
  transition: background .15s, border-color .15s; }
.sw-track::after { content: ''; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--sw-knob); transition: transform .15s, background .15s; }
.sw input:checked + .sw-track { background: rgba(90, 167, 255, 0.28); border-color: var(--accent); }
.sw input:checked + .sw-track::after { transform: translateX(13px); background: var(--accent); }
/* 演示第几句（批次 >1 时显示） */
#bslice { display: flex; align-items: center; gap: 3px; }
#bslice .bs-lab { font-size: 11px; color: var(--dim); margin-right: 2px; white-space: nowrap; }
#bslice .bs { height: 24px; min-width: 30px; padding: 0 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--chip-txt); font: 600 12px sans-serif; }
#bslice .bs:hover { border-color: var(--btn-bd); color: var(--txt); }
#bslice .bs.on { border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-txt); }
/* 检视面板 / 全屏查看器的「第几句」切换（批次 >1 才有） */
#insSlice { display: flex; gap: 4px; padding: 0 14px 6px; }
#insSlice .bs { height: 22px; padding: 0 9px; border-radius: 6px; cursor: pointer; font: 600 11px sans-serif;
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--chip-txt); }
#insSlice .bs.on { border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-txt); }
#fsSlice { display: flex; gap: 4px; align-items: center; }
#fsSlice .fs-lab { font-size: 11px; color: var(--dim); }
#fsSlice .bs { height: 22px; padding: 0 9px; border-radius: 6px; cursor: pointer; font: 600 11px sans-serif;
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--chip-txt); }
#fsSlice .bs.on { border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-txt); }
/* 生成面板：批次时每句一格 */
.gen-cell { display: inline-flex; align-items: baseline; gap: 5px; min-width: 168px; }
.gen-cell.done { opacity: .3; }
.gen-cell.on { color: var(--txt); }
/* 当前演示句那一列加重（点哪句哪句排最前 → 右下角概率信息同步突出它） */
.gen-cell.cur { border-left: 2px solid var(--accent); padding-left: 7px; margin-left: -2px; border-radius: 2px; }
#verify { font-size: 12px; color: var(--ok); border: 1px solid var(--verify-bd); background: var(--verify-bg);
  padding: 4px 11px; border-radius: 20px; cursor: pointer; white-space: nowrap; transition: filter .15s; }
#verify:hover { filter: brightness(1.2); }

/* 逐步生成步骤标签（嵌在顶栏输入框那行）：数字 = 第几步 */
#stepTags { display: flex; gap: 3px; flex: none; }
#stepTags .stag { width: 24px; height: 24px; padding: 0; cursor: pointer; text-align: center;
  border-radius: 6px; border: 1px solid var(--line); background: var(--chip-bg); color: var(--chip-txt);
  font: 600 12px Consolas, monospace; }
#stepTags .stag:hover { border-color: var(--btn-bd); color: var(--txt); }
#stepTags .stag.on { border-color: var(--accent2); background: var(--stag-on-bg); color: var(--stag-on-txt); }

/* top 用 --topbar-h（app.js 同步的实际顶栏高）：桌面恒 50px，手机折行后自动下移 */
#subbar { position: fixed; top: var(--topbar-h, 50px); left: 0; right: 0; height: 2px; background: var(--subbar-bg); z-index: 19; }
#progBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--grad1), var(--grad2)); }
#mtxt { position: fixed; top: calc(var(--topbar-h, 50px) + 6px); right: 16px; font-size: 11px; color: var(--dim); z-index: 19;
  font-family: Consolas, monospace; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 左侧目录 */
#outline { position: fixed; left: 12px; top: calc(var(--topbar-h, 50px) + 18px);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 178px; overflow-y: auto;
  padding: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); z-index: 15;
  backdrop-filter: blur(8px); scrollbar-width: thin; }
#outline::-webkit-scrollbar { width: 6px; }
#outline::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
.ol-item { position: relative; padding: 6px 8px 6px 20px; border-radius: 7px; cursor: pointer; margin-bottom: 2px;
  transition: background .12s; }
.ol-item::before { content: ''; position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--ol-dot); }
.ol-item.k-enc::before { background: var(--accent); box-shadow: 0 0 5px rgba(90, 167, 255, .6); }
.ol-item.k-dec::before { background: var(--accent2); box-shadow: 0 0 5px rgba(185, 140, 255, .6); }
.ol-item:hover { background: var(--ol-hov); }
.ol-item.on { background: var(--ol-on); }
.ol-item.on::after { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2.5px;
  border-radius: 2px; background: var(--accent); }
.ol-item.k-dec.on::after { background: var(--accent2); }
.ol-title { display: block; font-size: 13px; }

/* 目录分组：输出站与编码器/解码器「导航逻辑不同」（层号 vs 循环轮次）→ 分割线隔开 */
.ol-sep { height: 1px; margin: 8px 2px 7px; background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent); }
.ol-grouplabel { font-size: 10px; letter-spacing: 0.5px; color: var(--dim); padding: 0 2px 5px 4px; }

/* 「输出与生成」条上的 1..N 循环芯片：与「▶ 掩码/▶ 交叉」动画入口**不同**（那是绝对定位在右侧），
   这里改**上下两行**：第一行站名，第二行芯片。
   ⚠️ 芯片数 = 真实解码步数（随句子动态变化，可能 >6），所以必须 **flex-wrap 换行**（原来写死 6 个单行）。
   ⚠️ 若用动画入口那套绝对定位（right:8px），芯片会盖住站名。 */
.ol-item.has-loop { padding-bottom: 8px; }
.ol-loop { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 1px 0; }
.ol-loop-c {
  appearance: none; -webkit-appearance: none; font-family: inherit;
  flex: 0 0 auto; min-width: 23px; height: 21px; padding: 0 4px; font-size: 11px; line-height: 1;
  color: var(--loop-c); background: var(--loop-bg);
  border: 1px solid var(--loop-bd); border-radius: 6px; cursor: pointer;
  transition: all .12s;
}
.ol-loop-c:hover { border-color: var(--loop-hov-bd); background: var(--loop-hov-bg); }
.ol-loop-c.on { color: var(--loop-on-txt); background: var(--loop-on-bg); border-color: var(--loop-hov-bd); font-weight: 600; }

/* 当前站名 / 提示条 / 键盘提示：三种底部信息统一为同款胶囊 */
#curstation { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); font-size: 13px;
  color: var(--cap-txt); background: var(--cap-bg); border: 1px solid var(--line); padding: 4px 16px;
  border-radius: 20px; z-index: 15; letter-spacing: 1px; backdrop-filter: blur(6px); }
#note { position: fixed; left: 50%; transform: translateX(-50%) translateY(8px); bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 18;
  padding: 7px 16px; border-radius: 9px; background: var(--note-bg); border: 1px solid var(--note-bd);
  font-size: 13px; color: var(--note-txt); opacity: 0; transition: all .25s; pointer-events: none;
  max-width: 70vw; text-align: center; }
#note.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#keyhint { position: fixed; left: 202px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); font-size: 11.5px;
  color: var(--keyhint-txt); background: var(--keyhint-bg); border: 1px solid var(--line-soft); border-radius: 20px;
  padding: 3px 12px; z-index: 14; letter-spacing: .5px; }

/* 3D 标签 */
.lbl { font-size: 11.5px; color: var(--lbl-txt); background: var(--lbl-bg); padding: 1px 6px; border-radius: 5px;
  white-space: nowrap; transform: translateY(-2px); }
/* labelPos='none'：不显示标签（数字已印在面板纹理上，如 token_id）。
   ⚠️ 必须用 class：CSS2DRenderer 每帧重置 element.style.display，inline display:none 会被抹掉。
   用 !important 压住 CSS2DRenderer 的行内 display。 */
.lbl.lbl-off { display: none !important; }
.gate { font-size: 15px; font-weight: 700; color: var(--gate-txt); letter-spacing: 1px; text-shadow: 0 2px 8px #000;
  padding: 2px 12px 2px 15px; border-radius: 20px; background: var(--gate-bg); border: 1px solid var(--gate-bd);
  position: relative; backdrop-filter: blur(4px); }
/* 站点识别色：站牌左侧的小色条 */
.gate::before { content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 2px; background: #8a93a6; }
.gate.acc-enc::before { background: var(--accent); box-shadow: 0 0 6px rgba(90, 167, 255, .8); }
.gate.acc-dec::before { background: var(--accent2); box-shadow: 0 0 6px rgba(185, 140, 255, .8); }
.gate.acc-tk::before  { background: #8a93a6; }
.gate.acc-in::before  { background: #8a93a6; }
.gate.acc-out::before { background: #8a93a6; }
.block-title { font-size: 14px; font-weight: 700; color: var(--title-strong); letter-spacing: .8px;
  text-shadow: 0 2px 6px #000, 0 0 3px #000; }   /* 子层主标题：醒目、做视觉锚点 */
.mark { font-size: 10.5px; color: var(--mark); }
.mark-head { font-size: 12.5px; font-weight: 600; color: var(--mark-head); }
.mark-arrow { font-size: 12px; color: var(--mark-arrow); }
.mark-mask { font-size: 10px; color: var(--mark-mask); }
.mark-cache { font-size: 10.5px; color: var(--mark-cache); }   /* KV 缓存标示（绿色，与缓存的"复用"语义一致） */
.lane { font-size: 11px; color: var(--lane-txt); background: var(--lane-bg); padding: 0 4px; border-radius: 4px; }

/* 检视面板 */
#inspector { position: fixed; right: 12px; top: calc(var(--topbar-h, 50px) + 18px);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 380px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; z-index: 16;
  transform: translateX(420px); transition: transform .25s, top .2s; backdrop-filter: blur(8px); scrollbar-width: thin; }
#inspector.show { transform: none; }
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
#insTitle { font-size: 15px; font-weight: 600; }
.ins-sub { font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
#insClose { border: 1px solid var(--line); background: var(--btn-bg); color: var(--dim); border-radius: 7px;
  cursor: pointer; width: 26px; height: 26px; }
#insClose:hover { color: var(--txt); border-color: var(--btn-bd); }
/* 矩阵区：左 token 列 + 矩阵画布 + 网格线覆盖层 */
#insMatrix { display: flex; gap: 6px; margin: 10px 0 6px; align-items: stretch; }
#insTokens { flex: none; width: 44px; display: flex; flex-direction: column; padding: 1px 0; }
#insTokens .tk { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px;
  font-size: 11px; color: var(--txt2); font-family: Consolas, "Microsoft YaHei UI", monospace;
  white-space: nowrap; overflow: hidden; }
#insPlot { position: relative; flex: 1; }
#insCvWrap { position: relative; }
/* 列 token 标签（S/P 这类列也是 token 的矩阵，画在矩阵下方 —— x 轴习惯） */
#insColLabels { display: none; margin-top: 3px; }
#insColLabels.show { display: flex; }
#insColLabels .cl { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--txt2);
  font-family: Consolas, "Microsoft YaHei UI", monospace; white-space: nowrap; overflow: hidden; }
#insCanvas { display: block; width: 100%; height: auto; border: 1px solid var(--cell-bd); border-radius: 5px;
  image-rendering: pixelated; cursor: crosshair; }
#insGrid { position: absolute; top: 1px; left: 1px; right: 1px; bottom: 1px; pointer-events: none; }
#insGrid .hl { position: absolute; left: 0; right: 0; height: 1px; background: rgba(255, 255, 255, 0.22); }
#insGrid .vl { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, 0.14); }
/* 悬浮单格高亮框 + 跟随数值标签 */
#insHi { position: absolute; display: none; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 0 1.5px #fff, 0 0 10px rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.10); }
#insCell { position: absolute; display: none; pointer-events: none; z-index: 6;
  background: var(--inscell-bg); border: 1px solid var(--inscell-bd); border-radius: 6px; padding: 2px 8px;
  font: 11.5px Consolas, monospace; color: var(--txt-strong); white-space: nowrap; }
#insBar { width: 100%; height: 18px; border-radius: 4px; display: block; margin-bottom: 8px; }
#insStats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--txt2);
  font-family: Consolas, monospace; }
#insStats span { background: var(--cell-bg); border: 1px solid var(--cell-bd); border-radius: 5px; padding: 2px 7px; }
#insTable { margin-top: 10px; overflow: auto; max-height: 260px; font-family: Consolas, monospace; font-size: 11px; }
#insTable table { border-collapse: collapse; }
#insTable th { color: var(--th); font-weight: 400; padding: 2px 6px; position: sticky; top: 0; background: var(--th-bg); }
#insTable td { padding: 2px 6px; color: var(--txt3); border-top: 1px solid var(--tbl-bd); text-align: right; }
/* softmax 的「概率前十」表（用户口径 2026-10-14：字体尽可能大）—— 只有 4 列、面板放得下，
   所以单独放大到 17px；不设内部滚动（让它撑开面板，面板自己滚） */
#insTable.topk-mode { max-height: none; overflow: visible; }
#insTable table.topk { width: 100%; }
#insTable table.topk th { position: static; background: transparent; font-size: 13.5px; color: var(--topk-th);
  padding: 6px 10px; border-bottom: 1px solid var(--topk-bd); text-align: right; }
#insTable table.topk td { font-size: 17px; line-height: 1.35; color: var(--topk-txt); padding: 5px 10px;
  border-top: 1px solid var(--topk-bd2); text-align: right; }
#insTable table.topk th:first-child, #insTable table.topk td:first-child { text-align: left; color: var(--topk-th); font-size: 14px; }
#insTable table.topk th:nth-child(2), #insTable table.topk td:nth-child(2) { text-align: left; }
.mini { color: var(--dim); font-size: 11px; }
#insFull { margin-top: 10px; width: 100%; height: 31px; border-radius: 8px; cursor: pointer;
  background: linear-gradient(135deg, var(--prim1), var(--prim2)); border: 1px solid var(--prim-bd); color: #fff; font-size: 13px; }
#insFull:hover { filter: brightness(1.12); }

/* 生成轨迹 */
#genPanel { position: fixed; right: 12px; bottom: 16px; width: 420px; max-height: 46vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; z-index: 15;
  backdrop-filter: blur(8px); }
#genPanel.hidden { display: none; }
/* 生成轨迹（右下角，点「输出与生成」导航后出现）
   ⚠️ 用户口径 2026-10-14：字体别太暗、别用和背景差不多的颜色，字号适当放大 ——
   原 .gen-row opacity .45 + #64748b/#6b7d95 在深底上几乎看不清，全部提亮 */
.gen-head { font-size: 15px; color: var(--txt); margin-bottom: 8px; }
.gen-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 6px; border-radius: 6px;
  font-size: 13.5px; opacity: .85; transition: all .2s; }
.gen-row.on { opacity: 1; background: var(--gen-on); }
.gen-idx { color: var(--gen-idx); font-size: 12.5px; width: 48px; }
.gen-pick { color: var(--gen-pick); font-family: Consolas, monospace; min-width: 62px; }
.gen-p { color: var(--gen-p); font-family: Consolas, monospace; width: 42px; }
.gen-alts { color: var(--gen-idx); font-family: Consolas, monospace; font-size: 12.5px; }

/* 遮罩层 */
#loading { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: var(--mask-bg); transition: opacity .35s; }
#loading.hidden { opacity: 0; pointer-events: none; }
.loadbox { width: 380px; text-align: center; }
.loadtitle { font-size: 14px; color: var(--loadtitle); margin-bottom: 14px; }
.loadtrack { height: 5px; background: var(--loadtrack); border-radius: 3px; overflow: hidden; }
#loadbar { height: 100%; width: 2%; background: linear-gradient(90deg, var(--grad1), var(--grad2)); transition: width .3s; }
#loadtext { margin-top: 10px; font-size: 12px; color: var(--dim); }

/* 自检清单 */
#verifyBox { position: fixed; top: calc(var(--topbar-h, 50px) + 8px); right: 16px; z-index: 25; width: 420px; max-height: 60vh; overflow-y: auto;
  background: var(--vbox-bg); border: 1px solid var(--vbox-bd); border-radius: var(--radius); padding: 12px;
  font-size: 11px; font-family: Consolas, monospace; display: none; }
#verifyBox.show { display: block; }
#verifyBox h4 { margin: 0 0 8px; font-size: 13px; font-family: inherit; }
#verifyBox div { padding: 2px 0; color: var(--txt2); display: flex; justify-content: space-between; gap: 8px; }
#verifyBox div.ok { color: var(--ok); }
#verifyBox div.bad { color: var(--bad); }

/* 全屏矩阵查看器（双击矩阵打开）：滑动条控制显示的行数 / 维度数，拖动平移*/
#fsView { position: fixed; inset: 0; z-index: 60; background: var(--fs-bg); display: flex;
  flex-direction: column; backdrop-filter: blur(6px); }
#fsView.hidden { display: none; }
.fs-head { display: flex; align-items: center; gap: 18px; padding: 9px 16px 8px; flex: none;
  border-bottom: 1px solid var(--line); }
.fs-titles { min-width: 0; }
#fsTitle { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-sub { font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.fs-barwrap { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
#fsBar { width: 190px; height: 14px; border-radius: 3px; display: block; }
#fsScale { margin-top: 0; font-family: Consolas, monospace; white-space: nowrap; }
#fsClose { border: 1px solid var(--line); background: var(--btn-bg); color: var(--dim); border-radius: 7px;
  cursor: pointer; width: 28px; height: 28px; flex: none; }
#fsClose:hover { color: var(--txt); border-color: var(--btn-bd); }
#fsBody { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 10px 14px; }
/* 左侧 token 列（行 = token 的矩阵，含 S/P）：**贴在全屏画布左边固定不动** —— 它不参与「维度数」滑动，
   永远看得见；高度锁成画布高度，所以逐行与矩阵严格对齐。 */
#fsTokens { flex: none; align-self: flex-start; position: relative; display: flex; flex-direction: column;
  overflow: hidden; margin-right: 6px; user-select: none; }
#fsTokens .tk { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
  font-size: 15px; color: var(--fstok); font-family: Consolas, "Microsoft YaHei UI", monospace;
  white-space: nowrap; overflow: hidden; }
#fsTokens .hl { position: absolute; left: 0; right: 0; height: 1px; background: var(--fstok-hl); }
/* 画布 + 下方「列 token」行：两者同宽（宽度都按画布实宽在 JS 里锁死）→ 每格对一列 */
#fsPlot { flex: none; display: flex; flex-direction: column; align-items: flex-start; }
#fsColToks { display: none; flex-direction: row; margin-top: 3px; overflow: hidden; user-select: none; }
#fsColToks.show { display: flex; }
#fsColToks .cl { flex: 1 1 0; min-width: 0; text-align: center; font-size: 13px; color: var(--fstok);
  font-family: Consolas, "Microsoft YaHei UI", monospace; white-space: nowrap; overflow: hidden; }
#fsCanvas { display: block; image-rendering: pixelated; border-radius: 4px; cursor: default; background: var(--fscanvas-bg); }
/* 鼠标所在格的白色高亮框（全屏矩阵查看器）：深色衬边 + 白框，浅/深底色都醒目 */
#fsHi { position: absolute; display: none; pointer-events: none; z-index: 2; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(3, 8, 16, 0.8), 0 0 0 2.5px #ffffff, 0 0 12px rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.14); }
#fsCell { position: absolute; left: 0; top: 0; display: none; pointer-events: none; z-index: 3;
  background: var(--inscell-bg); border: 1px solid var(--inscell-bd); border-radius: 6px; padding: 2px 9px;
  font: 12px Consolas, monospace; color: var(--txt-strong); white-space: nowrap;
  box-shadow: var(--shadow); }
.fs-ctrl { flex: none; display: flex; align-items: center; gap: 30px; padding: 9px 18px 11px;
  border-top: 1px solid var(--line); }
.fs-sl { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--txt2); flex: 1; min-width: 0; }
.fs-sl > span { flex: none; }
.fs-sl b { font: 12px Consolas, monospace; color: var(--txt-strong); min-width: 112px; text-align: right; flex: none; }
/* 双手柄滑动条：左把手=窗口起点，右把手=窗口终点，中段（亮色区间）可整体拖动平移 */
.fs-dual { position: relative; flex: 1; height: 26px; min-width: 120px; user-select: none; touch-action: none; }
.fs-track { position: absolute; left: 8px; right: 8px; top: 50%; height: 4px; transform: translateY(-50%);
  background: var(--fstrack); border-radius: 2px; }
.fs-fill { position: absolute; top: 50%; height: 4px; transform: translateY(-50%); border-radius: 2px;
  background: linear-gradient(90deg, var(--grad1), var(--grad2)); cursor: pointer; z-index: 2; }
.fs-fill::after { content: ''; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }   /* 扩大命中区 */
.fs-handle { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--fshandle); border: 2px solid var(--fshandle-bd); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .1s; z-index: 3; }
.fs-handle:hover { transform: scale(1.18); }

/* 权重矩阵总览（顶栏「权重矩阵」按钮）：层 × 位置的参数表格 —— 上表权重 W、下表偏置与归一化 */
#wView { position: fixed; inset: 0; z-index: 50; background: var(--fs-bg); display: flex;
  flex-direction: column; backdrop-filter: blur(6px); }
#wView.hidden { display: none; }
.wv-head { flex: none; padding: 10px 18px 9px; border-bottom: 1px solid var(--line); }
.wv-top { display: flex; align-items: flex-start; gap: 12px; }
.wv-titles { min-width: 0; flex: 1; }
#wvTitle { font-size: 15px; font-weight: 600; }
.wv-sub { font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
#wvClose { flex: none; border: 1px solid var(--line); background: var(--btn-bg); color: var(--dim);
  border-radius: 7px; width: 30px; height: 28px; cursor: pointer; font-size: 13px; }
#wvClose:hover { color: var(--txt); border-color: var(--btn-bd); }
.wv-body { flex: 1; overflow-y: auto; padding: 16px 22px 60px; scrollbar-width: thin; }
.wv-body::-webkit-scrollbar { width: 8px; }
.wv-body::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
/* 小节（表标题 + 表） */
.wv-sec2 { margin-bottom: 30px; }
.wv-secttl { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 10px; }
.wv-secttl .t { font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.wv-secttl .n { font-size: 11px; color: var(--dim); }
/* 表格：1px 缝隙做网格线；列宽比 = 每格矩阵数比（6:4:4:2），全部小卡等宽 */
.wv-tblwrap { overflow-x: auto; padding-bottom: 2px; }
.wv-tbl { display: grid; grid-template-columns: 66px 6fr 4fr 4fr 2fr; gap: 1px;
  background: var(--wv-tbl); border: 1px solid var(--wv-tbl); border-radius: 10px; overflow: hidden; min-width: 1060px; }
.wv-th { background: var(--wv-th); color: var(--txt2); font-size: 11.5px; text-align: center;
  padding: 7px 4px; letter-spacing: .5px; white-space: nowrap; }
.wv-rh { background: var(--wv-rh); color: var(--txt2); font-size: 11.5px; font-family: Consolas, monospace;
  display: flex; align-items: center; justify-content: center; }
.wv-td { background: var(--wv-td); padding: 8px; min-width: 0; }
.wv-row { display: flex; gap: 6px; align-items: flex-end; }
/* 格内小卡：权重（缩略图画框 + 名称） */
.wv-mx { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.wv-mx-th { background: var(--wv-thumb); border: 1px solid var(--wv-thumb-bd); border-radius: 5px; height: 82px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: border-color .15s; }
.wv-mx:hover .wv-mx-th { border-color: var(--btn-bd); }
.wv-mx-lab { font-size: 10.5px; color: var(--wv-lab); text-align: center; font-family: Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-mx-th.wait::after { content: '载入中…'; font-size: 10px; color: var(--dim); }
.wv-mx-th.wait .wv-cv { display: none; }
/* 格内小卡：偏置 / 归一化（细色带 + 名称） */
.wv-bi { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.wv-bi-bar { height: 14px; background: var(--wv-thumb); border: 1px solid var(--wv-thumb-bd); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: border-color .15s; }
.wv-bi:hover .wv-bi-bar { border-color: var(--btn-bd); }
.wv-bi-lab { font-size: 10px; color: var(--wv-lab2); text-align: center; font-family: Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-bi.wait .wv-bi-lab { color: var(--wv-wait); }
.wv-cv { image-rendering: pixelated; border-radius: 2px; }
/* 公共参数（词嵌入 / 输出偏置）：两张固定宽小卡 */
.wv-pub { display: flex; gap: 10px; }
.wv-pub .wv-mx, .wv-pub .wv-bi { flex: 0 0 132px; }

/* 投影动画播放器（anim.js）：目录「▶ 动画」按钮 + 底部控制条（播放/暂停 · 调速 · 拖动定位 · 关闭） */
.ol-anim {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  appearance: none; -webkit-appearance: none;
  font-family: inherit; font-size: 10px; line-height: 1.5; letter-spacing: 0.5px;
  color: var(--gold); background: transparent;
  border: 1px solid var(--gold-bd); border-radius: 999px;
  padding: 1px 7px; cursor: pointer;
}
.ol-anim:hover { border-color: var(--gold-hov-bd); background: var(--gold-hov-bg); }
.ol-anim.on { border-color: var(--gold-hov-bd); background: var(--gold-on-bg); color: var(--gold-on-txt); }
/* 解码器「▶ 动画」单按钮展开态（点开选择菜单时） */
.ol-anim.open { border-color: var(--gold-hov-bd); background: var(--gold-on-bg); color: var(--gold-on-txt); }
/* 解码器 item 的标题行：站名 + 「▶ 动画」按钮两端对齐（按钮不再 absolute） */
.ol-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ol-head .ol-anim { position: static; transform: none; }
/* 解码器动画选择菜单（内联展开：掩码 / 交叉 —— 原两个按钮手机上放不下，2026-10-16 合成一个入口） */
.ol-anim-menu { display: none; margin: 5px 2px 3px; padding: 3px; border-radius: 8px;
  border: 1px solid var(--list-bd); background: var(--list-bg); flex-direction: column; gap: 1px; }
.ol-anim-menu.show { display: flex; }
.oa-item { display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 6px 9px; border: none; border-radius: 6px; background: transparent; cursor: pointer;
  font-family: inherit; text-align: left; }
.oa-item:hover { background: var(--list-hov); }
.oa-item .oa-t { font-size: 12px; color: var(--list-ci); }
.oa-item .oa-s { font-size: 9.5px; color: var(--list-dim); }
.oa-item.a-dsa .oa-t { color: var(--gdsa); }   /* 掩码=橙（同原按钮配色） */
.oa-item.a-dca .oa-t { color: var(--gdca); }   /* 交叉=青 */
/* 掩码（橙，与 ACCENT.dsa 一致）/ 交叉（青，与 ACCENT.dca 一致）入口配色 */
.ol-anim.a-dsa { color: var(--gdsa); border-color: var(--gdsa-bd); }
.ol-anim.a-dsa:hover { border-color: var(--gdsa-hov-bd); background: var(--gdsa-hov-bg); }
.ol-anim.a-dsa.on { border-color: var(--gdsa-hov-bd); background: var(--gdsa-on-bg); color: var(--gdsa-on-txt); }
.ol-anim.a-dca { color: var(--gdca); border-color: var(--gdca-bd); }
.ol-anim.a-dca:hover { border-color: var(--gdca-hov-bd); background: var(--gdca-hov-bg); }
.ol-anim.a-dca.on { border-color: var(--gdca-hov-bd); background: var(--gdca-on-bg); color: var(--gdca-on-txt); }

.anim-bar {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: none; align-items: center; gap: 10px; z-index: 46;
  background: var(--ab-bg); border: 1px solid var(--ab-bd);
  border-radius: 999px; padding: 7px 14px; user-select: none;
  backdrop-filter: blur(8px);
}
.anim-bar.on { display: flex; }
.anim-bar button {
  appearance: none; -webkit-appearance: none; background: transparent; border: none;
  color: var(--ab-txt); cursor: pointer; font: 14px/1 ui-monospace, Consolas, monospace;
  padding: 4px 7px; border-radius: 7px;
}
.anim-bar button:hover { background: var(--ab-hov-bg); }
.ab-speed { display: inline-flex; align-items: center; gap: 2px; }
.ab-speed button { font-size: 13px; padding: 3px 6px; }
/* 音效开关：默认静音（灰、斜杠划掉）→ 开启（金、带声波弧）。图标纯 CSS 画，emoji 在深色底上辨识度差 */
.ab-snd { padding: 5px 9px; opacity: 0.55; }
.ab-snd:hover { opacity: 1; }
.ab-snd.on { opacity: 1; }
.ab-ico { display: block; position: relative; width: 19px; height: 17px; color: currentColor; }
/* 音符头（左下的小圆） */
.ab-ico::before {
  content: ''; position: absolute; left: 0; bottom: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: currentColor;
}
/* 音符杆（右侧竖条）；关闭态用斜杠覆盖 → 表示静音 */
.ab-ico::after {
  content: ''; position: absolute; left: 12px; top: 0;
  width: 2.5px; height: 17px; border-radius: 1px;
  background: currentColor;
}
.ab-snd:not(.on) .ab-ico::after {
  background: linear-gradient(45deg, transparent 38%, var(--ab-slash) 38%, var(--ab-slash) 62%, transparent 62%);
}
/* 开启态：音符杆右侧加一道声波弧 */
.ab-snd.on .ab-ico::after {
  background: currentColor;
  box-shadow: 4.5px 0 0 0 currentColor;
}
.ab-rate {
  color: var(--ab-txt); font: 12px/1 ui-monospace, Consolas, monospace;
  min-width: 26px; text-align: center;
}
.ab-track {
  position: relative; width: min(760px, calc(100vw - 560px)); height: 8px; border-radius: 4px;
  background: var(--ab-track); cursor: pointer;
}
.ab-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #f5a623, #ffe08a);
}
.ab-segs { position: absolute; inset: 0; pointer-events: none; }
.ab-seg {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px;
  background: var(--ab-seg); border-radius: 1px; pointer-events: none;
}
.ab-thumb {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px;
  margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--ab-thumb); box-shadow: var(--shadow-sm);
}
.ab-track:hover .ab-thumb { transform: scale(1.12); }
/* 键盘聚焦态：进度条外圈高亮；提示放进度条右侧（用户口径：不要浮在上方挡动画） */
.ab-track.focus { box-shadow: 0 0 0 2px var(--ab-focus); }
.ab-kbhint {
  font: 11px/1.6 ui-monospace, Consolas, monospace; color: var(--ab-txt); white-space: nowrap;
  background: var(--ab-bg); border: 1px solid var(--ab-hint-bd);
  border-radius: 999px; padding: 2px 10px; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.anim-bar.kb .ab-kbhint { opacity: 1; }

/* 构建/版本标记：右下角小字 —— 用来当场核对浏览器跑的是不是最新代码（反馈 bug 报这个号） */
#buildTag { position: fixed; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 10.5px; color: var(--buildtag);
  font-family: ui-monospace, Consolas, monospace; pointer-events: none; user-select: none; z-index: 5; }

/* ⚠️ 必须有：项目里 .hidden 此前只对 #fsView / #wView / #genPanel / #loading 单独定义，
   .combo-list 挂上 hidden 却没有任何 display:none → "点了收不起"反复修不好的真正原因。
   （不能写通用 .hidden{display:none}：#loading 靠 opacity 淡出，被 display 干掉就没过渡了） */
.combo-list.hidden { display: none; }

/* 返回首页（顶栏 brand 右侧小按钮，外观对齐 #topbar button） */
#topbar a.topbtn { display: inline-flex; align-items: center; height: 31px; padding: 0 11px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--btn-bg); color: var(--txt);
  font-size: 12.5px; text-decoration: none; white-space: nowrap; opacity: .82;
  transition: border-color .15s, background .15s, opacity .15s; }
#topbar a.topbtn:hover { border-color: var(--btn-bd); background: var(--btn-bg-hov); opacity: 1; }

/* ============================================================
   全屏沉浸模式 / 目录收起（2026-10-16 · P1）
   · 点顶栏「全屏」按钮 → body.fs-ui：顶栏隐藏（--topbar-h 同步为 0，
     outline/inspector 自动贴顶）+ 请求浏览器全屏
   · 顶部悬停（body.fs-peek）→ 顶栏临时滑回；鼠标离开 / 点右上角 ✕ 按钮 / Esc 退出
   ============================================================ */
body.fs-ui #topbar { display: none; }
body.fs-ui.fs-peek #topbar { display: flex; }   /* peek：悬停唤出，不改变 --topbar-h（保持 0） */

/* 沉浸模式的退出按钮（右上角）：peek 时隐藏（那时用顶栏操作） */
#fsExit { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; z-index: 30;
  display: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--dim);
  cursor: pointer; backdrop-filter: blur(8px); }
body.fs-ui:not(.fs-peek) #fsExit { display: flex; }
#fsExit:hover { color: var(--txt); border-color: var(--btn-bd); }
#fsExit svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

/* 全屏按钮（顶栏图标式按钮，口径同 #themeToggle） */
#btnFs { display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; }
#btnFs svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
#btnFs.on { border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-txt); }

/* 目录收起：把手 + #outline 滑出（top 也加过渡：沉浸 peek 唤回顶栏时平滑下移） */
#outline { transition: transform .25s ease, top .2s ease; }
#outline.ol-hide { transform: translateX(calc(-100% - 16px)); }
#olToggle { position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 17;
  width: 18px; height: 52px; padding: 0; border: 1px solid var(--line); border-left: none;
  border-radius: 0 10px 10px 0; background: var(--panel); color: var(--dim); cursor: pointer;
  backdrop-filter: blur(8px); }
#olToggle::after { content: '‹'; font: 700 13px/1 Consolas, monospace; }
#olToggle.on::after { content: '›'; }
#olToggle:hover { color: var(--txt); border-color: var(--btn-bd); }

/* 手机端圆盘摇杆：平移镜头。拖动方向=平移方向，拖动幅度=速度（越远越快），松手回中即停。
   仅触摸设备显示（body.touch-ui 由 app.js 判定）。无文字元素（长按不会触发选择/复制菜单）。 */
#joyPad { position: fixed; left: 12px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); z-index: 18;
  width: 132px; height: 132px; border-radius: 50%; display: none;
  background: var(--cap-bg); border: 1px solid var(--line); backdrop-filter: blur(6px);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28); }
body.touch-ui #joyPad { display: block; }
/* 内圈虚线（活动区提示） + 外围八向刻度点 */
#joyPad::before { content: ''; position: absolute; inset: 12px; border-radius: 50%;
  border: 1px dashed var(--line-soft); pointer-events: none; }
.jp-stick { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: var(--chip-bg); border: 1px solid var(--btn-bd);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); pointer-events: none;
  transition: transform .15s ease-out, background .12s, border-color .12s; }
#joyPad.on .jp-stick { transition: background .12s, border-color .12s; }   /* 拖动中跟手无延迟 */
#joyPad.on { border-color: var(--btn-bd); }
#joyPad.on .jp-stick { background: var(--chip-on-bg); border-color: var(--accent); }

/* ============================================================
   响应式适配（2026-10-16）——移动端 / 窄屏。
   全部写在媒体查询内，桌面（>900px）零变化。
   两档断点：≤900px（平板 / 横屏手机）、≤768px（手机竖屏）。
   顶栏高度变量 --topbar-h 由 app.js 的 ResizeObserver 同步：
   手机顶栏折行变高后，subbar / outline / inspector 等自动跟随下沿。
   ============================================================ */

/* ---------- 769–1560px：窄桌面 / 半屏窗口 ----------
   输入框收窄 + 间距收紧，尽量让顶栏保持单行（折行时工具组整体移到第二行） */
@media (max-width: 1560px) and (min-width: 769px) {
  #topbar { column-gap: 7px; }
  #topbar input { width: 90px; }
  .toolwrap { gap: 7px; }
}

/* ---------- ≤900px：平板 / 横屏手机 ---------- */
@media (max-width: 900px) {
  #outline { width: 156px; }
  #inspector { width: min(380px, calc(100vw - 24px)); }
  #genPanel { width: min(420px, calc(100vw - 24px)); }
  #verifyBox { width: min(420px, calc(100vw - 24px)); }
  .wv-body { padding: 14px 14px 48px; }
  .ab-track { width: min(560px, 46vw); }   /* 原 calc(100vw - 560px) 在窄屏会算成负值 */
}

/* ---------- ≤768px：手机 ---------- */
@media (max-width: 768px) {
  /* —— 顶栏：折行 + 收缩 —— */
  #topbar { flex-wrap: wrap; height: auto; min-height: 44px; row-gap: 7px; column-gap: 6px;
    padding: calc(7px + env(safe-area-inset-top, 0px)) 10px 7px; }
  .brand { font-size: 13.5px; letter-spacing: 0; }
  .brand::before { margin-right: 6px; }
  /* ⚠️ input 字号必须 ≥16px：iOS 上 <16px 的输入框聚焦时页面会被自动放大 */
  #topbar input { width: 92px; height: 30px; font-size: 16px; padding: 0 8px; }
  #topbar #sent { width: 102px; }
  #topbar button { height: 30px; font-size: 12.5px; padding: 0 9px; }
  #topbar button.topbtn, #topbar a.topbtn { height: 30px; padding: 0 9px; font-size: 12px; }
  .spacer { display: none; }
  /* 输入区（模型/句子/开关）整行独占，内部不够时自动再折行 */
  .sent-wrap { order: 9; flex: 1 0 100%; flex-wrap: wrap; row-gap: 7px; }
  /* 步骤标签整行，超宽横向滚动（无下拉，不会裁出问题） */
  #stepTags { order: 10; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  /* 右缘 combo（第 2/3 句）的下拉右对齐，防伸出行尾被屏幕裁掉 */
  #topbar .combo:has(#sent2) .combo-list,
  #topbar .combo:has(#sent3) .combo-list { left: auto; right: 0; }
  /* 未启用的第 2/3 句输入框直接隐藏（开关仍在原位）：
     省一整行宽度；打开开关 → JS 去掉 disabled → 输入框自动出现（:has 联动） */
  #topbar .combo:has(input:disabled) { display: none; }

  /* —— 左侧目录：缩窄 + 限高，不再挡半个屏 —— */
  #outline { width: 152px; max-height: 44vh; bottom: auto; padding: 5px; }
  .ol-title { font-size: 11.5px; }
  .ol-item { padding: 6px 6px 6px 18px; }
  .ol-grouplabel { font-size: 9.5px; }
  .ol-loop-c { min-width: 21px; height: 19px; font-size: 10px; }

  /* —— 检视面板：全宽卡片（滑入动画不变：420px 位移已大于手机屏宽）—— */
  #inspector { left: 8px; right: 8px; width: auto;
    top: calc(var(--topbar-h, 50px) + 10px);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding: 12px; }
  #insTable { max-height: 210px; }

  /* —— 右下生成面板：全宽 —— */
  #genPanel { left: 8px; right: 8px; width: auto; max-height: 38vh; }

  /* —— 底部胶囊 / 提示 —— */
  #curstation { font-size: 12px; padding: 3px 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  #note { max-width: 88vw; font-size: 12.5px; bottom: calc(50px + env(safe-area-inset-bottom, 0px)); }
  #keyhint { display: none; }   /* 键盘提示：触屏无意义 */
  #buildTag { font-size: 9.5px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }

  /* —— 沉浸模式 / 目录把手：触摸目标加大 —— */
  #olToggle { width: 22px; height: 58px; }
  #olToggle::after { font-size: 15px; }
  #fsExit { width: 44px; height: 44px; border-radius: 12px; }

  /* —— 右侧工具组：允许内部换行兜底 —— */
  .toolwrap { gap: 6px; flex-wrap: wrap; }

  /* —— 全屏矩阵查看器：头部折行、控制条改纵向、把手加大触摸目标 —— */
  .fs-head { flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px; }
  .fs-barwrap { margin-left: 0; flex: 1 1 100%; }
  #fsBar { width: 100%; max-width: 260px; height: 16px; }
  .fs-ctrl { flex-direction: column; align-items: stretch; gap: 9px;
    padding: 9px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .fs-sl b { min-width: 58px; font-size: 11.5px; }
  .fs-handle { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
  #fsTokens .tk { font-size: 12px; padding-right: 5px; }
  #fsColToks .cl { font-size: 11px; }
  #fsBody { padding: 8px; }

  /* —— 权重矩阵总览 —— */
  .wv-head { padding: 8px 10px; }
  .wv-body { padding: 10px 10px 40px; }

  /* —— 投影动画播放器：折行 + 窄进度条 —— */
  .anim-bar { max-width: calc(100vw - 16px); flex-wrap: wrap; justify-content: center; gap: 6px 8px;
    padding: 6px 10px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .ab-track { width: min(320px, 52vw); }
  .ab-kbhint { display: none; }

  /* —— 加载框 / 自检面板 —— */
  .loadbox { width: min(380px, calc(100vw - 48px)); }
  #verifyBox { left: 8px; right: 8px; width: auto; top: calc(var(--topbar-h, 50px) + 8px); }

  /* —— 下拉候选列表 —— */
  .combo-list { max-height: 170px; }
}
