/* web/css/app.css —— SketchUp Pro 2018 网页复刻的全部界面样式。
 *
 * 观感目标：浅灰工具栏 / 深色文字 / 1px 精细分隔线 / 28-30px 大工具栏按钮 /
 * 右侧「默认面板」托盘 / 底部状态栏与数值控制框（VCB）/ 类桌面软件的阴影与层次。
 * 全部原创，无外部字体、无图片资源、无主题框架；深色模式不做（保持 SketchUp 2018 的浅色观感）。
 *
 * 组织：1 变量与重置 → 2 主体布局 → 3 菜单栏 → 4 工具栏 → 5 视口/角标/推理标签
 *      6 默认面板（托盘 + 各面板控件）→ 7 状态栏/VCB → 8 轻提示 → 9 对话框
 *      10 错误/自检输出 → 11 响应式 → 12 滚动条与可访问性
 */

/* ========================================================================
   1. 设计变量与重置
   ======================================================================== */
:root {
  color-scheme: light;

  --ui-font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  --mono-font: "SFMono-Regular", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace;

  /* 桌面软件外壳 */
  --chrome-bg: #f0f0ee;
  --chrome-bg-alt: #e7e7e3;
  --chrome-edge: #c8c8c2;
  --chrome-edge-strong: #a9a9a2;
  --chrome-highlight: #fbfbf8;

  /* 菜单栏 */
  --menubar-bg: linear-gradient(#fafaf7, #eeeeea);
  --menubar-ink: #24241f;

  /* 工具栏 */
  --toolbar-bg: #f0f0ee;
  --toolbar-btn-hover: #e7eef6;
  --toolbar-btn-active: #cfe2f5;
  --toolbar-btn-edge: #8bb2d4;

  /* 托盘与面板 */
  --tray-bg: #f4f4f1;
  --tray-head-bg: #e9e9e5;
  --tray-tab-bg: #e4e4df;
  --tray-tab-active: #f4f4f1;
  --tray-tab-ink: #55554e;
  --panel-bg: #f9f9f6;
  --panel-head-bg: #efefe9;
  --panel-sunken: #fbfbf8;

  /* 文字与线条 */
  --ink: #26261f;
  --ink-strong: #11110d;
  --ink-muted: #6d6d64;
  --ink-faint: #8d8d83;
  --line: #d3d3cc;
  --line-soft: #e4e4dd;

  /* 强调色（SketchUp 蓝） */
  --accent: #1b6fb8;
  --accent-strong: #145a97;
  --accent-soft: #dbeaf8;
  --accent-ink: #ffffff;

  /* 语义色 */
  --danger: #b02a20;
  --danger-soft: #f8e2df;
  --ok: #2f7d34;
  --warn: #b7791f;

  /* 状态栏 / VCB */
  --status-bg: #e8e8e3;
  --status-bg-alt: #f2f2ee;
  --vcb-bg: #ffffff;
  --vcb-ink: #14324a;
  --vcb-edge: #9a9a93;

  /* 浮层 */
  --toast-bg: #26261f;
  --toast-ink: #f6f6f1;
  --modal-bg: #f8f8f5;
  --modal-veil: rgba(22, 24, 28, 0.42);
  --modal-edge: #a9a9a2;

  /* 阴影与尺寸 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.10);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.18);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.34);
  --radius: 3px;
  --menubar-h: 26px;
  --toolbar-h: 44px;
  --status-h: 30px;
  --btn-size: 30px;
  --tray-width: 286px;

  --focus-ring: 0 0 0 2px rgba(27, 111, 184, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--ui-font);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--chrome-bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

[hidden] { display: none !important; }

h1, h2, h3, h4, p, ul, ol { margin: 0; }
button, input, select, textarea { font-family: inherit; }
svg { display: block; }

input, textarea, pre, code, .mono, kbd { user-select: text; }

:focus-visible {
  outline: 2px solid rgba(27, 111, 184, 0.55);
  outline-offset: 1px;
}
button:focus:not(:focus-visible) { outline: none; }

.noscript {
  margin: 24px;
  padding: 16px 20px;
  border: 1px solid #d9c9a6;
  border-radius: 4px;
  background: #fbf4e4;
  color: #5c4a21;
  font-size: 13px;
  line-height: 1.65;
}

/* ========================================================================
   2. 主体布局
   ======================================================================== */
#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  background: var(--chrome-bg);
}

#workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  background: var(--chrome-bg);
}

#viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, #a8d4f0 0%, #d7ecf8 46%, #eef6fb 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

#gl-canvas,
#overlay-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#gl-canvas { z-index: 0; }
#overlay-canvas { z-index: 1; pointer-events: none; }

/* ========================================================================
   3. 菜单栏
   ======================================================================== */
#menubar {
  position: relative;
  z-index: 600;
  display: flex;
  align-items: stretch;
  min-height: var(--menubar-h);
  padding: 0 4px;
  background: var(--menubar-bg);
  border-bottom: 1px solid var(--chrome-edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.menu { position: relative; display: flex; }

.menu-btn {
  height: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--menubar-ink);
  font-size: 12.5px;
  line-height: 1;
  cursor: default;
  white-space: nowrap;
}

.menu-btn:hover { background: rgba(27, 111, 184, 0.10); }
.menu-btn.is-open {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18) inset;
}

.menu-popup {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 800;
  min-width: 248px;
  padding: 4px;
  background: #fbfbf8;
  border: 1px solid #b7b7b0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-2);
}

.menu.is-open .menu-popup { display: block; }

/* 长菜单（无 flyout 的窗口/帮助等）在矮窗口里滚动；带子菜单的菜单不能 overflow，
   否则脱离文档流的 flyout 会被裁剪。JS 在渲染时只给无 children 的菜单加这个类。 */
