/* ============================================================
 * 实用拼豆主义 · 图纸工具 —— 移动优先样式
 * ============================================================ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden 属性优先级保障：防止自定义 display 覆盖 UA 的 [hidden] 样式 */
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: #f2f3f6;
  color: #1f2430;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
}
button { font-family: inherit; }

/* ---------------- 视图切换 ---------------- */
.view {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  background: #f2f3f6;
}
.view.active { display: flex; }

/* ---------------- 欢迎页 ---------------- */
.welcome {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px;
  text-align: center;
  gap: 14px;
}
.welcome-logo { animation: float 3.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.welcome h1 { margin: 0; font-size: clamp(19px, 6vw, 26px); letter-spacing: 1px; }
.welcome-sub { margin: 0; color: #6b7280; font-size: 14px; line-height: 1.7; }
.welcome-tips {
  margin-top: 26px; padding: 14px 18px;
  background: #fff; border-radius: 14px;
  color: #6b7280; font-size: 12.5px; line-height: 2;
  box-shadow: 0 2px 10px rgba(31,36,48,.06);
  text-align: left;
}

/* 首页板规格选择 */
.board-spec-pick {
  margin-top: 18px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.board-spec-label {
  font-size: 12px; color: #6b7280; font-weight: 600; letter-spacing: .5px;
}
.board-spec-pick .chip-row { justify-content: center; }

/* ---------------- 通用按钮 ---------------- */
.big-btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 16px 44px;
  background: linear-gradient(135deg, #ff8a4c, #ff5e3a);
  color: #fff; font-size: 18px; font-weight: 600;
  border: none; border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255,94,58,.35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.big-btn:active { transform: scale(.96); box-shadow: 0 4px 12px rgba(255,94,58,.3); }

.primary-btn {
  padding: 13px 20px;
  background: linear-gradient(135deg, #ff8a4c, #ff5e3a);
  color: #fff; font-size: 15.5px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer;
  transition: transform .1s ease, opacity .1s ease;
}
.primary-btn:active { transform: scale(.97); opacity: .9; }
.primary-btn.grow { flex: 1; }
.primary-btn:disabled { opacity: .45; }

.ghost-btn {
  padding: 12px 22px;
  background: #fff; color: #ff5e3a;
  font-size: 15px; font-weight: 600;
  border: 1.5px solid #ffcdc0; border-radius: 12px;
  cursor: pointer;
}
.ghost-btn:active { background: #fff3ef; }
.ghost-btn.grow { flex: 1; }

.mini-btn {
  padding: 8px 14px;
  background: #eef1f6; color: #374151;
  font-size: 13px; font-weight: 600;
  border: none; border-radius: 9px; cursor: pointer;
}
.mini-btn:active { background: #e0e4eb; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: inherit;
  border: none; border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: rgba(127,127,127,.15); }

/* ---------------- 顶栏 ---------------- */
.bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: #1f2430; color: #f5f6fa;
  min-height: 56px;
}
.bar-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.bar-right { width: 40px; }

.topbar-mid {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
}
.topbar-name {
  max-width: 180px;
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-meta {
  display: flex; gap: 10px;
  font-size: 11px; color: #9aa3b5;
}
#save-state { color: #7fd18c; }
#save-state.unsaved { color: #ffce6a; }

.footer-bar {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #f2f3f6;
}

/* ---------------- 裁剪页 ---------------- */
.crop-stage {
  position: relative; flex: 1; overflow: hidden;
  background: #14161c;
  touch-action: none;
}
#crop-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  pointer-events: none;
}
.crop-handle {
  position: absolute; width: 26px; height: 26px;
  pointer-events: auto; touch-action: none;
}
.crop-handle::after {
  content: '';
  position: absolute; inset: 7px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.crop-handle.nw { left: -13px; top: -13px; cursor: nwse-resize; }
.crop-handle.ne { right: -13px; top: -13px; cursor: nesw-resize; }
.crop-handle.sw { left: -13px; bottom: -13px; cursor: nesw-resize; }
.crop-handle.se { right: -13px; bottom: -13px; cursor: nwse-resize; }
.crop-handle.n { left: 50%; top: -13px; margin-left: -13px; cursor: ns-resize; }
.crop-handle.s { left: 50%; bottom: -13px; margin-left: -13px; cursor: ns-resize; }
.crop-handle.w { left: -13px; top: 50%; margin-top: -13px; cursor: ew-resize; }
.crop-handle.e { right: -13px; top: 50%; margin-top: -13px; cursor: ew-resize; }
.crop-aspect {
  display: flex; gap: 8px; justify-content: center;
  padding: 10px;
  overflow-x: auto;
  background: #fff;
}

/* ---------------- chips ---------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 15px;
  background: #fff; color: #374151;
  font-size: 13.5px; font-weight: 500;
  border: 1.5px solid #dfe3ea; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: all .12s ease;
}
.chip.on {
  background: #1f2430; color: #fff;
  border-color: #1f2430;
}
.chip:active { transform: scale(.95); }

/* ---------------- 参数区 ---------------- */
.params { background: #fff; border-bottom: 1px solid #e6e8ee; }
.params-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: none; border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: #374151;
}
.params-toggle svg { transition: transform .2s ease; color: #9aa3b5; }
.params.open .params-toggle svg { transform: rotate(180deg); }
.params-body {
  display: none;
  padding: 4px 16px 16px;
}
.params.open .params-body { display: block; }
.param-row { margin: 10px 0; }
.param-label {
  display: block; margin-bottom: 8px;
  font-size: 12px; color: #9aa3b5; font-weight: 600;
  letter-spacing: .5px;
}
.param-label .param-sub {
  margin-left: 8px; color: #ff5e3a; font-weight: 700; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.custom-size {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 13.5px; color: #374151;
}
.custom-size input {
  width: 64px; padding: 8px 6px;
  font-size: 15px; text-align: center;
  border: 1.5px solid #dfe3ea; border-radius: 9px;
  background: #fff; color: #1f2430;
  -webkit-appearance: none; appearance: none;
}
.custom-size input:focus { outline: none; border-color: #ff8a4c; }
.custom-size em { color: #9aa3b5; font-style: normal; }
#btn-regenerate { width: 100%; margin-top: 8px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px;
  font-size: 13.5px; color: #374151; cursor: pointer;
}
.switch-sub { color: #9aa3b5; font-size: 11.5px; }
.switch-row input { display: none; }
.switch {
  flex-shrink: 0;
  width: 46px; height: 27px;
  background: #dfe3ea; border-radius: 999px;
  position: relative; transition: background .18s ease;
}
.switch::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s ease;
}
.switch-row input:checked + .switch { background: #ff5e3a; }
.switch-row input:checked + .switch::after { transform: translateX(19px); }

/* ---------------- 画布区 ---------------- */
.canvas-wrap {
  position: relative; flex: 1;
  min-height: 0;
  background: #eef0f3;
  overflow: hidden;
}
#board {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.canvas-hud {
  position: absolute; right: 10px; top: 10px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 5;
}
.hud-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); color: #1f2430;
  font-size: 20px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(31,36,48,.16);
}
.hud-btn:active { transform: scale(.92); }
.zoom-tip {
  position: absolute; left: 12px; bottom: 12px;
  padding: 6px 12px;
  background: rgba(31,36,48,.55); color: #fff;
  font-size: 11px; border-radius: 999px;
  pointer-events: none;
  opacity: .9;
}

.select-actions {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: rgba(31,36,48,.92);
  border-radius: 14px;
  z-index: 6;
  white-space: nowrap;
}
.select-actions span { color: #fff; font-size: 12.5px; padding: 0 2px; }
.select-actions .mini-btn { background: rgba(255,255,255,.16); color: #fff; }
.select-actions .mini-btn:active { background: rgba(255,255,255,.28); }

.gen-mask {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(242,243,246,.86);
  backdrop-filter: blur(3px);
  z-index: 10;
  color: #374151; font-size: 14.5px; font-weight: 500;
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid #ffd6c6; border-top-color: #ff5e3a;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 底部工具栏 ---------------- */
.toolbar {
  background: #fff;
  border-top: 1px solid #e6e8ee;
  padding-bottom: env(safe-area-inset-bottom);
}
/* 用色色块条：横向滚动，点击高亮该颜色所有格子 */
.used-strip {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 8px 12px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.used-strip::-webkit-scrollbar { display: none; }
.used-strip:empty { display: none; }
.strip-item {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: none; padding: 0;
  cursor: pointer;
}
.strip-item:active { opacity: .8; }
.strip-swatch {
  display: block;
  width: 38px; height: 30px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,0.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
  transition: box-shadow .15s;
}
.strip-code {
  font-size: 10px; font-weight: 600;
  color: #6b7280; line-height: 1;
}
.strip-item.on .strip-swatch {
  border-color: #ff5e3a;
  box-shadow: 0 0 0 2px rgba(255,94,58,0.4);
}
.strip-item.on .strip-code { color: #ff5e3a; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px;
  background: transparent; color: #6b7280;
  border: none; border-radius: 12px; cursor: pointer;
  position: relative;
}
.tool-btn:active { background: #f2f3f6; }
.tool-btn.on { color: #ff5e3a; background: #fff0ea; }
.tool-btn:disabled { opacity: .3; }
.tool-btn.accent { color: #ff5e3a; }
.action-row {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 8px;
}
.action-row .tool-btn { height: 46px; }
.spacer { flex: 1; }

.color-current {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 8px;
  background: #f5f6f8;
  border: 1.5px solid #e6e8ee; border-radius: 999px;
  cursor: pointer;
}
.color-current:active { transform: scale(.97); }
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.color-code { font-size: 14.5px; font-weight: 700; color: #1f2430; }

/* ---------------- 抽屉 / 弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0;
  background: rgba(15,17,23,.5);
  z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 560px;
  max-height: 72vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  transform: translateY(30px);
  transition: transform .22s ease;
  overflow-y: auto;
}
.sheet-mask.show .sheet { transform: translateY(0); }
.small-sheet { max-width: 400px; border-radius: 20px; margin: 0 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 700; color: #1f2430;
}
.sheet-sub { font-size: 12px; color: #9aa3b5; margin-top: -6px; }

.modal {
  position: fixed; inset: 0;
  background: rgba(15,17,23,.55);
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-panel {
  width: 100%; max-width: 520px; max-height: 86vh;
  background: #fff; border-radius: 18px;
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
  transform: scale(.96);
  transition: transform .18s ease;
  overflow: hidden;
}
.modal.show .modal-panel { transform: scale(1); }

/* 色板网格（当前用色） */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.palette-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px;
  background: #f5f6f8; border: 1.5px solid transparent;
  border-radius: 12px; cursor: pointer;
  transition: transform .1s ease;
}
.palette-item:active { transform: scale(.93); }
.palette-item.on { border-color: #ff5e3a; background: #fff0ea; }
.palette-item .swatch {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(0,0,0,.12);
}
.palette-item .pcode { font-size: 11.5px; font-weight: 700; color: #374151; }
.palette-item .pcount { font-size: 10px; color: #9aa3b5; }

/* 全色卡 */
.group-tabs {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex-shrink: 0;
}
.group-tabs::-webkit-scrollbar { display: none; }
.gtab {
  padding: 7px 13px;
  background: #f2f3f6; color: #374151;
  font-size: 12.5px; font-weight: 600;
  border: none; border-radius: 999px;
  white-space: nowrap; cursor: pointer;
}
.gtab.on { background: #1f2430; color: #fff; }
.gtab.fx { color: #b0740a; }
.gtab.fx.on { background: #b0740a; color: #fff; }

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
}
.color-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 3px 5px;
  background: #f8f9fb; border: 1.5px solid transparent;
  border-radius: 11px; cursor: pointer;
}
.color-cell:active { transform: scale(.93); }
.color-cell .swatch {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.12);
  position: relative;
}
.color-cell .ccode { font-size: 11px; font-weight: 700; color: #374151; }
.color-cell.fx .swatch::after {
  content: '✦';
  position: absolute; top: -5px; right: -5px;
  width: 14px; height: 14px;
  font-size: 9px; line-height: 14px; text-align: center;
  background: #b0740a; color: #fff;
  border-radius: 50%;
}
.color-cell.fx { border-color: #f3e2bb; }
.color-cell.on { border-color: #ff5e3a; background: #fff0ea; }

/* 顶栏「精度」按钮（醒目入口） */
.quality-open-btn {
  display: flex; align-items: center; gap: 4px;
  background: #ff5e3a; color: #fff !important;
  border-radius: 999px; padding: 5px 12px 5px 9px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(255,94,58,.35);
}
.quality-open-btn:active { transform: scale(.95); }
.quality-open-btn svg { flex-shrink: 0; }

/* 精度面板：板子规格行 */
.qs-board-row { margin-bottom: 4px; }
.qs-board-row .chip-row { flex-wrap: wrap; }

/* 精度选择（滑块 + 实时预览） */
.quality-tip {
  margin: 4px 0 12px;
  font-size: 12.5px; color: #6b7486; line-height: 1.6;
}
.quality-preview-wrap {
  width: 100%; height: 220px;
  background: #eef0f3; border-radius: 12px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.quality-preview-wrap canvas { width: 100%; height: 100%; display: block; }
.quality-slider-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
/* 宽高直接输入行：与滑块双向联动 */
.quality-dims-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 10px 0 0;
}
.qs-dim-input {
  width: 88px; height: 42px;
  text-align: center;
  font-size: 17px; font-weight: 700; color: #1f2430;
  font-variant-numeric: tabular-nums;
  background: #f7f8fa;
  border: 1.5px solid #e0e2ea; border-radius: 10px;
  outline: none;
  -moz-appearance: textfield;
}
.qs-dim-input::-webkit-outer-spin-button,
.qs-dim-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qs-dim-input:focus {
  border-color: #ff5e3a; background: #fff;
  box-shadow: 0 0 0 3px rgba(255,94,58,0.12);
}
.qs-dim-sep {
  font-size: 16px; font-weight: 600; color: #6b7486;
}
.quality-slider-row .qs-end {
  font-size: 11px; color: #9aa3b5; font-variant-numeric: tabular-nums;
  min-width: 18px; text-align: center;
}
#quality-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 30px; background: transparent; cursor: pointer;
}
#quality-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ff5e3a 0%, #ffb199 100%);
}
#quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -10px;
  border-radius: 50%; background: #fff;
  border: 3px solid #ff5e3a;
  box-shadow: 0 2px 6px rgba(255,94,58,.35);
}
#quality-slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ff5e3a 0%, #ffb199 100%);
}
#quality-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #ff5e3a;
  box-shadow: 0 2px 6px rgba(255,94,58,.35);
}
.quality-info {
  margin: 10px 0 14px; padding: 10px 12px;
  background: #f8f9fb; border-radius: 10px;
  font-size: 12.5px; color: #444c5e; line-height: 1.7;
  text-align: center;
}
.quality-info b {
  font-size: 16px; color: #1f2430; font-variant-numeric: tabular-nums;
}
.quality-info .qi-boards { color: #ff5e3a; font-weight: 700; }

/* 统计 */
.stats-summary {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.stat-card {
  flex: 1; min-width: 70px;
  background: #f5f6f8; border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat-card b { display: block; font-size: 17px; color: #1f2430; }
.stat-card span { font-size: 11px; color: #9aa3b5; }
.stats-list { overflow-y: auto; }
.stat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f1f4;
}
.stat-row .swatch {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.stat-row .scode { width: 44px; font-size: 13.5px; font-weight: 700; }
.stat-row .sbar-wrap { flex: 1; }
.stat-row .sbar {
  height: 8px; border-radius: 4px;
  background: #eef0f3; overflow: hidden;
}
.stat-row .sbar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ff8a4c, #ff5e3a);
  border-radius: 4px;
}
.stat-row .snum { width: 62px; text-align: right; font-size: 12.5px; color: #6b7280; }
.stat-row .mini-btn { flex-shrink: 0; }

/* 项目列表 */
.projects-list {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
  max-height: 56vh;
}
.project-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  background: #f8f9fb;
  border: 1.5px solid transparent;
  border-radius: 14px; cursor: pointer;
}
.project-card.on { border-color: #ff5e3a; background: #fff5f1; }
.project-card img {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #e6e8ee;
}
.project-card .pinfo { flex: 1; min-width: 0; }
.project-card .pname {
  font-size: 14.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-card .pmeta { font-size: 11.5px; color: #9aa3b5; margin-top: 3px; }
.project-card .icon-btn { color: #b0b7c3; }
.project-card .icon-btn:active { color: #ff5e3a; background: #ffe9e1; }

/* 顶部菜单 */
.top-menu-mask { align-items: flex-start; justify-content: flex-end; padding: 66px 12px 0 0; }
.top-menu {
  background: #fff; border-radius: 14px;
  min-width: 220px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
  transform: translateY(-8px); opacity: 0;
  transition: all .16s ease;
}
.top-menu-mask.show .top-menu { transform: translateY(0); opacity: 1; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 13px 16px;
  background: none; border: none;
  font-size: 14.5px; color: #1f2430;
  text-align: left; cursor: pointer;
}
.menu-item:active { background: #f5f6f8; }
.menu-item.danger { color: #e5484d; }
.menu-item + .menu-item { border-top: 1px solid #f0f1f4; }

/* 替换确认 */
.replace-info {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px;
  background: #f8f9fb; border-radius: 12px;
  font-size: 14.5px; font-weight: 600;
}
.replace-info .swatch {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid rgba(0,0,0,.12);
}
.replace-info .arrow { color: #9aa3b5; }
.replace-btns { display: flex; gap: 10px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 96px;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(31,36,48,.92); color: #fff;
  font-size: 13.5px; font-weight: 500;
  border-radius: 999px;
  z-index: 100;
  white-space: nowrap;
  animation: toast-in .2s ease;
  pointer-events: none;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* 桌面适配 */
@media (min-width: 760px) {
  .view { max-width: 100%; }
  .canvas-wrap canvas { cursor: crosshair; }
  .toolbar { padding-left: max(16px, calc((100% - 680px) / 2)); padding-right: max(16px, calc((100% - 680px) / 2)); }
}
