/* ===== 图片模块 通用样式 ===== */

/* 主图载入条 */
.source-strip {
  display: flex; align-items: center; gap: var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-16);
  padding: var(--s-2) var(--s-3); margin-bottom: var(--s-3);
}
.source-thumb {
  width: 40px; height: 40px; border-radius: var(--r-12); object-fit: cover;
  background: var(--bg-tint); border: 1px solid var(--line); flex-shrink: 0;
}
.source-info { flex: 1; min-width: 0; }
.source-name { font-weight: 700; font-size: var(--fs-14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-meta { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }
.source-empty { display: flex; flex-direction: column; gap: var(--s-2); }
.source-empty strong { font-size: var(--fs-14); }
.pick-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-10);
  font-size: var(--fs-13); font-weight: 600; transition: background var(--trans);
}
.pick-btn:hover { background: var(--accent-strong); }
.pick-btn svg { width: 15px; height: 15px; }

/* 预览容器 */
.preview-box {
  border: 1px solid var(--line); border-radius: var(--r-14); overflow: auto;
  background: var(--bg-tint); display: flex; align-items: center; justify-content: center;
  min-height: 140px; max-height: 300px;
}
.preview-box.pos-preview { position: relative; }
.preview-box.pos-preview canvas { cursor: crosshair; }
.pos-hint { font-size: var(--fs-12); color: var(--text-3); margin: 0 0 var(--s-2); }

/* 颜色选择器 */
.color-picker { position: relative; }
.color-swatch {
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-10);
  padding: var(--s-2) var(--s-3); cursor: pointer; color: var(--text-2);
  font-size: var(--fs-13); font-weight: 600; transition: border-color var(--trans);
}
.color-swatch:hover { border-color: var(--accent); color: var(--accent); }
.swatch-chip { width: 18px; height: 18px; border-radius: var(--r-6); border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.swatch-text { min-width: 44px; text-align: left; }
.color-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-14);
  box-shadow: var(--shadow-2); padding: var(--s-3); width: 232px;
  display: flex; flex-direction: column; gap: var(--s-3);
}
.color-menu.hidden { display: none; }
.color-presets { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-2); }
.preset-dot {
  width: 24px; height: 24px; border-radius: var(--r-8); border: 1px solid var(--line);
  cursor: pointer; padding: 0; transition: transform var(--trans), box-shadow var(--trans);
}
.preset-dot:hover { transform: scale(1.15); box-shadow: var(--shadow-1); }
/* HSV 取色面板 */
.cp-panel { display: flex; flex-direction: column; gap: var(--s-2); }
.cp-sv {
  position: relative; height: 130px; border-radius: var(--r-8);
  background: linear-gradient(to bottom, rgba(0,0,0,0), #000),
              linear-gradient(to left, hsl(0,100%,50%), #fff);
  border: 1px solid var(--line); cursor: crosshair;
}
.cp-dot {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4);
  transform: translate(-50%, -50%); pointer-events: none;
}
.cp-hue {
  position: relative; height: 16px; border-radius: var(--r-8); cursor: pointer;
  background: linear-gradient(to right, #f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);
  border: 1px solid var(--line);
}
.cp-hue-marker {
  position: absolute; top: -3px; bottom: -3px; width: 4px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none;
}
.cp-current { display: flex; align-items: center; gap: var(--s-2); }
.cp-current .swatch-chip { width: 20px; height: 20px; }
.cp-hex { font-size: var(--fs-12); color: var(--text-2); letter-spacing: .3px; }

/* 位置快捷九宫格 */
.quick-grid { display: grid; grid-template-columns: repeat(3, 28px); gap: 3px; }
.quick-btn {
  height: 20px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-6); background: var(--surface);
  color: var(--text-2); font-size: 11px; cursor: pointer; transition: all var(--trans);
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.quick-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.preview-box canvas { max-width: 100%; max-height: 300px; width: auto; height: auto; display: block; }
.preview-box.crop-box { position: relative; justify-content: flex-start; cursor: crosshair; }
.preview-box.crop-box canvas { cursor: crosshair; }

/* 控件 */
.ctrl-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: var(--s-3) 0; }
.ctrl-row .option-group { gap: var(--s-2); }
.ctrl-inline { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.thumb-btn {
  display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-10);
  font-size: var(--fs-13); font-weight: 600; color: var(--text-2); transition: all var(--trans);
}
.thumb-btn:hover { border-color: var(--accent); color: var(--accent); }
.thumb-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.slider { -webkit-appearance: none; width: 150px; height: 6px; border-radius: 999px; background: var(--line); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; box-shadow: var(--shadow-1); }
.slider-val { min-width: 36px; font-size: var(--fs-12); color: var(--text-2); text-align: right; }
.text-input {
  width: 100%; max-width: 240px; border: 1px solid var(--line); border-radius: var(--r-10);
  padding: var(--s-2) var(--s-3); font-size: var(--fs-14); color: var(--text); outline: none;
}
.text-input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.result-actions { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-3); }

/* 拼图 */
.drop-zone.cmp { padding: var(--s-4); }
.cmp-strip { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.cmp-chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: var(--accent-soft); color: var(--accent); padding: 4px 10px;
  border-radius: var(--r-full); font-size: var(--fs-12); font-weight: 600;
}
.cmp-chip button { border: none; background: transparent; color: inherit; cursor: pointer; font-size: var(--fs-12); line-height: 1; }
.cmp-chip button:hover { color: var(--danger); }