.menu-popup--scroll {
  max-height: calc(100vh - var(--menubar-h) - 10px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  height: 24px;
  padding: 0 8px 0 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: default;
}

.menu-item:hover:not([disabled]),
.menu-item:focus-visible {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
  outline: none;
}

.menu-item[disabled] { opacity: 0.42; }
.menu-item:hover kbd { color: #eaf3fb; border-color: rgba(255, 255, 255, 0.35); background: transparent; }

.mi-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #51606d;
}
.menu-item:hover .mi-icon { color: #eaf3fb; }

.mi-check {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.menu-item:hover .mi-check { color: #ffffff; }
.menu-item.is-checked .mi-check { color: var(--accent-strong); }

.mi-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mi-shortcut { justify-self: end; }
.mi-shortcut:empty { display: none; }

.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

/* ========================================================================
   4. 大工具栏
   ======================================================================== */
#toolbar {
  position: relative;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  min-height: var(--toolbar-h);
  padding: 5px 8px;
  background:
    linear-gradient(180deg, #f7f7f4 0%, var(--toolbar-bg) 42%, #eaeae6 100%);
  border-bottom: 1px solid var(--chrome-edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.tb-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tb-sep {
  width: 1px;
  height: 24px;
  margin: 0 5px;
  background: var(--chrome-edge);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.75);
  flex: 0 0 auto;
}

.tb-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--btn-size);
  height: var(--btn-size);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #3a3a34;
  cursor: default;
}

.tb-btn svg { display: block; }

.tb-btn:hover {
  background: var(--toolbar-btn-hover);
  border-color: #b9cfe2;
}

.tb-btn:active {
  background: #d8e6f3;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14);
}

.tb-btn.active {
  background: linear-gradient(180deg, #d8e9f8, var(--toolbar-btn-active));
  border-color: var(--toolbar-btn-edge);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 1px 1px rgba(0, 0, 0, 0.08);
  color: #14486f;
}

.tb-btn[aria-pressed="true"] { color: #14486f; }

/* 视图 → 界面 → 大图标（V5 §7 / V6 §7）：JS 在 body 上切换 .is-large-icons。
   放大按钮和 SVG，并让工具栏保持单行横向滚动，避免按钮折行抬高工具栏挤小视口。
   这里的 --btn-size / --toolbar-h 直接写在 body 上，响应式 :root 的值不会覆盖继承值。 */
body.is-large-icons {
  --btn-size: 38px;
  --toolbar-h: 50px;
}

body.is-large-icons #toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #b8b8af transparent;
}

body.is-large-icons #toolbar .tb-group,
body.is-large-icons #toolbar .tb-btn { flex: 0 0 auto; }
body.is-large-icons #toolbar .tb-btn svg { width: 26px; height: 26px; }
body.is-large-icons #toolbar .tb-sep { height: 30px; }

/* 工具栏有横向溢出（<1100px 横向滚动）时，右边缘给一道渐隐，提示"还有按钮" */
#toolbar[data-overflow="scroll"] {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.85), inset -14px 0 12px -12px rgba(0, 0, 0, 0.22);
}

/* 浮动 tooltip（#toolbar-tip 由 shell.js 定位）
   为什么不用 `[data-tip]:hover::after`：<1100px 时 #toolbar 变成横向滚动容器，
   伪元素会被 overflow 剪掉；挂到 body 的浮层不会被裁。 */
#toolbar-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1200;
  max-width: 280px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 3px;
  background: rgba(36, 36, 31, 0.95);
  color: #f7f7f2;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-2);
  transition: opacity 0.08s ease;
}

#toolbar-tip.is-visible { opacity: 1; }
#toolbar-tip[hidden] { display: none; }

/* ========================================================================
   5. 视口角标 / 推理标签
   ======================================================================== */
#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  color: rgba(38, 44, 48, 0.8);
  font-size: 11px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.hud-axes {
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.7));
}

.hud-view {
  padding: 1px 5px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.52);
  font-weight: 600;
}

.hud-units { color: rgba(38, 44, 48, 0.55); }

#inference-label {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 40;
  display: none;
  max-width: 260px;
  padding: 2px 8px;
  border-left: 3px solid #ff2f92;
  border-radius: 3px;
  background: rgba(34, 36, 32, 0.92);
  color: #ffffff;
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

#inference-label:not(:empty) { display: block; }

/* ========================================================================
   6. 默认面板（右侧托盘）
   ======================================================================== */
#tray {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--tray-width);
  width: var(--tray-width);
  min-height: 0;
  background: var(--tray-bg);
  border-left: 1px solid var(--chrome-edge);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.8);
  transition: width 0.12s ease, flex-basis 0.12s ease;
}

/* 拖拽中：关掉过渡，否则面板会"追着"指针慢半拍 */
#tray.is-resizing { transition: none; }

body.is-resizing { cursor: col-resize; user-select: none; }

/* 托盘左边界宽度把手（V3 §6）：跨在分隔线上，命中区 8px，视觉上只在 hover/聚焦时出现 */
#tray-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  z-index: 30;
  width: 8px;
  touch-action: none;
  cursor: col-resize;
  background: transparent;
}

#tray-resize::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background 0.12s ease;
}

#tray-resize:hover::before,
#tray-resize:focus-visible::before,
#tray.is-resizing #tray-resize::before { background: var(--accent); }

#tray-resize:focus-visible { outline: none; }

/* 折叠态 / 窄屏（面板变成底部抽屉）时把手没有意义 */
#tray.is-collapsed #tray-resize { display: none; }

#tray-head {
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex: 0 0 auto;
  background: var(--tray-head-bg);
  border-bottom: 1px solid var(--chrome-edge);
}

#tray-tabs {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.tray-tab {
  flex: 1 1 25%;
  min-width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 4px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 2px solid transparent;
  background: var(--tray-tab-bg);
  color: var(--tray-tab-ink);
  font-size: 11px;
  line-height: 1.2;
  cursor: default;
  white-space: nowrap;
}

.tray-tab:hover { background: #eef3f8; color: var(--ink); }

.tray-tab.is-active {
  background: var(--tray-tab-active);
  color: var(--ink-strong);
  border-bottom-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.tab-icon { display: grid; place-items: center; color: #61707c; }
.tray-tab.is-active .tab-icon { color: var(--accent); }

.tray-collapse {
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  width: 24px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink-muted);
  cursor: default;
}

.tray-collapse:hover { background: #e1e1db; color: var(--ink); }

#tray-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  background: var(--tray-bg);
}

#tray.is-collapsed {
  flex-basis: 30px;
  width: 30px;
}
#tray.is-collapsed #tray-tabs,
#tray.is-collapsed #tray-body { display: none; }
#tray.is-collapsed #tray-head {
  height: 100%;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  border-bottom: 0;
}

/* ---- 面板通用 ---- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow-1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  background: linear-gradient(180deg, #f7f7f3, var(--panel-head-bg));
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-strong);
}

.panel-badge {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9e9e3;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 15px;
  white-space: nowrap;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

/* ---- 可折叠小节 ---- */
.panel-section {
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--panel-sunken);
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  background: #f0f0ea;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  cursor: default;
}

.section-head:hover { background: #eaeae3; color: var(--ink); }

.section-chevron {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  transition: transform 0.12s ease;
}

.panel-section.is-collapsed .section-chevron { transform: rotate(-90deg); }
.panel-section.is-collapsed .section-body { display: none; }

.section-title { flex: 1 1 auto; }

.section-note {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-faint);
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}

/* ---- 表单与字段 ---- */
.field-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #ffffff;
  overflow: hidden;
}

.field-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 23px;
  padding: 2px 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
}

.field-row:last-child { border-bottom: 0; }

.field-label { color: var(--ink-muted); }

.field-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.field-row .select { width: 100%; max-width: 150px; }

.inline-form {
  display: flex;
  gap: 4px;
  align-items: center;
}
.inline-form .input { flex: 1 1 auto; min-width: 0; }

.input,
.select {
  height: 23px;
  padding: 0 5px;
  border: 1px solid var(--chrome-edge-strong);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-size: 11.5px;
  font-family: inherit;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.input-lg { height: 28px; font-size: 12.5px; }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(176, 42, 32, 0.16); }

