/* =====================================================================
 * 365Lab 截图美化 - 样式表
 * 设计：浅/深色自适应，移动端优先响应式，纯 CSS 无依赖
 * ===================================================================== */

:root {
  --accent: #6d5efc;
  --accent-2: #ff7eb3;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --border: #e4e6f0;
  --text: #1c1d29;
  --text-soft: #61657a; /* R106: 由 #6b6e80 调暗，使其落在 --surface-2(#f0f1f8) 上达 5.08:1，满足 WCAG AA 4.5:1（原为 4.46，略低于阈值） */
  --shadow-sm: 0 1px 3px rgba(20, 22, 45, .08);
  --shadow-md: 0 8px 24px rgba(20, 22, 45, .10);
  --radius: 14px;
  --radius-sm: 9px;
  --ctrl-w: 360px;
  /* R117：画布外区域透明棋盘格用色（编辑器舞台背景） */
  --checker-a: #e6e9f2;
  --checker-b: #f4f5fa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a23;
    --surface-2: #1f2330;
    --border: #2a2f3d;
    --text: #eef0f6;
    --text-soft: #9aa0b4;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, .5);
    --checker-a: #1b1e28;
    --checker-b: #232734;
  }
  .fmt-note { color: #ff8a7a; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand-logo { display: flex; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-tag { font-size: 11.5px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 auto;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.lang-btn.active { background: var(--accent); color: #fff; }

/* ---------------- 布局 ---------------- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr; /* 默认单列：移动端 / 中屏 */
  min-height: 0;
}

/* 控制面板（左栏 / 右栏通用样式） */
.controls {
  background: var(--surface);
  padding: 16px;
  overflow-y: auto;
}
.controls-left { border-right: 1px solid var(--border); }
.controls-right { border-left: 1px solid var(--border); }

/* 宽屏三栏：左控制面板 | 预览 | 右控制面板 */
@media (min-width: 1080px) {
  .app {
    grid-template-columns: var(--ctrl-w) minmax(0, 1fr) var(--ctrl-w);
  }
  .controls {
    max-height: calc(100vh - 57px);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  font-size: 13.5px;
  margin: 0 0 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 3px 4px;
  margin-left: -4px;
  margin-right: -4px;
  border-radius: var(--radius-sm);
  transition: color .15s ease, background .15s ease;
}
.card h2:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.card h2:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 折叠手柄：右侧 chevron（用伪元素，避免污染 i18n 文本节点） */
.card h2::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: .5;
  transition: transform .2s ease, opacity .2s ease;
}
.card.collapsed > h2 { margin-bottom: 0; }
.card.collapsed > h2::after { transform: rotate(-45deg) translateY(-2px); opacity: .3; }
.card.collapsed > *:not(h2) { display: none; }

