/* ============================================================================
   共想章-绘 · 板框与图层 —— 样式
   桌面：画布居中 + 右侧侧边工具栏
   移动（≤ 820px）：工具栏折叠成底部弹出 sheet，画布占满
   零依赖，只用 CSS 变量 + 媒体查询。
   ========================================================================== */

:root {
  --bg: #0a1512;
  --bg-2: #0f211c;
  --panel: #12261f;
  --panel-2: #17322a;
  --line: #23443a;
  --text: #e6f2ec;
  --muted: #8faea2;
  --accent: #2fbf88;
  --accent-dim: #1d7a58;
  --topbar-h: 52px;
  --panel-w: 348px;
  --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  /**
   * 【防止橡皮筋回弹 / 下拉刷新】触屏上手指往下一拉，iOS/Android 会把整页拽下来再弹回去 ——
   * 在画布上画到一半时这一下最要命：页面动了、笔迹没动（或者反过来）。
   * 画布本身另外有 touch-action:none（见 .stage-canvas），这里管的是整页边界那一下。
   * 注意别写 overflow:hidden —— 那会把页面里本来就该滚的地方（右栏、广场列表）一起锁死。
   */
  overscroll-behavior: none;
}

/**
 * 【浏览器的"拖拽 / 选择"默认行为，整页收掉】2026-10-11 用户报"点多了会拖动网页的图标与字体"。
 * 真机取证（`_scratch/drag-probe.mjs`）三条入口，全是浏览器的默认值、不是我们的功能：
 *   ① `<img>` 默认 `draggable=true` —— 按住品牌 logo / 图层缩略图就能把图拖走（拖到桌面还会存成文件）；
 *   ② 文字没关选择 —— 双击选词、三击选段，攒出选区之后在文字上一拖就"拖着字走"（拖影里带着内联图标）；
 *   ③ 整行 `draggable` 的图层行/素材行位移一过阈值就启动排序（这条是功能，见 app.js 的拖拽排序）。
 * 所以整页关掉：**要拖的东西必须由 JS 明确声明**（行级 draggable），不许浏览器自己接手。
 * 【例外要放开】输入框 / 文本域 / 可编辑区得能选字、选中、复制；临时要选字的地方挂 `.selectable`。
 * 【为什么连 img 也管】装饰性图标（logo、缩略图、封面）没有一个是"拿来拖的"：
 * 素材行/示例元素行那种"拖到画布上"拖的是**整行**（payload 由 dragstart 里写 dataTransfer 决定）。
 */
body { user-select: none; -webkit-user-select: none; }
input, textarea, [contenteditable], .selectable { user-select: text; -webkit-user-select: text; }
img { -webkit-user-drag: none; }

#app { display: flex; flex-direction: column; height: 100%; }

/* ------------------------------------------------------------------ 顶栏 */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }

/**
 * 站点公告条（后台「设置」里写的）：一条发丝线分隔的窄条，不是浮起来的卡片、不用色块。
 * 提醒级只把图标和左边那条竖线染成警告色 —— 一眼能分清"通知"和"出事了"。
 */
.notice {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  font-size: 12px; line-height: 1.5;
  color: var(--text);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  /**
   * 【2026-10-11 去掉那条 2px 的强调色竖条】单边粗色条是 AI 生成界面最典型的"廉价强调"
   * （anti-ai-ui-slop 清单点名的 lazy accent）：它把一条边染成品牌色，既不像边框也不像分隔。
   * 语义改由**图标颜色**承担（`.notice .ico` 是强调色、`.notice.warn .ico` 是警告色）——
   * 颜色不再靠"糊一条边"，结构仍然只有发丝线。
   */
  border-left: 0;
  flex: none;
}
.notice[hidden] { display: none; }
.notice.warn { border-left-color: var(--warn); }
.notice.warn .ico { color: var(--warn); }
.notice .ico { color: var(--accent); flex: none; }
.notice #noticeText { flex: 1 1 auto; min-width: 0; }
.notice button {
  flex: none; padding: 2px; border: 0; background: transparent; color: var(--muted);
}
.notice button:hover { color: var(--text); }

.brand { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.spacer { flex: 1 1 auto; }

.grp { display: flex; gap: 4px; }
.seg { display: flex; background: var(--panel); border-radius: var(--radius); padding: 2px; }

/* ------------------------------------------------------------------ 按钮 */

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
button:hover { background: #1e4034; }
button:active { transform: translateY(1px); }
button.on, button.active { background: var(--accent-dim); border-color: var(--accent); color: #eafff6; }
button.wide { width: 100%; }
button:disabled { opacity: .42; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ------------------------------------------------------- 左侧素材工作区 */

.assets {
  flex: none;
  width: 218px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.assets-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 10px 10px 4px;
}
.assets-head h2 { margin: 0; font-size: 13px; letter-spacing: .4px; font-weight: 600; }
.assets-fold { display: none; padding: 4px 9px; font-size: 12px; }

/* 页签：素材 / 成品 共用左栏这一块地方 */
.side-tabs { display: flex; gap: 4px; }
.side-tabs button {
  padding: 3px 11px;
  font-size: 12.5px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
}
.side-tabs button:hover { color: var(--text); }
.side-tabs button.on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #eafff6;
}

.assets-body {
  overflow-y: auto;
  padding: 6px 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.assets-body[hidden] { display: none; }
.assets-toggle { display: none; }

.asset-list { display: flex; flex-direction: column; gap: 6px; }
.asset-list:empty { display: none; }

/* ---------------------------------------------------------- 成品库（示例稿） */

.example-list { display: flex; flex-direction: column; gap: 10px; }
.example-list:empty { display: none; }

.example-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sunken);
  overflow: hidden;
}
/* 正在大图里展开的那一份，左侧索引上给个标记 */
.example-block.on { border-color: var(--accent); }
.example-head { padding: 6px 6px 2px; }
/* 缩略图按卡片比例（85.5:54）预留，图还没画出来时不会跳版 */
.example-thumb {
  display: block; width: 100%; height: auto;
  border-radius: 5px;
  aspect-ratio: 85.5 / 54;
  background: var(--checker) 50% / 10px 10px;
}
.example-meta { padding: 5px 2px 3px; }
.example-meta b { display: block; font-size: 12.5px; font-weight: 600; }
.example-meta span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.45; }

/* 成品缩略图只是"索引"：点它把成品整幅展开到中间大区域（真正的抠图在大图上做） */
.pack-canvas { cursor: pointer; }
.pack-canvas.on { box-shadow: 0 0 0 2px var(--accent); }

/* 从成品图上拖元素时跟着鼠标的幽灵框：尺寸按成品比例算，所见即所得 */
.drag-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  border: 1.5px dashed var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  transform: translate(-50%, -50%);
}

/* 成品里的元素：和素材行一样，**直接拖到画布** */
.example-elems { display: flex; flex-direction: column; gap: 3px; padding: 3px 6px 7px; }
.pack-elem {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: grab;
}
.pack-elem:hover { background: #12271f; border-color: var(--line); }
.pack-elem:active { cursor: grabbing; }
.pack-elem.dragging { opacity: .38; }
.pack-elem img {
  width: 26px; height: 26px; flex: none;
  border-radius: 4px;
  object-fit: contain;
  pointer-events: none;
  background: var(--checker) 50% / 8px 8px;
}
.pack-elem .pe-name {
  flex: 1 1 auto; min-width: 0;
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pack-elem .pe-size { flex: none; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.asset-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sunken);
  cursor: grab;
}
.asset-item:active { cursor: grabbing; }
.asset-item.dragging { opacity: .38; }

/* 缩略图用棋盘格垫底，透明素材才看得出边界 */
.asset-thumb {
  width: 46px; height: 46px; flex: none;
  border-radius: 5px;
  object-fit: contain;
  background: var(--checker) 50% / 12px 12px;
  pointer-events: none;
}
.asset-name {
  flex: 1 1 auto; min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 4px;
  font: inherit; font-size: 12px;
  color: var(--text);
}
.asset-name:hover { border-color: var(--line); }
.asset-name:focus { border-color: var(--accent); background: var(--sunken); }
.asset-del {
  flex: none;
  padding: 1px 6px;
  background: none; border: none;
  color: var(--muted); font-size: 15px; line-height: 1.15;
}
.asset-del:hover { background: #4a1f1f; color: #ffb3b3; border-radius: 5px; }

/* 鼠标悬浮缩略图看大图 */
.asset-peek {
  position: fixed; z-index: 80;
  pointer-events: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--sunken);
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.asset-peek[hidden] { display: none; }
.asset-peek img {
  display: block;
  max-width: 240px; max-height: 240px;
  background: var(--checker) 50% / 12px 12px;
}

/* ------------------------------------------------------------------ 抠图 */

.cut-stage {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
}
.cut-stage canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.cut-row { display: flex; gap: 10px; align-items: center; }

/* ------------------------------------------------------------------ 主体 */

main { display: flex; flex: 1 1 auto; min-height: 0; }

/**
 * 左侧工具栏（一竖排工具，点一下换工具）—— 位置和绘画软件的肌肉记忆一致。
 *
 * 【为什么图标下面还带小字】这个项目的用户明确反馈过"只有图标找不到东西"
 * （当年隐藏功能用复选框就被否了）。绘画软件靠长期习惯认图标，我们靠一句话认识它。
 * 【为什么不给渐变/投影/大圆角】沿用全站那套克制的工程风：发丝线 + 语义 token，
 * 亮暗两套主题共用同一份规则（只换 token，不另写一套）。
 */
/**
 * ============================================================================
 *  左侧工具轨（2026-10-11 重设计：精密仪表台）
 * ============================================================================
 *  【为什么这么改】旧版是"62px 宽 + 每颗带中文标签 + 选中＝强调色填底 + 强调色描边"，
 *  三个都是 AI 生成界面最典型的指纹（anti-ai-ui-slop 清单点名的"圆角块 + 彩色边框"、
 *  "到处同一个圆角"、"图标不分轻重"）。工程软件（EDA/CAD）的做法反过来：
 *    · 宽度只留图标，栏宽 62 → 48；
 *    · **命中区不缩、视觉缩**：按钮本体仍 44×44（项目硬标准，diag-rail 断言 ≥44×44），
 *      看得见的那块只有 30×30 —— 靠 ::before 画，不把按钮改小；
 *    · 选中态不再"填底 + 描边"，改成左侧 2px 指示条（切换时它 transform 滑过去）+ 一层淡底；
 *    · 图标 19 → 18px，线宽由图标系统统一到 1.5（更细 = 更"仪器"）；
 *    · 分组靠发丝线，不靠留白堆。
 *  【标签去哪了】`<span>` 一直在 DOM 里（读屏、title、diag-rail 第 94 行那条断言全靠它），
 *  只是视觉上收成"贴在右边的胶囊"，只在**当前工具**与**悬停**时出现 —— 栏宽省下来给画布。
 *  【颜色为什么不写死】全部走 token（--panel/--line/--accent/--surface-hover…）：
 *  亮/暗两套主题只覆盖 token，这里一行都不用改（项目规矩：组件只引用 token）。
 */
.tool-rail {
  flex: none;
  width: 48px;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 6px 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  position: relative;
  /* 标签胶囊要能伸出栏外：这里不能是 auto（一个方向 auto 会把另一个也变成 auto 而裁掉它） */
  overflow: visible;
}
/** 指示条：整个轨共用一条，切换工具时滑过去（transform 动画，不动 layout）。 */
.tool-rail .rail-ind {
  position: absolute; left: 0; top: 0;
  width: 2px; height: 16px; border-radius: 0 1px 1px 0;
  background: var(--accent);
  transform: translateY(20px);
  transition: transform 240ms cubic-bezier(.2, .8, .2, 1);
}
.tool-rail .rail-btn {
  position: relative; flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted);
  cursor: pointer; font: inherit;
  transition: color var(--t);
}
/* 视觉只有 30×30：悬停/选中时亮的是这一块，命中区仍是 44×44 */
.tool-rail .rail-btn::before {
  content: ""; position: absolute; width: 30px; height: 30px;
  border-radius: var(--radius-sm); background: transparent;
  transition: background var(--t);
}
.tool-rail .rail-btn .ico { width: 18px; height: 18px; flex: none; position: relative; z-index: 1; }
.tool-rail .rail-btn:hover { color: var(--text); }
.tool-rail .rail-btn:hover::before { background: var(--surface-hover); }
/* 当前拿在手上的那个工具：**只留左侧那条指示条**（在 .rail-ind 上，由 JS 摆位）。
   【C：为什么把强调色淡底去掉】实测轨里同时存在两块绿（淡底 3% + 指示条 2%）——
   同一个"选中"给了两个强调信号，就不再是强调。现在底色用中性的一档，
   强调只由那条指示条承担（颜色只在**一个**地方说话）。 */
.tool-rail .rail-btn.on { color: var(--text); }
/* 【2026-10-12 撤回 C】强调色淡底回来了：A+B+C 那一版整条撤掉
   （用户反馈：底部两枚圆钮那种形态贴参照物太近，看着像抄的）。
   注意上面那段 "C" 的注释是那一版留下的说明，现状以这三行为准。 */
.tool-rail .rail-btn.on::before { background: var(--accent-soft); }
.tool-rail .rail-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 标签胶囊：只在"当前工具"与"悬停"时出现（DOM 里永远在） */
.tool-rail .rail-btn > span {
  position: absolute; left: calc(100% + 5px);
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--panel-3); border: 1px solid var(--line-2); color: var(--text);
  font-size: 11.5px; letter-spacing: .3px; white-space: nowrap;
  opacity: 0; transform: translateX(-3px); pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 40;
}
.tool-rail .rail-btn:hover > span,
.tool-rail .rail-btn.on > span { opacity: 1; transform: none; }
/* 胶囊里的快捷键小牌（JS 不填就只是一个空 span，不占位） */
.tool-rail .rail-btn > span kbd {
  font: 10.5px/1.3 "Cascadia Mono", Consolas, monospace;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 3px;
}
.tool-rail .rail-sep { width: 16px; height: 1px; margin: 6px 0; background: var(--line); flex: none; }

/* 【为什么用 padding + inset:0 的 canvas】canvas 的尺寸由这个容器撑开，
   和"当前显示哪个视图"无关 —— 隐藏再显示之后不会变成 0 尺寸。
   成品稿视图还需要四周留白，正好也用这个 padding。 */
.stage-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  background: radial-gradient(circle at 50% 40%, #14302a 0%, #0a1512 70%);
}
.stage-wrap[hidden] { display: none; }
.stage-canvas {
  display: block;
  position: absolute;
  inset: 18px;
  border-radius: 8px;
  touch-action: none;
}
/**
 * 【手指真正落的那一层】fabric 把内容画在 .stage-canvas 上，但**接收指针事件的是它上面盖着的
 * 那张 upperCanvasEl**，两张都是 fabric 那个 `.canvas-container` 的子节点。
 * touch-action 必须写在"手指落上去的那个元素"上才作数 —— 只写 .stage-canvas 是防不住的
 * （和触屏监听挂错节点是同一个坑，见 src/ui/stage.js 里那一段）。
 * 【为什么 !important 都不需要】fabric 自己在 CSS 里也写了 `touch-action:none`，
 * 这里再钉一条是**显式**表达依赖：哪天升级 fabric、它不写这条了，这条还在。
 */
.canvas-container {
  touch-action: none;
}

/* 成品稿视图：整幅展开（大图才好"抠"元素）。
   canvas 的位置/大小由 JS 设（缩放 + 平移），所以这儿把 `.stage-canvas` 的 `inset:18px` 放开。 */
#packView { overflow: hidden; }
#packStage {
  inset: auto;
  background: var(--checker) 50% / 14px 14px;
  cursor: crosshair;
}
#packStage.panning { cursor: grabbing; }
#packStage.hit { cursor: grab; }
#packStage.grabbing { cursor: grabbing; }

/* 拖动元素时鼠标碰到「我的稿」页签 → 页签高亮（提示"松手前先经过这里"） */
.seg.pick-target { box-shadow: 0 0 0 2px var(--accent); }

/* 落点提示框：在"我的稿"上跟着鼠标，尺寸就是真正会放上去的尺寸 */
.drop-spot {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, -50%);
  border: 1.5px dashed var(--accent);
  border-radius: 4px;
  background: var(--accent-soft);
}
.drop-spot[hidden] { display: none; }

/* 自动草稿提示条：和站点公告同一套骨架（横条 + 图标 + 两个按钮），只是配色不同 */
.draftbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line-2);
  color: var(--text);
}
.draftbar[hidden] { display: none; }
.draftbar .spacer { flex: 1 1 auto; }
.draftbar .ico { width: 15px; height: 15px; color: var(--accent); flex: none; }
.draftbar button { font-size: 12px; padding: 3px 9px; }

/* 三步上手：三步卡片，每步一句话 + 一个直达按钮 */
.intro-steps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.intro-steps li {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
}
.intro-steps b { font-size: 13px; }
.intro-steps span { grid-column: 1; font-size: 12px; color: var(--muted); }
.intro-steps button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

/* 动态：顶栏铃铛上的小红点 + 面板里的时间线 */
#feedBtn { position: relative; }
.feed-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 15px; text-align: center; font-weight: 600;
}
.feed-dot[hidden] { display: none; }
.feed-list { display: flex; flex-direction: column; gap: 5px; max-height: min(56vh, 420px); overflow-y: auto; }
.feed-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); font-size: 12.5px; cursor: pointer;
}
.feed-row:hover { border-color: var(--accent); }
.feed-row b { color: var(--text-strong); }
.feed-when { margin-left: auto; color: var(--muted-2); font-size: 11.5px; }
.feed-quote {
  flex-basis: 100%; color: var(--muted); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 「套用整套排版」：成品稿视图里那颗按钮（贴着底部提示，靠上一点免得压住它） */
.pack-apply {
  position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%);
  z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; font-size: 12.5px;
}
.pack-apply[disabled] { opacity: .55; }
.pack-apply .ico { width: 15px; height: 15px; }
/* 正反切换不再在成品稿画面里单独长一套控件（用户要求：并到顶栏那一对键上，见 app.js 的 switchPackSideHook） */

/**
 * 成品稿左上角那条「板宽」：这份成品的卡片尺寸 + 「按这份的板宽导入」开关。
 * 【为什么要它】以前这里一个字都不写，搬回我的稿之后也看不出它本来多大 ——
 * 只能按"你当前的卡片"等比缩一遍，用户看到的板宽就跟作者不一样了。
 */
.pack-size {
  position: absolute; left: 14px; top: 12px; z-index: 4;
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 10px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-xs);
}
.pack-size[hidden] { display: none; }
.pack-size .ico { width: 14px; height: 14px; flex: none; color: var(--muted); }
.pack-size b { color: var(--text-strong); font-weight: 600; }
.pack-size .chk { margin: 0; font-size: 11.5px; color: var(--muted); }
.pack-size button { font-size: 11.5px; padding: 3px 8px; }

/* 批 2：「最近套用」一排胶囊（成品稿视图左上，紧贴板宽条下面；没记录就 hidden 不占地方） */
.pack-recent {
  position: absolute; left: 14px; top: 58px; z-index: 4;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  max-width: min(620px, 72%);
  padding: 4px 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-xs);
}
.pack-recent[hidden] { display: none; }
.pack-recent .recent-label { font-size: 11px; color: var(--muted); flex: none; }
.pack-recent .recent-chip {
  font-size: 11.5px; padding: 4px 10px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-color: var(--line);
}
.pack-recent .recent-clear { font-size: 11px; padding: 4px 9px; color: var(--muted); }
@media (max-width: 820px) {
  .pack-recent .recent-chip,
  .pack-recent .recent-clear { min-height: 44px; }
}

/* 快捷键表：两列（键 / 说明），键用 kbd 样式 */
.keys-grid {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 7px 14px; align-items: baseline;
  margin-bottom: 10px;
}
.keys-grid kbd {
  font: inherit; font-size: 11.5px;
  padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line-2); background: var(--panel);
  color: var(--text-strong); white-space: nowrap;
}
.keys-grid span { font-size: 12.5px; color: var(--muted); }