select.select {
  appearance: auto;
  padding-right: 2px;
  cursor: default;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--chrome-edge-strong);
  border-radius: 3px;
  background: linear-gradient(180deg, #fbfbf8, #ecece6);
  color: var(--ink);
  font-size: 11.5px;
  font-family: inherit;
  white-space: nowrap;
  cursor: default;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.btn:hover:not([disabled]) {
  border-color: #8eb2d3;
  background: linear-gradient(180deg, #f5fafe, #dfeaf5);
}

.btn:active:not([disabled]) {
  background: #d6e6f6;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14);
}

.btn[disabled] { opacity: 0.45; }

.btn-sm { height: 22px; padding: 0 7px; }

.btn-primary {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, #3a8bce, var(--accent));
  color: var(--accent-ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}
.btn-primary:hover:not([disabled]) {
  border-color: #114f86;
  background: linear-gradient(180deg, #4297dc, #1f79c4);
}

.btn-danger {
  border-color: #8f1f18;
  background: linear-gradient(180deg, #c8453a, var(--danger));
  color: #ffffff;
}
.btn-danger:hover:not([disabled]) { background: linear-gradient(180deg, #d35246, #a9281e); }

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-muted);
  cursor: default;
}

.icon-btn:hover { border-color: #bcd2e6; background: #e7eff7; color: var(--ink); }
.icon-btn.is-off { color: #b3b3aa; }
.icon-btn.danger:hover { border-color: #e0b4ae; background: var(--danger-soft); color: var(--danger); }

.kbd,
kbd {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border: 1px solid #c3c3bb;
  border-bottom-color: #a8a8a0;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff, #f0f0ea);
  color: var(--ink);
  font-family: var(--mono-font);
  font-size: 10.5px;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.hint {
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.mono {
  font-family: var(--mono-font);
  font-size: 10px;
  color: #41505c;
}

/* ---- 空状态 ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 10px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: var(--panel-sunken);
  color: var(--ink-muted);
  text-align: center;
}

.empty-icon { display: grid; place-items: center; color: #a9a9a0; }
.empty-title { font-size: 11.5px; font-weight: 600; color: var(--ink); }
.empty-hint { max-width: 230px; font-size: 10.5px; line-height: 1.5; }

/* ---- 统计 / 标签 / 列表 ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #ffffff;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-label { font-size: 9.5px; color: var(--ink-muted); }

.tag-row { display: flex; flex-wrap: wrap; gap: 3px; }

.tag {
  padding: 0 6px;
  border: 1px solid #ccddec;
  border-radius: 8px;
  background: #eef3f8;
  color: #33556f;
  font-size: 9.5px;
  line-height: 15px;
}

.sel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 140px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #ffffff;
}

.sel-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px;
}
.sel-row:last-child { border-bottom: 0; }
.sel-kind { min-width: 36px; color: var(--ink-muted); }

/* ---- 材质面板 ---- */
.active-material {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
}

.active-swatch {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.active-info { display: flex; flex-direction: column; min-width: 0; }
.active-name { font-size: 12px; font-weight: 600; }
.active-hint { font-size: 10px; color: var(--ink-muted); }

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 5px;
}

.swatch {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  font-family: inherit;
  cursor: default;
}

.swatch:hover { border-color: #8eb2d3; background: var(--accent-soft); }

.swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(27, 111, 184, 0.25);
}

.swatch-color {
  display: block;
  height: 26px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.swatch-name {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 9.5px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 组件面板 ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }

.chip {
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f0f0ea;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 10.5px;
  cursor: default;
}

.chip:hover { border-color: #a9c6df; background: #e6eef6; }

.chip.is-active {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--accent-ink);
}

.component-group { display: flex; flex-direction: column; gap: 4px; }

.group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
}

.group-count {
  padding: 0 5px;
  border-radius: 8px;
  background: #e9e9e3;
  color: var(--ink-muted);
  font-size: 9.5px;
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 5px;
}

.component-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  font-family: inherit;
  cursor: default;
}

.component-card:hover {
  border-color: #8eb2d3;
  background: var(--accent-soft);
  box-shadow: var(--shadow-1);
}

.cc-icon { display: grid; place-items: center; color: #4c6b86; }
.cc-name { color: var(--ink); font-size: 10.5px; line-height: 1.25; text-align: center; }
.cc-size { color: var(--ink-faint); font-size: 9.5px; }

/* ---- 图层面板 ---- */
.layer-list,
.scene-list,
.tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.layer-row {
  display: grid;
  grid-template-columns: 22px 12px minmax(0, 1fr) auto 20px;
  gap: 4px;
  align-items: center;
  padding: 2px 3px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: #ffffff;
}

.layer-row:hover { border-color: #dbe7f2; background: #f4f8fc; }

.layer-row.is-active {
  border-color: #b9d3e9;
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.layer-dot {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 50%;
}

.layer-name {
  overflow: hidden;
  padding: 1px 2px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.layer-name:hover { text-decoration: underline; }

.layer-count {
  min-width: 14px;
  color: var(--ink-faint);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---- 场景面板 ---- */
.scene-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #ffffff;
}

.scene-row:hover { border-color: #bcd2e6; background: #f7fafd; }

.scene-main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: default;
}

.scene-thumb {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 28px;
  overflow: hidden;
  border: 1px solid #c2cdd6;
  border-radius: 2px;
  background: linear-gradient(160deg, #cfe3f3, #eef6fb 65%, #e6eadf);
  color: #5d7488;
}

.scene-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.scene-text { display: flex; flex-direction: column; min-width: 0; }

.scene-name {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-sub { color: var(--ink-muted); font-size: 9.5px; }
.scene-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 1px; }

/* ---- 样式面板 ---- */
.radio-list { display: flex; flex-direction: column; gap: 2px; }

.radio-row {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 11.5px;
  cursor: default;
}

.radio-row:hover { background: #f2f7fc; }

.radio-row.is-active {
  border-color: #bcd2e6;
  background: var(--accent-soft);
}

.radio-row input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.radio-mark {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  border: 1px solid #8f8f86;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #f1f1eb);
}

.radio-row.is-active .radio-mark { border-color: var(--accent); }

.radio-row.is-active .radio-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--accent);
}

.radio-row:focus-within { outline: 2px solid rgba(27, 111, 184, 0.35); outline-offset: 1px; }

.radio-relabel,
.radio-en { color: var(--ink-faint); font-size: 9.5px; }

.toggle-list { display: flex; flex-direction: column; gap: 2px; }

.toggle-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: default;
}

.toggle-row:hover { background: #f2f7fc; }
.toggle-icon { display: grid; place-items: center; color: var(--ink-muted); }
.toggle-row.is-on .toggle-icon { color: var(--accent); }

.switch {
  position: relative;
  display: block;
  width: 26px;
  height: 14px;
  border: 1px solid #b9b9b0;
  border-radius: 8px;
  background: #d3d3cb;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.switch.is-on { border-color: var(--accent-strong); background: var(--accent); }

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  transition: left 0.12s ease;
}

.switch.is-on .switch-knob { left: 13px; }

/* ---- 阴影面板 ---- */
.sun-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: default;
}

.sun-toggle:hover { border-color: #bcd2e6; background: #f7fafd; }

.sun-toggle.is-on {
  border-color: #e0c07a;
  background: linear-gradient(180deg, #fffdf3, #fdf6e3);
}

.sun-icon { color: var(--warn); display: grid; place-items: center; }
.sun-text { display: flex; flex: 1 1 auto; flex-direction: column; }
.sun-title { font-size: 12px; font-weight: 600; }
.sun-sub { color: var(--ink-muted); font-size: 10px; }

.slider-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--panel-sunken);
}

.slider-list.is-disabled { opacity: 0.5; pointer-events: none; }

.slider-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 46px;
  gap: 6px;
  align-items: center;
}

.slider-label { color: var(--ink-muted); font-size: 11px; }

.slider-value {
  color: var(--ink);
  font-family: var(--mono-font);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type="range"].range {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  margin: 0;
  background: transparent;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border: 1px solid #b5b5ac;
  border-radius: 2px;
  background: linear-gradient(#d9d9d2, #c9c9c1);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 1px solid #8f8f86;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #e6e6df);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #c9c9c1;
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1px solid #8f8f86;
  border-radius: 50%;
  background: #ffffff;
}

/* ---- 大纲（树） ---- */
.tree,
.tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree { display: flex; flex-direction: column; }
.tree-children { display: flex; flex-direction: column; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 3px 2px calc(3px + var(--depth, 0) * 12px);
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 11.5px;
  cursor: default;
}

.tree-row:hover { border-color: #dbe7f2; background: #f2f7fc; }

.tree-node.is-active > .tree-row {
  border-color: #bcd2e6;
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.tree-toggle {
  display: grid;
  place-items: center;
  width: 14px;
  height: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-muted);
  cursor: default;
}

.tree-toggle.is-empty { visibility: hidden; }
.tree-icon { display: grid; place-items: center; color: #5f7a91; }

.tree-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-kind {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 12px;
}

.tree-count {
  flex: 0 0 auto;
  min-width: 12px;
  color: var(--ink-faint);
  font-size: 9.5px;
  text-align: right;
}

/* ========================================================================
   7. 状态栏 / 数值控制框
   ======================================================================== */
#statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--status-h);
  padding: 0 8px;
  background: linear-gradient(180deg, var(--status-bg-alt), var(--status-bg));
  border-top: 1px solid var(--chrome-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-size: 11.5px;
}

#status-leading {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#boot-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf6;
  color: var(--ink-muted);
  font-size: 10px;
  white-space: nowrap;
}

#boot-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9a227;
}

#boot-status.is-ready::before { background: var(--ok); }

#status-right {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 推理读数（长度 / 角度）：状态栏右侧，跟 VCB 并排，空闲时压暗显示 —— */
#status-inference {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 2px;
  color: var(--ink-muted);
}

.si-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.si-label {
  color: var(--ink-faint);
  font-size: 10px;
}

.si-value {
  min-width: 42px;
  color: var(--ink-strong);
  font-family: var(--mono-font);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* 没有推理结果时整体压暗，"——"不抢视线 */
#status-inference[data-state="idle"] .si-value { color: var(--ink-faint); }
#status-inference[data-state="active"] .si-label { color: var(--accent-strong); }

#vcb-group { display: flex; align-items: center; gap: 5px; }

#vcb-label {
  min-width: 26px;
  color: var(--ink-muted);
  font-size: 11px;
  text-align: right;
}

#vcb {
  width: 136px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--vcb-edge);
  border-radius: 2px;
  background: var(--vcb-bg);
  color: var(--vcb-ink);
  font-family: var(--mono-font);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

#vcb::placeholder {
  color: #9aa6b1;
  font-family: var(--ui-font);
  font-size: 10.5px;
  font-style: italic;
}

#vcb:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring), inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.status-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
}

#doc-name {
  max-width: 210px;
  overflow: hidden;
  color: var(--ink-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#edition-badge {
  padding: 1px 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: #2f6f3a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 15px;
}

#edition-badge[data-edition="dev"] { background: #8a5a12; }

/* ========================================================================
   8. 轻提示
   ======================================================================== */
#toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  z-index: 1200;
  max-width: min(560px, 84vw);
  padding: 7px 14px;
  border-radius: 4px;
  background: rgba(38, 38, 33, 0.96);
  color: var(--toast-ink);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

#toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
  cursor: default;
}

/* ========================================================================
   9. 对话框
   ======================================================================== */
#modal-root { position: relative; z-index: 1000; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--modal-veil);
}

.dialog {
  display: flex;
  flex-direction: column;
  width: min(var(--dialog-width, 480px), 100%);
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  border: 1px solid var(--modal-edge);
  border-radius: 4px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  outline: none;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #f9f9f6, #ebebe6);
}

.dialog-icon {
  display: grid;
  place-items: center;
  margin-top: 1px;
  color: var(--accent);
}

.dialog-title-wrap { flex: 1 1 auto; min-width: 0; }
.dialog-title { font-size: 13px; font-weight: 600; color: var(--ink-strong); }
.dialog-subtitle { margin-top: 2px; color: var(--ink-muted); font-size: 11px; }

.dialog-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-muted);
  cursor: default;
}

.dialog-close:hover { border-color: #d8b9b4; background: var(--danger-soft); color: var(--danger); }

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  padding: 12px;
  overflow: auto;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 3px 3px;
  background: #f3f3ef;
}

.dialog-foot .btn { height: 26px; padding: 0 14px; font-size: 12px; }

.dialog-text {
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.65;
  word-break: break-word;
}

/* ---- 表单 ---- */
.form-row { display: flex; flex-direction: column; gap: 3px; }
.form-label { color: var(--ink-muted); font-size: 11.5px; }
.form-hint { color: var(--ink-muted); font-size: 11px; line-height: 1.55; }

.form-error {
  padding: 4px 7px;
  border: 1px solid #e3b7b1;
  border-radius: 3px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
}

.muted { color: var(--ink-muted); font-size: 11.5px; }

/* ---- 打开文档 ---- */
.doc-toolbar { display: flex; align-items: center; gap: 10px; }
.doc-toolbar-hint { color: var(--ink-muted); font-size: 11px; }

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 170px;
  max-height: 46vh;
  max-height: 46dvh;
  padding: 2px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.doc-row:last-child { border-bottom: 0; }

.doc-open {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: default;
}

.doc-open:hover { background: var(--accent-soft); }

.doc-icon { display: grid; place-items: center; color: var(--accent); }
.doc-text { display: flex; flex-direction: column; min-width: 0; }

.doc-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-meta { color: var(--ink-muted); font-size: 10.5px; }

.doc-empty { padding: 24px 12px; color: var(--ink-muted); text-align: center; }
.doc-empty-title { margin-bottom: 4px; color: var(--ink); font-weight: 600; }

/* ---- 关于 ---- */
.about { display: flex; align-items: center; gap: 14px; }

.about-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #fdfdfb, #e6e6e0);
  color: var(--accent);
  box-shadow: inset 0 1px 0 #ffffff;
}

.about-main { min-width: 0; }
.about-title { font-size: 16px; font-weight: 600; color: var(--ink-strong); }
.about-version { margin: 2px 0; color: var(--ink-muted); font-size: 11.5px; }
.about-edition { margin-top: 4px; }

.badge,
#edition-badge.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  background: #2f6f3a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.badge[data-edition="dev"] { background: #8a5a12; }

/* ---- 信息表 ---- */
.info-table {
  width: 100%;
  border: 1px solid var(--line);
  border-collapse: collapse;
  background: #ffffff;
  font-size: 11.5px;
}

.info-table th {
  width: 38%;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: #f4f4ef;
  color: var(--ink-muted);
  font-weight: 500;
  text-align: left;
  vertical-align: top;
}

.info-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.info-table tr:last-child th,
.info-table tr:last-child td { border-bottom: 0; }

/* ---- 快捷键（#shortcut-dialog：数据源 shell.js 的 SHORTCUT_TABLE） ---- */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.shortcut-title {
  margin-bottom: 4px;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.shortcut-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.shortcut-table td { padding: 2px 0; vertical-align: middle; }
.shortcut-desc { color: var(--ink); }
.shortcut-keys { text-align: right; white-space: nowrap; }

/* 筛选框：按动作 / 按键 / 命令 id 过滤，命中的整行保留 */
.shortcut-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcut-filter {
  flex: 1 1 auto;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 12px;
}

.shortcut-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.shortcut-count {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shortcut-table tr[hidden] { display: none; }
.shortcut-group[hidden] { display: none; }

/* 快捷键分组很高：让对话框主体自己滚，底部按钮常驻 */
#shortcut-dialog .dialog-body { max-height: 62vh; max-height: 62dvh; }

/* ========================================================================
   10. 错误 / 自检输出
   ======================================================================== */
#js-errors {
  position: fixed;
  left: 8px;
  bottom: calc(var(--status-h) + 8px);
  z-index: 1300;
  max-width: min(760px, 80vw);
  max-height: 30vh;
  margin: 0;
  padding: 6px 9px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  background: rgba(120, 24, 18, 0.95);
  color: #fff2ee;
  font-family: var(--mono-font);
  font-size: 10.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

#js-errors:empty { display: none; }
#js-errors.has-error { border-color: #e8a79e; }

#selftest-output {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 1300;
  max-width: 60vw;
  max-height: 40vh;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-family: var(--mono-font);
  font-size: 10.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: var(--shadow-2);
}

/* ========================================================================
   11. 响应式（最低支持到 900px 宽的窗口）
   ======================================================================== */
@media (max-width: 1180px) {
  :root {
    --tray-width: 254px;
    --btn-size: 28px;
  }
  .component-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #doc-name { max-width: 150px; }
}

/* <1100px：大工具栏（27 个工具 + 分隔符）一行放不下 ——
   改成横向滚动，而不是折成三行（折行会把三维视口往下挤，SketchUp 从不这么干）。
   tooltip 因此不能再用伪元素（会被滚动容器裁掉），改由 #toolbar-tip 浮层负责。 */
@media (max-width: 1100px) {
  #toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #b8b8af transparent;
    -webkit-overflow-scrolling: touch;
  }

  #toolbar .tb-group,
  #toolbar .tb-btn { flex: 0 0 auto; }

  #toolbar::-webkit-scrollbar { height: 5px; }
  #toolbar::-webkit-scrollbar-thumb { border-radius: 3px; background: #b8b8af; }
  #toolbar::-webkit-scrollbar-track { background: transparent; }
}

@media (max-width: 1000px) {
  #tray-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #tray-tabs::-webkit-scrollbar { display: none; }
  .tray-tab { flex: 0 0 auto; min-width: 64px; }
  .slider-row { grid-template-columns: 52px minmax(0, 1fr) 42px; }
  #status-text { max-width: 46vw; }
}

@media (max-width: 900px) {
  :root {
    --tray-width: 100%;
    --menubar-h: 24px;
    --status-h: 34px;
    --btn-size: 27px;
  }

  #workspace { flex-direction: column; }

  /* 窄屏托盘变成底部抽屉，宽度把手（左右拖）没有意义 */
  #tray-resize { display: none; }

  #tray {
    flex: 0 0 auto;
    width: 100%;
    height: 214px;
    border-top: 1px solid var(--chrome-edge);
    border-left: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  #tray.is-collapsed { width: 100%; height: 30px; flex-basis: 30px; }
  #tray.is-collapsed #tray-head { height: 30px; align-items: center; padding-top: 0; }

  #tray-head { align-items: center; }
  #tray-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tray-tab { border-bottom-width: 2px; padding: 4px 6px; }

  #tray-body { padding: 6px; }

  #toolbar { padding: 4px 6px; }

  #statusbar { gap: 6px; padding: 0 6px; }
  #status-right { gap: 5px; }
  #status-inference { gap: 5px; }
  #doc-name { display: none; }
  #vcb { width: 112px; }
  .hud-units { display: none; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .modal-backdrop { padding: 12px; }
  .dialog { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
}

@media (max-width: 640px) {
  #boot-status { display: none; }
  #vcb { width: 96px; }
  #vcb-label { display: none; }
  /* 极窄屏：推理读数只剩数字，标签藏起来（省出 VCB 的位置） */
  #status-inference .si-label { display: none; }
  .menu-btn { padding: 0 7px; font-size: 12px; }
  .component-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .shortcut-grid { grid-template-columns: 1fr; }
}

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

/* ========================================================================
   12. 滚动条
   ======================================================================== */
#tray-body,
.doc-list,
.sel-list,
#js-errors,
#selftest-output {
  scrollbar-width: thin;
  scrollbar-color: #c6c6be transparent;
}

#tray-body::-webkit-scrollbar,
.doc-list::-webkit-scrollbar,
.sel-list::-webkit-scrollbar,
#js-errors::-webkit-scrollbar,
#selftest-output::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#tray-body::-webkit-scrollbar-thumb,
.doc-list::-webkit-scrollbar-thumb,
.sel-list::-webkit-scrollbar-thumb {
  border: 2px solid var(--tray-bg);
  border-radius: 6px;
  background: #cdcdc5;
}

#tray-body::-webkit-scrollbar-thumb:hover { background: #b8b8af; }

#tray-body::-webkit-scrollbar-track,
.doc-list::-webkit-scrollbar-track,
.sel-list::-webkit-scrollbar-track { background: transparent; }

/* ========================================================================
   13. 欢迎屏幕（V2 §6：模板卡片 + 最近模型 + 开始使用）
   ======================================================================== */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(120% 90% at 50% -10%, #ffffff 0%, #eef3f8 46%, #d9e0e7 100%);
}

#welcome[hidden] { display: none; }

body.started #welcome { display: none; }

#welcome.is-hidden { display: none; }

.welcome-shell {
  display: flex;
  flex-direction: column;
  width: min(900px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--chrome-edge-strong);
  border-radius: 6px;
  background: #f6f7f8;
  box-shadow: var(--shadow-3);
}

.welcome-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#ffffff, #edf1f5);
}

.welcome-logo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: var(--shadow-1);
}

.welcome-title-wrap { min-width: 0; }
.welcome-title { font-size: 17px; font-weight: 600; color: var(--ink-strong); letter-spacing: 0.2px; }
.welcome-sub { margin-top: 3px; color: var(--ink-muted); font-size: 11.5px; }

.welcome-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.welcome-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px 10px;
}

.welcome-col + .welcome-col { border-left: 1px solid var(--line); }

.welcome-col-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.welcome-en { color: var(--ink-faint); font-size: 10px; font-weight: 400; }

.welcome-templates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
}