/* 字段 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > span { font-size: 12.5px; color: var(--text-soft); display: flex; justify-content: space-between; align-items: center; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field.inline > span { margin: 0; }
/* 复选框字段：勾选框与文字紧挨左对齐，不被 space-between 拉开 */
.field.inline.checkbox { justify-content: flex-start; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.field.disabled { opacity: .45; }
.field.disabled input[type="color"] { cursor: not-allowed; }

select, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.field.inline select { width: auto; min-width: 120px; }
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

input[type="color"] {
  width: 42px; height: 30px; padding: 2px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
  cursor: pointer;
}

.val { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* R116：标签完整显示优先——去掉 R111 的 max-width/省略号截断，
   标签永不收缩换行截断，滑条自动让位缩短；极窄时整行换行兜底 */
.field--row { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.field--row > .field-label {
  flex: 0 0 auto;
  margin: 0;
  font-size: 12.5px; color: var(--text-soft);
  white-space: nowrap;
  /* 覆盖 .field > span 的 flex space-between，避免标签被拉伸 */
  display: block;
}
.field--row > input[type="range"] {
  flex: 1 1 70px; min-width: 48px; width: auto; margin: 0;
}
.field--row > .field-num {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 2px;
}
.field--row .fld-num {
  width: 56px; padding: 4px 6px;
  font-size: 12.5px; text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; /* 隐藏 Firefox 原生箭头，改用自定义按钮 */
}
.field--row .fld-num::-webkit-outer-spin-button,
.field--row .fld-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-unit { color: var(--text-soft); font-size: 12px; min-width: 8px; }
/* 上下箭头：仅在数值输入框聚焦时显示（:focus-within），点击按 step 增减 */
.field-num { position: relative; }
.fld-spin { display: none; }
.field-num:focus-within .fld-spin { display: inline-flex; flex-direction: column; }
.fld-spin-btn {
  width: 15px; height: 12px; padding: 0; margin: 0;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-soft); font-size: 7px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.fld-spin-btn:hover { background: var(--accent); color: #fff; }
.fld-up { border-radius: 3px 3px 0 0; }
.fld-down { border-radius: 0 0 3px 3px; border-top: none; }
.grid2 .field--row { margin-bottom: 0; }

/* R115：双列并排字段全部单列化（用户要求「一行2个改为1个」）——
   半宽列曾导致标签换行（光晕色1/光晕大小）、hex 裁剪等挤压问题，
   R111–R113 为半宽列打的紧凑补丁随两列布局一并移除，字段恢复全宽标准尺寸 */

/* R112：颜色控件重构为「文字 | 颜色选择框 | 颜色代码框(可编辑)」单行布局 */
.field--row > input[type="color"] { flex: 0 0 auto; width: 34px; height: 26px; margin: 0; padding: 2px; }
.field--row > .fld-hex {
  flex: 1 1 70px; min-width: 56px; width: auto; max-width: 110px;
  padding: 5px 8px; font-size: 12.5px; line-height: 1;
  font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.3px;
}
.fld-hex.is-invalid { border-color: #e5484d; box-shadow: 0 0 0 2px rgba(229,72,77,0.25); outline: none; }

/* R115：.row.gap 并排行——按钮对保持并排，表单字段独占一行不再互挤 */
.row.gap { flex-wrap: wrap; }
.row.gap > .field--row,
.row.gap > .field--color { flex: 1 1 100%; }

.sub { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }
.sub[hidden] { display: none; }

/* R113：相关功能分组方框（把同一类控件收进同一个可见边框内，便于直观识别） */
.fgroup {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  padding: 10px 12px 12px;
  margin: 12px 0;
}
.fgroup:first-child { margin-top: 0; }
.fgroup:last-child { margin-bottom: 0; }
.fgroup-h {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .03em;
  margin: 0 0 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.fgroup-h::before {
  content: "";
  width: 3px; height: 12px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}
/* 方框内字段间距收紧，避免与外框留白叠加 */
.fgroup > .field { margin-bottom: 10px; }
.fgroup > .grid2,
.fgroup > .row { margin-bottom: 10px; }
.fgroup > .field:last-child,
.fgroup > .grid2:last-child,
.fgroup > .row:last-child,
.fgroup > .hint:last-child { margin-bottom: 0; }
.fgroup > .hint { margin: 6px 0 0; }

/* R115：桌面端也单列化（原 1fr 1fr 双列导致标签/数值框挤压，与移动端统一） */
.grid2 { display: grid; grid-template-columns: 1fr; gap: 10px 14px; }
.grid2 .field { margin-bottom: 0; }
/* R173：宽度/高度并排一行（用户要求恢复双列）——仅此一组放开，其余字段维持 R115 单列 */
.grid2--wh { grid-template-columns: 1fr 1fr; }

/* 线型分段控件（实线 / 虚线 / 点线 / 点划） */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 8px 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-soft); font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.seg-btn:hover { background: var(--border); }
.seg-btn.active {
  background: rgba(109,94,252,.14); border-color: var(--accent); color: var(--text);
  box-shadow: 0 0 0 2px rgba(109,94,252,.25);
}

/* === 无障碍：统一键盘焦点指示环（仅键盘聚焦时显示，鼠标点击不显示，避免双环） === */
.seg-btn:focus-visible,
.preset:focus-visible,
.anno-style-btn:focus-visible,
.wm-cell:focus-visible,
.ratio-preset:focus-visible,
.user-preset-btn:focus-visible,
.style-preset:focus-visible,
.lang-switch .lang-btn:focus-visible,
.icon-btn:focus-visible,
.a-btn:focus-visible,
.export-preview-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.seg-btn:focus:not(:focus-visible),
.preset:focus:not(:focus-visible),
.anno-style-btn:focus:not(:focus-visible),
.wm-cell:focus:not(:focus-visible),
.ratio-preset:focus:not(:focus-visible),
.user-preset-btn:focus:not(:focus-visible),
.style-preset:focus:not(:focus-visible),
.lang-switch .lang-btn:focus:not(:focus-visible),
.icon-btn:focus:not(:focus-visible),
.a-btn:focus:not(:focus-visible) {
  outline: none;
}
.dash-preview { width: 100%; height: 10px; border-radius: 3px; background: currentColor; }
.dash-preview.dash-solid   { background: currentColor; }
.dash-preview.dash-dashed  { background: repeating-linear-gradient(to right, currentColor 0 7px, transparent 7px 12px); }
.dash-preview.dash-dotted  { background-image: radial-gradient(circle, currentColor 1.6px, transparent 1.8px); background-size: 9px 10px; background-repeat: repeat-x; background-position: center; }
.dash-preview.dash-dashdot { background: repeating-linear-gradient(to right, currentColor 0 7px, transparent 7px 9px, currentColor 9px 10px, transparent 10px 16px); }

/* 箭头样式分段控件：SVG 线稿预览（三角 / 开放 / 圆点 / 菱形） */
.head-preview { width: 26px; height: 12px; display: block; }

/* 序号气泡形状预览（自动 / 正圆 / 方形） */
.shape-preview { width: 26px; height: 14px; display: block; }

/* 高亮叠加模式预览（正常 / 荧光笔 multiply / 提亮 screen） */
.blend-preview { width: 26px; height: 14px; display: block; }

/* 多行文字对齐预览（左 / 中 / 右） */
.align-preview { width: 26px; height: 14px; display: block; }

/* 背景图片上传控件 */
#bgImgFile { display: block; width: 100%; font-size: 12px; color: var(--text-soft);
  padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; }
#bgImgFile:hover { border-color: var(--accent); }

/* 按钮 */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn.full { width: 100%; }

.row { display: flex; }
.row.gap { gap: 8px; margin-top: 10px; }
.row.gap .btn { flex: 1; }

/* 拖拽区 */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); }
.dropzone.drag { border-color: var(--accent); background: rgba(109,94,252,.08); }
.dz-hint { margin: 0 0 10px; font-size: 12.5px; color: var(--text-soft); }
.dz-tip { margin: 10px 0 0; font-size: 11px; color: var(--text-soft); }

/* 渐变预设 */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset {
  width: 34px; height: 34px; border-radius: 8px;
  border: 2px solid var(--border); cursor: pointer;
  transition: transform .1s;
}
.preset:hover { transform: scale(1.08); }
.preset.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,94,252,.35); }