/* 导出清单 */
.export-list {
  list-style: none; margin: 0 0 8px; padding: 0;
  max-height: min(42vh, 300px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.export-list li {
  font-size: 12px; color: var(--muted);
  padding: 3px 7px; border-radius: 4px; background: var(--panel);
}
.export-ask { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* ---------------------------------------------------------------- 交给店主 */
/* 顶栏那颗按钮要**看得出来是主行动**（付款在别处，站内唯一要客户做的事就是传文件）。 */
.primary-toggle { border-color: var(--accent); color: var(--accent-hi); }
.primary-toggle:hover { background: var(--accent-soft); }

/* ---------------------------------------------------------------- 做谷模式 */
/**
 * 【做谷模式：默认关 = 普通绘画网页】2026-10-11 用户定案：把"出板/做周边"那一整套入口
 * 收在一个开关后面（板框、挖孔、沉金、颜色提取、正反面、交给店主），关着的时候这个站就是
 * 一个正常的绘画网页。
 *
 * 【为什么用"标记属性 + 一条 CSS"而不是删 DOM】功能一行没动：`[data-goods-only]` 只控制显隐，
 * 代码里的绑定、诊断脚本的选择器、撤销栈、doc 结构全都不变 —— 想退回去只要把这条规则删掉。
 * 【为什么必须 display:none】`visibility:hidden` 还会占位、还会被 Tab 聚焦到；
 * 隐藏的面板项也不该再吃指针事件。
 * 【唯一的例外按类收】图层行里那颗"沉金"小按钮与 ⋯ 菜单里的沉金项是**运行时生成**的，
 * 挂不了标记属性 —— 行内那颗在这里按类收，菜单项在 app.js 里按模式决定要不要生出来。
 */
body:not(.mode-goods) [data-goods-only] { display: none !important; }
body:not(.mode-goods) .layer-item .gold-btn { display: none !important; }
/* 顶栏那颗开关自己：关着是安静的一颗，开着才亮起来（它是"我现在在做谷子"的唯一指示） */
.goods-toggle { border-color: var(--line); color: var(--muted); }
.goods-toggle:hover { color: var(--text); }
.goods-toggle.on { border-color: var(--accent); color: var(--accent-hi); background: var(--accent-soft); }
.send-pick { gap: 8px; }
.send-pick button { display: inline-flex; align-items: center; gap: 6px; }
/* 文件清单：和「导出前确认」那张列表同一个调子，长了能滚 */
.send-list {
  list-style: none; margin: 8px 0 4px; padding: 0;
  max-height: min(30vh, 200px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.send-list li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 3px 7px; border-radius: 4px; background: var(--panel);
}
.send-list li b { color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-list li em { font-style: normal; color: var(--muted-2); margin-left: auto; white-space: nowrap; }
.send-list li button { padding: 1px 7px; font-size: 11px; }
#sendHint { min-height: 36px; }

/**
 * 拖动成品元素时的左侧投放区（`#packDrop`）。
 * 【为什么整条左侧浮在上面】左栏（素材/成品）在拖动时不是"要看的东西"，而"拖到哪儿算数"
 * 必须一眼看得出来 —— 半透明压住左栏 + 虚线描边 + 一句话，比自己猜"能不能放这儿"清楚得多。
 * 【为什么 pointer-events:none】判定用的是坐标（拖动中鼠标在 window 上跟），
 * 让它吃到指针事件反而是多余的；顺便也不会挡住拖动结束后左栏的点击。
 * 工程风照旧：半透明底 + 发丝虚线 + 一个强调色，不做发光/渐变。
 */
.pack-drop {
  position: fixed;
  left: 0;
  top: var(--topbar-h);
  bottom: 0;
  /* 和左栏同宽（220px）：拖动中左栏整个藏起来（见下面的规则），
     投放区正好铺满那一块 —— 不然会露出半截被切断的左栏文字，看着像渲染坏了 */
  width: 220px;
  z-index: 60;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 12px;
  /* 不透明：半透明时左栏的文字会透上来，和投放区自己的文案叠在一起，看着像乱码 */
  background: var(--bg);
  border-right: 1px dashed var(--line-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.pack-drop[hidden] { display: none; }
.pack-drop b { font-size: 14px; color: var(--text-strong); }
.pack-drop > span:first-of-type { color: var(--muted-2); font-size: 11.5px; }
.pack-drop .ico { width: 22px; height: 22px; color: var(--muted-2); }
.pack-drop.over {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
  border-right-color: var(--accent);
  border-right-style: solid;
  color: var(--text);
}
.pack-drop.over b, .pack-drop.over .ico { color: var(--accent); }
.pack-drop em { font-style: normal; color: var(--muted-2); font-size: 11px; }
/* 拖动中把左栏藏起来（visibility 保留占位，不会引起布局跳动）—— 投放区正好盖在那一块上 */
#app[data-pack-drag] .assets { visibility: hidden; }
@media (max-width: 720px) {
  .pack-drop { width: min(56vw, 220px); font-size: 11.5px; }
}

/* 旋转角度气泡：跟在元素正上方。
   用 position:fixed + 视口坐标，不走 .stage-wrap 那套 padding/inset ——
   挂在里面就得把 18px 的内缩算进去，多一处会算错的地方。 */
.angle-tip {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  transform: translate(-50%, -100%);
  padding: 3px 9px;
  margin-top: -10px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.angle-tip[hidden] { display: none; }
.pack-tip {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  margin: 0;
  max-width: min(92%, 620px);
  background: rgba(6, 20, 16, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 13px;
  text-align: center;
}

.stage-badge {
  position: absolute; left: 12px; top: 12px;
  background: rgba(6, 20, 16, .78);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  letter-spacing: .5px;
  pointer-events: none;
}
.hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: rgba(6, 20, 16, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  max-width: min(90%, 540px);
  text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.hint.show { opacity: 1; }
.hint.warn { border-color: #b9861f; color: #ffd98a; }

/* ------------------------------------------------------------------ 新手情境提示（P0-3）
   导入第一张图 / Shift 多选 / 拖动吸附时各出现一次（“只出现一次”由 app.js 的 dango.tips.v1 记）。
   【为什么不挡画布】它贴的是画布**左下角**，而且整块 pointer-events:none、只有按钮可点 ——
   就算正好压在卡片上，画布上的拖动/点选也不会被它吃掉。底部居中那条留给 hint()（一次性气泡）。
   【为什么 ≤820px 直接关掉】触屏没有 Shift 多选、左下角也容易被手掌盖住；窄屏布局不变。 */
.onboard-tip {
  position: absolute; left: 16px; bottom: 16px; z-index: 67;
  display: flex; align-items: flex-start; gap: 8px;
  width: min(320px, calc(100% - 32px));
  padding: 10px 11px;
  background: var(--panel-2);       /* 跟着主题走：亮色下白底深字，暗色下深底浅字（对比度 ≥4.5） */
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .38);
  pointer-events: none;
  animation: ob-tip-in .16s ease;
}
@keyframes ob-tip-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.onboard-tip[hidden] { display: none; }
.onboard-tip .ob-ico { color: var(--accent); margin-top: 1px; flex: none; }
.onboard-tip .ob-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.onboard-tip .ob-text { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text); }
.onboard-tip .ob-row { display: flex; align-items: center; gap: 6px; }
.onboard-tip button { pointer-events: auto; font-size: 11.5px; padding: 4px 9px; }
/* 【必须显式写】全局按钮有 `display:inline-flex`（作者样式），会把 UA 的 [hidden]{display:none} 压掉 ——
   这是本项目注释里踩过三次的同一个坑（.row / #paintBrushCard 那几处）。不写这条，
   没有动作按钮的提示里会留下一个空的小圆角块（实测截图里就有）。 */
.onboard-tip button[hidden] { display: none; }
.onboard-tip .ob-act { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }
.onboard-tip .ob-no { border-color: transparent; background: transparent; color: var(--muted); }
.onboard-tip .ob-no:hover { color: var(--text); background: var(--surface-hi); }
@media (max-width: 820px) { .onboard-tip { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .onboard-tip { animation: none; } }

/* -------------------------------------------------------------- 新手 3 步清单（2026-10-18）
   左栏一份（#onboardCard）+ 帮助弹窗里一份（#onboardHelp），同一套样式与状态。
   【为什么放左栏】它不浮在画布上、不挡操作；三项完成/手动关掉就消失。
   【勾是怎么来的】全部由真实动作触发（导入成功 / 抠出素材 / 导出或发布成功），
   行本身**不是按钮**，点它不会打勾 —— 避免"点一下就算学会"的假进度。 */
.onboard-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.onboard-card[hidden] { display: none; }
.obc-head { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.obc-head b { font-size: 12.5px; font-weight: 600; }
.obc-count { margin-left: auto; color: var(--muted); font-size: 11px; letter-spacing: .3px; }
.obc-close {
  width: 22px; height: 22px; padding: 0;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.obc-close:hover { color: var(--text); background: var(--surface-hi); }
.obc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.obc-list li {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; line-height: 1.5; color: var(--muted-2);
}
.obc-tick {
  width: 16px; height: 16px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  font-size: 10px; line-height: 1; color: transparent;
}
.obc-list li.done { color: var(--text); }
.obc-list li.done .obc-tick {
  background: var(--accent-dim); border-color: var(--accent); color: #eafff6;
}
.obc-list li.done .obc-tick::before { content: '✓'; }
.obc-done { margin: 1px 0 0; font-size: 12px; color: var(--accent); font-weight: 600; }
.obc-done[hidden] { display: none; }
.onboard-help {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
}
.onboard-help .obc-list { margin: 6px 0 2px; }
.onboard-help .obc-list li { font-size: 13px; }
.onboard-help .row { margin-top: 8px; }

/* ------------------------------------------------------------------ 对齐条（P0-2a）
   选中 ≥2 个同层素材/图片才出现，其余时候 hidden（连高度都不占 —— 用户要的就是空出画布）。
   浮在画布顶上居中：absolute 定位在 .stage-wrap 里，不参与布局，也不吃画布尺寸。
   命中区 44×44：图标按钮在触屏/高分屏上都要点得中（同项目的其它工具按钮也按这条来）。 */
.align-bar {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  z-index: 66;                      /* 高于画布、低于弹窗/提示条（.hint 用 absolute 无 z，靠后绘制） */
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(6, 20, 16, .92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .38);
}
.align-bar[hidden] { display: none; }
.align-bar button {
  width: 44px;
  height: 44px;                     /* 命中区 ≥44px（验收要求） */
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.align-bar button:hover { background: rgba(255, 255, 255, .07); border-color: var(--line); }
.align-bar button:active { transform: translateY(1px); }
.align-bar button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.align-bar .ico { width: 19px; height: 19px; }
.align-sep { width: 1px; height: 22px; margin: 0 3px; background: var(--line); flex: none; }
.align-count {
  padding: 0 8px 0 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* ≤820px 一律不出现（没有 Shift 多选的触屏形态；工具条上的图标也没有 44px 的余量） */
@media (max-width: 820px) {
  .align-bar { display: none !important; }
}

/* -------------------------------------------------------- mm 标尺 + 屏幕参考线（批 2）
   标尺占的是画布外沿那圈 18px 留白（.stage-wrap 的 padding），**不动画布尺寸**。
   参考线是 DOM 覆盖层（.guide-layer），只活在屏幕上：不进 doc、不进导出、不产生撤销点。
   颜色沿用辅助线那族的琥珀色（GUIDE_COLOR），和吸附的绿线分开：
   绿 = 这一下要贴上去的线；琥珀 = 用户自己拉出来、一直摆在那里的参考线。 */
.ruler-top,
.ruler-left {
  position: absolute;
  z-index: 63;                       /* 高于画布、低于对齐条(66)与提示 */
  background: var(--panel);
  touch-action: none;
}
/* 【canvas 是替换元素】只写 left+right 不会把它拉宽（width:auto 取的是画布固有宽度，
   实测会缩成 34px）；宽高必须显式给 calc()，画布的背店尺寸再由 JS 按 clientWidth 设。 */
.ruler-top {
  left: 18px; top: 0;
  width: calc(100% - 36px); height: 18px;
  border-bottom: 1px solid var(--line);
  cursor: row-resize;
}
.ruler-left {
  left: 0; top: 18px;
  width: 18px; height: calc(100% - 36px);
  border-right: 1px solid var(--line);
  cursor: col-resize;
}
.ruler-corner {
  position: absolute; left: 0; top: 0; width: 18px; height: 18px;
  z-index: 63;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
/* 正反面徽标原来正好落在标尺那一圈里 → 往画布里让 6px（只在"我的稿"视图） */
#mineView .stage-badge { left: 24px; top: 24px; }
.guide-layer {
  position: absolute;
  left: 18px; right: 18px; top: 18px; bottom: 18px;
  z-index: 64;
  pointer-events: none;              /* 只有线本身能抓，空白处照常操作画布 */
}
.guide-layer .gv,
.guide-layer .gh {
  position: absolute;
  pointer-events: auto;
}
.guide-layer .gv { top: 0; bottom: 0; width: 13px; margin-left: -6px; cursor: col-resize; }
.guide-layer .gh { left: 0; right: 0; height: 13px; margin-top: -6px; cursor: row-resize; }
.guide-layer .gv::after,
.guide-layer .gh::after {
  content: '';
  position: absolute;
  background: rgba(255, 214, 102, .78);
}
.guide-layer .gv::after { left: 6px; top: 0; bottom: 0; width: 1px; }
.guide-layer .gh::after { top: 6px; left: 0; right: 0; height: 1px; }
.guide-layer .gv.on::after,
.guide-layer .gh.on::after { background: rgba(255, 226, 140, 1); box-shadow: 0 0 0 1px rgba(255, 214, 102, .35); }
/* 拖动中的 mm 读数气泡（fixed，跟指针走；和旋转角气泡同一套做法） */
.guide-tip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  transform: translate(-50%, -140%);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-3, var(--panel));
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.guide-tip[hidden] { display: none; }
/* 「N 条参考线 · 清空」浮条：有参考线才出现（用完即隐），按钮命中区 44px */
.guide-chip {
  position: absolute;
  right: 22px; top: 22px;
  z-index: 64;
  display: flex; align-items: center; gap: 6px;
  padding: 2px 4px 2px 10px;
  border-radius: 999px;
  background: rgba(6, 20, 16, .9);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.guide-chip[hidden] { display: none; }
.guide-chip button {
  min-width: 44px; min-height: 44px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 999px;
}
/* ≤820px：标尺/参考线整组不出现（触屏上拉标尺会和画布手势打架；也不给旧布局添乱） */
@media (max-width: 820px) {
  .ruler-top, .ruler-left, .ruler-corner, .guide-layer, .guide-chip { display: none !important; }
}

/* ------------------------------------------------------------------ 面板 */

.panel {
  flex: none;
  width: var(--panel-w);
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  /**
   * 【为什么要 position + z-index】画布（fabric 的 canvas）是**绝对定位**的，而面板原来是 static ——
   * 同层叠上下文里定位元素永远盖在 static 元素之上，所以画布一旦越界（哪怕只多 1px），
   * 就会盖住面板左边那一条：看起来"板子穿模控制板"，而且那一条点不到面板。
   * 给面板一个层叠层级，画布无论如何都在它下面。
   * 【为什么写在这儿（第一处 .panel）而不是下面那条 UI v2 规则里】手机端后面有
   * `position: fixed`（底部抽屉），同权重看源码顺序 —— 写在后面会把手机端覆盖掉。
   */
  position: relative;
  z-index: 1;
}
.panel-scroll { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.grip { display: none; }

/**
 * ============================================================================
 *  左右两栏"收起"（2026-10-11 用户要：素材栏向左收起、工作栏向右收起）
 * ============================================================================
 *  【默认一个字不变】开工时两栏都是开着的（body 上没有类），收起是**用户按出来的能力**，
 *  状态记在 localStorage —— 这守住了项目既定规矩「默认布局一个字都不许变」。
 *  【为什么用 display:none 而不是滑出去】滑出去（transform）会把布局宽度留在原地，
 *  画布一点没变宽 —— 那就白收了。收起的**目的**是"画布变大"，所以让它直接离开文档流。
 *  工程软件收面板就是这个手感（EDA/CAD 都是瞬间收，不做花哨动画）。
 *  【为什么全在 min-width:821px 里】手机端两栏各自有一套抽屉逻辑（素材是左侧抽屉、
 *  工作栏是底部 sheet），桌面这套绝不能掺进去。
 *  【怎么收回来的】收起后边缘留一条 14×44 的"拉手"（#assetsPeek / #panelPeek）——
 *  它只在收起时出现，命中的是"把面板拉回来"这一件事。
 */
.peek { display: none; }
@media (min-width: 821px) {
  body.fold-left .assets { display: none; }
  /**
   * 【收起右栏：为什么从"整棵 display:none"改成"零宽 + 只藏非浮窗内容"】
   * 浮窗（把段头拖到画布上那张卡）是用 `position:fixed` 拔出行流的，但 **DOM 上仍然待在 #panel 里**
   * （float-panel.js 的既定设计：卡片留在原地，不来回搬家）。
   * 父级一旦 `display:none`，**子级设什么都救不回来** —— 实测："拖出浮窗 → 收起右栏"
   * 浮窗会变成 0×0 一起消失（老写法 `body.fold-right .panel { display:none }` 就是这个毛病）。
   * 现在改成：面板占地归零（画布照样变宽，和原来的目的完全一致）+ 只隐藏**非浮窗**的段与那把把手，
   * 浮窗继续显示（2026-10-12 用户要："收起右栏时浮窗不该跟着消失"）。
   */
  body.fold-right .panel {
    width: 0; min-width: 0; flex-basis: 0;
    padding: 0; border: 0;
  }
  body.fold-right .panel > .panel-scroll > .card:not(.floating),
  body.fold-right .panel .grip { display: none; }
  body.fold-left #assetsPeek,
  body.fold-right #panelPeek { display: grid; place-items: center; }

  /* 素材栏头部那颗"收起"：桌面上也露出来（原来只在手机端显示） */
  .assets-fold { display: inline-flex; align-items: center; }
  /* 右栏的收起把手：贴在面板左边缘的一条细带（手机端那根 44×4 的横条在桌面上不要） */
  .grip {
    display: flex; align-items: center; justify-content: center;
    position: absolute; left: -11px; top: 50%; margin-top: -22px;
    width: 11px; height: 44px; padding: 0;
    border: 1px solid var(--line); border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--panel-2); color: var(--muted); cursor: pointer; z-index: 2;
  }
  .grip:hover { color: var(--text); background: var(--panel-3); }
  .grip > span { display: none; }
  .grip .ico { width: 12px; height: 12px; }
}
#assetsPeek, #panelPeek {
  position: fixed; top: 50%; margin-top: -22px; z-index: 44;
  width: 14px; height: 44px; padding: 0; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); cursor: pointer;
}
#assetsPeek { left: 0; border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
#panelPeek { right: 0; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
#assetsPeek:hover, #panelPeek:hover { color: var(--text); background: var(--panel-3); }
#assetsPeek .ico, #panelPeek .ico { width: 13px; height: 13px; }

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  /**
   * 【卡片不许被压扁】.panel-scroll 是个 flex 列，卡片默认 `flex-shrink:1`；
   * 一旦某张卡片的 min-height 比它的内容矮，它就会被压到 min-height、
   * 内容**溢出到下一张卡片底下**（下一张卡片有背景色，正好把它盖住）——
   * 「自动打阴影」那一整块就是这么消失过一次的。内容多就让面板滚，别压。
   */
  flex: 0 0 auto;
}

.row { display: flex; gap: 6px; flex-wrap: wrap; }
/**
 * 【hidden 必须显式打赢 display:flex】`[hidden]` 在 UA 样式表里只有 `display:none`，
 * 权重最低 —— 上面那条 `.row{display:flex}` 会把它盖掉，于是"藏起来"的那一行照样在。
 * 挖孔卡片上「收口/退一个点/放弃」那一行就这么一直露着（属性是 true，眼睛看得见）。
 */
.row[hidden] { display: none; }
.row > button { flex: 1 1 auto; }
.row-inline { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.row-inline > span { color: var(--muted); font-size: 12px; min-width: 32px; }
.row-inline input[type="number"] { width: 68px; }

/* ------------------------------------------------------------ 图层列表 */

.layer-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 8px;
  /* 【2026-10-17 P1】216 → 236：行高已到 44 的硬下限（不能再压），要多露一层只能让列表
     自身高一点 —— 44×5 + 3×4 = 232，236 留 4px 余量，同屏可见 4 → 5 层（+25%）。 */
  max-height: 236px;
  overflow-y: auto;
}
.layer-item {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--sunken);
  cursor: pointer;
}
/* 悬停**只改底色**，不碰边框 —— 以前 hover 也改边框色，鼠标从画布移向「图片效果」时
   必然经过列表最下面那行（板框层），那一圈绿边看着就像"它被选中了"。
   选中则是一条 3px 的左侧色条 + 亮边框，两者一眼分得开。 */
.layer-item:hover { background: #10241e; }
.layer-item.on {
  border-color: var(--accent);
  background: #14312a;
  box-shadow: inset 3px 0 0 0 var(--accent);
}
.layer-item.off { opacity: .45; }

/* 图层行里的图标按钮：隐藏（眼睛）+ 锁 —— 都用内联 SVG，不依赖字体 */
.layer-item .ico {
  width: 15px; height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 隐藏 / 显示：眼睛按钮 */
.vis {
  flex: none;
  padding: 1px 3px;
  background: none; border: none;
  color: var(--text);
  cursor: pointer;
}
.vis:hover { border-radius: 5px; background: #1e4034; }
/* 隐藏那一行：眼睛变成"划掉的眼睛"并压暗，一眼看出这层关掉了 */
.vis.off { color: #8fa39b; }

.lname {
  flex: 1 1 auto; min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 4px;
  font: inherit; font-size: 12.5px;
  color: var(--text);
}
.lname:hover { border-color: var(--line); }
.lname:focus { border-color: var(--accent); background: var(--sunken); }
.llabel { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lgroup { flex: none; font-size: 9px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 5px; max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lflag { flex: none; font-size: 11px; color: var(--accent); }
.layer-group-head { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); background: rgba(255,255,255,.03); }
.layer-group-head b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-group-head small { margin-left: auto; font-size: 9px; color: var(--muted-2); }
.layer-group-head .lg-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }

/* 图层类型标签 */
.tag {
  flex: none;
  font-size: 10.5px; line-height: 1.6;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag-board { border-color: var(--accent); color: #7fe3b0; }
.tag-image { border-color: #4fa3e3; color: #9fd0f5; }
.tag-perspective { border-color: #d8b24a; color: #ffd76a; }
.tag-text { border-color: #d8b24a; color: #ffd76a; }

/* 透视图层的设置块：跟着"当前选中的是透视图层"出现，不是一个独立面板。
   左边一道琥珀色细条 = 它管的是哪个图层，扫一眼就对得上列表里那一行的标签色。 */
.plane-box {
  margin-top: 8px;
  padding: 8px 9px 6px;
  border-left: 2px solid #d8b24a;
  background: #12261f;
  border-radius: 0 8px 8px 0;
  display: grid; gap: 7px;
}
.plane-box .tip { margin: 0; }
.plane-box button.wide { margin-top: 0; }

/* 「隐藏辅助线」：按钮上的字写**动作**，图标表示当前状态（和图层那对眼睛一个道理）。
   关掉之后整颗按钮压暗，一眼看出"现在是藏着的"。 */
.grid-toggle {
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.grid-toggle .ico {
  width: 15px; height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.grid-toggle.off {
  color: var(--muted);
  border-color: var(--line);
  background: var(--panel-3);
}

/* 拖拽调层级 */
.layer-item.dragging { opacity: .38; }
.layer-item.drop-before { box-shadow: inset 0 2px 0 0 var(--accent); }
.layer-item.drop-end { box-shadow: inset 0 -2px 0 0 var(--accent); }

/* 左键直接删这一层 */
.del {
  flex: none;
  padding: 1px 6px;
  background: none; border: none;
  color: var(--muted);
  font-size: 15px; line-height: 1.15;
}
.del:hover { background: #4a1f1f; color: #ffb3b3; border-radius: 5px; }

/* 锁：锁住之后画布上选不中、列表里拖不动 */
.lock {
  flex: none;
  padding: 1px 3px;
  background: none; border: none;
  /* 未锁也要看得清（一开始用 var(--muted) 太暗，截图里几乎看不见） */
  color: #8fa39b;
  cursor: pointer;
}
.lock:hover { border-radius: 5px; background: #1e4034; color: #eafff6; }
/* 未锁：锁梁挪出去（看起来是"开着的锁"）；锁住：锁梁扣上 + 换成琥珀色 */
.lock .shackle { transform: translateX(2.6px); }
.lock.on { color: #ffc46b; }
.lock.on .shackle { transform: none; }

/* 沉金：这一层出板时放两份（铜层 + 阻焊开窗）。
   开着 = 琥珀实底 + 深字（"这一块铜要露出来"），关着 = 只是一个浅浅的描边胶囊，
   所以扫一眼列表就知道哪几层会被沉金。 */
.gold-btn {
  flex: none;
  padding: 1px 6px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: inherit; font-size: 10.5px; line-height: 1.65;
  cursor: pointer;
  white-space: nowrap;
}
.gold-btn:hover { border-color: #ffc46b; color: #ffd76a; }
.gold-btn.on {
  border-color: #ffc46b;
  background: #ffc46b;
  color: #26200c;
  font-weight: 600;
}
/* 混合模式（工具市场里叫「映射」）：这一整层按选定模式盖到下面的层上，只影响画面/导出图。
   默认"正常"是灰的（绝大多数层都是它），选了别的模式才亮起来 —— 和沉金同一套视觉语言。
   【为什么卡 max-width】原生的 select 宽度跟着最长的选项走，"正片叠底"会把图层行撑开、
   把图层名挤没；宽一点的那个字在展开的下拉里照样看得全。 */
.blend-sel {
  flex: none;
  max-width: 68px;
  padding: 1px 4px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: inherit; font-size: 10.5px; line-height: 1.65;
  cursor: pointer;
}
.blend-sel:hover { border-color: #ffc46b; color: #ffd76a; }
.blend-sel.on { border-color: #ffc46b; color: #ffd76a; font-weight: 600; }
/* 锁住那一行整体压一点：一眼看出"这层动不了"（但别压到看不清名字） */
.layer-item.locked .lname { color: var(--muted); }
.layer-item.locked { border-style: dashed; }

/* ------------------------------------------------------------------ 控件 */

.slider { display: grid; grid-template-columns: 52px 1fr 62px; align-items: center; gap: 6px; margin: 8px 0; font-size: 12px; color: var(--muted); }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider output { font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }

.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }

input[type="number"], select {
  background: var(--sunken); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
  font: inherit; min-width: 0;
}
/* 抠图弹窗里的倍率下拉跟复选框并排，别撑高那一行 */
.cut-row select { padding: 4px 6px; font-size: 12px; }

.tip { margin: 7px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.tip b { color: #cfe8dd; }

/* ------------------------------------------------------------------ FAB / 移动端 */

.fab {
  display: none;
  position: fixed; right: 14px; bottom: calc(14px + var(--safe-b));
  z-index: 40;
  border-radius: 999px;
  padding: 12px 20px;
  background: var(--accent-dim);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}

/* --------------------------------------------------------- 移动端：底部 sheet */

@media (max-width: 820px) {
  .fab { display: block; }

  /* 左栏变左侧抽屉：默认收起，点顶栏「素材」滑出 */
  .assets-toggle { display: inline-block; padding: 6px 12px; }
  .assets {
    position: fixed;
    left: 0; top: var(--topbar-h); bottom: 0;
    width: min(78vw, 300px);
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 46;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .5);
  }
  .assets.open { transform: translateX(0); }
  .assets-fold { display: inline-block; }

  .panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-height: 68vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform .22s ease;
    z-index: 45;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
    padding-bottom: var(--safe-b);
  }
  .panel.open { transform: translateY(0); }
  .grip { display: flex; align-items: center; justify-content: center; height: 26px; flex: none; cursor: grab; }
  .grip span { width: 44px; height: 4px; border-radius: 2px; background: var(--line); }
  .panel-scroll { padding-bottom: 74px; }

  .hint { bottom: calc(72px + var(--safe-b)); }
  .brand { font-size: 13px; }
  .brand span { display: none; }
  /* 手机上顶栏要装的东西最多，商标缩到 16px（仍然是"与文字基线对齐"的那一档） */
  .brand-logo { height: 16px; width: 16px; }
  .grp button { padding: 7px 9px; font-size: 12px; }
  .seg button { padding: 6px 12px; }
}

@media (max-width: 420px) {
  .layer-list { max-height: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .hint { transition: none; }
}

/* 图片效果卡片里的取色器：缩到跟输入框一样高，不然比旁边的滑块高一大截 */
#fxOutlineColor {
  width: 46px; height: 28px; padding: 2px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
}
#fxOutlineColor:disabled { opacity: .4; }
/* 光影的取色器跟白边那个同款；压暗/提亮那颗按钮旁边的宽度不够就让它别缩 */
#brushColor {
  flex: 0 0 auto; width: 44px; height: 28px; padding: 2px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
}
#effectCard .slider { grid-template-columns: 62px 1fr 58px; }
/* 「图片效果」常驻：高度也要钉住 —— 文字长短一变高度就变，下面的卡片会跟着上下窜
   【为什么是 [open]】钉高度是为了"内容变了别窜"，但它**必须让位给用户主动收起**：
   不加 [open] 的话，收起来的卡片还占着 168px 的空白（页面上就是一大片空档）。 */
#effectCard[open] { min-height: 168px; }
/* 图层那行的提示也钉成两行：它从 1 行变 2 行会让下面整块面板下移 18px，
   鼠标正往下移时那一窜就足以让人点到别的卡片 */
#layerHint { min-height: 36px; }
#effectCard .tip { height: 38px; overflow: hidden; }
#effectCard.idle { opacity: .55; }
#effectCard .slider input[type="range"]:disabled { opacity: .5; }

/* 光影画笔：同样常驻 + 高度钉住（理由同上），提示固定两行 */
#brushCard[open] { min-height: 268px; }
#brushCard .slider { grid-template-columns: 62px 1fr 58px; }
#brushCard .tip { height: 38px; overflow: hidden; }
#brushCard.idle { opacity: .55; }
#brushCard.idle button, #brushCard.idle input[type="range"] { opacity: .5; }
/* 作用图层那一行：横着排、放不下就横向滚 —— 高度恒定，卡片才不会因为层数变了上下窜 */
.brush-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 10px 0 4px; font-size: 12px; color: var(--muted);
}
.brush-row em { font-style: normal; color: var(--text); }
.brush-targets {
  display: flex; gap: 6px; align-items: center;
  height: 30px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
.brush-targets button {
  flex: 0 0 auto; font-size: 11px; line-height: 1;
  padding: 6px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.brush-targets button[aria-pressed="true"] {
  border-color: var(--accent); color: var(--text-strong); background: var(--accent-soft);
}
.brush-targets button:disabled { cursor: not-allowed; opacity: .35; }
.brush-targets .none { font-size: 11px; color: var(--muted); }
/* 颜色提取：预览 + 单色选择 + 四个滑块（常驻 + 高度恒定，和别的卡片一个规矩） */
#goldCard[open] { min-height: 474px; }
#goldCard .slider { grid-template-columns: 66px minmax(0, 1fr) 54px; margin: 4px 0; }
#goldCard #goldColor {
  width: 44px; height: 28px; padding: 2px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
}
#goldColorName { min-width: 40px; font-size: 11px; }
/* 预览底是棋盘格：**透明的地方要一眼看出来**（不然"提取出来是空的"看不出来） */
.gold-preview {
  margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background-color: #0e1a16;
  background-image:
    linear-gradient(45deg, #1c2c26 25%, transparent 25%, transparent 75%, #1c2c26 75%),
    linear-gradient(45deg, #1c2c26 25%, transparent 25%, transparent 75%, #1c2c26 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.gold-preview canvas { display: block; width: 100%; height: auto; }
#goldCard .chk { margin-top: 6px; }
#goldCard .tip { height: 38px; overflow: hidden; }
#goldCard.idle button, #goldCard.idle input { opacity: .5; }

/* 「按这张图的轮廓扩板框」：图探出板框时它自己亮起来 —— 不弹窗、不抢焦点 */
#outlineFollow { margin-top: 6px; }
#outlineFollow.nudge {
  border-color: var(--accent); color: #06231b; background: var(--accent);
  animation: nudgePulse 1.6s ease-in-out infinite;
}
@keyframes nudgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127, 227, 176, .55); }
  50% { box-shadow: 0 0 0 5px rgba(127, 227, 176, 0); }
}
/* 挖孔：矩形/异形两种画法 + 直角/圆角二选一（和别的卡片一个规矩：常驻、高度恒定） */
#holeCard[open] { min-height: 236px; }
#holeCard .slider { grid-template-columns: 58px minmax(0, 1fr) 52px; margin: 4px 0; }
/* 按下态统一走 UI v2 里那条通用规则（这里不重复写，免得两套主题下不一致） */
#holeCard .row { margin-top: 6px; }
#holeCard .tip { height: 38px; overflow: hidden; }
#holeCorner:disabled { opacity: .35; }
#holeCard.idle { opacity: .55; }
/* 擦除画笔：擦除/涂回 + 浓度 + 笔刷（常驻 + 高度恒定，和别的卡片一个规矩） */
#eraseCard .slider { grid-template-columns: 58px minmax(0, 1fr) 52px; margin: 6px 0 2px; }
#eraseCard .tip { height: 38px; overflow: hidden; }
#eraseCard.idle { opacity: .55; }
#eraseCard.idle button, #eraseCard.idle input[type="range"] { opacity: .5; }
/* 透明度 / 渐变透明：常驻 + 高度恒定（理由同上：出现消失会让下面的卡片窜位置） */
#fadeToggle { margin-top: 8px; }
/* 【minmax(0,1fr) 不能省】滑块的固有宽度（range 默认 129px）会把 1fr 撑开，
   把最后一列输出框挤出容器 —— 用 minmax(0,1fr) 才允许滑块列收缩。 */
.fade-box { margin-top: 6px; padding-left: 8px; border-left: 2px solid var(--line); }
.fade-box .slider { grid-template-columns: 40px minmax(0, 1fr) 62px; margin: 6px 0; }
.shadow-box .slider { grid-template-columns: 40px minmax(0, 1fr) 62px; }
#fadeHint { height: 38px; overflow: hidden; }
#fadeToggle:disabled, .fade-box input:disabled { opacity: .45; }

/* 定向投影：按钮 + 参数块（块只在开着的时候出现，是用户自己点的，不会在鼠标底下窜） */
#shadowToggle { margin-top: 8px; }
.shadow-box { margin-top: 6px; padding-left: 8px; border-left: 2px solid var(--line); }
.shadow-box .slider output { font-size: 11px; }
#shadowColor {
  width: 44px; height: 28px; padding: 2px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
}
#brushCard.idle .shadow-box { opacity: .5; }
/* 「进入画笔」开着时的强调态走 UI v2 那条通用规则 */

/* ============================================================================
   UI v2 —— 克制的工程工具风（含暗/亮双主题）
   ----------------------------------------------------------------------------
   【为什么是"再写一层"而不是推翻重来】上面的规则承载着很多**行为性**的东西
   （卡片高度钉死不许窜、hover 只改底色不改边框、[hidden] 要打赢 display:flex…），
   那些都是踩过坑留下来的。这一层只做外观，选择器名字一个没改。

   【这一版的取向：像工程软件，不像 SaaS 仪表盘】
     ① 平面：按钮/卡片不用渐变、不用彩色投影、不发光、不玻璃模糊
     ② 中性：底色是石墨灰（不带绿），绿色只作强调色 —— 只在"选中/生效/主行动"出现
     ③ 结构靠**发丝线**而不是靠"一张张浮起来的卡片"：右栏是一整块面，段落之间一条 1px 线
     ④ 密度：行高/内边距/圆角都收紧，一屏能看更多参数
     ⑤ 图标中性灰、和文字同色，不再"每个标题一颗绿图标"
     ⑥ 控件回到工程习惯：小方块复选框、细轨滑块、方形图标按钮

   【双主题怎么做的】所有颜色先归到**一层语义 token**（下面 `:root` 里那串），
   组件规则只引用 token；`[data-theme="light"]` 只覆盖 token 本身 —— 于是"换主题"
   是一处改动，不是一个组件一个组件地改。`color-scheme` 跟着切，原生滚动条/控件也会跟着变。
   ========================================================================== */

:root {
  color-scheme: dark;

  /* ---- 三层面 + 内陷面（按钮/输入框的几种底） ---- */
  --bg: #0e1114;
  --panel: #131619;
  --panel-2: #171a1e;
  --panel-3: #1c2024;
  --surface-hi: rgba(255, 255, 255, .1);      /* 抬起来的一块（当前页签/选中） */
  --surface-hover: #23282d;                   /* 按钮悬停 */
  --surface-press: #1a1e22;                   /* 按钮按下 */
  --sunken: #0c1013;                          /* 输入框/画布这类"凹进去"的底 */

  /* ---- 线 ---- */
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .2);

  /* ---- 文字三级 + 反白 ---- */
  --text: #e2e6ea;
  --muted: #98a2ab;
  --muted-2: #7e8890;                          /* 最弱一级也要过 4.5:1（真机有对比度抽检钉着） */
  --text-strong: #dff3ea;                     /* 强调块上的文字 */
  --text-strong-2: #cbd4d9;                   /* 正文里的加粗 */
  --on-surface-hi: #fff;                      /* 抬起来那块上的文字 */
  --on-accent: #06120d;                       /* 强调色上的文字 */
  --danger-ink: #e8b4b4;
  --warn-ink: #f0d5ab;

  /* ---- 强调 / 语义色 ---- */
  --accent: #3f9d7a;
  --accent-hi: #48ab86;
  --accent-dim: #2b6b55;
  --accent-soft: rgba(63, 157, 122, .16);
  --gold: #c4a03c;
  --warn: #c9964a;
  --danger: #c96a6a;

  /* ---- 标签 / 手柄 / 透明底格子 ---- */
  --tag-board: #82c4ab;
  --tag-image: #93bfe0;
  --tag-persp: #cfae5c;
  --tag-text: #e0b062;
  --thumb: #c9d0d5;
  --thumb-hi: #e6ebee;
  --checker: repeating-conic-gradient(#1a1f23 0% 25%, #12161a 0% 50%);

  /* ---- 形状 / 阴影 / 焦点 ---- */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 5px;
  --shadow-1: none;
  --shadow-2: 0 6px 18px -10px rgba(0, 0, 0, .7);
  --shadow-3: 0 14px 34px -18px rgba(0, 0, 0, .8);
  --ring: 0 0 0 2px rgba(63, 157, 122, .45);
  --overlay-bg: rgba(6, 8, 10, .72);

  --t: .12s ease;
  --t-slow: .18s ease;
  --ico: 14px;
  --topbar-h: 46px;
  --panel-w: 344px;
}

/**
 * 亮色主题：**只覆盖 token**，组件规则一行都不用改。
 * 【取值原则】白底上不用"提亮"来表达层次，而是用"压暗"：面比底更白（panel-2 = #fff），
 * 抬起来的那块用淡淡的黑（surface-hi），凹进去的用纯白（sunken）；
 * 强调色要压深一档（#12795a），不然白底上发飘、对比度也不够。
 */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eceeef;
  --panel: #f6f7f8;
  --panel-2: #fff;
  --panel-3: #eff1f2;
  --surface-hi: rgba(20, 26, 30, .07);
  --surface-hover: #e9ecee;
  --surface-press: #e0e4e6;
  --sunken: #fff;
  --line: rgba(18, 24, 28, .13);
  --line-2: rgba(18, 24, 28, .22);
  --line-strong: rgba(18, 24, 28, .3);
  --text: #1b2126;
  --muted: #59636b;
  --muted-2: #646d75;                          /* 白底上要更深一点才够对比度 */
  --text-strong: #0f3d2e;
  --text-strong-2: #2b3338;
  --on-surface-hi: #12181c;
  --on-accent: #fff;
  --danger-ink: #8f2f2f;
  --warn-ink: #7a4b12;
  --accent: #12795a;
  --accent-hi: #0e6249;
  --accent-dim: #0b5a43;
  --accent-soft: rgba(18, 121, 90, .1);
  --gold: #8a6a12;
  --warn: #8a5a12;
  --danger: #b23b3b;
  --tag-board: #12795a;
  --tag-image: #2a6ea8;
  --tag-persp: #8a6a12;
  --tag-text: #a3722a;
  --thumb: #6f7a83;
  --thumb-hi: #39424a;
  --checker: repeating-conic-gradient(#e4e7e9 0% 25%, #f5f6f7 0% 50%);
  --shadow-2: 0 6px 18px -10px rgba(20, 26, 30, .2);
  --shadow-3: 0 14px 34px -18px rgba(20, 26, 30, .26);
  --ring: 0 0 0 2px rgba(18, 121, 90, .35);
  --overlay-bg: rgba(28, 34, 38, .38);
}

html, body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }

/* 细滚动条 */
.panel-scroll, .layer-list, .assets-body, .example-list, .asset-list {
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.panel-scroll::-webkit-scrollbar, .layer-list::-webkit-scrollbar, .assets-body::-webkit-scrollbar,
.example-list::-webkit-scrollbar, .asset-list::-webkit-scrollbar { width: 8px; height: 8px; }
.panel-scroll::-webkit-scrollbar-thumb, .layer-list::-webkit-scrollbar-thumb, .assets-body::-webkit-scrollbar-thumb,
.example-list::-webkit-scrollbar-thumb, .asset-list::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px; border: 2px solid transparent; background-clip: content-box;
}
.panel-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 图标（中性，跟文字同色） */

svg.lucide {
  width: var(--ico); height: var(--ico);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}
button > svg.lucide + .lbl, button > svg.lucide + span { margin-left: 6px; }
.icon-only { padding: 0 !important; width: 30px; height: 30px; justify-content: center; }
.icon-only > svg.lucide { width: 15px; height: 15px; opacity: 1; }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  gap: 6px;
  padding: 0 10px;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; letter-spacing: .2px; }
.brand > span:last-child { color: var(--muted-2); font-weight: 400; font-size: 11.5px; }
/**
 * 顶栏商标（站点名左边那枚）。
 * 【为什么用 height 而不是宽高都写】商标是正方形，只定高让它自己按比例缩放 ——
 * 以后换一张宽高比不同的图，这里不用跟着改。
 * 【为什么基线要对齐】顶栏是 flex + align-items:center，图标和文字会各自居中；
 * 中文没有下伸部，视觉上图标会显得"偏上"。`align-self:center` 保持居中，
 * 再用 `translateY(-.5px)` 微调到与文字视觉中心齐平（16~20px 的图标差半像素就看得出）。
 * 【为什么不用 SVG】原始素材是位图 JPEG，自动描边会把线条搞毛糙（见 brand/make-icons.py 说明），
 * 宁可给一张干净的 1024 位图缩下来。
 */
.brand-logo { height: 18px; width: 18px; flex: none; align-self: center; transform: translateY(-.5px); }
/* 亮色主题下，白线图形压在浅色顶栏上会看不见 —— 用 filter 把它压成深色（alpha 不变），
   比再加载一份深线版省一次请求。 */
[data-theme="light"] .brand-logo { filter: brightness(.12) saturate(1.2); }

/* 分段控件 = 平轨道 + 抬起来的中性块（不是彩色药丸） */
.seg {
  display: inline-flex; gap: 2px;
  padding: 2px;
  background: var(--surface-hi);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  border-radius: 3px; padding: 5px 11px; font-size: 12px; font-weight: 500;
}
.seg button:hover:not(:disabled) { background: var(--surface-hi); color: var(--text); }
.seg button.on { background: var(--surface-hi); color: var(--on-surface-hi); font-weight: 600; }
.grp { display: inline-flex; gap: 4px; }
.grp + .grp::before { content: ''; width: 1px; align-self: stretch; margin: 9px 3px 9px 0; background: var(--line); }
/* 批 2：顶栏 1:1 按钮（文字）。和旁边图标按钮同高，数字等宽，别把 "1:1" 挤成两行。 */
.topbar .zoom-1to1 {
  width: auto;
  min-width: 36px;
  padding: 0 6px;
  font-size: 12px;
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.assets-toggle { display: none; }

/**
 * 「安装应用」那一组（手机 / 桌面都能装成独立窗口）。
 * 【★ [hidden] 这条必须显式写】`.grp` 是 `display: inline-flex`（特异性 0,0,1），
 * UA 样式表里的 `[hidden]{display:none}` 也是 0,0,1 —— 谁后写谁赢，作者样式永远在 UA 之后，
 * 于是**不加这条 hidden 就压不住**，按钮会在不支持的浏览器上照常露出来。
 * 这个坑本文件已经踩过三次（见 .plane-box / .row / #paintBrushCard 那几处）。
 * 【为什么不像旁边按钮那样自己写一套 padding】它就是个普通顶栏按钮，沿用 `.topbar button`
 * 已有的尺寸；手机端 ≥44px 命中区由文件末尾那条 `.topbar button` 统一兜（它管所有顶栏按钮）。
 * 这里只加"默认不存在"和"分隔线"两件事，能少写就少写。
 */
#installGrp[hidden] { display: none; }

/**
 * 「安装应用」按钮出现时亮一圈（由 app.js 的 revealInstallBtn() 加上这个类，2 秒后摘掉）。
 * 【为什么需要它】这颗按钮排在顶栏最右边，手机上要横滑 1008px 才够得着；app.js 出现时会自动
 * 把顶栏滑过去，但"滑过去"这件事本身很轻，没有一圈光晕用户不会注意到那边多了颗按钮。
 * 【为什么用 box-shadow 而不是 outline】outline 不吃圆角（这颗按钮是 8px 圆角，方框会露出角）；
 * box-shadow 跟着 border-radius 走，而且它不参与布局、不会把旁边的按钮挤开。
 * 【为什么不用 animation】用不到关键帧 —— 一个 2 秒的 transition 就够了；
 * 系统开了"减少动态效果"时，文件末尾那条全局规则会把 transition 压到 0.001ms，自动退化成"直接亮着"。
 */
#installBtn.install-flash {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-dim);
  transition: box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
#installBtn.install-flash .ico { color: var(--accent); }

/**
 * 顶栏的「导出」下拉。
 * 【为什么是 <details> 而不是自己写开关】浏览器自带"点外面关不掉、按 Esc 也不关"的那套？
 * 不 —— <details> 至少是"点标题开合"的原生语义，键盘也能用（Enter/Space），
 * 而我们在 app.js 里补一条"点了里面的按钮就收起"，两行就够，不用自己造 popover。
 * 【为什么带阴影】平面卡片不许有阴影（工程风那条），但**浮在内容之上的临时层**例外 ——
 * 和弹窗 .sheet 同一个待遇（--shadow-2），不然它压在深色画布上会糊成一片看不出来。
 */
.export-menu { position: relative; }
.export-menu > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; font-size: 12.5px; font-weight: 500;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
  background: var(--panel-3); color: var(--text);
  transition: background var(--t), border-color var(--t);
}
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.export-menu[open] > summary { background: var(--accent-soft); border-color: var(--accent); color: var(--text-strong); }
.export-menu > summary .ico { width: 15px; height: 15px; }
.export-pop {
  /* fixed 而不是 absolute：顶栏是 overflow-x:auto（会裁掉绝对定位的子元素，见 app.js 那段注释）。
     top/right 由 app.js 在打开时按标题位置算；这两行是"JS 万一没跑到"时的兜底位置。 */
  position: fixed; top: var(--topbar-h, 44px); right: 12px; z-index: 60;
  width: min(274px, calc(100vw - 24px)); padding: 10px;
  display: grid; gap: 8px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
.export-pop .tip { margin: 0; }

/* ---------------------------------------------------------------- 按钮（平面三档） */

button {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  color: var(--text);
  transition: background var(--t), border-color var(--t), color var(--t);
}
button:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--line-strong); }
button:active:not(:disabled) { background: var(--surface-press); }
button:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
button:disabled { opacity: .35; cursor: not-allowed; }
/* 按下态：**淡淡的同色底 + 强调色描边**（不是一整块实心色） */
button[aria-pressed="true"]:not(.vis):not(.lock):not(.del):not(.asset-del),
button.on:not(.vis):not(.lock):not(.del):not(.asset-del) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text-strong);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent); font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-hi); }
button.wide { width: 100%; }
/* "该点它了"的提示：安静地给个强调描边，不做呼吸动画 */
#outlineFollow.nudge { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }

/* ---------------------------------------------------------------- 左栏 / 素材 */

.assets { width: 220px; background: var(--panel); border-right: 1px solid var(--line); }
.assets-head { padding: 9px 10px 5px; }
.side-tabs { display: inline-flex; gap: 2px; }
.side-tabs button {
  padding: 4px 10px; font-size: 12px; font-weight: 500;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs); color: var(--muted);
}
.side-tabs button:hover { color: var(--text); background: var(--surface-hi); }
.side-tabs button.on { background: var(--surface-hi); color: var(--on-surface-hi); font-weight: 600; }
.assets-body { padding: 4px 10px 12px; gap: 8px; }
.asset-list { gap: 5px; }
.asset-item {
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: border-color var(--t), background var(--t);
}
.asset-item:hover { background: var(--panel-3); border-color: var(--line-2); }
.asset-thumb { width: 42px; height: 42px; border-radius: 4px; }
.stash-list { display: flex; flex-direction: column; gap: 6px; }
.stash-list:empty { display: none; }
/* 「我的仓库」的一行：缩略图 + 名字/大小 + 一排动作（搬回来 / 删除）。
   【为什么动作单独一行】「搬回来」是有字的按钮，横着塞进 218px 的左栏会和名字挤在一起；
   排成"上面看、下面动"，一眼就知道点哪儿。
   【flex-basis 要给 0】不给的话名字那一列按 max-content 撑开，缩略图就被挤到上一行去了。 */
.stash-item { cursor: default; align-items: flex-start; flex-wrap: wrap; }
.stash-item .asset-thumb { width: 46px; height: 46px; }
.stash-nothumb { background: var(--checker) 50% / 12px 12px; }
.stash-meta { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stash-meta b { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stash-meta span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stash-acts { flex: 1 0 100%; display: flex; gap: 6px; }
.stash-acts button {
  flex: 1;
  padding: 3px 8px;
  font: inherit; font-size: 11.5px;
  color: var(--muted-2);
  background: var(--surface-hi);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
}
.stash-acts .stash-back:hover { color: var(--accent); border-color: var(--accent); }
.stash-acts .stash-del:hover { color: var(--danger-ink); border-color: var(--danger-ink); }
.asset-peek { border-radius: var(--radius-sm); border-color: var(--line-2); box-shadow: var(--shadow-3); background: var(--panel-2); }
.example-block { border-radius: var(--radius-sm); background: var(--panel-2); }
.pack-elem { border-radius: 4px; }
.pack-elem:hover { background: var(--surface-hi); border-color: var(--line-2); }

/* ---------------------------------------------------------------- 画布区（平面） */

.stage-wrap { padding: 18px; background: var(--bg); }
.stage-canvas { inset: 18px; border-radius: 4px; }
.stage-badge {
  left: 14px; top: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .4px;
  color: var(--muted);
}
.hint {
  display: flex; align-items: center; gap: 7px;
  bottom: 16px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
  font-size: 12px; line-height: 1.5;
  max-width: min(92%, 620px);
  text-align: left;
  transform: translateX(-50%) translateY(4px);
  transition: opacity var(--t-slow), transform var(--t-slow);
}
.hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hint .hint-ico { color: var(--muted); }
.hint.warn { border-color: var(--warn); color: var(--warn-ink); }
.hint.warn .hint-ico { color: var(--warn); }
.pack-tip { border-radius: var(--radius-xs); background: var(--panel-2); border-color: var(--line); }

/* ---------------------------------------------------------------- 右栏：一整块面 + 段头带分段 */

.panel {
  width: var(--panel-w);
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.panel-scroll { padding: 0 12px 16px; gap: 0; }
/**
 * 【为什么不再"一张张浮起来的卡片"】八张圆角卡片 + 阴影，一屏看过去像模板拼的。
 * 工程软件的做法是**一整块面板 + 发丝线分段**：信息密度更高，也不抢注意力。
 * 【为什么段头做成一条通栏的"带"】段落一多（图层/效果/两支画笔/挖孔/切割/提取/板框/导出 +
 * 装进来的工具），只靠发丝线根本看不出"这一段从哪儿开始" —— 用户的原话是"太乱"。
 * 所以每段的标题变成一条通栏段头带：一眼看清有几段、各叫什么，**点它就收起/展开**
 * （用原生 `<details>/<summary>`：零 JS 也能收，键盘和读屏也天生认它）。
 */
.card { padding: 0 0 12px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.card > summary {
  display: flex; align-items: center; gap: 7px;
  /* 【2026-10-11 段头压到 30px】量过：原来一段段头 45px，15 段就是 675px，
     一屏 817px 里只剩 142px —— "看全所有段头 + 展开一段"根本装不下。
     压到 30px 之后 15 段 450px，才腾得出放参数的地方（配手风琴：一次只展开一段）。 */
  margin: 0 -12px 4px;                  /* 通栏：吃掉 .panel-scroll 的左右内边距 */
  padding: 5px 12px 5px;
  min-height: 30px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; letter-spacing: .5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;                     /* 去掉原生那个三角（下面自己画） */
}
.card > summary::-webkit-details-marker { display: none; }
.card > summary:hover { color: var(--text-strong-2); }
.card > summary:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.card:first-child > summary { border-top: 0; }
.card > summary .h3-ico { color: var(--muted-2); opacity: 1; }
.card > summary em {
  margin-left: auto;
  font-style: normal; font-weight: 400;
  font-size: 10.5px; color: var(--muted-2);
  max-width: 62%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
}
/** 收起/展开指示：一个小折角，展开时朝下、收起时朝右（纯 CSS，不引图标字体） */
.card > summary::after {
  content: ''; flex: none;
  width: 5px; height: 5px; margin-left: 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: .6;
}
.card:not([open]) > summary { color: var(--muted-2); }
.card:not([open]) > summary::after { transform: rotate(-45deg); }
/* 收起后这条段头就是这一段唯一的痕迹 —— 别让它变得像不可点 */
.card:not([open]) > summary:hover { color: var(--muted); }
.card.idle { opacity: .55; }
/** 装了工具的那一段：段头带用强调色，和内置的分得开 */
.card.group > summary { color: var(--text-strong-2); }
.card.group > summary .h3-ico { color: var(--accent); }

.row { gap: 5px; }
.row-inline { gap: 6px; }
.row-inline > span { color: var(--muted); font-size: 11.5px; }
.tip { margin: 7px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--muted-2); }
.tip b, .tip strong { color: var(--text-strong-2); font-weight: 600; }

/* ---------------------------------------------------------------- 图层行 */

.layer-list { gap: 3px; margin-bottom: 8px; }
.layer-item {
  gap: 6px;
  padding: 4px 6px;
  /* 【P1】缩略图缩到 32 后行高会掉到 42 —— 用 min-height 钉死在 44（命中区硬规矩，不许更低）。 */
  min-height: 44px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  transition: background var(--t), border-color var(--t);
}
.layer-item:hover { background: var(--surface-hi); }
.layer-item.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 2px 0 0 0 var(--accent);
}
.layer-item.off { opacity: .42; }
.layer-item.locked { border-style: dashed; border-color: var(--line-2); }
.layer-item.dragging { opacity: .35; }
.layer-item .ico { width: 15px; height: 15px; }
.lname { font-size: 12.5px; padding: 3px 4px; border-radius: 4px; }
.lname:hover { border-color: var(--line); background: var(--surface-hi); }
.lname:focus { border-color: var(--accent); background: var(--sunken); box-shadow: none; }
.vis, .lock {
  width: 22px; height: 22px; padding: 0;
  display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: 4px;
  color: var(--muted-2);
  transition: background var(--t), color var(--t);
}
.vis:hover, .lock:hover { background: var(--surface-hi); color: var(--text); }
.vis.off { color: var(--muted-2); opacity: .7; }
.lock.on { color: var(--gold); }
/* 沉金开关（浅色主题）：整行按钮组同高，开着用金色实底一眼可见 */
.gold-btn {
  height: 20px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--muted-2);
  font: inherit; font-size: 10.5px; line-height: 1; letter-spacing: .2px;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.gold-btn:hover { border-color: var(--gold); color: var(--gold); }
.gold-btn.on { border-color: var(--gold); background: var(--gold); color: #fff; font-weight: 600; }
/* 混合模式下拉（和沉金胶囊同高同一行；"正常"不抢眼，选了别的模式用描边+加粗点出来） */
.blend-sel {
  height: 20px; max-width: 72px; padding: 0 4px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--muted-2);
  font: inherit; font-size: 10.5px; line-height: 1; letter-spacing: .2px;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.blend-sel:hover { border-color: var(--gold); color: var(--gold); }
.blend-sel.on { border-color: var(--gold); color: var(--gold); font-weight: 600; }
.del, .asset-del {
  width: 20px; height: 20px; padding: 0;
  display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: 4px;
  color: var(--muted-2); font-size: 13px; line-height: 1;
  transition: background var(--t), color var(--t);
}
.del:hover, .asset-del:hover { background: rgba(201, 106, 106, .16); color: var(--danger-ink); }

/**
 * 触摸设备：把手指要按的控件撑到按得中。
 * 【为什么放媒体查询里，而不是直接改上面的尺寸】桌面用鼠标，20px 的图标按钮正合适，
 * 撑到 44px 会把整个图层面板撑得松松垮垮；而手指点 20px 基本按不准（实测图层行这几颗
 * 就是 20~22px，触摸标准是 ≥44）。所以按设备能力分开，两边都不用将就。
 * hover:none（没有悬停能力）与 pointer:coarse（手指这类粗指针）取并集，手机/平板都能命中。
 */
@media (hover: none), (pointer: coarse) {
  .vis, .lock, .del, .asset-del { width: 44px; height: 44px; }
  .gold-btn { height: 44px; padding: 0 14px; font-size: 12px; }
  .blend-sel { height: 44px; max-width: 96px; font-size: 12px; }
  .lname { padding: 11px 8px; font-size: 13px; }
  .layer-item { min-height: 52px; }
  button { min-height: 44px; }      /* 顶栏/面板里的所有按钮，先保证高度够 */
  .icon-only { min-width: 44px; }   /* 只有图标的，宽度也得够，否则还是一根细条 */
  /**
   * 【顶栏那些只有图标的按钮】宽度被 flex 压到 34px 左右（高度有 44 但宽度不够，
   * 手指横向还是会点偏）。**不能把盒子撑宽** —— 顶栏是 flex 布局，撑宽会把旁边几颗挤走
   * （那就改了布局）。所以用一个透明的伪元素把**可点区域**撑到 44×44：
   * 视觉一个像素不变，手指命中范围够大。
   */
  /* 【"+ 吸管"那颗顶栏按钮的尺寸】手机端 `button { min-height:44px }` 已经把它撑到 34×44，
     和旁边一直就有的撤销/重做/缩放那几颗**完全同规格**（顶栏是 flex，把某一颗单独撑宽
     会把别的挤走 —— 那就改了默认布局）。手指真正要按的 44×44 目标在图层行和面板里
     （.vis/.lock/.del、辅助线那几颗按钮），那几处都够 44。 */
}
.tag { font-size: 10px; padding: 1px 6px; letter-spacing: .2px; background: transparent; }
.tag-board { border-color: var(--tag-board); color: var(--tag-board); }
.tag-image { border-color: var(--tag-image); color: var(--tag-image); }
.tag-perspective { border-color: var(--tag-persp); color: var(--tag-persp); }
.tag-text { border-color: var(--tag-text); color: var(--tag-text); }

/* ---------------------------------------------------------------- 表单控件 */

.slider { grid-template-columns: 54px minmax(0, 1fr) 58px; gap: 8px; margin: 8px 0; font-size: 11.5px; }
.slider output { font-size: 11.5px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
#effectCard .slider { grid-template-columns: 62px minmax(0, 1fr) 54px; }
#goldCard .slider, #holeCard .slider, #eraseCard .slider { grid-template-columns: 62px minmax(0, 1fr) 54px; }

/* 滑块：4px 细轨 + 已填充段（--p 由 app.js 写）+ 12px 圆柄（不发光） */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 18px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg,
    var(--accent) calc(var(--p, 0) * 100%), var(--line-2) calc(var(--p, 0) * 100%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -4px;
  border-radius: 50%;
  background: var(--thumb);
  border: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--thumb-hi); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }
input[type="range"]:disabled { opacity: .35; cursor: not-allowed; }

/* 复选框：小方块 + 对勾（工程习惯，不用 iOS 那种开关） */
.chk { gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chk input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; flex: none;
  margin: 0; position: relative;
  border-radius: 3px;
  background: var(--sunken);
  border: 1px solid var(--line-2);
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.chk input[type="checkbox"]::after {
  content: '';
  position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: 2px solid var(--on-accent);
  border-top: 0; border-left: 0;
  transform: rotate(45deg);
  opacity: 0;
}
.chk input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.chk input[type="checkbox"]:checked::after { opacity: 1; }
.chk input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ring); }
.chk input[type="checkbox"]:disabled { opacity: .35; cursor: not-allowed; }
.chk:hover { color: var(--text); }

/* ============================================================================
   右栏"整洁化"（2026-10-11，用户选 (a) 全量改）
   ============================================================================
   【量出来的问题】面板 817px 一屏，内容 2832px（滚 3.47 屏）；15 段里默认展开 9 段占 2817px；
   可见部分塞着 32 滑块 / 116 按钮 / 4 勾选框。所以四件事：段头压矮、手风琴只展开一段
   （JS 在 app.js 的 bind 里）、段头带"当前值"徽标、控件收层级（勾选框→矢量开关、按钮降级）。
   【为什么用 display/颜色而不是动画】工程风：收起是瞬间的、状态是静态可读的，
   这里不做位移花活（--t 只用于颜色/位置这类 120ms 的小反馈）。
   ========================================================================== */

/* ① 段头右上角的"当前值"徽标：收起时也知道里面是什么（app.js 的 paintCardBadges 填） */
.card > summary .badge {
  margin-left: auto; flex: none;
  font: 11px/1.4 "Cascadia Mono", Consolas, monospace;
  color: var(--muted); font-variant-numeric: tabular-nums;
  padding-left: 8px;
}
/* 副标题要给它让位：太长就省略，别把徽标挤出去 */
.card > summary em { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ② 勾选框 → 矢量开关（用户定的规矩：开关类控件别用勾选框；厚度 0 即关）
      注：这里覆盖的是下面那条"小方块 + 对勾"的老规矩（那是更早的决定，用户偏好优先）。 */
.chk input[type="checkbox"] {
  width: 30px; height: 16px; border-radius: 8px;
  background: var(--sunken); border: 1px solid var(--line-2);
}
.chk input[type="checkbox"]::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 10px; height: 10px;
  border: 0; border-radius: 50%; background: var(--muted);
  transform: none; opacity: 1;
  transition: transform var(--t), background var(--t);
}
.chk input[type="checkbox"]:checked { background: var(--accent-soft); border-color: var(--accent-dim); }
.chk input[type="checkbox"]:checked::after { transform: translateX(14px); background: var(--accent); }

/* ============================================================================
   命令面板（Ctrl/⌘ + K）—— 2026-10-11
   ============================================================================
   【为什么长这样】它是"万能兜底"：界面可以继续往简里收，功能一个不少，找不到就搜一下。
   所以它本身必须是**最安静的一块**：没有毛玻璃、没有渐变、没有大投影，
   只有一条发丝线边框 + 一张列表 —— 和右栏、工具轨同一套语言（工程风）。
   ========================================================================== */
.cmd-modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.cmd-modal[hidden] { display: none; }
.cmd-box {
  width: min(560px, 92vw);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.cmd-box input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line);
  background: var(--sunken); color: var(--text);
  padding: 12px 14px; font: inherit; font-size: 13.5px;
}
.cmd-box input:focus { outline: none; }
.cmd-list { max-height: 46vh; overflow-y: auto; padding: 4px; }
.cmd-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.cmd-row.on { background: var(--surface-hi); }
.cmd-row .cmd-label { flex: 1; font-size: 13px; }
/* 同义词命中的说明（2026-10-17）：搜「对齐」时多出来的对齐命令要写清为什么在这 */
.cmd-row .cmd-why { flex: none; font-size: 10.5px; color: var(--accent); }
.cmd-row kbd, .cmd-tip kbd {
  font: 10.5px/1.4 "Cascadia Mono", Consolas, monospace;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 1px 4px;
}
.cmd-empty { margin: 0; padding: 12px 14px; color: var(--muted-2); font-size: 12px; }
.cmd-tip { margin: 0; padding: 7px 12px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 11px; }

/* ============================================================================
   右栏「细条模式」—— 细条 + 点开浮出（2026-10-11）
   ============================================================================
   【为什么不新建一套 UI】`<details>` 的开合本来就是"点一下展开"；手风琴又保证了
   同一时刻只有一段展开。所以这里只做两件事：把栏压成 46px 的图标条（标题文字用
   font-size:0 收掉、图标留着），再把**展开中的那一段**摆成贴着细条的浮层 ——
   "细条 + 点开浮出"就是这两条既有机制的自然结果，没有第二套状态要维护。
   【默认关】既定规矩「默认布局一个字都不许变」：它是用户按出来的形态
   （命令面板里一条命令，状态记 localStorage）。
   ========================================================================== */
body.panel-thin .panel { width: 46px; }
body.panel-thin .panel-scroll { padding: 4px 0; }
body.panel-thin .card > summary {
  font-size: 0;                       /* 标题文字收掉（图标有显式尺寸，不受影响） */
  flex-direction: column; gap: 0; justify-content: center;
  padding: 9px 0; margin: 0 0 2px; min-height: 36px;
}
body.panel-thin .card > summary .ico { width: 18px; height: 18px; }
body.panel-thin .card > summary .badge,
body.panel-thin .card > summary em { display: none; }
body.panel-thin .card:not([open]) > *:not(summary) { display: none; }
/* 展开的那一段 = 浮层（贴着细条摆，不盖画布中心） */
body.panel-thin .card[open] {
  position: fixed; right: 54px; top: 72px;
  width: min(320px, 40vw); max-height: 72vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4); z-index: 48;
  padding: 0 12px 12px;
}
body.panel-thin .card[open] > summary {
  font-size: 11.5px; flex-direction: row; gap: 7px;
  padding: 8px 12px 7px; margin: 0 -12px 8px; min-height: 30px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
/* 「工具抽屉」：把那张浮层从右边挪到**左轨右边**（一个类的事，DOM 与右栏结构都没动） */
body.tool-left.panel-thin .card[open] { right: auto; left: 54px; }

/* ============================================================================
   笔刷库（2026-10-11）—— 左分类 + 右"带笔迹预览"的卡片
   ============================================================================
   【层级学谁、表达不学谁】借的只是"左边分类、右边一张张看得出笔形的卡"这个**功能层级**；
   笔迹预览是我们自己的渲染器 `renderBrushLayer` 现画的一条 S 形线，命名/图标/配色全是自己的
   （强调色只用于"当前这一支"，不做那种蓝色描边）—— 没有取用他人素材。
   ========================================================================== */
.brush-lib { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; margin: 6px 0 10px; }
.brush-lib .bl-cats { display: flex; flex-direction: column; gap: 2px; }
.brush-lib .bl-cat {
  text-align: left; padding: 6px 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
}
.brush-lib .bl-cat:hover { color: var(--text); background: var(--surface-hover); }
.brush-lib .bl-cat.on { background: var(--surface-hi); color: var(--text); }
.brush-lib .bl-cards { display: flex; flex-direction: column; gap: 6px; max-height: 312px; overflow-y: auto; }
.brush-lib .bl-card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 8px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--sunken); cursor: pointer; text-align: left; font: inherit;
}
.brush-lib .bl-card:hover { border-color: var(--line-2); }
.brush-lib .bl-card.on { border-color: var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.brush-lib .bl-card canvas { grid-column: 1 / -1; width: 100%; height: 32px; display: block; }
.brush-lib .bl-name { font-size: 12px; color: var(--text); }
.brush-lib .bl-num { font: 11px/1.4 "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.brush-lib .bl-empty { margin: 0; padding: 6px 2px; color: var(--muted-2); font-size: 11.5px; }

/* ============================================================================
   两处收尾（2026-10-11 用户报）
   ============================================================================
   ①【左素材栏的收起要跟右栏一模一样】原来左边是头部一颗写着「收起」的文字按钮，
     右边是贴在面板边缘的一条竖把手 —— 两边的"收起在哪"手感不一致，用户找不到。
     现在左边也做成同样的竖把手（数字都一样：11×44、贴边 11px、圆角同侧、只留箭头）。
   ②【笔刷 UI 重复】六支笔那一排和笔刷库的分类在选同一件事。做法：**库是唯一看得见的选择器**，
     那排按钮**退出视野但保留布局**（`position:absolute; visibility:hidden`）——
     它是"内置笔"那条路的唯一实现（笔刷库点卡走的就是它），也是既有回归量尺寸的对象，
     所以不能删；但用户不该再看到两套。
   ========================================================================== */
@media (min-width: 821px) {
  /* 【为什么不能用 relative 给把手当定位父级】`_diag-ui` 有一条断言钉着
     "电脑端素材工作区在左侧（静态定位，不浮动）" —— 素材栏必须是 static。
     所以把手自己 `position: fixed` 贴到素材栏的右边缘。
     【起点是 48px 不是 0】工具轨在素材栏**左边**（`diag-rail` 钉着"轨在最左一列"），
     所以素材栏实际是 48 → 268；早先写 `calc(220px - 11px)` 少算了这 48px，
     把手落进了素材栏内部（用户报的"位置不对"就是这个）。
     CSS 这里只给个初值，真正的坐标由 JS 按实时几何贴（见 app.js 的 syncAssetsFoldPos）。
     【往哪儿贴】贴着素材栏那条边线**往外探**：右栏那条把手是骑在面板边线上的（占 `[线-10, 线+1]`），
     左边镜像过去就是 `[线-1, 线+10]` —— 所以起点取 `right - 1`（不是 `right - 11`，那样整条都在面板里面）。 */
  .assets-fold {
    display: flex; align-items: center; justify-content: center;
    position: fixed; left: calc(48px + 220px - 1px); top: 50%; margin-top: -22px;
    width: 11px; height: 44px; padding: 0; font-size: 0;      /* 文字收掉，只留那颗箭头 */
    border: 1px solid var(--line); border-left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    /* 【z-index 必须压过 mm 标尺（63）】这条 11px 的收起把手正好贴在新加的 Left 标尺边上；
       标尺要能拖，但这颗按钮也得点得中 —— 它只有 44px 高的一条，盖不住多少刻度。 */
    background: var(--panel-2); color: var(--muted); cursor: pointer; z-index: 67;
  }
  .assets-fold:hover { color: var(--text); background: var(--panel-3); }
  .assets-fold .ico { width: 12px; height: 12px; }
  /* 【桌面去重：吸管只留一个入口】顶栏那颗 #pickColorBtn 和左轨「取色」是**同一颗按钮**
     （左轨那颗内部就是点它，状态也是同一份），桌面端两处都摆着就显得重复。
     桌面只留左轨那颗（键盘 I 也在那儿）；手机端（≤820px）照旧显示 —— 那边左轨/右栏
     都收进底部 sheet，顶栏是唯一够得着的取色入口（diag-draw-tools 那条 ≥44px 断言就是钉它的）。 */
  #pickColorBtn { display: none; }
}

/* ============================================================================
   浮窗可调大小（2026-10-12 用户要）
   ============================================================================
   【为什么用原生 resize】一行 CSS 就有得体的拖角、光标与最小尺寸行为，
   不用自己写一套拖拽（少一份要维护的交互、少一处和 float-panel 抢鼠标的地方）。
   【为什么限死上下限】太小看不见内容、太大把画布盖光；配合已有的贴边吸附才不会失控。
   【尺寸暂不记忆】刷新后回到默认宽 —— 要"记住尺寸"得往 float-panel 那条记录里加两个字段（下一步）。
   ========================================================================== */
@media (min-width: 821px) {
  /* 【下限只给"展开中"的浮窗】收起时它应该只剩一条标题（~46–68px）；
     给基类加 min-height 会把收起的浮窗顶到 140px，实测被 diag-panel 逮到「收起后只剩一条标题」失败。 */
  #panel details.card.floating { resize: both; overflow: auto; }
  #panel details.card.floating[open] { min-width: 240px; min-height: 140px; max-width: 78vw; max-height: 85vh; }
}
/* 六支笔那一排：退出视野、保留布局（绝对定位，不在面板里留空档） */
.brush-grid { position: absolute; visibility: hidden; }

/* ③ 每段最多一颗主按钮：其余降级成 ghost（细边框、无填充）——116 颗同权按钮是"乱"的大头。
      真正的主行动（.primary）保持填充不变。 */
.card .row button:not(.primary):not(.on),
.card > .wide:not(.primary) {
  background: transparent; border-color: var(--line); color: var(--muted);
}
.card .row button:not(.primary):not(.on):hover,
.card > .wide:not(.primary):hover { color: var(--text); border-color: var(--line-2); }
.card .row button.on,
.card .row button[aria-pressed="true"] { border-color: var(--accent-dim); color: var(--accent-hi); }

input[type="number"], select {
  background: var(--sunken);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  padding: 5px 7px;
  font: inherit; font-size: 12px;
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}
input[type="number"]:hover, select:hover { border-color: var(--line-strong); }
input[type="number"]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select { appearance: none; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 12px, calc(100% - 8px) 12px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
input[type="color"] { border-radius: var(--radius-xs); background: var(--sunken); border: 1px solid var(--line-2); }
input[type="color"]:disabled { opacity: .35; }

/* 子面板：左侧一道 2px 细条表示"管的是哪个对象"（颜色对齐列表里的标签色） */
.plane-box { border-left: 2px solid var(--tag-persp); background: var(--surface-hi); border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.fade-box, .shadow-box { border-left: 2px solid var(--line-2); }

/* ---------------------------------------------------------------- 文字图层 */
/* 和 .plane-box 一个形状（都是"图层的一个专属设置块"），只是颜色区分：琥珀 = 文字。 */
.text-box {
  margin-top: 8px;
  padding: 8px 9px 6px;
  border-left: 2px solid var(--tag-text);
  background: var(--surface-hi);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  display: grid; gap: 6px;
}
.text-box .slider { margin: 4px 0; }
.text-box .row-inline { margin-top: 0; }
/* 内容输入框占满一行：中文一句话十几个字，窄了只看得见开头两个 */
.text-box .row-inline input[type="text"] { flex: 1; min-width: 0; }
.text-row { align-items: center; flex-wrap: nowrap; }
.text-row .text-font { flex: 1; min-width: 0; margin-top: 0; }
.text-row select { max-width: 100%; }
.text-box .tip { margin: 0; }
/* 【高度钉死】提示有长有短（"够得到板框外"那条特别长），不钉死的话下面的卡片会跟着窜位。 */
#textWarn { min-height: 34px; overflow: hidden; }

/**
 * 【[hidden] 必须显式打赢 display:grid】和文件上面 `.row[hidden]` 那一条是同一个坑：
 * `[hidden]` 在 UA 样式表里只有 `display:none`，而作者样式里的 `display:grid/flex`
 * **优先级更高**，于是"加了 hidden 的元素照样看得见"。
 * 这四个子面板都是"按当前选中的图层出现/消失"，漏掉任何一条都会出现
 * "选中文字图层，右栏却还挂着透视辅助线/渐变滑块"这种一眼就怪的画面。
 */
.plane-box[hidden], .text-box[hidden], .fade-box[hidden], .shadow-box[hidden] { display: none; }

/* ============================================================ 画笔系统
   「画笔」那一段是**按需出现**的（没建画笔图层时整段 hidden），所以这里的样式只影响
   用到画笔的用户 —— 没用到的时候右栏和以前一个像素都不差。

   【[hidden] 那一条又是必须的】下面给 #paintBrushCard 的滑块写了 display:grid，
   同文件里这个坑已经踩过三次（.row / .plane-box / .float-reset），所以显式压一条。 */
#paintBrushCard[hidden] { display: none; }
#paintBrushCard .slider { grid-template-columns: 58px minmax(0, 1fr) 60px; margin: 6px 0; }
/* 提示两行封顶：卡片高度恒定，下面的卡片才不会跟着窜位 */
#paintBrushCard .tip { min-height: 34px; overflow: hidden; }

/* 六支笔：一排 3 个（手机上手指够得着），每个 ≥44px 高 */
.brush-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 8px;
}
.brush-grid > button {
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.brush-grid > button[aria-pressed="true"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #eafff6;
}

/* 自定义笔刷预设：一颗一个，超宽换行 */
.brush-presets {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 0;
}
.brush-presets:empty { display: none; }
.brush-presets > button {
  min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.brush-presets > button .swatch {
  width: 13px; height: 13px; border-radius: 999px;
  border: 1px solid var(--line-2);
  flex: 0 0 auto;
}
.brush-presets > button .rm {
  color: var(--muted-2);
  padding: 0 2px;
  font-size: 14px; line-height: 1;
}

/* ============================================================ 形状工具
   「形状」那一段和画笔段同一个规矩：**按需出现**（没建形状图层时整段 hidden），
   所以这里的样式只影响用到形状的用户 —— 没用到的时候右栏和以前一个像素都不差。
   【[hidden] 那条又是必须的】下面给滑块写了 display:grid，不加这条 hidden 就压不住（同文件踩过三次）。 */
#shapeCard[hidden], #symmetryCard[hidden], #referenceCard[hidden] { display: none; }
#shapeCard .slider, #symmetryCard .slider, #referenceCard .slider {
  grid-template-columns: 58px minmax(0, 1fr) 60px; margin: 6px 0;
}
/* 提示两行封顶：卡片高度恒定，下面的卡片才不会跟着窜位 */
#shapeCard .tip, #symmetryCard .tip, #referenceCard .tip { min-height: 34px; overflow: hidden; }

/* ============================================================ 沉金橡皮
   和形状/画笔段同一个规矩：**按需出现**（没进沉金这条路时整段 hidden），
   所以没用到的时候右栏和以前一个像素都不差。
   【[hidden] 那条又是必须的】下面给滑块写了 display:grid，不加这条 hidden 就压不住（同文件踩过三次）。 */
#goldEraseCard[hidden] { display: none; }
#goldEraseCard .slider { grid-template-columns: 58px minmax(0, 1fr) 60px; margin: 6px 0; }
#goldEraseCard .tip { min-height: 34px; overflow: hidden; }
/* 多边形的"边数/旋转"跟着类型显隐（同样的 [hidden] 坑） */
.shape-poly[hidden] { display: none; }

/* ============================================================ 参考图浮窗
   它**不在右栏里**（`#refPanel` 是 body 的直接子节点），所以 base 样式要自带一份 ——
   右栏那些段的基础样式挂在 `#panel .card` 上，这里够不着。
   而"浮起来长什么样"（fixed/宽度/阴影/44px 标题栏）**复用** .card.floating 那一套，
   由 ui/float-panel.js 加类 —— 一份 CSS 管两种浮窗，不重写第二套。 */
details.card.ref-panel {
  position: fixed;
  z-index: 40;                    /* 压在画布上，但不挡右栏弹窗（那些是 100+） */
  width: 320px;
  max-height: calc(100vh - 90px);
  overflow: hidden auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 0 10px 10px;
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .75);
}
details.card.ref-panel[hidden] { display: none; }
/* 段头带（= 拖拽把手）：在浮窗里是 44px 高，触屏也够得着 */
details.card.ref-panel > summary {
  position: sticky; top: 0; z-index: 2;
  min-height: 44px;
  margin: 0 -10px 8px;
  padding: 0 0 0 10px;
  gap: 6px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background: var(--panel-2);
  cursor: grab;
}
details.card.ref-panel > summary:active { cursor: grabbing; }
details.card.ref-panel > summary::after { display: none; }
details.card.ref-panel > summary em { max-width: 45%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 抓手圆点（和右栏浮窗同一个记号，用户一眼知道"这块能拖"） */
details.card.ref-panel > summary::before {
  content: ''; flex: none;
  width: 12px; height: 14px;
  background-image: radial-gradient(currentColor 1.1px, transparent 1.2px);
  background-size: 6px 5px;
  opacity: .55;
}
/* 浮窗里那两颗按钮（收起 / 放回）本来就是 44×44 —— 这一档必须显式给，别处那条挂在 #panel 上 */
details.card.ref-panel .float-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
details.card.ref-panel .float-btn:hover { background: var(--surface-hi); color: var(--text); }
details.card.ref-panel .float-btn .ico { width: 17px; height: 17px; }
.ref-box { position: relative; display: grid; place-items: center; min-height: 80px; }
/* 【object-fit: contain】参考图不能变形（变形就没法照着描了）；缩放走 transform，不重排 */
.ref-box img { max-width: 100%; max-height: calc(100vh - 180px); object-fit: contain; transform-origin: center; display: block; }
.ref-box img:not([src]) { display: none; }
.ref-empty { margin: 8px 0; }
.ref-tools {
  position: absolute; right: 4px; bottom: 4px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #eafff6;
  font-size: 11px; line-height: 18px;
}
.ref-tools[hidden] { display: none; }

/**
 * 笔刷预览圈：**光标处一个圈**，直径 = 笔的 mm × 8px/mm × 当前缩放。
 * 【为什么是 fixed 定位的 div、不是画布上的对象】fabric 对象会进 `canvas.getObjects()`，
 * 命中判定、框选、混合层的"哪些算层内容"、导出探查全都得为它写例外；
 * 一个 fixed 的 div 不碰任何一处，也**永远漏不进导出**（它在画布外面）。
 * `pointer-events:none` 保证它绝不抢指针事件。 */
#brushCursor {
  position: fixed; z-index: 40;
  border: 1px solid rgba(255, 255, 255, .92);
  outline: 1px solid rgba(0, 0, 0, .45);   /* 内外各一道：白底和黑底上都看得见 */
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, .35);
  transition: width .06s linear, height .06s linear;
}
#brushCursor[hidden] { display: none; }

/* ---------------------------------------------------------------- 弹窗（平面） */

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow: auto;
  background: var(--overlay-bg);
}
.modal[hidden] { display: none; }
.sheet {
  position: relative;
  width: min(100%, 470px);
  max-height: 90vh;
  overflow: auto;
  padding: 17px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  box-shadow: var(--shadow-3);
  animation: sheetIn var(--t-slow) both;
}
.sheet.wide-sheet { width: min(100%, 880px); }
.sheet h2 { margin: 0 0 13px; font-size: 14px; letter-spacing: .3px; }
.cut-stage {
  display: flex; justify-content: center;
  border-radius: var(--radius-xs); border-color: var(--line-2); background: var(--sunken);
}
/**
 * 【画布必须能"整个装进视口"】它是框选的操作面：比视口还高的话，
 * 拖动到下半截会落到视口外面（mouse.up 收不到），框就永远画不出来。
 * 所以宽高都留 auto + 两条 max 约束（保持原比例），而不是 width:100%（会被 max-height 压扁）。
 */
.cut-stage canvas {
  display: block;
  width: auto; height: auto;
  max-width: 100%; max-height: 56vh;
  touch-action: none; cursor: crosshair;
}

/* ---------------------------------------------------------------- 工具演示（2026-10-18）
   独立演示画布：只是一张 <img> 在按帧换，不碰 fabric、不碰用户 doc。
   ≤820px 铺满（手机上也能看清）；桌面 880×自适应，帧按 3:2 显示。 */
.demo-modal { padding: 16px; }
.demo-box {
  position: relative;
  width: min(100%, 900px);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: sheetIn var(--t-slow) both;
}
.demo-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.demo-head b { font-size: 13.5px; }
.demo-sub { color: var(--muted); font-size: 11.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-head #demoClose { margin-left: auto; flex: none; min-height: 36px; }
.demo-stage {
  position: relative;
  background: var(--sunken);
  display: flex; align-items: center; justify-content: center;
  min-height: 0; flex: 1 1 auto;
  overflow: hidden;
}
.demo-stage img {
  display: block;
  width: 100%; height: auto;
  max-height: min(72vh, 640px);
  object-fit: contain;
  background: var(--sunken);
}
.demo-label {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(6, 20, 16, .82);
  border: 1px solid var(--line);
  color: #eafff6;
  font-size: 11.5px;
  pointer-events: none;
}
.demo-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px 11px;
  border-top: 1px solid var(--line);
}
.demo-caption { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--text); }
.demo-dots { display: inline-flex; gap: 5px; flex: none; }
.demo-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line-2); display: block;
}
.demo-dots i.on { background: var(--accent); }
@media (max-width: 820px) {
  .demo-modal { padding: 0; align-items: stretch; }
  .demo-box { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .demo-stage img { max-height: none; height: 100%; }
  .demo-head #demoClose { min-height: 44px; }
}

/* ---------------------------------------------------------------- 工具市场 */

/* 顶栏那个入口上的"装了几个" */
#toolCount { color: var(--muted-2); font-size: 11px; margin-left: 6px; }
#toolCount:empty { display: none; }

.market-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.market-bar input[type="search"] {
  flex: 1 1 220px; min-width: 0;
  background: var(--sunken); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  padding: 6px 9px; font: inherit; font-size: 12.5px;
}
.market-bar input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.market-cats { display: flex; gap: 4px; flex-wrap: wrap; }
.market-cats .chip {
  padding: 4px 10px; font-size: 11.5px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.market-cats .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text-strong); }

.market-list { display: flex; flex-direction: column; gap: 7px; max-height: min(56vh, 460px); overflow-y: auto; padding-right: 2px; }
.market-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel);
}
.market-item.on { border-color: var(--accent); background: var(--accent-soft); }
.market-item .mi-ico { margin-top: 2px; color: var(--muted); }
.market-item.on .mi-ico { color: var(--accent); }
.mi-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mi-meta b { font-size: 12.5px; font-weight: 600; }
.mi-sub { font-size: 10.5px; color: var(--muted-2); }
.mi-sum { font-size: 12px; color: var(--muted); }
.mi-steps { font-size: 10.5px; color: var(--muted-2); }
/* 新手三段（2026-10-17）：什么时候用 / 它做什么；同义词命中时那句"因为 XX 匹配" */
.mi-when { font-size: 12px; color: var(--text); }
.mi-does { font-size: 12px; color: var(--text); }
.mi-why { font-size: 10.5px; color: var(--accent); }
.market-item > button { flex: none; }

/* 工具市场每行的点赞 / 评论（和广场一个手势：一人一票、点一下取消） */
.mi-acts { flex: none; display: flex; align-items: center; gap: 4px; }
.mi-like, .mi-cmt {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 3px 7px; border-radius: 999px; font: inherit; font-size: 11.5px;
}
.mi-like:hover, .mi-cmt:hover { background: var(--surface-hi); color: var(--text); }
.mi-like.on { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.mi-like.on .ico { fill: color-mix(in srgb, var(--danger) 24%, transparent); }
.mi-cmt.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.mi-like .ico, .mi-cmt .ico { width: 14px; height: 14px; }
/* 「看它怎么用」：市场行里那颗小按钮（独立演示画布，不动用户稿） */
.mi-demo {
  flex: none;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.mi-demo:hover { color: var(--text); background: var(--surface-hi); border-color: var(--line-2); }
.tool-card .row > .tool-demo { flex: 0 0 auto; }

/* 展开的评论区：挂在那一行下面，和列表同宽 */
.tool-cmts {
  margin: -3px 0 5px 0; padding: 9px 11px;
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--panel-2);
  display: flex; flex-direction: column; gap: 6px;
}
.tc-head { font-size: 11.5px; color: var(--muted-2); }
.tc-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.tc-who { flex: none; font-size: 11px; color: var(--muted-2); }
.tc-txt { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.tc-del { flex: none; padding: 2px 5px; }
.tc-del .ico { width: 13px; height: 13px; }
.tc-form { display: flex; gap: 6px; }
.tc-form input { flex: 1 1 auto; min-width: 0; }

/* 装到右栏的工具卡片：沿用 .card 那套（发丝线分段），只把"运行"那颗按钮强调出来 */
.tool-card > summary .h3-ico { color: var(--accent); }
.tool-card > .tip { margin-top: 0; }
/* 工具卡上的「什么时候用 / 它做什么」（2026-10-17）：两行短句，排在长说明前面 */
.tool-aim { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 2px; }
.tool-aim .tip { margin: 0; font-size: 12px; color: var(--text); }
.tool-card .row > button:first-child { flex: 1 1 auto; }
.tool-card .row > button:last-child { flex: 0 0 auto; }
.tool-card .tip.warn { color: var(--warn); }

/**
 * 工具卡片的控件一行一个：数字框和下拉都靠右，和滑块的读数对齐
 * —— 一排看下来右边是一条线（左边标签、右边取值），像工程软件，不像表单。
 */
.tool-card .row-inline { justify-content: space-between; }
.tool-card .row-inline > span:first-child { color: var(--muted); }
.tool-card .row-inline .ip { display: flex; align-items: center; gap: 4px; }
.tool-card .row-inline .ip .u { font-style: normal; color: var(--muted-2); font-size: 11px; min-width: 14px; }
.tool-card .row-inline input[type="number"] { text-align: right; }
.tool-card .row-inline select { max-width: 132px; }
/* 装卸时有轻微的状态变化提示（不做入场动画：面板重画会重播） */
.market-item.on > button { opacity: .9; }

/* ---------------------------------------------------------------- 主题开关 / 移动端 / FAB */

/* 主题按钮：图标表示"切过去会变成什么"（当前暗 → 显示太阳） */
#themeToggle svg.lucide { width: 15px; height: 15px; }

.fab {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  font-weight: 600; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
@media (max-width: 820px) {
  .assets-toggle { display: inline-flex; padding: 6px 10px; }
  .panel { border-radius: 10px 10px 0 0; }
  .grip span { width: 40px; height: 3px; border-radius: 2px; background: var(--line-2); }
  /**
   * 【手机上的画笔参数要"做大"】手指点滑块比鼠标难得多：滑块轨加高、拇指放大、
   * 字号提一档。这是用户点名过的硬标准（≥44px）在画笔这一段的落地。
   * 六支笔本来就是一排 3 个 × 44px，手机上不挤。
   */
  #paintBrushCard .slider { grid-template-columns: 62px minmax(0, 1fr) 64px; margin: 10px 0; font-size: 13px; }
  #paintBrushCard .slider input[type="range"] { height: 44px; }
  /* 拇指也跟着做大（26px 的圆点），margin-top 要重算才能落在 4px 的轨上居中 */
  #paintBrushCard .slider input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  #paintBrushCard .row > button { min-height: 44px; }
  #paintBrushCard .row-inline input[type="color"] { width: 44px; height: 44px; }
  #paintBrushCard .tip { min-height: 46px; font-size: 12.5px; }
}

/* ======================================================== 工具卡片的「浮动外壳」
   右栏每一段都能拖出去变成一块浮窗（拖动把手 = 它自己的段头带）、拖到窗口四边吸附贴边、
   收起到只剩一条标题、位置记在 localStorage 里，另有一颗全局「复位」回到经典布局。
   逻辑在 src/ui/float-panel.js，这里只管长相。

   【为什么整套浮动规则都关在 min-width:821px 里】
   ≤820px 的右栏是「底部 sheet」，`.panel` 在那套媒体查询里是 `position: fixed` + `transform`。
   有 transform 的祖先会变成 fixed 后代的**包含块**（顺手还会裁掉它），浮动卡片在那儿必然是坏的。
   与其在 JS 里到处判断，不如让样式根本不存在 —— 小屏连这套规则都匹配不上，出事都出不了。
   【为什么面板态一像素都不变】`.float-btn` 默认 `display:none`，不参与段头带那个 flex 行；
   段头带的高度/宽度/底色和改动前完全一样（这正是回归脚本量的那些数）。
   【为什么复位按钮要显式写 [hidden]】作者样式里只要出现 `display`，浏览器默认的
   `[hidden]{display:none}` 就被盖掉了 —— 这个坑在本文件里已经踩过三次（见 .plane-box 那几处）。
   ================================================================ */

.float-btn { display: none; }
.float-reset[hidden] { display: none; }

/* 吸附提示线：拖到离窗口边 ≤24px 时贴在那条边上亮起来 */
#floatSnap {
  position: fixed; z-index: 55; pointer-events: none; opacity: 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  border-radius: 2px;
  transition: opacity .1s linear;
}
/* 拖动中：不管鼠标滑到哪儿，光标都保持"抓着"的样子 */
body.float-dragging, body.float-dragging * { cursor: grabbing !important; user-select: none; }

/**
 * 全局「复位工具布局」：**只在有东西浮着/贴着的时候才出现**。
 * 常驻一颗按钮就等于改了默认布局 —— 藏起来时才满足"没拖过 = 和以前一模一样"。
 * 摆在右栏左边、画布右下角：不压中间的提示气泡，也不压左栏的素材列表。
 */
.float-reset {
  position: fixed; z-index: 55;
  right: calc(var(--panel-w) + 14px); bottom: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.float-reset:hover { background: var(--accent-dim); color: #eafff6; }
.float-reset .ico { width: 15px; height: 15px; color: var(--accent); }
.float-reset:hover .ico { color: inherit; }

@media (min-width: 821px) {
  /* 段头带就是拖拽把手。光标给个"能抓"的暗示 —— 不改任何一个像素，
     但用户把鼠标放上去就知道这块能拖（光靠嘴说"能拖"没人找得到）。 */
  #panel .card > summary { position: relative; cursor: grab; }
  #panel .card > summary:active { cursor: grabbing; }

  /**
   * 【44px 这件事怎么在不改布局的前提下满足】段头带本身只有 34px 高 —— 撑到 44px 会让
   * 右栏凭空多出 9×10=90px 的滚动，那正好违反"没拖过就一模一样"。所以**只把命中区撑大**：
   * 上下各 8px，全落在本来就空着的地方（上一张卡片 12px 的 padding-bottom、
   * 这一张段头带 10px 的 margin-bottom），一个像素的渲染都不动，命中高度 ≥50px。
   * 【为什么用伪元素而不是加真节点】伪元素不参与 flex 行、不进无障碍树，天生"零布局影响"；
   * 浏览器命中它时回报的就是 summary 本人，所以点它照样收/展、按它照样拖。
   * 【为什么只对没浮起来的生效】浮窗里段头带本来就是 44px，而且那个 ::before 要留给抓点。
   */
  .card:not(.floating) > summary::before {
    content: '';
    position: absolute; left: 0; right: 0; top: -8px; bottom: -8px;
  }

  /* 拖到一半时窗口失焦、或者上一次的 pointerup 没送到，都会留下一个悬挂的 drag ——
     指针一回到卡片上就显示抓手（这是"这块能拖"的唯一提示，嘴上说没人找得到）。
     【为什么用 :not(.floating) 写两遍】上面那条 `#panel .card > summary` 是拖动那次改动的既有样式，
     `#refPanel` 不在 #panel 里，得自己说一遍；右栏那些段命中这一条时和上面那条完全等价（同样不进布局）。 */
  .card:not(.floating) > summary { position: relative; cursor: grab; }
  .card:not(.floating) > summary:active { cursor: grabbing; }

  .card.floating {
    position: fixed;
    left: 0; top: 0;                 /* 真坐标由 float-panel.js 写 inline */
    width: var(--panel-w);
    max-height: calc(100vh - 16px);
    overflow: hidden auto;           /* 内容比屏幕高时自己滚；横向一律不滚（负 margin 通栏会差 1px） */
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    padding: 0 12px 12px;
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .75);
    /**
     * 【为什么要把 .idle 的半透明顶掉】`.card.idle`（当前这一层没内容，这段工具暂时用不上）
     * 是 `opacity:.55`。在右栏里它衬的是面板底色，看得出"淡了"；飞到画布上就变成**半透明浮窗**，
     * 底下的图直接透上来，字都糊了 —— 看着像渲染坏了。浮窗里改用虚线边表示同样的意思，
     * 实心背景保底：浮在什么上面都得看得清。
     * （同权重看源码顺序，这条写在 .card.idle 后面才盖得住，别往上挪。）
     */
    opacity: 1;
  }
  .card.floating.idle { border-style: dashed; border-color: var(--line-2); }
  /**
   * 【参考图浮窗也吃这一套】`#refPanel` 不在 #panel 里，所以按类补一次：
   * fixed + 隐藏滚动 + 实心底 + 阴影 —— "浮在画布上"的样子只有一份定义，不写第二套。
   * 【为什么不再写一遍 left/top:0】ref-panel 那份 base 里就是 fixed，坐标由 float-panel.js 写 inline。
   */
  details.card.ref-panel.floating {
    position: fixed;
    left: 0; top: 0;
    width: var(--panel-w);
    max-height: calc(100vh - 16px);
    overflow: hidden auto;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    padding: 0 12px 12px;
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .75);
    opacity: 1;
  }
  details.card.ref-panel.floating > summary { margin: 0 -12px 10px; }
  details.card.ref-panel.floating.snapping {
    box-shadow: 0 0 0 2px var(--accent), 0 18px 50px -12px rgba(0, 0, 0, .75);
  }
  /**
   * 浮窗的段头带 = 44px 高的标题行：左边一排抓点、中间工具名、右边两颗 44×44 的按钮。
   * `position: sticky` 是为了内容超长滚动时**把手不会跟着滚走** —— 不然滚到底就再也拖不动了。
   */
  .card.floating > summary {
    position: sticky; top: 0; z-index: 2;
    height: 44px;
    margin: 0 -12px 10px;
    padding: 0 0 0 10px;
    gap: 6px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
    background: var(--panel-2);
    cursor: grab;
  }
  /* 收起指示换成右边那颗按钮了，那个纯 CSS 小折角在这儿只会打架 */
  .card.floating > summary::after { display: none; }
  .card.floating > summary::before {
    content: ''; flex: none;
    width: 12px; height: 14px;
    background-image: radial-gradient(currentColor 1.1px, transparent 1.2px);
    background-size: 6px 5px;
    opacity: .55;
  }
  /* 浮窗段头带右边要让出两颗 44px 的按钮，作用域那行小字得能真的缩下来。
     `min-width:0` 是必须的：flex 项默认最小尺寸是 min-content，光给 max-width 挡不住
     （标题一长它就把按钮顶出卡片右边缘）。 */
  .card.floating > summary em { max-width: 40%; min-width: 0; }
  .card.floating .float-btn {
    display: grid; place-items: center;
    width: 44px; height: 44px; flex: none;
    padding: 0; border: 0; border-radius: 0;
    background: transparent; color: var(--muted);
    cursor: pointer;
  }
  .card.floating .float-btn:hover { background: var(--surface-hi); color: var(--text); }
  .card.floating .float-btn .ico { width: 17px; height: 17px; }
  .card.floating > summary .float-back:hover { color: var(--accent); }
  /* 拖到边附近（松手就会吸附）时描一圈 —— 和那条高亮边线一起给"要贴上了"的反馈 */
  .card.floating.snapping {
    box-shadow: 0 0 0 2px var(--accent), 0 18px 50px -12px rgba(0, 0, 0, .75);
  }
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/**
 * 【小屏上的参考图】浮动拖拽那一套在 ≤820px 上是**整套关掉**的（那边是底部 sheet，
 * 见 ui/float-panel.js 的 DESKTOP 判断）。但参考图还是得能看、能收起 —— 所以这里给它
 * 一个"贴满宽度的一条"：位置固定、不参与拖动，标题栏那颗收起按钮照样管用（44px）。
 * 【为什么不干脆隐藏】手机上看参考图恰恰是最需要的场景（对着屏幕描）。
 */
@media (max-width: 820px) {
  details.card.ref-panel {
    left: 8px; right: 8px; width: auto;
    top: 60px;
    max-height: 46vh;
  }
  details.card.ref-panel .float-btn { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/**
 * 页脚（ICP 备案号 + 协议入口）。
 *
 * 【为什么是 #app 里的一条 flex 子项，而不是 <body> 末尾的一块】
 * `#app` 是 `height: 100%` 的纵向 flex（body 不滚动），把页脚放在 #app **外面**
 * 它就永远待在视口下方 —— 等于没显示。而"网站底部必须展示备案号"是硬要求，
 * 监管抽查时看不到就是没有。所以它必须是 #app 的最后一个 flex 子项（flex: 0 0 auto，
 * 只吃掉大约一行的高度），这样任何视图（编辑器 / 成品稿 / 广场）下它都在屏幕底部。
 *
 * 【为什么字号压到 11.5px】这是"看得见但不抢戏"的一行：它要可读、可点，
 * 但不该把画布挤掉太多（这一行整体高度约 26px）。
 */
.appfoot {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px 12px;
  padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0px));
  font-size: 11.5px; line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.appfoot a { color: var(--muted); text-decoration: none; }
/*
 * 页脚那枚商标（index / legal / 404 三处页脚共用这一条）。
 * 【为什么是 inline 的图而不是 flex 子项】页脚是 flex 容器，把图直接当子项会把
 * "© 2026 共想章-绘"这行文字和图拆成两列（多一个 gap），所以图放在 <span> 里当行内图。
 * 【为什么用 vertical-align 而不是 transform】行内图文对齐靠 vertical-align 最稳，
 * 微调 -0.6em 是因为中文没有下伸部、图片会看着偏高。
 * 【为什么垫商标深蓝 + 白线版】页脚底色跟着主题走（深 / 浅都有）。白线图形在浅底上、
 * 深线图形在深底上都会被吞掉，而**白线 + 深蓝底**两头都看得见 —— 而且深蓝就是商标自己的色。
 * 图里自带约 1/4 的安全边距，所以给 26px 的框，观感约等于 20px 的实心块。
 */
.appfoot img.foot-logo {
  height: 26px; width: 26px; background: #0c1922; border-radius: 5px;
  vertical-align: -.6em; margin-right: 5px;
}
.appfoot a:hover, .appfoot a:focus-visible { color: var(--text); text-decoration: underline; }
/* 手机上把链接行留足，但别换行成三行（换行了会顶掉画布高度） */
@media (max-width: 820px) {
  .appfoot { gap: 2px 10px; font-size: 11px; }
}

/**
 * 窄屏（手机/窄窗口）整条工具栏隐藏。
 * 【为什么不改成横排贴在顶栏下面】手机构图本来就紧（上面顶栏 + 下面抽屉 + 画布），
 * 再挤一条 48px 的横条就把画布压扁了；而手机端本来就有「工具」抽屉这条路（#fab）。
 * 桌面端才是"左边一竖排"这套肌肉记忆的主场。
 */
@media (max-width: 820px) {
  .tool-rail { display: none; }
}

/* ============================================================================
   图层行（按手绘稿重排，2026-10-11）
   结构：[缩略图] [眼睛] [锁] 名字 [映射▾] [⋯] [×]
   · 缩略图 = **这一层现在的图**（用户："把当前图层里的图显示在上面"）
   · 「⋯」里放：沉金 / 复制图层 / 上移 / 下移
   · 板框层只有 [框] [眼睛] 名字
   ============================================================================ */
.layer-item { position: relative; }

.thumb {
  flex: 0 0 auto;
  /* 【2026-10-17 P1】40 → 32：行高要压到 44，缩略图是行里最高的一块；32 还看得清内容。 */
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sunken, #0d1b17);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  line-height: 1;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.plain { font-weight: 600; }

.menu-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.menu-btn:hover { border-color: var(--line); background: var(--surface-hi); color: var(--fg); }
.menu-btn.on { border-color: var(--accent); color: var(--accent); }
/* 这一层开过混合时，行内只留一个金色小点（P1：下拉收进菜单后，状态仍然一眼能看出来） */
.menu-btn.blend-on { position: relative; color: var(--gold); }
.menu-btn.blend-on::after {
  content: ''; position: absolute; right: 2px; top: 2px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--gold);
}

.menu-pop {
  position: absolute;
  right: 22px;
  top: 26px;
  z-index: 30;
  min-width: 150px;                 /* 多了「混合模式 + 下拉」一行 */
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #0f1f1a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu-item {
  text-align: left;
  padding: 5px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover { background: var(--surface-hi); }
.menu-item.on { color: var(--gold, #ffd76a); font-weight: 600; }
/* 菜单里的「混合模式」一行（P1：从行内收进来的下拉） */
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px;                 /* 菜单里的可点行也 ≥44 */
  padding: 5px 8px;
}
.menu-row > span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.menu-row .blend-sel { height: 32px; max-width: 92px; font-size: 11.5px; }

/* ============================================================================
   手机端触控目标 ≥44×44（2026-10-12）
   ============================================================================
   【量出来的问题】390×844 下 96 个可点元素里 **93 个**不到 44：顶栏按钮 33~34px、
   段标题 `summary` 33px、开关行 `.chk` 28px、广场按钮 33px（手指点空率高）。
   【为什么原来那条没治好】手机端早有一条 `button { min-height: 44px }`，
   但它是**元素选择器**（特异性 0,0,1）—— 被 `.topbar button{...}`、`.card > summary` 这类更具体的规则压住了。
   【为什么写在这里】同特异性的规则**后写的赢**：放在样式表最末尾，才压得住前面那一堆；
   只列这四类（顶栏 / 段标题 / 开关行 / 广场主按钮），不做全局 `button` 一刀切 ——
   免得把市场卡片、抽屉里那些本来就够大的控件也一起改变节奏。
   ========================================================================== */
@media (max-width: 820px) {
  .topbar button, .topbar summary, .topbar select,
  #panel .card > summary,
  /* 【面板里的按钮】段内的工具按钮（新建图层 / 上移 / 平滑 / 导出…）原来多是 33px ——
     手机上这是**点得最多**的一批，一并拉到 44。
     （输入框刻意不拉：图层名那种"一行一个"的输入框拉到 44 会把图层列表撑得很长，
     而手指真正频繁点的是按钮。） */
  #panel button,
  /* 广场那一排（搜索框旁的分段 / 通知 / 我的 / 回收站 / 上传 / 发布）不在 `#panel` 里，
     得单独点它们的名 —— 它同样是手机上天天点的位置。 */
  .pz-bar button,
  /* 几个"漏网但确实该大"的：提醒条（我加的那条，30px 太矮）、
     素材栏收起、以及 .wide 这种跨栏主按钮。刻意**不**动的：`#grip`（手机端那根本来就是
     44×4 的细横条，靠"细"来避免挡内容）、以及页脚里那些行内文字链接 A。 */
  #buildBar, #assetsFold, button.wide,
  .chk, label.chk,
  button.primary, .pz-like, .side-tabs button { min-height: 44px; }
}

/* ============================================================================
   专注模式（P0-1，2026-10-17）—— 一个键把左右两栏收成 44px 细条
   ============================================================================
   【和「收起」(fold) 的区别 —— 为什么是独立状态，不塞进 fold】
   fold 的语义是"这一栏我不要了"：`display:none` + 屏幕边缘一条 14×44 的拉手，画布照样变宽，
   但它把一栏整个藏掉了。专注的语义是"还在这儿、别占地方"：宽度过渡到 44px，图标照旧能点，
   点一下就把那一栏放回来并退出专注。两套状态互不干扰 —— fold 的类、记忆、CSS 一行没动，
   这里只是在 body 上多挂一个 `focus-on`（默认不加 = 默认布局和以前逐像素相同）。
   【为什么过渡类只在切换那 200ms 存在】`focus-anim` 由 JS 进/出专注时临时加上，
   transitionend（带定时兜底）一响就摘掉并**只**调用一次 stage.fit()+render()（见 app.js 的 setFocus）。
   平时没有这个类，宽度变化就是瞬时的 —— 和以前一样，不会让任何已有流程变慢。
   【为什么只改桌面】≤820px 两栏是左侧抽屉 / 底部 sheet（各占满屏那一套），
   "44px 细条"在那儿没有意义；整块规则关在 min-width:821px 里，移动端一个像素都不变。
   ========================================================================== */

/* 细条本身：默认不存在（不参与布局；对应状态才露出来）。
   专注模式用 #assetsStrip（3 个页签，既定形态不动）；P1 的左栏收起用 #leftStrip（4 入口 + 展开）。 */
.focus-strip, .left-strip { display: none; }
#focusGrp { display: flex; }
#moreGrp { display: none; }          /* P1：只在 <1440 显示（见文件末尾的媒体查询） */

@media (min-width: 821px) {
  /* 过渡：只在切换那一下存在（专注 = 左右都收；左栏自己的收起 = 只收左栏） */
  body.focus-anim .assets,
  body.focus-anim .panel,
  body.left-anim .assets {
    transition: width 200ms cubic-bezier(.2, .8, .2, 1);
  }
  /* 过渡中间栏会短暂比内容窄，先裁掉，别让内容溢到画布上。
     【为什么只裁 .assets】`.panel-scroll` 本来就是 overflow:auto（自己会裁）；
     `.panel` 上再加 hidden 会把左边缘那条 11px 的收起把手一起裁掉。 */
  body.focus-anim .assets,
  body.left-anim .assets { overflow: hidden; }

  body.focus-on .assets,
  body.left-collapsed .assets { width: 44px; }
  body.focus-on .panel { width: 44px; }

  /* ---- 左栏：只剩一条图标条 ----
     两条条互斥：专注模式（focus-on）显示既定的 #assetsStrip；P1 的左栏收起显示 #leftStrip。
     两者同时成立时以专注为准（exit 专注后 left-collapsed 自己会把 4 入口那条露出来）。 */
  body.focus-on .assets > :not(.focus-strip) { display: none; }
  body.left-collapsed:not(.focus-on) .assets > :not(.left-strip) { display: none; }
  body.focus-on .assets .focus-strip,
  body.left-collapsed:not(.focus-on) .assets .left-strip {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    width: 100%; padding: 6px 0;
  }
  .focus-strip-btn {
    /* 44px 的栏宽扣掉边框只剩 43 —— 宽度让到 40，**竖向命中区钉 44**（硬规矩不降）。 */
    width: 40px; height: 44px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; color: var(--muted);
    border-radius: var(--radius-sm);
  }
  .focus-strip-btn:hover { color: var(--text); background: var(--panel-3); }
  .focus-strip-btn .ico { width: 18px; height: 18px; }

  /* ---- 右栏：每一段的段头带本身就是图标条（标题文字收掉、图标留着） ---- */
  body.focus-on .panel > .grip { display: none; }
  body.focus-on .panel > .panel-scroll {
    padding: 8px 0; gap: 2px;
    overflow-x: hidden; overflow-y: auto;   /* 装进来的工具段多了还能滚 */
  }
  body.focus-on .panel .card {
    padding: 0; border: 0; background: transparent; border-radius: 0;
  }
  body.focus-on .panel .card > summary {
    font-size: 0;                     /* 标题文字收掉（图标有显式尺寸，不受影响） */
    flex-direction: column; gap: 0; justify-content: center;
    padding: 9px 0; margin: 0; min-height: 36px;
    background: transparent; border: 0;
  }
  /* 收起/展开的小箭头在 44px 里只会变成噪点：专注模式下它没有意义（点一下整个栏就展开了） */
  body.focus-on .panel .card > summary::after { display: none; }
  body.focus-on .panel .card > summary .ico { width: 18px; height: 18px; }
  body.focus-on .panel .card > summary em,
  body.focus-on .panel .card > summary .badge { display: none; }
  body.focus-on .panel .card > *:not(summary) { display: none; }
  /* 拖到画布上的浮窗 / 细条模式下点开的浮层：专注时都让路（它们本来就是"占地方"的东西） */
  body.focus-on .panel .card.floating { display: none; }
  body.focus-on .panel .card[open] {
    position: static; width: auto; max-height: none; overflow: visible;
    padding: 0; border: 0; background: transparent; box-shadow: none;
  }

  /* 顶栏那颗专注按钮亮着（和全站开关同一个语汇：不是彩色药丸，只是抬起来） */
  body.focus-on #focusBtn { background: var(--accent-dim); border-color: var(--accent); color: #eafff6; }
}

@media (max-width: 820px) {
  /* 手机端不提供专注入口：那儿两栏是抽屉 / 底部 sheet，"44px 细条"没有意义 */
  #focusGrp { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  /* 系统开了"减少动态效果"：不做宽度过渡，JS 的兜底定时器照样收尾（fit+render 各一次） */
  body.focus-anim .assets,
  body.focus-anim .panel,
  body.left-anim .assets { transition: none; }
}

/* ============================================================================
   P1 顶栏窄屏收纳（2026-10-17）—— <1440 把四个次要入口收进「⋯」
   ============================================================================
   【为什么是 1440】1440 是这套界面的"标准桌面宽"：≥1440 一个像素都不变（用户明确要求）。
   <1440 时顶栏本来就会横向滚动（实测 1280 下 scrollWidth 1374），把安装/帮助/通知/主题
   收起来后能回到一屏内，而做谷/导出/交给店主/全清/工具市场这些"干活"的入口全部留在外面。
   【为什么不跟 820px 打架】这条只做"少四个按钮、多一个 ⋯"，不改移动端任何布局规则；
   ≤820px 的顶栏按钮统一 ≥44px 那套照旧生效（.topbar button 那条在文件更前面）。
   ========================================================================== */
@media (min-width: 821px) and (max-width: 1439px) {
  #introBtn, #feedBtn, #themeGrp, #installGrp { display: none !important; }
  #moreGrp { display: inline-flex; }
  /* 批 2：<1440 顶栏已经排满（P1 刚把次要入口收进「⋯」，1280 只剩 22px 余量）——
     新加的 1:1 按钮在这里让位给 Ctrl+1 快捷键，≥1440 有位置时再露出来。 */
  #zoom1Btn { display: none !important; }
  /* <1440 顶栏略微收一收间距（只在桌面断点里，820px 移动端那套一个像素不动）。
     量过：1280 收完仍差 22px 才不横滚，gap 6→3 + padding 10→6 正好补上。
     【按钮/段头不许被挤扁】flex 默认会 shrink，实测 1280 下「导出」被挤成两行（高 52px）——
     钉成 flex:none + nowrap，宁可让顶栏横向滚也不让文字折行。 */
  .topbar { gap: 3px; padding: 0 6px; }
  .topbar button, .topbar summary { flex: 0 0 auto; white-space: nowrap; }
}
@media (min-width: 1440px) {
  #moreGrp { display: none !important; }
}

.topbar-more {
  position: fixed;                 /* .topbar 是 overflow-x:auto，absolute 会被裁掉 */
  z-index: 95;
  min-width: 190px;
  padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .55);
}
.topbar-more[hidden] { display: none; }
.topbar-more button[hidden] { display: none; }   /* 作者 display:flex 会压掉 UA 的 [hidden] */
.topbar-more button {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 12.5px; text-align: left;
}
.topbar-more button:hover, .topbar-more button:focus-visible { background: var(--surface-hi); }
.topbar-more .ico { width: 16px; height: 16px; color: var(--muted); }
#moreBtn { font-size: 16px; line-height: 1; min-width: 44px; min-height: 44px; padding: 0 10px; }

/**
 * 「界面已更新 · 点这里刷新」那条 toast（build-watch.js 注入的 `#buildBar`）。
 * 【为什么必须补这条】它的注入样式是 `#buildBar { display:flex }`（id 选择器）—— 比 UA 的
 * `[hidden]{display:none}` 权重高，于是 `bar.hidden=true` 时它**照样显示**、还盖在弹窗按钮上
 * （实测手机端把「不用了，我知道怎么用」挡到点不动）。这里用 `#buildBar[hidden]` 显式压回去。
 * 这是全站第三次踩同一个坑（.row / #paintBrushCard / .onboard-tip .ob-act），所以写清缘由。
 */
#buildBar[hidden] { display: none !important; }

/* ============================================================================
   手机端体验修整（2026-10-18，task-16）
   ----------------------------------------------------------------------------
   【为什么整块追加在文件最末】这套样式前面有十几段 ≤820px 的旧规则（面板 68vh、
   底栏常驻、页脚换行…），散着改很容易被后写的规则反压。这里用**最后一段 + 更高特异性**
   一次性收口；桌面一行不碰（全部包在 max-width:820px 里）。
   ============================================================================ */

.brand-name { font-weight: 700; }
.grip-label { display: none; }
.sheet-scrim { display: none; }
/* 桌面：这一层盒子"不存在"，里面的子项照旧是 .topbar 的 flex 子项（默认布局逐像素不变） */
.topbar-actions { display: contents; }

@media (max-width: 820px) {
  /* ---------------------------------------------------------------- 顶栏 */
  /* 两行：第一行只放 商标 + 三 tab + ⋯（不滚）；第二行是动作条，可横向滑。
     这样三 tab 永远一行可点，页面也不会被撑宽。 */
  :root { --topbar-h: 100px; }
  .topbar {
    height: 100px;
    flex-wrap: wrap;
    align-content: center;
    row-gap: 2px;
    gap: 4px;
    padding: 2px 6px;
    overflow: visible;
  }
  .topbar > .brand { order: 1; }
  .topbar > #views { order: 2; flex: 0 0 auto; min-width: 0; }
  .topbar-actions {
    order: 4;
    flex: 1 0 100%;
    display: flex; align-items: center; gap: 4px;
    height: 44px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .spacer { display: none; }
  .brand { font-size: 13px; gap: 4px; }
  .brand-logo { height: 18px; width: 18px; }
  /* 三 tab 一行、不收缩成两行；按钮本身 ≥44 */
  #views button { min-height: 44px; padding: 6px 8px; font-size: 12px; flex: 0 0 auto; white-space: nowrap; }
  /* 前进/后退箭头在手机上收起（成品稿切换用下拉 #packPick，顶栏不再挤两个箭头） */
  #packNav { display: none !important; }
  /* 顶栏可点元素统一 44：只加高会在 390 下留一堆 36 宽的图标，这里连宽度一起钉 */
  .topbar button, .topbar summary { min-width: 44px; min-height: 44px; }
  .topbar .seg button { min-width: 44px; }
  /* 1:1 那颗写了 36px（桌面够用），手机端同样拉到 44 */
  .topbar .zoom-1to1 { min-width: 44px; }
  /* 正面/背面：并进第二行动作条的最前面（不做浮层，避免盖住画布/卡片） */
  #sides { flex: 0 0 auto; }
  #sides button { min-height: 44px; min-width: 52px; }
  /* 动作条保持一行：按钮/summary 不折行、不收缩（否则「导出」会变成竖排两个字） */
  .topbar-actions > .grp, .topbar-actions > button, .topbar-actions > details,
  .topbar-actions > .seg { flex: 0 0 auto; }
  .topbar-actions button, .topbar-actions summary { white-space: nowrap; }
  /* 正反面已经有浮层了，画布角上那枚「正面」角标不再重复 */
  #mineView .stage-badge { display: none; }

  /* ---------------------------------------------------------------- 底部 sheet */
  .panel {
    width: auto;                  /* 旧规则后面还有一条 width:344px，这里必须再压一次 */
    left: 0; right: 0;
    max-height: 52vh;             /* 440/844 ≈ 52% —— 不再吃 68% 屏 */
    padding-bottom: 0;
  }
  body.sheet-full .panel { max-height: 86vh; }

  /* 44px 拖拽把手（可下滑收 / 上滑全屏）+ 明确「收起」 */
  #panel .grip {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; min-height: 44px; flex: none;
    cursor: grab; touch-action: none;
    color: var(--muted);
  }
  #panel .grip:active { cursor: grabbing; }
  #panel .grip > span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
  #panel .grip .ico { width: 14px; height: 14px; }
  #panel .grip .grip-label { display: inline; font-size: 12px; font-weight: 500; }
  #panel .panel-scroll { padding-bottom: 18px; }

  /* 遮罩：点一下收起（面板 45 / 遮罩 44 / 顶栏下面开始） */
  .sheet-scrim {
    position: fixed;
    left: 0; right: 0; top: var(--topbar-h); bottom: 0;
    z-index: 44;
    background: rgba(4, 10, 8, .46);
  }
  body.sheet-open .sheet-scrim { display: block; }

  /* 开合让位：sheet 多高，画布容器就矮多少；ResizeObserver 会同步 fabric 尺寸，
     JS 在过渡结束后 fit 一次（卡片完整可见，见 app.js 的 setSheetOpen）。 */
  #mineView { transition: height .2s ease; }
  body.sheet-open #mineView { flex: 0 0 auto; height: calc(100% - var(--sheet-h, 0px)); }
  body.sheet-open #fab { display: none; }

  /* ---------------------------------------------------------------- 底部条 */
  .fab {
    display: block;
    right: 12px;
    bottom: calc(32px + var(--safe-b));   /* 抬到页脚之上，留 12px */
    min-width: 44px; min-height: 44px;
    padding: 10px 16px;
  }
  /* 页脚压成一行小字：保留备案 + 三个协议入口，去掉 © 前缀（帮助里仍有完整版权信息） */
  .appfoot {
    flex-wrap: nowrap;
    gap: 0 8px;
    padding: 3px 8px calc(2px + var(--safe-b));
    font-size: 9.5px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
  }
  .appfoot .foot-copy { display: none; }
  .appfoot img.foot-logo { height: 16px; width: 16px; margin-right: 3px; vertical-align: -.45em; }

  /* 画笔参数条：只在画笔/橡皮激活时出现（app.js 把当前工具写到 body[data-tool]），
     位置抬到 FAB 上方；sheet 打开时收起（避免盖在面板上）。 */
  #brushBar { display: none; left: 8px; right: 8px; bottom: calc(84px + var(--safe-b)); min-height: 44px; }
  body[data-tool="brush"] #brushBar,
  body[data-tool="eraser"] #brushBar { display: flex; }
  body.sheet-open #brushBar { display: none; }

  /* 提示气泡别压住 FAB / 笔尖条（画笔激活时再抬一层） */
  .hint { bottom: calc(84px + var(--safe-b)); }
  body[data-tool="brush"] .hint,
  body[data-tool="eraser"] .hint { bottom: calc(138px + var(--safe-b)); }
  body.sheet-open .hint { display: none; }

  /* 面板里的按钮至少 44×44（原来只钉了高度） */
  #panel button { min-width: 44px; min-height: 44px; }

  /* 顶栏变高了：参考图浮窗别钻到顶栏下面 */
  details.card.ref-panel { top: calc(var(--topbar-h) + 8px); }
}

/* 360 及以下：站点名只留商标，给三 tab 让路 */
@media (max-width: 480px) {
  .brand-name { display: none; }
}

/* ============================================================================
   手机端 v2（2026-10-18，task-17）—— 一行顶栏 + 浮动工具轨 + 分组菜单
   ----------------------------------------------------------------------------
   全部追加在文件最末，覆盖 v1 的两行顶栏；桌面（≥821）这些新元素 display:none，
   现有桌面 DOM/工具轨/顶栏一个像素不动。
   ============================================================================ */

/* 新元素默认都不存在（桌面） */
.mobile-rail,
.mobile-rail-pop,
.mobile-menu,
#mobileMoreBtn,
.sheet-mobile-head,
.plaza-back { display: none; }

@media (max-width: 820px) {
  :root { --topbar-h: 56px; }
  .topbar {
    height: 56px;
    flex-wrap: nowrap;
    align-content: normal;
    gap: 4px;
    padding: 0 6px;
    overflow: hidden;
  }
  .topbar > .brand { order: 0; }
  .topbar > #views { order: 0; flex: 1 1 auto; min-width: 0; justify-content: center; }
  .topbar-actions { display: none !important; }
  .topbar > #moreGrp { display: none !important; }
  #mobileMoreBtn {
    display: inline-flex;
    align-items: center; justify-content: center;
    flex: 0 0 auto;
    min-width: 44px; min-height: 44px;
    margin-left: 0;
    font-size: 18px; line-height: 1;
  }
  .brand { font-size: 12.5px; gap: 4px; }
  .brand-name { display: inline; }       /* v1 的 ≤480 只留商标规则作废：一行现在放得下 */
  .brand-logo { height: 18px; width: 18px; }
  #views button { min-height: 44px; min-width: 44px; padding: 6px 7px; font-size: 11.5px; flex: 0 0 auto; white-space: nowrap; }
  #sides { display: none !important; }   /* 正反面已进「⋯ → 创作」 */
  #mineView .stage-badge { display: none; }

  /* ---------------------------------------------------------------- 浮动工具轨 */
  .mobile-rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: calc(var(--topbar-h) + 8px);
    width: 44px;
    z-index: 46;                          /* 高于 sheet 遮罩（44），低于菜单（60） */
    pointer-events: none;                 /* 只有按钮区域可点，不挡画布手势 */
    border-radius: 0 8px 8px 0;
  }
  .mobile-rail::before {
    content: '';
    position: absolute; inset: 0;
    background: color-mix(in srgb, var(--panel-2) 86%, transparent);
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    pointer-events: none;
  }
  .mobile-rail-btn,
  .mobile-rail-toggle {
    pointer-events: auto;
    position: relative;
    width: 44px; height: 44px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    padding: 0;
    border: 0; background: transparent;
    color: var(--muted);
    font-size: 9.5px; line-height: 1;
  }
  .mobile-rail-btn .ico { width: 18px; height: 18px; }
  .mobile-rail-btn span { font-size: 9px; letter-spacing: .2px; }
  .mobile-rail-btn.on {
    color: var(--on-surface-hi);
    background: var(--accent-soft);
    box-shadow: inset 2px 0 0 var(--accent);
  }
  .mobile-rail-more { border-top: 1px solid var(--line); }
  .mobile-rail-toggle {
    border-top: 1px solid var(--line);
    color: var(--muted-2);
  }
  .mobile-rail-toggle .rail-handle-label { display: none; font-size: 11px; font-weight: 600; }
  .mobile-rail.collapsed .mobile-rail-btn { display: none; }
  .mobile-rail.collapsed .mobile-rail-toggle .ico { display: none; }
  .mobile-rail.collapsed .mobile-rail-toggle .rail-handle-label { display: block; }
  .mobile-rail.collapsed::before { border-radius: 0 8px 8px 0; }
  .mobile-rail.collapsed .mobile-rail-toggle { border-top: 0; }

  .mobile-rail-pop {
    display: flex; flex-direction: column;
    position: fixed;
    left: 48px;
    z-index: 47;
    min-width: 150px;
    padding: 4px;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-3);
  }
  .mobile-rail-pop[hidden] { display: none; }
  .mobile-rail-pop button {
    display: flex; align-items: center; gap: 8px;
    min-height: 44px;
    padding: 0 10px;
    border: 0; border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 12.5px; text-align: left;
  }
  .mobile-rail-pop button:hover { background: var(--surface-hi); }
  .mobile-rail-pop .ico { width: 16px; height: 16px; color: var(--muted); }

  /* ---------------------------------------------------------------- 「⋯」分组菜单 */
  .mobile-menu {
    display: block;
    position: fixed;
    right: 6px;
    top: calc(var(--topbar-h) + 4px);
    width: min(92vw, 340px);
    max-height: calc(100vh - var(--topbar-h) - 12px);
    overflow-y: auto;
    z-index: 60;
    padding: 4px 0 6px;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-3);
  }
  .mobile-menu[hidden] { display: none; }
  .mm-group { border-top: 1px solid var(--line); padding: 2px 0 4px; }
  .mm-group:first-child { border-top: 0; }
  .mm-group > b {
    display: block;
    padding: 8px 12px 2px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .6px;
    color: var(--muted-2);
  }
  .mm-group > button,
  .mm-group > a {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px;
    width: 100%; min-height: 44px;
    padding: 0 12px;
    border: 0; border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 13px; text-align: left;
    text-decoration: none;
    box-sizing: border-box;
  }
  .mm-group > button:hover,
  .mm-group > a:hover { background: var(--surface-hi); }
  .mm-group .ico { width: 16px; height: 16px; color: var(--muted); }
  .mm-row { display: flex; gap: 4px; padding: 0 6px 2px; }
  .mm-row button {
    flex: 1 1 0;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--text); font-size: 12.5px;
  }
  .mm-row button:hover { background: var(--surface-hi); }
  .mm-note { margin: 0; padding: 2px 12px 4px; font-size: 10.5px; color: var(--muted); }
  .mm-about > a { color: var(--muted); font-size: 12px; }

  /* ---------------------------------------------------------------- 底部再收 */
  .panel { max-height: 46vh; }           /* 52 → 46：sheet 更矮一点 */
  /* sheet 内部也小一号：内边距 8~10、行距 10、标题 13 / 说明 11（段头保持 ≥44 的命中区） */
  #panel .panel-scroll { padding: 0 10px 12px; }
  #panel .card { padding-bottom: 8px; }
  #panel .card > summary { font-size: 13px; padding: 4px 10px; }
  #panel .card > summary em { font-size: 11px; }
  #panel .row { gap: 10px; }
  #panel .tip { font-size: 11px; line-height: 1.5; }
  #app .appfoot { display: none; }       /* 编辑器里不再常驻页脚（收进 ⋯ → 关于） */
  #app[data-view="plaza"] .appfoot { display: flex; }   /* 广场页保留 */
  .fab {
    bottom: calc(12px + var(--safe-b));
    min-width: 44px; min-height: 44px;
  }
  #brushBar { bottom: calc(64px + var(--safe-b)); }
  .hint { bottom: calc(64px + var(--safe-b)); }
  body[data-tool="brush"] .hint,
  body[data-tool="eraser"] .hint { bottom: calc(118px + var(--safe-b)); }
  body.sheet-open .hint { display: none; }

  /* ---------------------------------------------------------------- 工具市场：底部 sheet ≤82vh */
  .sheet-mobile-head { display: none; }
  #marketModal { align-items: flex-end; padding: 0; }
  #marketModal .sheet.wide-sheet {
    width: 100%;
    max-height: 82vh;
    margin: 0;
    padding: 0 12px calc(12px + var(--safe-b));
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    display: flex; flex-direction: column;
  }
  .sheet-mobile-head {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 3;
    height: 44px; min-height: 44px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
  }
  .sheet-mobile-head .smh-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); flex: none; }
  .sheet-mobile-head b { font-size: 13px; }
  .sheet-mobile-head #marketClose { margin-left: auto; min-width: 44px; min-height: 44px; }
  #marketModal h2 { display: none; }        /* 手机端标题已在 44px 把手行里 */
  #marketModal .market-bar {
    position: sticky; top: 44px; z-index: 2;
    background: var(--panel-2);
    padding: 6px 0 4px;
    gap: 6px;
  }
  #marketModal .market-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #marketModal .market-cats::-webkit-scrollbar { display: none; }
  #marketModal .market-list { gap: 10px; max-height: none; overflow: visible; padding-right: 0; }
  /* 卡片一行：图标 + 名字/两行说明 + 演示 + 装载（≤120px 高，字号 13/11） */
  #marketModal .market-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    max-height: 120px;
  }
  #marketModal .mi-ico { width: 28px; height: 28px; }
  #marketModal .mi-meta { gap: 2px; min-width: 0; }
  #marketModal .mi-meta b { font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #marketModal .mi-sub,
  #marketModal .mi-why { display: none; }
  #marketModal .mi-when,
  #marketModal .mi-does {
    font-size: 11px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  }
  #marketModal .mi-acts { gap: 2px; }
  #marketModal .mi-like,
  #marketModal .mi-cmt { display: none; }   /* 手机上先保"名字/说明/装载"，赞评不占一行 */
  #marketModal .mi-demo { min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 11px; }
  #marketModal .market-item > button { min-height: 44px; font-size: 12px; }

  /* ---------------------------------------------------------------- 广场：保持视图切换，首屏 2 列紧凑 */
  #app[data-view="plaza"] #plazaBack { display: flex; }
  .plaza-back {
    position: fixed;
    left: 10px;
    bottom: calc(32px + var(--safe-b));   /* 在页脚之上（广场页保留页脚） */
    z-index: 30;
    align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 12px;
    box-shadow: var(--shadow-2);
  }
  #app[data-view="plaza"] .mobile-rail,
  #app[data-view="plaza"] #fab { display: none; }
  #app .pz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #app .pz-cover { max-height: 160px; }
  #app .pz-title { font-size: 12px; line-height: 1.3; }
  #app .pz-sub, #app .pz-note, #app .pz-foot { font-size: 11px; }
  #app .pz-body { padding: 8px 9px; gap: 3px; }
}

/* ============================================================================
   App 壳（2026-10-18，task-18）—— 手机端 4 Tab：画布 / 素材 / 工具 / 我的
   ----------------------------------------------------------------------------
   body.app-shell 由 JS 只在 ≤820 时挂；桌面和「打开完整编辑器」后全部规则不生效，
   桌面 DOM/布局一个像素不动。隐藏的顶栏/页脚/FAB 只是 display:none，不删节点。
   ============================================================================ */
.app-tabs, .app-page, .view-pill, .view-menu, .shell-empty { display: none; }

@media (max-width: 820px) {
  /* ---- 壳里只要画布 + 工具轨 + 底部 Tab ---- */
  body.app-shell .topbar,
  body.app-shell .appfoot,
  body.app-shell #fab,
  body.app-shell #panel,
  body.app-shell .sheet-scrim,
  body.app-shell .mobile-menu,
  body.app-shell #mobileMoreBtn,
  body.app-shell .plaza-back { display: none !important; }

  body.app-shell #mineView {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: calc(100% - 56px - env(safe-area-inset-bottom, 0px));
  }
  body.app-shell #mineView .canvas-container { max-width: 100%; }
  body.app-shell .mobile-rail { top: 8px; }
  body.app-shell .hint { bottom: calc(68px + var(--safe-b)); }
  body.app-shell #brushBar { bottom: calc(68px + var(--safe-b)); }

  /* ---- 底部 4 Tab（56 + safe） ---- */
  body.app-shell .app-tabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--panel-2);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .28);
  }
  .app-tabs button {
    flex: 1 1 0;
    min-width: 44px; min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: transparent;
    color: var(--muted);
    font-size: 10.5px;
  }
  .app-tabs .ico { width: 20px; height: 20px; }
  .app-tabs button[aria-selected="true"] { color: var(--text-strong); background: var(--accent-soft); box-shadow: inset 0 2px 0 var(--accent); }

  /* ---- Tab 整页 ---- */
  .app-page {
    display: block;
    position: fixed;
    left: 0; right: 0; top: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 55;
    overflow-y: auto;
    padding: 0 12px 16px;
    background: var(--bg);
  }
  .app-page[hidden] { display: none !important; }
  .app-page-head { padding: 14px 2px 6px; }
  .app-page-head h2 { margin: 0; font-size: 18px; }
  .app-page-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }
  .app-page-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
  .tool-group h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .5px; color: var(--muted-2); }
  .tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tool-grid button,
  .mine-list button,
  .settings-list button,
  .app-page-foot button {
    min-height: 48px;
    display: flex; align-items: center; gap: 8px; justify-content: flex-start;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--text);
    font-size: 13px;
    text-align: left;
  }
  .tool-grid .ico { width: 16px; height: 16px; color: var(--muted); }
  .app-page-foot { display: flex; gap: 8px; margin-top: 14px; }
  .app-page-foot button { flex: 1 1 0; justify-content: center; }
  .mine-list, .settings-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px; }
  .mine-list button { min-height: 48px; font-size: 13.5px; }
  .about-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
  .about-links a {
    display: inline-flex; align-items: center;
    min-height: 44px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 999px;
    color: var(--text); text-decoration: none; font-size: 12px;
  }

  /* ---- 素材 Tab：把现有 #assets 整页化 ---- */
  body.app-shell[data-app-tab="assets"] #assets {
    display: flex !important;
    position: fixed;
    left: 0; right: 0; top: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    width: auto;
    z-index: 55;
    transform: none;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
  }
  body.app-shell:not([data-app-tab="assets"]) #assets { display: none !important; }
  body.app-shell #assetsFold { display: none !important; }   /* 整页化后没有"收起抽屉"这回事 */
  body.app-shell .obc-close { min-width: 44px; min-height: 44px; }

  /* ---- 画布 Tab：左上视图胶囊 + 空状态三按钮 ---- */
  body.app-shell[data-app-tab="canvas"] .view-pill {
    display: inline-flex;
    position: fixed;
    left: 52px; top: 8px;
    z-index: 47;
    align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 12px;
    box-shadow: var(--shadow-2);
  }
  body.app-shell[data-app-tab="canvas"] .view-menu {
    display: flex; flex-direction: column;
    position: fixed;
    left: 52px; top: 58px;
    z-index: 58;
    min-width: 150px;
    padding: 4px;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-3);
  }
  body.app-shell[data-app-tab="canvas"] .view-menu[hidden] { display: none; }
  .view-menu button {
    min-height: 44px;
    display: flex; align-items: center; justify-content: flex-start;
    padding: 0 12px;
    border: 0; border-radius: 4px;
    background: transparent; color: var(--text);
    font-size: 13px; text-align: left;
  }
  .view-menu button:hover { background: var(--surface-hi); }

  body.app-shell[data-app-tab="canvas"].shell-empty-on .shell-empty {
    display: flex;
    position: absolute;
    left: 56px; right: 16px;
    top: 72px; bottom: 20px;
    z-index: 20;
    flex-direction: column; align-items: stretch; justify-content: center; gap: 8px;
    padding: 16px;
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--panel) 88%, transparent);
  }
  .shell-empty b { font-size: 15px; }
  .shell-empty p { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
  .shell-empty button {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--text);
    font-size: 13.5px;
  }
  .shell-empty button:first-of-type { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }
}