.welcome-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 1px 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: default;
}

.welcome-card:hover { border-color: #9ec1dc; background: #f7fbff; }

.welcome-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(27, 111, 184, 0.35);
}

.wc-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  color: #4c6b86;
}

.welcome-card.is-active .wc-icon { color: var(--accent-strong); }
.wc-name { font-size: 12px; font-weight: 600; }
.wc-en { color: var(--ink-faint); font-size: 9.5px; }
.wc-desc { grid-column: 1 / -1; margin-top: 3px; color: var(--ink-muted); font-size: 10.5px; line-height: 1.45; }

.welcome-recents {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
}

.welcome-recent {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: default;
}

.welcome-recent:hover { border-color: #9ec1dc; background: #f7fbff; }
.wr-icon { display: grid; place-items: center; color: var(--accent); }
.wr-text { display: flex; flex-direction: column; min-width: 0; }
.wr-name { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.wr-meta { color: var(--ink-muted); font-size: 9.5px; }

.welcome-note {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--ink-muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.welcome-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: linear-gradient(#f1f2ef, #e8e9e5);
}

.welcome-skip-label { display: flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 11px; }
.welcome-start { min-width: 132px; height: 28px; font-size: 12.5px; }

@media (max-width: 760px) {
  .welcome-cols { grid-template-columns: minmax(0, 1fr); }
  .welcome-col + .welcome-col { border-top: 1px solid var(--line); border-left: 0; }
  .welcome-templates { grid-template-columns: minmax(0, 1fr); }
}

/* ========================================================================
   14. 右键上下文菜单（#context-menu）
   ======================================================================== */
#context-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1200;
  min-width: 190px;
  max-width: 330px;
  padding: 4px;
  border: 1px solid #a2a8ae;
  border-radius: 4px;
  background: #fbfbf8;
  box-shadow: var(--shadow-2);
  user-select: none;
}

#context-menu[hidden] { display: none; }

.ctx-title {
  margin: 0 2px 3px;
  padding: 3px 7px 5px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.3px;
}

.ctx-item {
  display: flex;
  gap: 7px;
  align-items: center;
  width: 100%;
  height: 24px;
  padding: 0 8px 0 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: default;
}

.ctx-item:hover:not([disabled]),
.ctx-item:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #ffffff;
  outline: none;
}

.ctx-item[disabled] { opacity: 0.42; }
.ctx-item.is-danger:hover { border-color: #8d211a; background: var(--danger); }
.ctx-icon { display: grid; place-items: center; width: 14px; height: 14px; opacity: 0.85; }
.ctx-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-shortcut { color: var(--ink-faint); font-size: 10px; }
.ctx-item:hover .ctx-shortcut { color: #eaf3fb; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ========================================================================
   15. 菜单子菜单（视图 → 工具栏）
   ======================================================================== */
.menu-row { position: relative; display: block; }
.menu-item.has-submenu { grid-template-columns: 18px minmax(0, 1fr) 12px; }

.menu-item.has-submenu:hover,
.menu-row.is-open > .menu-item.has-submenu {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--accent-ink);
}

.mi-caret { display: grid; place-items: center; opacity: 0.6; }
.menu-item.has-submenu:hover .mi-caret { opacity: 1; }

.menu-submenu {
  top: -5px;
  left: 100%;
  z-index: 810;
  min-width: 196px;
  border-radius: var(--radius);
  display: none;
}

.menu-row:hover > .menu-submenu,
.menu-row.is-open > .menu-submenu { display: block; }

/* ========================================================================
   16. 对话框：标签页 / 表单网格 / 取色器
   ======================================================================== */
.dialog-tabs {
  display: flex;
  gap: 2px;
  margin: -4px 0 10px;
  border-bottom: 1px solid var(--line);
}

.dialog-tab {
  padding: 5px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: default;
}

.dialog-tab:hover { background: #eef3f8; color: var(--ink); }

.dialog-tab.is-active {
  margin-bottom: -1px;
  border-color: var(--line);
  background: var(--panel-bg);
  color: var(--ink-strong);
  box-shadow: inset 0 2px 0 var(--accent);
}

.dialog-pane { display: none; flex-direction: column; gap: 9px; }
.dialog-pane.is-active { display: flex; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.dialog-inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--panel-sunken);
  cursor: default;
}

.check-row:hover { border-color: #bcd2e6; background: #f6fafd; }
.check-row input { margin-top: 2px; }
.check-text { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; }
.check-note { color: var(--ink-muted); font-size: 10px; line-height: 1.45; }

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.color-label { color: var(--ink-muted); }

.color-input {
  width: 34px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  cursor: default;
}

.color-input::-webkit-color-swatch-wrapper { padding: 1px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 1px; }

.unit-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--panel-sunken);
  font-size: 11.5px;
}

.unit-preview-row { display: flex; gap: 6px; align-items: baseline; }
.unit-preview-row span { color: var(--ink-muted); }
.unit-preview-row b { font-family: var(--mono-font); color: var(--ink-strong); }

/* ========================================================================
   17. 面板新增控件（纹理缩略图 / 图层颜色 / 场景行号 / 样式颜色）
   ======================================================================== */
.swatch-color.has-texture {
  background-repeat: repeat;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.swatch-color.has-texture[data-texture-state="ready"] { background-color: transparent; }

.swatch-tex {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 8.5px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-swatch.has-texture { background-repeat: repeat; }

.layer-color {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  cursor: default;
}

.layer-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: default;
}

.layer-color:hover { border-color: var(--accent); }
.layer-color .layer-dot { width: 100%; height: 100%; border-radius: 0; }

.scene-row.is-active { border-color: #bcd2e6; background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

/* 场景名保持既有的单行省略；行号是 inline 元素，不改变文本溢出行为 */
.scene-name { white-space: nowrap; }

.scene-no {
  display: inline-grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  margin-right: 4px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-faint);
  font-size: 8.5px;
  vertical-align: 1px;
}

.scene-row.is-active .scene-no { border-color: var(--accent); color: var(--accent-strong); }

/* ========================================================================
   18. 面板停靠 / 浮动窗口（ui/dock.js，V4 §8）
   —— 只新增浮动窗口的 chrome、拖拽把手与右下角缩放手柄；
      #viewport 的任何尺寸规则都没有动（托盘进出 flex 流即可让视口自己变宽）。
   ======================================================================== */

/* 浮动层：整屏定位、默认不接指针，托盘进去后自己打开 pointer-events */
#dock-layer {
  position: fixed;
  inset: 0;
  z-index: 580;
  pointer-events: none;
}

#dock-layer > * { pointer-events: auto; }

/* ---- 标题栏 / 拖拽把手（停靠与浮动共用同一条） ---- */
#tray > .dock-titlebar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 4px 0 6px;
  border-bottom: 1px solid var(--chrome-edge);
  background: linear-gradient(#f4f4f0, #e5e5df);
  color: var(--ink-muted);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#tray > .dock-titlebar:active { cursor: grabbing; }

#tray > .dock-titlebar:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

/* 拖动中：整页换成抓取光标，别让画布显示工具光标 */
body.is-dock-dragging { cursor: grabbing; }

body.is-dock-dragging #gl-canvas,
body.is-dock-dragging #overlay-canvas { cursor: grabbing !important; }

/* 六个小圆点：告诉用户这里可以抓 */
.dock-grip {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background-image: radial-gradient(currentColor 1px, transparent 1.1px);
  background-size: 3px 3px;
  opacity: 0.5;
}

.dock-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-muted);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-mode {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 7px;
  background: #dde7f1;
  color: #1b4f77;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.dock-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfbf8;
  color: var(--ink);
  font-size: 9.5px;
  line-height: 1;
  cursor: default;
}

.dock-btn:hover { border-color: #9ec1dc; background: #f3f9ff; }
.dock-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.dock-btn svg { flex: 0 0 auto; }

/* ---- 浮动窗口本体 ---- */
#tray.is-floating {
  position: absolute;
  z-index: auto;
  flex: 0 0 auto;
  min-height: 0;
  border: 1px solid var(--chrome-edge-strong);
  border-radius: 4px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transition: none;
}

#tray.is-floating > .dock-titlebar {
  height: 26px;
  background: linear-gradient(#f8f8f4, #e2e2dc);
  border-bottom: 1px solid var(--chrome-edge-strong);
}

#tray.is-floating .dock-grip { opacity: 0.8; }

/* 浮动时左右宽度把手没有意义（宽度改由窗口右下角手柄控制） */
#tray.is-floating #tray-resize { display: none; }

/* 浮动窗口内部：顶端两角跟着圆角，标题栏以下保持面板底色 */
#tray.is-floating #tray-head { border-bottom: 1px solid var(--chrome-edge); }
#tray.is-floating #tray-body { background: var(--tray-bg); }

/* 右下角缩放手柄（只在浮动态出现） */
.dock-corner {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 15px;
  height: 15px;
  z-index: 40;
  border-bottom-right-radius: 3px;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 3px,
    rgba(38, 44, 48, 0.32) 3px 4px
  );
  cursor: nwse-resize;
  touch-action: none;
}