/* 工具按钮 */
.toolbar-tools { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tool-btn {
  position: relative;
  flex: 1; min-width: 40px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 0; font-size: 16px; cursor: pointer;
  color: var(--text);
}
.tool-btn kbd {
  position: absolute; right: 3px; bottom: 2px;
  font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-2, #6b6b80); background: var(--surface-2, #f0f0f5);
  border: 1px solid var(--border, #e3e3ea); border-radius: 4px;
  padding: 1px 3px; pointer-events: none; letter-spacing: .2px;
}
.tool-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-btn.active kbd { color: #fff; background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }

.hint { font-size: 11.5px; color: var(--text-soft); margin: 8px 0 0; }

/* 标注列表 */
.anno-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.fmt-note { font-size: 11.5px; color: #c0392b; margin: 8px 0 0; line-height: 1.5; }
.anno-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px;
}
.anno-list li.a-item { cursor: default; scroll-margin: 4px; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.anno-list li.a-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,94,252,.18); background: var(--surface); }
.anno-list li.a-item.hidden .a-label { opacity: .45; text-decoration: line-through; }
.anno-list li.a-item.dragging { opacity: .5; }
.anno-list li.a-item.drop-target { border-style: dashed; border-color: var(--accent); }
.anno-list li .a-grip { cursor: grab; color: var(--text-soft); font-size: 13px; line-height: 1; user-select: none; flex: 0 0 auto; }
.anno-list li .a-grip:active { cursor: grabbing; }
.anno-list li .a-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; cursor: pointer; }
.anno-list li .a-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.anno-list li .a-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anno-list li .a-acts { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.anno-list li .a-acts .a-btn {
  border: 0; background: transparent; color: var(--text-soft);
  cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 6px; line-height: 1;
}
.anno-list li .a-acts .a-btn:hover { background: rgba(109,94,252,.14); color: var(--accent); }
.anno-list li .a-acts .a-del:hover { background: rgba(255,95,87,.15); color: #ff5f57; }
.anno-empty { color: var(--text-soft); font-size: 12.5px; padding: 6px 2px; }

/* 标注多选批量操作条 */
.anno-multi-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.anno-multi-bar.has-selection { border-color: var(--accent); background: rgba(109,94,252,.08); }
.anno-multi-count { font-size: 12px; font-weight: 600; color: var(--text-soft); margin-right: auto; }
.anno-multi-bar.has-selection .anno-multi-count { color: var(--accent); }
.btn.xs { padding: 4px 9px; font-size: 11.5px; font-weight: 600; border-radius: 999px; }
.btn-ghost.xs:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost.danger { color: #ff5f57; }
.btn-ghost.danger:hover { background: rgba(255,95,87,.14); border-color: #ff5f57; }
/* 导出：按比例缩放快捷按钮组 */
.export-ratio-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.export-ratio-row .btn.xs { min-width: 42px; padding: 4px 8px; font-size: 11.5px; line-height: 1; }
/* 导出实时预览缩略图 */
.export-preview { margin-top: 12px; }
.export-preview-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.export-preview-stage {
  position: relative; max-width: 300px; border: 1px solid var(--border, #e3e3ea); border-radius: 10px;
  overflow: hidden; background: #fff; line-height: 0;
  display: flex; justify-content: center; align-items: center;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.export-preview-stage:hover, .export-preview-stage:focus-visible {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,94,252,.18); outline: none;
}
.export-preview-stage canvas { width: 100%; height: auto; display: block; }
.export-zoom-hint {
  position: absolute; right: 8px; bottom: 8px; line-height: 1;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; color: #fff;
  background: rgba(20,20,30,.62); backdrop-filter: blur(2px); pointer-events: none;
}
.export-preview-dim {
  margin-top: 6px; font-size: 12px; color: var(--text-2); text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 导出预览灯箱 */
.export-lightbox { position: fixed; inset: 0; z-index: 200; display: none; }
.export-lightbox.open { display: flex; }
.export-lightbox .lb-backdrop { position: absolute; inset: 0; background: rgba(15,15,25,.55); backdrop-filter: blur(3px); }
.export-lightbox .lb-card {
  position: relative; z-index: 1; margin: auto; width: min(92vw, 920px); max-height: 92vh;
  background: var(--surface, #fff); color: var(--text, #1d1d28); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden;
}
.lb-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border, #e3e3ea); }
.lb-title { font-size: 14px; font-weight: 600; margin-right: 2px; }
.lb-zoom { font-size: 12px; color: var(--text-2, #6b6b80); font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, #f0f0f5); cursor: default; }
.lb-fit { font-size: 12px; color: var(--text-2, #6b6b80); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border, #e3e3ea); background: var(--surface-2, #f0f0f5); cursor: pointer; transition: background .15s, border-color .15s; }
.lb-fit:hover { background: var(--border, #e3e3ea); }
.lb-fit:active { border-color: var(--accent, #4f7cff); }
.lb-stage { padding: 14px 16px; overflow: auto; display: flex; justify-content: center; align-items: flex-start; background: #f6f6fa; }
#exportLightboxCanvas { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.12); display: block; background: #fff; transform-origin: center center; will-change: transform; }
.lb-close { width: 30px; height: 30px; border: none; background: var(--surface-2, #f0f0f5); border-radius: 8px; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-2, #6b6b80); transition: background .15s; margin-left: auto; }
.lb-close:hover { background: var(--border, #e3e3ea); }
.lb-dim { padding: 0 16px 10px; text-align: center; font-size: 12px; color: var(--text-2, #6b6b80); font-variant-numeric: tabular-nums; }
.lb-actions { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border, #e3e3ea); }
.lb-actions .btn { flex: 1; }
body.lb-open { overflow: hidden; }


/* 多选标注对齐 / 等距分布按钮组 */
.anno-align-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.anno-align-row .btn.xs { min-width: 28px; padding: 4px 7px; font-size: 13px; line-height: 1; }
.anno-align-row .btn.xs:disabled { opacity: .4; cursor: not-allowed; }

.anno-list li .a-check { flex: 0 0 auto; width: 13px; height: 13px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.anno-list li.a-item.multi { border-color: var(--accent); background: rgba(109,94,252,.10); }
.anno-list li.a-item.hover { background: rgba(255,159,28,.14); box-shadow: inset 3px 0 0 #ff9f1c; }
.anno-list li.a-item.hover .a-label { color: #b5560a; }

/* 风格预设 */
.style-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.style-preset {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 10px; cursor: pointer;
  color: #fff; font-size: 12px; font-weight: 600; text-align: left; overflow: hidden; position: relative;
  transition: transform .1s, box-shadow .15s; line-height: 1.2;
}
.style-preset span { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .28); }
.style-preset:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.style-preset:active { transform: translateY(0); }

/* 标注颜色色板 */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.swatch {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border);
  cursor: pointer; padding: 0; transition: transform .1s;
}
.swatch:hover { transform: scale(1.12); }

/* 标注样式快捷预设 */
.sub-label { margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--text-soft); letter-spacing: .02em; }
.anno-styles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.anno-style-btn {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 10px 6px 6px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 999px; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .1s, background .15s;
}
.anno-style-btn:hover { border-color: var(--accent); background: rgba(109,94,252,.08); transform: translateY(-1px); }
.anno-style-btn:active { transform: translateY(0); }
.anno-style-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,94,252,.25); background: rgba(109,94,252,.12); }
.anno-style-btn .a-swatch {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,.12); box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.anno-style-btn .a-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anno-styles + .btn-ghost.block {
  width: 100%; margin-top: 10px; justify-content: center; font-size: 12.5px;
  border-style: dashed; color: var(--accent);
}
.anno-styles + .btn-ghost.block:hover { background: rgba(109,94,252,.10); border-color: var(--accent); }

/* 水印位置九宫格 */
.wm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 4px; }
.wm-cell {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 8px; height: 40px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.wm-cell span {
  width: 10px; height: 10px; border-radius: 3px; background: var(--text-soft); opacity: .55;
}
.wm-cell:hover { background: var(--border); }
.wm-cell.active { border-color: var(--accent); background: rgba(109, 94, 252, .12); box-shadow: 0 0 0 2px rgba(109, 94, 252, .25); }
.wm-cell.active span { background: var(--accent); opacity: 1; }

/* 用户自定义预设 */
.preset-save-row { display: flex; gap: 8px; margin-top: 10px; }
.preset-save-row input { flex: 1; min-width: 0; }
.user-preset-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.user-preset-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px;
}
.user-preset-btn {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  font: inherit; text-align: left; padding: 2px; border-radius: 6px;
}
.user-preset-btn:hover { background: var(--border); }
.user-preset-btn .a-swatch { width: 18px; height: 18px; border-radius: 5px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.12); }
.user-preset-btn .a-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-preset-list li .del {
  border: 0; background: transparent; color: var(--text-soft);
  cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 6px; flex: 0 0 auto;
}
.user-preset-list li .del:hover { background: rgba(255,95,87,.15); color: #ff5f57; }

/* 画布比例预设 */
.ratio-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ratio-preset {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s, color .15s;
}
.ratio-preset:hover { background: var(--border); }
.ratio-preset.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(109, 94, 252, .3);
}

/* ---------------- 预览区 ---------------- */
.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
}
.preview-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.icon-btn {
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: var(--border); }
.icon-btn.active { background: var(--accent, #6d5efc); border-color: var(--accent, #6d5efc); color: #fff; }
.zoom-label { font-size: 12.5px; color: var(--text-soft); min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
/* R172：画布工具栏右侧快捷导出区——占位推至最右（红框位），按钮与 icon-btn 同规格 */
.tb-spacer { flex: 1; }
.tb-quick {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); height: 32px; padding: 0 11px; border-radius: 8px;
  cursor: pointer; font-size: 12.5px; line-height: 1; white-space: nowrap;
}
.tb-quick:hover { background: var(--border); }
.tb-quick.active { background: var(--accent, #6d5efc); border-color: var(--accent, #6d5efc); color: #fff; }
.tb-quick svg { flex: 0 0 auto; }

.stage {
  flex: 1;
  display: flex;
  padding: 24px;
  overflow: auto;
  min-height: 0;
  position: relative;
  /* R117：画布之外的区域显示透明棋盘格——画布边界一目了然，
     且背景为「无/透明」时画布内透明区也能透出棋盘格（所见即所导） */
  background-image: conic-gradient(var(--checker-a) 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0);
  background-size: 20px 20px;
}
.canvas-wrap {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  align-self: center;
  line-height: 0;
}
#canvas {
  /* 居中改为由 .canvas-wrap 负责；画布超出可视区时仍可滚动到顶部/左侧 */
  max-width: 100%;
  background: transparent;
  box-shadow: var(--shadow-md);
  border-radius: 4px;
  display: block;
  position: relative; /* R173：压在 stageFrame 最终成图预览之上 */
  z-index: 1;
}
/* R173：最终成图舞台预览——contain 留白模式时铺在主画布外围，
   按导出目标展示「留白填色 + 构图」的最终观感（仅屏显，不参与交互/导出） */
#stageFrame {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  box-shadow: var(--shadow-md);
}
#stageFrame[hidden] { display: none; }
.guide-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* 绘制工具激活时才禁用触控默认手势（允许绘制）；选择模式下放行页面滚动 */
#canvas.tool-active { touch-action: none; cursor: crosshair; }
#canvas.tool-select { touch-action: auto; cursor: default; }

.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; color: var(--text-soft); pointer-events: none;
  z-index: 2; /* R176：高于 #canvas(z-index:1)——R173 后画布会拦截空状态按钮点击 */
}
.empty-state .btn { pointer-events: auto; }
.empty-illus { font-size: 52px; }
.empty-state p { margin: 0; font-size: 14px; }

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.foot-copyright { margin: 0; font-size: 11.5px; color: var(--text-soft); white-space: nowrap; }
.foot-note { margin: 0; flex: 1; text-align: center; font-size: 11.5px; color: var(--text-soft); }

/* Toast */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 80;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1079px) {
  .preview {
    order: -1; /* 先看到画布，再滚动控制面板 */
    position: sticky;
    top: 57px;
    z-index: 20;
    height: 46vh;
    border-bottom: 1px solid var(--border);
  }
  .stage { padding: 14px; }
  .controls {
    max-height: none;
    border-top: 1px solid var(--border);
  }
  .controls-left { border-right: 0; }
  .controls-right { border-left: 0; }
  .brand-tag { display: none; }
}

@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 8px 12px; }
  .brand-name { font-size: 14px; }
}

/* =====================================================================
 * 首页 / 落地页样式
 * ===================================================================== */
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

html { scroll-behavior: smooth; }

/* 首页顶栏导航 */
.home-topbar { justify-content: flex-start; gap: 16px; }
.home-topbar .main-nav { margin-left: auto; }
.main-nav { display: flex; gap: 22px; align-items: center; }
.main-nav a { color: var(--text-soft); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .15s; }
.main-nav a:hover { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* 英雄区 */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 44px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 24px 60px;
  scroll-margin-top: 64px;
}
.kicker {
  display: inline-block;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: rgba(109, 94, 252, .1);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15; margin: 0 0 16px; letter-spacing: -.5px;
}
.lead { font-size: 16px; color: var(--text-soft); margin: 0 0 26px; max-width: 520px; line-height: 1.7; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.trust { list-style: none; display: flex; gap: 20px; flex-wrap: wrap; padding: 0; margin: 28px 0 0; }
.trust li { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-soft); }
.tick { color: var(--accent); font-weight: 800; }
.hero-visual { display: flex; justify-content: center; }
#heroCanvas { width: 100%; max-width: 540px; height: auto; border-radius: 18px; box-shadow: var(--shadow-md); }

/* 通用区块 */
.section { max-width: 1180px; margin: 0 auto; padding: 60px 24px; scroll-margin-top: 64px; }
.section-alt { max-width: none; padding: 60px 24px; background: var(--surface-2); border-block: 1px solid var(--border); }
.section-alt > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.section-title { font-size: clamp(22px, 3vw, 30px); text-align: center; margin: 0 0 34px; font-weight: 800; letter-spacing: -.3px; }

/* 功能网格 */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature-card, .step-card, .why-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.feature-card:hover, .step-card:hover, .why-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-ico { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 15px; }
.feature-card p { margin: 0; font-size: 13px; color: var(--text-soft); line-height: 1.65; }

/* 步骤 */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step-card { padding: 26px 22px; }
.step-num {
  width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: #fff;
  font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 16px;
}
.step-card h3 { margin: 0 0 8px; font-size: 15px; }
.step-card p { margin: 0; color: var(--text-soft); font-size: 13px; line-height: 1.6; }

/* 为什么选择 */
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.why-card { padding: 26px 22px; text-align: center; }
.why-ico { font-size: 30px; margin-bottom: 12px; }
.why-card h3 { margin: 0 0 8px; font-size: 15px; }
.why-card p { margin: 0; color: var(--text-soft); font-size: 13px; line-height: 1.65; }

/* FAQ */
.faq-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-item summary {
  cursor: pointer; padding: 16px 18px; font-weight: 600; font-size: 14.5px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent); font-size: 22px; font-weight: 700; line-height: 1; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-a { padding: 0 18px 16px; color: var(--text-soft); font-size: 13.5px; line-height: 1.75; }

/* CTA 横幅 */
.cta-band {
  text-align: center; padding: 66px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.cta-band h2 { margin: 0 0 10px; font-size: clamp(22px, 3vw, 30px); }
.cta-band p { margin: 0 0 24px; opacity: .92; font-size: 15px; }
.cta-band .btn-primary { background: #fff; color: var(--accent); }
.cta-band .btn-primary:hover { filter: brightness(.96); }

/* 页脚 */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 44px 24px 26px; }
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 24px; }
.footer-brand .brand-name { font-weight: 700; font-size: 15px; }
.footer-tag { color: var(--text-soft); font-size: 12.5px; margin: 8px 0 0; max-width: 360px; line-height: 1.6; }
.footer-nav h4 { margin: 0 0 12px; font-size: 12.5px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; }
.footer-nav a { display: block; color: var(--text); text-decoration: none; padding: 4px 0; font-size: 13.5px; }
.footer-nav a:hover { color: var(--accent); }
.footer-note p { color: var(--text-soft); font-size: 13px; line-height: 1.65; margin: 0; }
.footer-copy { text-align: center; color: var(--text-soft); font-size: 12.5px; margin: 28px 0 0; }

/* 首页响应式 */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 30px; padding: 36px 20px 48px; }
  .hero-visual { order: -1; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid, .why-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 720px) {
  .main-nav { display: none; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .section, .section-alt { padding: 44px 18px; }
}

/* R51 撤销历史面板（指针式历史：撤销 / 重做 / 跳步回退） */
.undo-cluster { position: relative; }
.history-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: 248px; max-height: 326px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 14px 36px rgba(0,0,0,.20);
  padding: 8px; display: none;
}
.history-panel.open { display: block; }
.history-head { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 2px 6px 8px; }
.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; padding: 6px 8px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--text); font-size: 12.5px; cursor: pointer;
}
.history-item:hover { background: var(--surface-2); }
.history-item.active { background: rgba(109,94,252,.14); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.history-item .h-idx {
  flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 6px; background: var(--surface-2); font-size: 11px; color: var(--text-2);
}
.history-item.active .h-idx { background: var(--accent); color: #fff; }
.history-item .h-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#historyCount { display: inline-block; min-width: 14px; text-align: center; opacity: .72; font-variant-numeric: tabular-nums; }
.hist-count { align-self: center; padding: 2px 6px; background: var(--surface-2); border-radius: 6px; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.history-hint { font-size: 11px; color: var(--text-2); padding: 0 6px 8px; opacity: .82; }
.history-item.focused { background: var(--surface-2); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,94,252,.4); }
.history-item.focused .h-idx { background: var(--accent); color: #fff; }
.history-item:focus { outline: none; }
/* 悬停预览：琥珀色左侧高亮，与选中紫(.active 填充) / 键盘焦点紫环(.focused) 区分 */
.history-item.previewing { background: rgba(255,159,28,.12); border-left: 3px solid #ff9f1c; padding-left: 6px; }
.history-item.previewing .h-idx { background: #ff9f1c; color: #fff; }
.history-preview-tag {
  display: inline-block; margin: 0 6px 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,159,28,.16); color: #c4760a; font-size: 11px; font-weight: 600;
}
.history-preview-tag[hidden] { display: none; }

/* ===================== R118：文字图层（自定义文字 / 拖动 / 缩放 / 旋转） ===================== */
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 56px;
}
.text-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.text-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
}
.text-chip:hover { border-color: var(--accent); }
.text-chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.text-chip .tc-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--text);
}
.text-chip.off .tc-name { opacity: .5; text-decoration: line-through; }
.text-chip .tc-eye, .text-chip .tc-del {
  flex: 0 0 auto; border: 0; background: transparent;
  color: var(--text-soft); font-size: 11px; font-family: inherit;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.text-chip .tc-del { font-size: 15px; line-height: 1; }
.text-chip .tc-eye:hover, .text-chip .tc-del:hover { background: rgba(109, 94, 252, .14); color: var(--text); }

/* ===================== R120：光标语义统一 ===================== */
/* 滑条：可点击 / 按下抓握（拖动中保持 grabbing，避免中途跳变） */
input[type="range"] { cursor: pointer; }
input[type="range"]:active { cursor: grabbing; }
input[type="range"]::-webkit-slider-thumb { cursor: grab; }
input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
input[type="range"]::-moz-range-thumb { cursor: grab; }
input[type="range"]:active::-moz-range-thumb { cursor: grabbing; }
/* 下拉框 / 文本域 */
select { cursor: pointer; }
textarea { cursor: text; }
/* 失效控件：明确表达不可点 */
button:disabled, .btn:disabled, .btn-primary:disabled, .btn-ghost:disabled,
.btn.xs:disabled, .preset-btn:disabled { cursor: not-allowed; }
.field.disabled, .field.disabled input, .field.disabled select,
.field.disabled label, .field.disabled .fld-hex { cursor: not-allowed; }
/* 拖入文件 / 拖放区：copy 语义（!important 用于压住画布内联光标） */
.dropzone.drag { cursor: copy; }
body.drag-file #canvas, body.drag-file .dropzone, body.drag-file .stage { cursor: copy !important; }
/* 折叠卡片标题可点 */
.card h2 { cursor: pointer; }

/* ===================== R121：三步搞定卡片——数字图标与标题同行 ===================== */
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-head .step-num { margin-bottom: 0; flex: 0 0 auto; }
.step-head h3 { margin: 0; font-size: 15px; }

/* ===================== R122：全站取消文字下划线 ===================== */
/* 按钮类 <a class="btn">、CTA、正文链接的浏览器默认下划线一律去除（品牌/导航/页脚此前已单独 reset） */
a, a:hover, a:focus, a:active, a:visited { text-decoration: none; }
.btn { text-decoration: none; }

/* ===================== R124：图标徽标风格统一 ===================== */
/* 功能卡与「为什么选择」卡共用同一套图标容器：46px 圆角渐变底、等大 emoji，消除原生 emoji 尺寸/风格差异 */
.feature-ico, .why-ico {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(109, 94, 252, .13), rgba(255, 126, 179, .13));
  border: 1px solid rgba(109, 94, 252, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
}
/* 功能卡：图标左、标题右，描述整行在下 */
.feature-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.feature-head .feature-ico { margin-bottom: 0; }
.feature-head h3 { margin: 0; font-size: 15px; }
/* why 卡保持居中布局，仅套用统一徽标 */
.why-ico { margin: 0 auto 12px; }

/* ===================== R125：内容页（FAQ / 教程 / 关于 / 条款 / 隐私） ===================== */
.page-main { padding: 40px 24px 64px; }
.page-wrap { max-width: 860px; margin: 0 auto; }
.page-title { margin: 0 0 10px; font-size: 30px; line-height: 1.25; letter-spacing: -.3px; }
.page-lead { margin: 0 0 26px; color: var(--text-soft); font-size: 14.5px; line-height: 1.75; }
.page-section { margin: 30px 0; }
.page-section h2 { margin: 0 0 12px; font-size: 19px; }
.page-section p { margin: 0 0 10px; color: var(--text); font-size: 14px; line-height: 1.8; }
.page-list { margin: 0; padding-left: 20px; }
.page-list li { font-size: 14px; line-height: 1.8; color: var(--text-soft); margin-bottom: 6px; }
.page-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.page-faq .faq-item { margin-bottom: 10px; }
.legal-meta { margin: 0 0 18px; font-size: 12.5px; color: var(--text-soft); }

/* 教程：步骤 / 快捷键 */
.tut-steps { display: flex; flex-direction: column; gap: 14px; }
.tut-step { display: flex; gap: 14px; align-items: flex-start; }
.tut-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.tut-body h3 { margin: 4px 0 6px; font-size: 15.5px; }
.tut-body p { margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--text-soft); }
.kb-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; }
.kb-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); }
.kb-row kbd {
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 5px 7px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}

/* 关于：官网卡 / 原则卡 / 联系卡 */
.site-card, .contact-card {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.site-ico, .contact-ico {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1;
  background: linear-gradient(135deg, rgba(109, 94, 252, .13), rgba(255, 126, 179, .13));
  border: 1px solid rgba(109, 94, 252, .16);
}
.site-body h3, .contact-body h3 { margin: 2px 0 6px; font-size: 15.5px; }
.site-body p, .contact-body p { margin: 0 0 10px; font-size: 13.5px; color: var(--text-soft); line-height: 1.7; }
.prin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.prin-card {
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.prin-card h3 { margin: 12px 0 6px; font-size: 15px; }
.prin-card p { margin: 0; font-size: 13px; color: var(--text-soft); line-height: 1.7; }
.contact-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); margin: 0 0 6px; }
.copy-email-btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 14px; border-radius: 10px; border: 1px dashed rgba(109, 94, 252, .5);
  background: rgba(109, 94, 252, .08); color: var(--text);
  font: 600 14px/1 inherit; transition: background .15s, border-color .15s;
}
.copy-email-btn:hover { background: rgba(109, 94, 252, .16); border-color: var(--accent); }
.copy-email-addr { font-variant-numeric: tabular-nums; }
.copy-email-hint {
  font-size: 11.5px; font-weight: 600; color: var(--accent);
  padding: 3px 7px; border-radius: 999px; background: rgba(109, 94, 252, .14);
}
.contact-tip { margin: 10px 0 0; font-size: 12.5px; color: var(--text-soft); }

/* 条款 / 隐私：广告披露块 */
.ads-note {
  margin-top: 14px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
}
.ads-note h3 { margin: 0 0 10px; font-size: 14.5px; }
.ads-note p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.75; color: var(--text-soft); }
.ads-links { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ads-links a { font-size: 13px; color: var(--accent); }

/* 内容页 toast（邮箱复制提示） */
.page-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 12px;
  background: var(--text); color: var(--surface); font-size: 13.5px; line-height: 1.5;
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0, 0, 0, .25));
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.page-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .page-main { padding: 26px 16px 48px; }
  .page-title { font-size: 24px; }
  .kb-list, .prin-grid { grid-template-columns: 1fr; }
  .site-card, .contact-card { flex-direction: column; gap: 12px; }
}

/* ===================== R126：顶部菜单统一 5 项 + 当前页高亮 ===================== */
.main-nav a[aria-current="page"] {
  color: var(--accent); font-weight: 700;
  background: rgba(109, 94, 252, .12);
  padding: 5px 10px; border-radius: 8px;
  box-shadow: none;
}
/* 工具页底部法律链接（顶部菜单收敛为 5 项后保留入口） */
.foot-legal { margin: 0; display: flex; align-items: center; gap: 8px; justify-content: flex-end; white-space: nowrap; font-size: 11.5px; color: var(--text-soft); }
.foot-legal a { color: var(--text-soft); }
.foot-legal a:hover { color: var(--accent); }

/* ===================== R127：顶部菜单宽度与页面内容宽度对齐 ===================== */
/* 工具页（.topbar 无 home-topbar）保持全屏宽；其余页面顶栏内容宽度对齐各自正文容器：
   - 首页：R175 起改为与页脚 .footer-inner 完全一致（24px 页边距 + 1180px 居中内容盒）
   - 内容页：正文容器为 .page-wrap（860px 居中） */
.topbar.home-topbar {
  padding-left: 24px;
  padding-right: 24px;
}
.topbar-inner {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar.content-topbar {
  padding-left: max(18px, calc((100% - 860px) / 2));
  padding-right: max(18px, calc((100% - 860px) / 2));
}
@media (max-width: 900px) {
  .topbar.content-topbar { padding-left: 18px; padding-right: 18px; }
}

/* ===================== R129：emoji 图标 → 统一线性 SVG 图标 ===================== */
.feature-ico svg, .why-ico svg, .site-ico svg, .contact-ico svg {
  display: block; color: var(--accent);
}
.empty-illus { color: var(--accent); }
.empty-illus svg { display: block; }

/* ===================== R130：页脚三列导航（工具 / 帮助 / 关于） ===================== */
.footer-inner { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.footer-note-text {
  margin: 10px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--text-soft);
  max-width: 360px;
}
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ===================== R131：美化工具页顶部菜单靠右 ===================== */
/* 顶栏为 space-between 三栏（品牌 / 导航 / 语言切换）：给导航 margin-left:auto，
   把导航与语言切换成一组推到右侧，品牌保持在左。 */
.tool-nav { margin-left: auto; justify-content: flex-end; }
@media (max-width: 900px) {
  .tool-nav { margin-left: 0; }
}

/* ===================== R150：三栏布局 + 侧栏分组 Tab ===================== */
/* 恢复常驻三栏（左 主图·背景·风格 | 中 画布 | 右 文字·装饰·标注·输出），
   每侧内部分组用 Tab 切换，替代原「长列表滚动」与 R134 的单栏叠加模式。 */
.side-tabs {
  display: flex; gap: 6px;
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  margin: -16px -16px 12px; /* 全出血抵消 .controls 的 padding，吸附在滚动容器顶部 */
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
}
.side-tab {
  flex: 1 1 0; min-width: 0; cursor: pointer;
  padding: 9px 6px 8px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--text-soft);
  font: 600 12.5px/1.2 inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-radius: 8px 8px 0 0;
  transition: color .15s, background .15s, border-color .15s;
}
.side-tab:hover { color: var(--text); background: var(--surface-2); }
.side-tab.active {
  color: var(--accent); background: var(--surface-2);
  border-bottom-color: var(--accent);
}
.side-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* R150 测试钩子：?allpanels=1 → 全部分组可见（回归探针用，生产不受影响） */
body.all-panes .tabpane { display: block !important; }
body.all-panes .side-tabs { display: none; }

/* R138 装饰图层面板 */
.deco-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 4px 0 10px; }
.deco-emoji-btn {
  font-size: 18px; line-height: 1; padding: 6px 0; cursor: pointer;
  border: 1px solid var(--border, #e3e3ee); border-radius: 8px;
  background: var(--card, #fff); transition: border-color .15s, background .15s, transform .1s;
}
.deco-emoji-btn:hover { border-color: var(--accent, #6d5efc); background: var(--accent-soft, #f1effe); transform: translateY(-1px); }
.deco-emoji-btn:active { transform: translateY(0); }
#decoShapeBtns { margin: 8px 0 4px; }
/* 文件选择按钮：label 包裹隐藏 input，复用 .btn 外观 */
.file-btn { position: relative; overflow: hidden; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn.full { width: 100%; }

/* R143 彩色文字自定义配色 */
#rainbowPalette { flex-wrap: wrap; gap: 10px; margin: 6px 0; }
#rainbowPalette + .presets { margin-top: 8px; }
.rp-swatch {
  position: relative; width: 34px; height: 34px; border-radius: 9px;
  border: 2px solid rgba(255, 255, 255, .92);
  box-shadow: 0 1px 4px rgba(28, 29, 41, .18);
  transition: transform .12s, box-shadow .12s;
}
.rp-swatch:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(28, 29, 41, .22); }
.rp-swatch input[type="color"] {
  width: 100%; height: 100%; border: 0; padding: 0; background: none;
  cursor: pointer; border-radius: 7px;
}
.rp-swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.rp-swatch input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.rp-del {
  position: absolute; top: -7px; right: -7px; z-index: 1;
  width: 17px; height: 17px; border-radius: 50%; border: 0; padding: 0;
  background: #6d5efc; color: #fff; font-size: 11px; line-height: 17px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(28, 29, 41, .3);
}
.rp-del:hover { background: #ff5f57; }

/* R145 弹窗美化：toast + 导出灯箱 */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.94); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes toastDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.72); opacity: .65; }
}
.toast {
  max-width: 82vw;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 20px 11px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #262840, #1a1b28);
  color: #f2f3fa;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .10),
    0 6px 20px rgba(15, 16, 32, .28),
    0 2px 6px rgba(15, 16, 32, .18);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  line-height: 1.45;
}
.toast.show {
  animation: toastIn .32s cubic-bezier(.34, 1.56, .64, 1);
}
.toast::before {
  content: ''; flex: 0 0 auto;
  width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a99dff, var(--accent, #6d5efc));
  box-shadow: 0 0 8px rgba(109, 94, 252, .8);
  animation: toastDot 1.6s ease-in-out infinite;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
@media (prefers-color-scheme: dark) {
  .toast {
    background: linear-gradient(135deg, #2a2e42, #1d2130);
    border-color: rgba(255, 255, 255, .18);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .12),
      0 8px 26px rgba(0, 0, 0, .55),
      0 2px 8px rgba(0, 0, 0, .4);
  }
}
@media (prefers-reduced-motion: reduce) {
  .toast.show { animation: none; }
  .toast::before { animation: none; }
}

/* R145 导出灯箱 */
@keyframes lbIn {
  from { opacity: 0; transform: translateY(14px) scale(.965); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.export-lightbox .lb-backdrop {
  background: rgba(12, 13, 26, .62);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
}
.export-lightbox .lb-card {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow:
    0 30px 90px rgba(10, 12, 30, .4),
    0 10px 30px rgba(10, 12, 30, .22);
  animation: lbIn .3s cubic-bezier(.22, 1, .36, 1) both;
}
.lb-head { background: var(--surface-2, #f0f1f8); }
.lb-zoom { font-weight: 600; }
.lb-stage { background: linear-gradient(180deg, #edeff7, #f7f8fc); }
.lb-close {
  border-radius: 10px;
  transition: background .18s, color .18s, transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.lb-close:hover { background: #ff5f57; color: #fff; transform: rotate(90deg); }
.lb-close:active { transform: rotate(90deg) scale(.9); }
@media (prefers-color-scheme: dark) {
  .export-lightbox .lb-card { border-color: rgba(255, 255, 255, .1); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
}
@media (prefers-reduced-motion: reduce) {
  .export-lightbox .lb-card { animation: none; }
  .lb-close { transition: background .18s, color .18s; }
  .lb-close:hover { transform: none; }
}

/* R151 中屏适配：1080~1279 收窄两侧面板，保证画布可用宽度（否则三栏下画布仅 ~360px） */
@media (min-width: 1080px) and (max-width: 1279px) {
  .app { grid-template-columns: 300px minmax(0, 1fr) 300px; }
}
/* R151 Tab 语义增强：聚焦态描边（键盘方向键切换时可见） */
.side-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px 8px 0 0; }
/* R151 中屏 Tab 文案防截断（300px 侧栏下英文 Annotate 等较长标签） */
@media (min-width: 1080px) and (max-width: 1279px) {
  .side-tab { font-size: 11.5px; padding: 9px 3px 8px; letter-spacing: -0.1px; }
}

/* R152 画布下方状态栏（图片信息）+ 页脚全屏宽 */
.status-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px; color: var(--text-soft);
  user-select: none;
}
.stb-item { display: inline-flex; align-items: center; }
.stb-item b {
  margin-left: 6px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
}
.stb-sep { width: 1px; height: 12px; background: var(--border); }
/* 页脚移出三栏 grid 后占满整行（左/中/右三栏布局） */
.preview-footer { text-align: center; }
.preview-footer .foot-legal { margin: 0; font-size: 11.5px; justify-content: flex-end; }

/* R153 表单纵向节奏统一优化：卡片/分组/子区内相邻元素最小间距兜底。
   根因：.grid2、.seg、按钮行等零下边距元素紧贴后续控件（如「重置位置」「透明背景」）。
   容器均为 block（外边距折叠生效），margin-top 12 与既有 margin-bottom 取大者，不会双倍。 */
.card > * + *,
.fgroup > * + *,
.sub > * + * { margin-top: 12px; }
/* 子区（虚线分隔块）与上文的间隔同步加大 */
.sub { margin-top: 12px; padding-top: 12px; }
/* R153 补充：id 规则优先级高于兜底选择器，单独对齐 */
#decoShapeBtns { margin-top: 12px; }

/* R158 修复：侧栏滚动时顶部露缝透出下层卡片内容。
   根因：.controls 的 padding-top:16px 使 sticky Tab 条最高只能钉在内容盒顶，
   与滚动容器（padding 盒）顶之间留出 16px 空缝。改为顶部无内距、由 Tab 条自身铺满，
   首卡间距移到 .tabpane 上；allpanels 钩子下恢复顶部内距。 */
.controls { padding-top: 0; }
.side-tabs { margin: 0 -16px 12px; }
.tabpane { padding-top: 16px; }
body.all-panes .controls { padding-top: 16px; }
body.all-panes .tabpane { padding-top: 0; }

/* R160 形状按钮图形化：按钮内嵌 SVG 形状预览（currentColor 随主题），文字标签保留 */
#decoShapeBtns .ratio-preset { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#decoShapeBtns .ratio-preset svg { width: 13px; height: 13px; flex: none; }

/* R160 emoji 分页器：‹ 页码 › 居中排布，禁用态降透明度 */
.eg-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 2px 0 10px; }
.eg-pager-btn {
  width: 26px; height: 26px; border: 1px solid var(--border, #e3e3ee); border-radius: 8px;
  background: var(--card, #fff); color: var(--text, #333); cursor: pointer;
  font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.eg-pager-btn:hover:not(:disabled) { border-color: var(--accent, #6d5efc); background: var(--accent-soft, #f1effe); }
.eg-pager-btn:disabled { opacity: .35; cursor: not-allowed; }
.eg-page-info { font-size: 12px; color: var(--muted, #777); font-variant-numeric: tabular-nums; min-width: 30px; text-align: center; }

/* R184/R185 SEO：工具页视觉隐藏 h1（屏幕阅读器与搜索引擎可见，不影响布局） */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