/* 完整编辑器（app-shell 关掉）时页脚回来（task-18 验收点）；FAB 相应抬到页脚之上 */
@media (max-width: 820px) {
  body:not(.app-shell) #app .appfoot { display: flex; }
  body:not(.app-shell) .fab { bottom: calc(32px + var(--safe-b)); }
}

/* ---------------------------------------------------------------- 离线提示（PWA） */
.offline-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow-3);
}
.offline-bar[hidden] { display: none; }
.offline-bar .ico { width: 16px; height: 16px; color: var(--warn); }
.offline-bar button {
  min-width: 44px; min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text-strong);
  font-size: 12px;
}
@media (max-width: 820px) {
  body.app-shell .offline-bar { bottom: calc(68px + var(--safe-b)); }
  body:not(.app-shell) .offline-bar { bottom: calc(32px + var(--safe-b)); }
}

/* ============================================================================
   画笔预设（2026-10-18，画笔工程第 1 段）
   ============================================================================ */
.brush-preset-head {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0 4px;
  font-size: 12px;
}
.brush-preset-head b { font-size: 12.5px; }
.brush-preset-head button { margin-left: auto; min-height: 36px; font-size: 11.5px; }
.brush-recent {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: thin;
}
.brush-recent .tip { padding: 4px 0; }
.brush-preset-chip {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 62px; min-height: 44px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
}
.brush-preset-chip canvas { display: block; border-radius: 3px; }
.brush-preset-chip:hover { border-color: var(--line-2); color: var(--text); }
.brush-preset-chip.mobile { min-width: 84px; font-size: 11px; }
.brush-packs { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 8px; }
.brush-packs[hidden] { display: none; }
.brush-pack b { display: block; font-size: 11px; color: var(--muted-2); margin-bottom: 4px; }
.brush-pack-row { display: flex; gap: 6px; flex-wrap: wrap; }
.brush-pack-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.brush-pack-item {
  display: flex; flex-direction: column; gap: 6px;
  align-items: stretch;
}
.brush-pack-head { display: flex; flex-direction: column; gap: 2px; }
.brush-pack-head b { font-size: 13px; }
.brush-pack-preset {
  display: flex; align-items: center; gap: 5px;
  min-height: 40px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 11.5px;
}
.brush-pack-preset canvas { display: block; border-radius: 3px; }
.brush-pack-item > button.primary { align-self: flex-end; min-width: 88px; min-height: 40px; }