#tray.is-floating .dock-corner { display: block; }

/* 折叠态下标题栏只留把手与按钮，别把文字挤成碎片 */
#tray.is-collapsed > .dock-titlebar { height: 18px; padding: 0 2px; gap: 3px; }
#tray.is-collapsed > .dock-titlebar .dock-title,
#tray.is-collapsed > .dock-titlebar .dock-mode,
#tray.is-collapsed > .dock-titlebar .dock-btn { display: none; }
#tray.is-collapsed > .dock-titlebar .dock-grip { margin: 0 auto; }

@media (max-width: 900px) {
  /* 窄屏：托盘本来是底部抽屉，浮出时也限制在视口内 */
  #tray.is-floating { max-width: calc(100vw - 12px); }
  #tray.is-floating > .dock-titlebar { height: 24px; }
}

/* ========================================================================
   19. 菜单对照表（#menu-parity-dialog：数据源 shell.js 的 MENU_PARITY，V4 §8）
   ======================================================================== */
.parity-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.parity-filter {
  flex: 1 1 auto;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 12px;
}

.parity-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.parity-status-filter {
  flex: 0 0 auto;
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-size: 11.5px;
}

.parity-count {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.parity-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.parity-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.parity-chip b { font-weight: 700; }

.parity-chip[data-status="implemented"] { background: #e3f1e5; border-color: #b6d7bb; color: #24612a; }
.parity-chip[data-status="simplified"] { background: #fdf3e0; border-color: #e8d3a6; color: #7a5512; }
.parity-chip[data-status="missing"] { background: #f8e6e3; border-color: #e2b9b2; color: #8a2b21; }

.parity-coverage {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 11px;
}

.parity-coverage b { color: var(--ink); font-weight: 700; }

.parity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.parity-group { min-width: 0; }

.parity-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.parity-en { color: var(--ink-faint); font-size: 10px; font-weight: 400; }

.parity-group-count {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.parity-table {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-collapse: collapse;
  background: #ffffff;
  font-size: 11px;
}

.parity-table th {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line);
  background: #f4f4ef;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 500;
  text-align: left;
}

.parity-table td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.parity-table tr:last-child td { border-bottom: 0; }
.parity-item { width: 34%; color: var(--ink); }
.parity-status { width: 64px; white-space: nowrap; }
.parity-note { color: var(--ink-muted); line-height: 1.4; }

.parity-badge {
  display: inline-block;
  padding: 0 5px;
  border-radius: 2px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.parity-badge[data-status="implemented"] { background: #e3f1e5; color: #24612a; }
.parity-badge[data-status="simplified"] { background: #fdf3e0; color: #7a5512; }
.parity-badge[data-status="missing"] { background: #f8e6e3; color: #8a2b21; }

.parity-table tr[hidden] { display: none; }
.parity-group[hidden] { display: none; }

/* 表很高：让对话框主体自己滚，底部「关闭」常驻 */
#menu-parity-dialog .dialog-body { max-height: 64vh; max-height: 64dvh; }

@media (max-width: 720px) {
  .parity-grid { grid-template-columns: 1fr; }
  /* 极窄屏只留「菜单项 + 状态」，说明列隐藏（表头同步） */
  .parity-table th:last-child,
  .parity-table td.parity-note { display: none; }
  .parity-summary .parity-coverage { margin-left: 0; }
}

/* ========================================================================
   22. 场景条 / 幻灯片（§scene-strip，V7 §3，ui/scene_strip.js）
   —— 挂点在 #workspace 与 #statusbar 之间，作为 #app 网格的自动行；
      空挂点不占高度，不改变 #viewport 的 flex/尺寸规则。
   ======================================================================== */
#scene-strip-host {
  min-width: 0;
  min-height: 0;
}

#scene-strip-host:empty { display: none; }

.scene-strip {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-top: 1px solid var(--chrome-edge);
  background: linear-gradient(180deg, #f7f7f3 0%, #ecece7 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 11px;
}

.scene-strip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 6px;
}

.scene-strip-main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.scene-strip-nav,
.scene-strip-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.scene-strip-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-right: 1px;
  color: var(--ink-muted);
  line-height: 1.05;
  white-space: nowrap;
}

.scene-strip-caption { font-size: 10px; letter-spacing: 0.08em; }
.scene-strip-count { color: var(--ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.scene-strip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  min-width: 26px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(#fbfbf8, #eeeeea);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  cursor: default;
}

.scene-strip-btn:hover:not(:disabled) {
  border-color: #9ec1dc;
  background: linear-gradient(#f7fbff, #e8f2fb);
}

.scene-strip-btn:active:not(:disabled) {
  background: #dcebf8;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.scene-strip-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.scene-strip-btn:disabled {
  opacity: 0.6;
  background: #f0f0eb;
  color: var(--ink-faint);
}

.scene-strip-step { min-width: 24px; padding: 0 5px; font-size: 15px; }
.scene-strip-btn-accent { border-color: #9ec1dc; background: linear-gradient(#f8fcff, #e7f2fb); color: #174f79; }
.scene-strip-visibility { flex: 0 0 auto; }

.scene-strip-track {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 4px;
  min-width: 84px;
  min-height: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px;
  scrollbar-width: thin;
  scrollbar-color: #b8b8af transparent;
}

.scene-strip-track::-webkit-scrollbar { height: 5px; }
.scene-strip-track::-webkit-scrollbar-thumb { border-radius: 3px; background: #b8b8af; }
.scene-strip-track::-webkit-scrollbar-track { background: transparent; }

.scene-strip-tab {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  max-width: 196px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fbfbf8;
}

.scene-strip-tab:hover { border-color: #b7cfe2; background: #f7fbff; }

.scene-strip-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.scene-strip-select {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

.scene-strip-select:focus-visible { outline: 2px solid rgba(27, 111, 184, 0.55); outline-offset: -2px; }
.scene-strip-select:disabled { opacity: 0.55; }
.scene-strip-tab.is-active .scene-strip-select { font-weight: 600; }

.scene-strip-thumb {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 32px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 2px;
  background: #eef3f7;
  color: var(--ink-faint);
}

.scene-strip-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-strip-thumb-ph { font-size: 9px; letter-spacing: 0.03em; }

.scene-strip-tabtext { display: flex; align-items: center; gap: 4px; min-width: 0; }

.scene-strip-no {
  display: inline-grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-faint);
  font-size: 8.5px;
  line-height: 1;
}

.scene-strip-tab.is-active .scene-strip-no { border-color: var(--accent); color: var(--accent-strong); }

.scene-strip-name {
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-strip-more {
  flex: 0 0 auto;
  width: 20px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: default;
}

.scene-strip-more:hover:not(:disabled) { background: #e9f2fa; color: var(--ink); }
.scene-strip-more:focus-visible { outline: 2px solid rgba(27, 111, 184, 0.55); outline-offset: -2px; }
.scene-strip-more:disabled { opacity: 0.55; }
.scene-strip-tab.is-active .scene-strip-more { border-left-color: rgba(27, 111, 184, 0.22); color: var(--accent-strong); }

.scene-strip-empty {
  margin: 0;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-strip-collapsed-label {
  display: none;
  color: var(--ink-muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.scene-strip[data-visible="false"] .scene-strip-main,
.scene-strip[data-visible="false"] .scene-strip-notices,
.scene-strip[data-visible="false"] .scene-strip-menu,
.scene-strip[data-visible="false"] .scene-strip-rename { display: none; }

.scene-strip[data-visible="false"] .scene-strip-collapsed-label { display: inline; margin-left: auto; }
.scene-strip[data-visible="false"] .scene-strip-row { justify-content: flex-end; padding: 3px 6px; }

.scene-strip-notices {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 12px;
  min-height: 0;
  padding: 0 6px 4px;
}

.scene-strip-note {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.scene-strip-note[data-tone="error"] { color: var(--danger); }

.scene-strip-menu,
.scene-strip-rename {
  position: absolute;
  right: 6px;
  bottom: calc(100% + 5px);
  z-index: 21;
  max-width: calc(100vw - 16px);
  border: 1px solid var(--chrome-edge-strong);
  border-radius: 3px;
  background: #fbfbf8;
  box-shadow: var(--shadow-2);
}

.scene-strip-menu {
  min-width: 220px;
  padding: 4px;
}

.scene-strip-menu-title {
  margin: 0;
  padding: 5px 8px 6px;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
  color: var(--ink-muted);
  font-size: 10.5px;
}

.scene-strip-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  padding: 5px 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: default;
}

.scene-strip-menu-item:hover:not(:disabled),
.scene-strip-menu-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.scene-strip-menu-item:disabled { color: var(--ink-faint); }
.scene-strip-menu-danger { color: var(--danger); }
.scene-strip-menu-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.scene-strip-menu-close {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 2px 2px;
  color: var(--ink-muted);
}

.scene-strip-rename {
  z-index: 22;
  width: min(330px, calc(100vw - 16px));
  padding: 9px 10px;
}

.scene-strip-rename-title {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 11.5px;
  font-weight: 600;
}

.scene-strip-rename-label {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-muted);
  font-size: 10.5px;
}

.scene-strip-rename-input {
  width: 100%;
  height: 26px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  user-select: text;
}

.scene-strip-rename-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

.scene-strip-rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 7px;
}

.scene-strip-rename-error {
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 10.5px;
}

@media (max-width: 900px) {
  .scene-strip-name { max-width: 78px; }
  .scene-strip-thumb { width: 38px; height: 28px; }
  .scene-strip-meta { display: none; }
  .scene-strip-track { min-width: 72px; }
}

@media (max-width: 720px) {
  .scene-strip-row { gap: 4px; padding: 4px 5px; }
  .scene-strip-main { gap: 4px; }
  .scene-strip-nav,
  .scene-strip-actions { gap: 3px; }
  .scene-strip-btn { height: 26px; padding: 0 6px; }
  .scene-strip-track { gap: 3px; padding: 0; }
  .scene-strip-empty { padding: 6px 8px; white-space: normal; }
  .scene-strip-notices { gap: 1px 8px; padding: 0 5px 3px; }
  .scene-strip-menu,
  .scene-strip-rename { right: 4px; bottom: calc(100% + 4px); }
}

@media (max-width: 480px) {
  .scene-strip-btn { padding: 0 5px; }
  .scene-strip-btn-label { display: none; }
  .scene-strip-more { width: 18px; }
  .scene-strip-thumb { width: 32px; height: 24px; }
  .scene-strip-name { max-width: 70px; }
  .scene-strip-tab { max-width: 150px; }
  .scene-strip-track { min-width: 64px; }
  .scene-strip-collapsed-label { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
}