/* 手机「工具 → 画笔」子页 */
.brush-page { padding-bottom: 24px; }
.brush-page-head { position: relative; }
.brush-back {
  min-height: 44px; margin-bottom: 4px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}
.mobile-brush-recent {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
}
.mobile-brush-packs { display: flex; flex-direction: column; gap: 10px; }
.mobile-brush-pack b { display: block; font-size: 11px; color: var(--muted-2); margin-bottom: 4px; }
.mobile-brush-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.mobile-brush-preview-wrap {
  margin: 10px 0 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
#mobileBrushPreview { display: block; width: 100%; height: 150px; border-radius: 6px; }
.mobile-brush-actions { display: flex; gap: 8px; margin-top: 8px; }
.mobile-brush-actions button {
  flex: 1 1 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}
.mobile-brush-actions #mobileBrushGo { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }
.brush-page .slider { margin: 10px 0; }
.brush-page .slider input[type="range"] { min-height: 44px; }
.brush-page .row > button { min-height: 48px; flex: 1 1 0; }

@media (max-width: 820px) {
  #marketModal .brush-pack-item {
    max-height: none;
    display: flex;
    grid-template-columns: none;
  }
  #marketModal .brush-pack-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  #marketModal .brush-pack-preset { min-height: 44px; }
}

/* ============================================================================
   笔刷编辑器（2026-10-18，task-22）
   ============================================================================ */
.brush-editor-sheet {
  width: min(94vw, 820px);
  max-height: 90vh;
  overflow: auto;
}
.be-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.be-head h2 { margin: 0; }
.be-head button { min-height: 44px; min-width: 64px; }
.be-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; margin-top: 10px; }
.be-left { position: sticky; top: 0; align-self: start; }
#brushEditorPreview {
  display: block; width: 120px; height: 120px;
  border: 1px solid var(--line); border-radius: 10px; background: #ece9e1;
}
.be-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; min-width: 0; }
.be-controls .slider { margin: 2px 0; }
.be-controls .slider input[type="range"] { min-height: 32px; }
.be-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.be-row > b { font-size: 12px; color: var(--muted-2); min-width: 52px; }
.be-stamps { display: flex; gap: 4px; flex-wrap: wrap; }
.be-stamps button, .be-curves button, .be-toggles button {
  min-height: 40px; min-width: 48px;
  padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 12px;
}
.be-stamps button[aria-pressed="true"], .be-curves button[aria-pressed="true"], .be-toggles button[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong);
}
.be-save input { flex: 1 1 150px; min-height: 44px; }
.be-save button { min-height: 44px; }
.be-mine { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.be-mine button { min-height: 42px; min-width: 88px; }
.be-mine .rm { margin-left: 4px; color: var(--warn); }
@media (max-width: 820px) {
  .brush-editor-sheet { width: 100%; max-height: calc(100vh - 12px); }
  .be-body { grid-template-columns: 1fr; }
  .be-left { position: static; }
  #brushEditorPreview { width: 200px; height: 120px; }
  .be-controls { grid-template-columns: 1fr; }
  .be-controls .slider input[type="range"] { min-height: 44px; }
  .be-stamps button, .be-curves button, .be-toggles button { min-height: 44px; }
}

/* ============================================================================
   手机工作台 5 页卡片（2026-10-18，task-23）
   ============================================================================ */
.wb-entry { display: flex; flex-direction: column; gap: 8px; }
.wb-entry-card {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 48px; min-height: 48px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}
.wb-entry-card:active { transform: translateY(1px); }
.wb-entry-card .ico { width: 22px; height: 22px; color: var(--accent); flex: none; }
.wb-entry-card span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wb-entry-card b { font-size: 13.5px; }
.wb-entry-card small { font-size: 10.5px; color: var(--muted-2); }
.wb-entry-card em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 18px; }
.wb-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.wb-all-title { margin: 14px 0 2px; font-size: 11.5px; color: var(--muted-2); font-weight: 500; }
.wb-page { padding-bottom: 24px; }
.wb-back {
  min-height: 44px; margin-bottom: 4px;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--text); font-size: 12px;
}
.wb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.wb-card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 64px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text); text-align: left;
}
.wb-card b { font-size: 13.5px; }
.wb-card small { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.wb-card:active { border-color: var(--accent); }
.wb-confirm { width: min(92vw, 380px); }
@media (min-width: 821px) {
  #workbenchEntries, #typesetPage, #cutoutPage, #effectsPage, #deliverPage, #wbClearConfirm { display: none !important; }
  #quickDock, #layerSheet, #layerDeleteConfirm, #shapeContextBar { display: none !important; }
}
@media (max-width: 820px) {
  .wb-card { min-height: 72px; }
}

/* 手机形状上下文条（App 壳，仅形状工具激活时） */
.shape-context { display: none; }
@media (max-width: 820px) {
  body.app-shell[data-app-tab="canvas"][data-tool="shape"] .shape-context {
    display: flex;
    position: fixed;
    left: 8px; right: 8px;
    bottom: calc(64px + var(--safe-b));
    z-index: 56;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 4px 8px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--panel-2);
    box-shadow: var(--shadow-3);
    overflow-x: auto;
  }
  .shape-context > b { font-size: 11px; color: var(--muted-2); flex: none; }
  .shape-ctx-kinds { display: flex; gap: 4px; flex: 1 1 auto; }
  .shape-context button {
    min-width: 44px; min-height: 44px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 11px;
    white-space: nowrap;
  }
  .shape-context button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }
}

/* ============================================================================
   全屏笔刷库 / 形状库（2026-10-18，task-25）
   ============================================================================ */
.brush-lib-sheet {
  width: min(760px, 94vw);
  height: 80vh;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
}
#brushLibraryModal, #shapeLibraryModal { background: rgba(0, 0, 0, .55); }
.bl-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bl-head h2 { margin: 0; font-size: 16px; flex: none; }
.bl-head input { flex: 1 1 auto; min-width: 0; min-height: 36px; }
.bl-head button { min-width: 44px; min-height: 44px; }
.bl-body { flex: 1 1 auto; display: flex; min-height: 0; }
.bl-cats {
  width: 96px; flex: none;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 4px;
}
.bl-cats button {
  min-height: 44px; width: 100%;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 12px; text-align: left; padding: 0 10px;
}
.bl-cats button[aria-selected="true"] { background: var(--accent-soft); color: var(--text-strong); }
.bl-list { flex: 1 1 auto; overflow-y: auto; min-width: 0; padding: 4px 8px; }
.bl-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 84px;
  padding: 6px 8px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--text); text-align: left;
}
.bl-row canvas { display: block; width: 200px; height: 56px; flex: none; border-radius: 6px; background: #ece9e1; }
.bl-row .bl-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bl-row .bl-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row .bl-meta small { font-size: 11px; color: var(--muted-2); }
.bl-row .bl-fav { margin-left: auto; color: var(--accent); font-size: 12px; }
.bl-empty { padding: 20px 10px; color: var(--muted-2); font-size: 12px; }
.bl-foot { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); }
.bl-foot button { flex: 1 1 0; min-height: 44px; }
.shape-lib-sheet { width: min(720px, 94vw); height: 76vh; max-height: 76vh; }
.shape-lib-grid { flex: 1 1 auto; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; grid-auto-rows: 110px; align-content: start; }
.shape-lib-card {
  min-height: 92px; display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text); font-size: 12px;
}
.shape-lib-card canvas { display: block; width: 120px; height: 48px; }
@media (max-width: 820px) {
  #brushLibraryModal .brush-lib-sheet,
  #shapeLibraryModal .shape-lib-sheet {
    width: 100vw; height: 100dvh; max-height: none;
    border-radius: 0; margin: 0;
  }
  #brushLibraryModal, #shapeLibraryModal { padding: 0; align-items: stretch; }
  .bl-head { padding-top: calc(8px + var(--safe-b)); }
  .bl-row canvas { width: 150px; height: 48px; }
  .bl-row { min-height: 84px; }
  .bl-cats { width: 88px; }
  .bl-cats button { font-size: 11.5px; }
  .bl-foot { padding-bottom: calc(8px + var(--safe-b)); }
  .shape-lib-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================================
   手机常驻快捷底栏 + 图层面板（2026-10-18，task-26）
   ============================================================================ */
.quick-dock { display: none; }
.quick-dock[hidden] { display: none !important; }
@media (max-width: 820px) {
  body.app-shell[data-app-tab="canvas"] .quick-dock {
    display: flex;
    position: fixed;
    left: 0; right: 0;
    bottom: calc(56px + var(--safe-b));
    height: 48px;
    z-index: 57;
    align-items: stretch;
    gap: 4px;
    padding: 0 6px;
    border-top: 1px solid var(--line);
    background: var(--panel-2);
    overflow: hidden;
  }
  .quick-dock > * { min-height: 44px; }
  .qd-brush {
    flex: 0 0 56px;
    display: flex; align-items: center; justify-content: center; gap: 3px;
    border: 0; border-radius: 8px;
    background: var(--panel); color: var(--text);
    font-size: 10px;
  }
  .qd-dot { width: 14px; height: 14px; border-radius: 50%; background: #111; border: 1px solid rgba(255,255,255,.35); flex: none; }
  .qd-range {
    position: relative;
    flex: 1 1 0; min-width: 0;
    height: 48px;
    border-radius: 8px;
    background: var(--panel);
    overflow: hidden;
  }
  .qd-range > span {
    position: absolute; left: 7px; top: 3px; z-index: 2;
    font-size: 9px; color: var(--muted-2); pointer-events: none;
  }
  .qd-range > output {
    position: absolute; right: 5px; top: 3px; z-index: 2;
    font-size: 9px; color: var(--muted); pointer-events: none;
  }
  .qd-range input[type="range"] {
    position: absolute; left: 0; right: 0; bottom: 0;
    width: 100%; height: 44px; margin: 0;
  }
  .qd-layer {
    flex: 0 0 62px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    border: 0; border-radius: 8px;
    background: var(--panel); color: var(--text);
    font-size: 9.5px; min-width: 0;
  }
  .qd-layer .ico { width: 15px; height: 15px; color: var(--accent); }
  .qd-layer span { max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .qd-layer small { font-size: 8.5px; color: var(--muted-2); }
  .qd-history { flex: 0 0 88px; display: flex; }
  .qd-history button {
    flex: 1 1 0; min-width: 44px; min-height: 44px;
    border: 0; border-radius: 8px;
    background: var(--panel); color: var(--text);
  }
  .qd-history button:disabled { opacity: .35; }
  body.app-shell #brushBar { display: none !important; }
  body.app-shell #mineView { height: calc(100% - 56px - 48px - env(safe-area-inset-bottom, 0px)); }
  body.app-shell[data-app-tab="canvas"][data-tool="shape"] .shape-context { bottom: calc(108px + var(--safe-b)); }

  /* 图层面板 */
  #layerSheet { padding: 0; align-items: flex-end; z-index: 100; }
  #layerDeleteConfirm { z-index: 110; }
  .layer-sheet {
    width: 100%; max-height: 52vh; height: 52vh;
    padding: 0; border-radius: 14px 14px 0 0;
    display: flex; flex-direction: column;
  }
  .layer-sheet-head {
    display: flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 10px;
    border-bottom: 1px solid var(--line);
  }
  .layer-sheet-head h2 { margin: 0; font-size: 14px; flex: 1 1 auto; }
  .layer-sheet-head button { min-width: 44px; min-height: 44px; }
  .layer-sheet-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
  .ls-row { display: flex; align-items: center; gap: 4px; min-height: 48px; border-bottom: 1px solid var(--line); }
  .ls-group { display: flex; align-items: center; gap: 4px; min-height: 44px; background: rgba(255,255,255,.035); border-bottom: 1px solid var(--line); }
  .ls-group small { font-size: 9px; color: var(--muted-2); min-width: 52px; text-align: right; }
  .ls-group .ls-name { font-weight: 600; }
  .ls-row.on { background: var(--accent-soft); }
  .ls-row button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text); }
  .ls-label { width: 16px !important; min-width: 16px !important; height: 16px !important; min-height: 16px !important; border-radius: 50%; border: 1px solid var(--line-2) !important; margin: 0 2px; }
  .ls-blend { width: 72px; height: 32px; font-size: 9.5px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; }
  .ls-clip, .ls-alpha { min-width: 28px !important; width: 28px; font-size: 12px; color: var(--muted-2) !important; padding: 0; }
  .ls-clip.on, .ls-alpha.on { color: var(--accent) !important; background: var(--accent-soft); }
  .ls-row .ls-name {
    flex: 1 1 auto; min-width: 0; text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 4px;
  }
  .ls-row .ls-vis.off { opacity: .35; }
  .ls-row .ls-lock.on { color: var(--warn); }
  .layer-sheet-foot {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
    padding: 6px; border-top: 1px solid var(--line);
    padding-bottom: calc(6px + var(--safe-b));
  }
  .layer-sheet-foot button { min-height: 44px; }
  .ls-empty { padding: 14px; color: var(--muted-2); font-size: 12px; }
}

/* ============================================================================
   Pro 布局（2026-10-18，task-28）：手机画布页顶栏 / 左轨 / 底栏 / 右滑面板
   ============================================================================ */
.pro-topbar, .pro-rail, .pro-bottom, .pro-palette-sheet { display: none; }
@media (max-width: 820px) {
  body.pro-layout .pro-topbar,
  body.pro-layout .pro-rail,
  body.pro-layout .pro-bottom { display: flex; }
  body.pro-layout #appTabs,
  body.pro-layout #quickDock,
  body.pro-layout #toolRail,
  body.pro-layout #brushBar { display: none !important; }
  body.pro-layout #mineView { height: 100%; }
  body.pro-layout.pro-home .pro-topbar,
  body.pro-layout.pro-home .pro-rail,
  body.pro-layout.pro-home .pro-bottom { display: none !important; }
  body.pro-layout.pro-home #appTabs { display: flex !important; }
  body.pro-layout.pro-home #mineView { height: calc(100% - 56px - env(safe-area-inset-bottom, 0px)); }
  .pro-topbar {
    position: fixed; left: 0; right: 0; top: 0; height: 44px; z-index: 72;
    align-items: center; gap: 2px; padding: 0 4px;
    background: var(--panel-2); border-bottom: 1px solid var(--line);
  }
  .pro-topbar button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text); }
  .pro-topbar .pro-grow { flex: 1 1 auto; }
  .pro-rail {
    position: fixed; left: 0; top: 44px; z-index: 71;
    width: 48px; flex-direction: column; gap: 0;
    background: var(--panel-2); border-right: 1px solid var(--line);
    border-radius: 0 10px 10px 0; overflow: hidden;
  }
  .pro-rail > button {
    width: 48px; min-height: 44px; border: 0; background: transparent; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    font-size: 8.5px;
  }
  .pro-rail > button .ico { width: 17px; height: 17px; }
  .pro-rail > button.on { color: var(--accent); background: var(--accent-soft); }
  .pro-rail-toggle { border-top: 1px solid var(--line) !important; }
  .pro-rail.collapsed > button:not(.pro-rail-toggle) { display: none; }
  .pro-rail.collapsed { border-radius: 0 10px 10px 0; }
  .pro-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; height: 48px; z-index: 72;
    align-items: stretch; gap: 4px; padding: 0 6px env(safe-area-inset-bottom, 0px);
    background: var(--panel-2); border-top: 1px solid var(--line);
  }
  .pro-bottom .pro-color {
    width: 44px; min-width: 44px; height: 44px; margin: 2px 0; border-radius: 50%;
    border: 2px solid var(--line-2); background: #111;
  }
  .pro-range { position: relative; flex: 1 1 0; min-width: 0; height: 48px; background: var(--panel); border-radius: 8px; overflow: hidden; }
  .pro-range > span { position: absolute; left: 6px; top: 3px; z-index: 2; font-size: 9px; color: var(--muted-2); }
  .pro-range > output { position: absolute; right: 4px; top: 3px; z-index: 2; font-size: 9px; color: var(--muted); }
  .pro-range input[type="range"] { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 44px; margin: 0; }
  .pro-switch { display: flex; flex: 0 0 88px; }
  .pro-switch button { flex: 1 1 0; min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
  .pro-switch button.on { color: var(--text-strong); background: var(--accent-soft); border-color: var(--accent); }
  body.pro-layout .shape-context { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }

  /* 右滑面板 */
  body.pro-layout #layerSheet,
  body.pro-layout #brushLibraryModal,
  body.pro-layout #settingsSheet,
  body.pro-layout #proPalette { padding: 0; align-items: stretch; justify-content: flex-end; z-index: 130; }
  body.pro-layout #layerSheet .layer-sheet,
  body.pro-layout #brushLibraryModal .brush-lib-sheet,
  body.pro-layout #settingsSheet .sheet,
  body.pro-layout #proPalette .pro-palette-sheet {
    display: flex; width: 300px; max-width: 92vw; height: 100dvh; max-height: none;
    border-radius: 0; margin: 0; animation: proSlide .18s ease-out;
  }
  @keyframes proSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
  .pro-palette-sheet { flex-direction: column; background: var(--panel); }
  .pro-pal-head { display: flex; align-items: center; min-height: 44px; padding: 0 4px 0 10px; border-bottom: 1px solid var(--line); }
  .pro-pal-head h2 { flex: 1 1 auto; margin: 0; font-size: 14px; }
  .pro-pal-head button { min-width: 44px; min-height: 44px; }
  .pro-pal-body { flex: 1 1 auto; overflow-y: auto; padding: 10px; }
  .pro-pal-now { width: 100%; height: 64px; border-radius: 10px; border: 1px solid var(--line-2); margin-bottom: 8px; }
  .pro-pal-row { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 11px; color: var(--muted); }
  .pro-pal-row span { width: 34px; flex: none; }
  .pro-pal-row input { flex: 1 1 auto; min-width: 0; height: 32px; }
  .pro-pal-row output { width: 36px; text-align: right; font-size: 10px; color: var(--muted-2); }
  .pro-pal-cap { margin: 10px 0 6px; font-size: 11px; color: var(--muted-2); }
  .pro-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .pro-swatches button { min-height: 40px; border-radius: 8px; border: 1px solid var(--line-2); }
  #groupEditModal { z-index: 140; }
  .group-edit-sheet { width: min(320px, 92vw); max-height: 80vh; }
  .group-edit-body { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .group-edit-body label { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
  .group-edit-body label input[type="text"], .group-edit-body label select { grid-column: 2 / 4; min-height: 36px; min-width: 0; }
  .group-edit-body label input[type="range"] { min-width: 0; height: 36px; }
  .group-edit-body label output { width: 38px; text-align: right; font-size: 11px; }
  .group-edit-body .ge-check { display: flex; justify-content: flex-start; gap: 8px; }
  .ls-group-meta { min-height: 32px !important; font-size: 9px !important; color: var(--muted-2) !important; }
}

/* ============================================================================
   选区 / 填充（2026-10-18，task-30）
   ============================================================================ */
.sel-bar { display: none; }
.sel-bar[hidden], .sel-overlay[hidden], .pro-sel-actions[hidden] { display: none !important; }
body.sel-mode .sel-bar {
  display: flex; position: fixed; left: 50%; transform: translateX(-50%);
  top: 52px; z-index: 76; gap: 2px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.sel-bar button { min-width: 40px; min-height: 40px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 10px; }
.sel-bar button.on { background: var(--accent-soft); color: var(--text-strong); }
.sel-overlay { position: fixed; inset: 0; z-index: 65; pointer-events: none; }
body.sel-mode .sel-overlay { pointer-events: auto; touch-action: none; }
.pro-sel-actions { display: flex; }
.pro-sel-actions button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text); font-size: 11px; }
.aux-guides { position: fixed; inset: 0; z-index: 64; pointer-events: none; }
.ref-layers { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
.ref-layers img { position: absolute; max-width: 40vw; max-height: 40vh; opacity: .5; border: 1px solid var(--line); pointer-events: none; }
.float-palette { position: fixed; z-index: 120; width: 168px; padding: 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-3); }
.float-palette[hidden] { display: none !important; }
.fp-head { height: 28px; display: flex; align-items: center; font-size: 11px; color: var(--muted); cursor: move; }
.fp-now { height: 38px; border-radius: 8px; border: 1px solid var(--line-2); margin-bottom: 6px; }
.fp-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.fp-swatches button { height: 28px; border-radius: 6px; border: 1px solid var(--line); }

/* 统一手机布局：首页抽屉 */
.mobile-home[hidden] { display: none !important; }
@media (max-width: 820px) {
  body.app-shell #appTabs,
  body.app-shell #quickDock,
  body.app-shell #topbar { display: none !important; }
  .mobile-home { padding: 0; align-items: flex-end; z-index: 150; }
  .mobile-home-sheet { width: 100%; max-height: 86vh; height: auto; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; }
  .mobile-home-head { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-bottom: 1px solid var(--line); }
  .mobile-home-head h2 { flex: 1 1 auto; margin: 0; font-size: 15px; }
  .mobile-home-head button { min-width: 44px; min-height: 44px; }
  .mobile-home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; overflow-y: auto; }
  .mh-card { min-height: 64px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); }
  .mh-card .ico { grid-row: 1 / 3; width: 22px; height: 22px; color: var(--accent); }
  .mh-card b { font-size: 13px; }
  .mh-card small { font-size: 10px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.pro-layout.sel-mode .sel-bar { top: 48px; }
  body.pro-layout .pro-sel-actions button { min-width: 44px; min-height: 44px; font-size: 10px; }
  body.app-shell[data-app-tab="canvas"][data-tool="shape"] .shape-context { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
}





