/* ============================================================
   图改大小 · 工具页公共样式
   ------------------------------------------------------------
   依赖 app.css 的 :root 变量（--brand / --line / --muted ...）
   工具页比首页窄（880px），聚焦单一任务。
   ============================================================ */

.tool-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ---------------- 面包屑 ---------------- */
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.crumb a:hover { color: var(--brand); }
.crumb .sep { color: #CBD5E1; }
.crumb .cur { color: var(--text); }

/* ---------------- 工具头部 ---------------- */
.tool-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.tool-head-icon {
  flex-shrink: 0;
  width: 58px; height: 58px;
  border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  font-size: 29px;
  line-height: 1;
}

.tool-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .3px;
}

.tool-head p {
  margin: 5px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ---------------- 面板 ---------------- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 15.5px;
  font-weight: 700;
}
.panel-title .step {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------------- 上传区 ---------------- */
.drop {
  border: 2px dashed #C7D2FE;
  border-radius: 16px;
  background: #FCFDFF;
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.drop:hover { border-color: #A5B4FC; background: #FAFBFF; }
.drop.is-drag { border-color: var(--brand); background: var(--brand-soft); }

.drop-icon { font-size: 40px; line-height: 1; }
.drop-title { margin: 14px 0 6px; font-size: 16px; font-weight: 600; }
.drop-desc { margin: 0; font-size: 13.5px; color: var(--muted); }
.drop-hint { margin-top: 12px; font-size: 12.5px; color: #A8B3C4; }

/* 已选文件 */
.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FBFCFE;
}

.file-thumb {
  flex-shrink: 0;
  width: 54px; height: 54px;
  border-radius: 11px;
  object-fit: cover;
  background: #EEF2F7;
}

.file-meta { min-width: 0; flex: 1; }
.file-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.file-x {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 9px;
  background: #F1F4FA;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.file-x:hover { background: #FEE2E2; color: #EF4444; }

/* ---------------- 表单件 ---------------- */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
}

.seg {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: #F1F4FA;
  border-radius: 12px;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 8px 22px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.seg button:hover { color: var(--brand); }
.seg button.is-on {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(30, 41, 59, .1);
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 18px;
  border-radius: 11px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.chip-btn:hover { border-color: #C7D2FE; color: var(--brand); }
.chip-btn.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* 颜色选择（圆点 + 自定义取色） */
.color-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.color-dot {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: border-color .16s, box-shadow .16s;
}
.color-dot:hover { border-color: #C7D2FE; }
.color-dot.is-on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.color-row input[type=color] {
  width: 30px; height: 30px;
  border: 2px solid var(--line);
  border-radius: 9px;
  padding: 0;
  background: none;
  cursor: pointer;
}
.color-row .color-custom {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}
.color-row .color-custom.is-on { color: var(--brand); }
.color-row .color-custom.is-on input[type=color] {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.range-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.range-row input[type=range] {
  flex: 1;
  height: 4px;
  accent-color: var(--brand);
  cursor: pointer;
}
.range-val {
  flex-shrink: 0;
  min-width: 92px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

.custom-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.custom-row input[type=number] {
  width: 140px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.custom-row input[type=number]:focus { border-color: var(--brand); }
.custom-row .unit { font-size: 13.5px; color: var(--muted); }

/* ---------------- 按钮 ---------------- */
.btn-main {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .28);
  transition: transform .16s, box-shadow .16s, opacity .16s;
}
.btn-main:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(99, 102, 241, .34); }
.btn-main:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  height: 44px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14.5px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s, color .16s;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.btn-row { display: flex; gap: 12px; }

/* ---------------- 进度 ---------------- */
.progress { margin-top: 18px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #EEF2F7;
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .25s;
}
.progress-text {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ---------------- 结果 ---------------- */
.result-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 6px 0 20px;
}
.rs-item { text-align: center; }
.rs-label { font-size: 12.5px; color: var(--muted); }
.rs-value { font-size: 21px; font-weight: 700; margin-top: 4px; }
.rs-arrow { font-size: 20px; color: #CBD5E1; }
.rs-value.is-good { color: #10B981; }

.bars { margin-bottom: 22px; }
.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.bar {
  height: 10px;
  border-radius: 999px;
  background: #EEF2F7;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #CBD5E1;
  transition: width .4s;
}
.bar.is-good > i { background: linear-gradient(90deg, #34D399, #10B981); }

.tip-warn {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  font-size: 13.5px;
  color: #92400E;
}

/* 结果预览图 */
.preview-wrap {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 14px;
  background: #F7F8FC;
  border: 1px solid var(--line);
  background-image:
    linear-gradient(45deg, #EEF1F7 25%, transparent 25%),
    linear-gradient(-45deg, #EEF1F7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #EEF1F7 75%),
    linear-gradient(-45deg, transparent 75%, #EEF1F7 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.preview-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(30, 41, 59, .13);
  vertical-align: middle;
}

/* 键值信息行 */
.kv {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.kv b { color: var(--text); font-weight: 600; }

/* 小尺寸输入对 */
.wh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.wh-row input[type=number] {
  width: 120px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .16s;
}
.wh-row input[type=number]:focus { border-color: var(--brand); }
.wh-row .x { color: #CBD5E1; font-size: 15px; }

.lock-btn {
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 17px;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.lock-btn.is-on { border-color: var(--brand); background: var(--brand-soft); }

/* ---------------- 浮动提示 ---------------- */
.t-toast-box {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.t-toast {
  padding: 11px 22px;
  border-radius: 12px;
  background: rgba(30, 41, 59, .93);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
  animation: tIn .22s ease;
}
.t-toast.is-ok { background: rgba(16, 185, 129, .95); }
.t-toast.is-err { background: rgba(239, 68, 68, .95); }
.t-toast.is-out { opacity: 0; transform: translateY(-8px); transition: opacity .35s, transform .35s; }

@keyframes tIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 尺寸卡片 + 取景裁剪（cropper.js 用） ---------------- */
.spec-group-title {
  margin: 22px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #475569;
}
.spec-group-title:first-of-type { margin-top: 0; }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.spec-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px 10px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .16s, background .16s, transform .16s;
}
.spec-card:hover { border-color: #C7D2FE; transform: translateY(-2px); }
.spec-card.is-on { border-color: var(--brand); background: var(--brand-soft); }

.spec-shape {
  margin: 0 auto 10px;
  background: #E2E8F5;
  border-radius: 4px;
  transition: background .16s;
}
.spec-card.is-on .spec-shape { background: var(--brand); }
.spec-name { display: block; font-size: 14.5px; font-weight: 700; }
.spec-meta { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.spec-desc { margin: 3px 0 0; font-size: 11.5px; color: #94A3B8; }

.crop-wrap {
  text-align: center;
  padding: 22px 16px;
  border-radius: 14px;
  background: #F7F8FC;
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.crop-box {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: #EEF2F7;
  box-shadow: 0 5px 18px rgba(30, 41, 59, .15);
  cursor: grab;
  touch-action: none;
}
.crop-box:active { cursor: grabbing; }
.crop-box img {
  position: absolute;
  top: 0; left: 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.crop-tip { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------- 多文件列表 ---------------- */
.mfile-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.mfile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #FBFCFE;
  transition: border-color .16s, box-shadow .16s, opacity .16s;
}
.mfile.is-drag { opacity: .4; }
.mfile.is-over { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.mfile-idx {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.mfile-thumb {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: #EEF2F7;
}
.mfile-thumb.is-ico {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
}

.mfile-meta { min-width: 0; flex: 1; }
.mfile-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mfile-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

.mfile-btns { flex-shrink: 0; display: flex; gap: 5px; }
.mfile-btn {
  width: 32px; height: 32px;
  border: 0;
  border-radius: 9px;
  background: #F1F4FA;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s, color .16s, opacity .16s;
}
.mfile-btn:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); }
.mfile-btn.is-x:hover { background: #FEE2E2; color: #EF4444; }
.mfile-btn:disabled { opacity: .3; cursor: not-allowed; }
.mfile-btn.is-handle { cursor: grab; }
.mfile-btn.is-handle:active { cursor: grabbing; }

.mfile-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mfile-sum { font-size: 13.5px; color: var(--muted); }
.mfile-sum b { color: var(--text); font-weight: 600; }

.mfile-empty {
  padding: 32px 16px;
  text-align: center;
  border: 2px dashed #DDE3EE;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

/* 结果页的多图缩略网格（切图 / 拼接分页） */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.thumb-cell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #FBFCFE;
  cursor: pointer;
  transition: border-color .16s, transform .16s;
}
.thumb-cell:hover { border-color: var(--brand); transform: translateY(-2px); }
.thumb-cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb-cell span {
  display: block;
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 719px) {
  .tool-main { padding: 0 16px 32px; }
  .crumb { padding: 14px 0 14px; }
  .tool-head { gap: 12px; margin-bottom: 20px; }
  .tool-head-icon { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
  .tool-head h1 { font-size: 20px; }
  .tool-head p { font-size: 13px; }
  .panel { padding: 18px; border-radius: 16px; }
  .drop { padding: 34px 16px; }
  .result-summary { gap: 14px; }
  .rs-value { font-size: 18px; }
  .seg button { padding: 8px 15px; font-size: 13.5px; }
  .btn-row { flex-direction: column; }
  .btn-ghost { width: 100%; }
  .mfile-thumb { width: 40px; height: 40px; }
  .mfile-btn { width: 30px; height: 30px; }
  .thumb-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   服务器类工具页（音视频 / AI 消除）补充
   ============================================================ */

/* 🔴 处理中锁住面板：只改配色拦不住连点，必须挡掉指针事件 */
.panel.is-locked { opacity: .55; pointer-events: none; }

/* 分段控件选项多时允许换行（如音频格式 7 项） */
.seg.is-wrap { flex-wrap: wrap; }

/* 没有缩略图时用 emoji 图标占位 */
.file-thumb.is-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

/* 字段下方的说明文字 */
.field-tip {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

/* 结果媒体预览（音频 / 视频播放器） */
.preview-media-wrap {
  padding: 14px;
  background: #F8FAFF;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 18px;
}

.preview-media {
  display: block;
  width: 100%;
  border-radius: 10px;
}

video.preview-media { max-height: 420px; background: #000; }

/* 文字结果（转写文本） */
.text-result {
  max-height: 340px;
  overflow: auto;
  padding: 14px 16px;
  background: #F8FAFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.95;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 上传完成、服务器处理中的阶段：整条进度用呼吸动画表示仍在跑 */
.progress-bar > i.is-run {
  width: 100% !important;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  animation: srv-run 1.6s ease-in-out infinite;
}

@keyframes srv-run {
  0%, 100% { opacity: .4; }
  50%      { opacity: 1; }
}

/* 结果体积变大时标红 */
.rs-value.is-bad { color: #DC2626; }

/* 音源分离的分轨列表 */
.stem-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.stem-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #FCFDFF;
}

.stem-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stem-card audio { width: 100%; display: block; }
.stem-dl { margin-top: 8px; width: 100%; }

/* AI 消除：点选画布舞台。
   🔴 必须 block + fit-content：inline-block 时容器宽度由内容决定，
   而 canvas 又要 100% 跟随容器 → 循环依赖，画布会跟图片对不齐。 */
.tap-stage {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #F1F4FA;
}

.tap-stage img { max-width: 100%; display: block; }

.tap-stage canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* 模式切换（涂抹 / 点选） */
.mode-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: #F1F4FA;
  border-radius: 12px;
  margin-bottom: 14px;
}

.mode-tabs button {
  border: 0;
  background: transparent;
  padding: 8px 20px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background .16s, color .16s;
}

.mode-tabs button.is-on {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(30, 41, 59, .09);
}

@media (max-width: 719px) {
  .stem-list { grid-template-columns: 1fr; }
  .seg.is-wrap button { padding: 8px 14px; }
  .text-result { font-size: 14px; }
}

/* ========== 原图预览（选完文件即显示，图片类工具通用） ========== */
.origin-preview {
  position: relative;
  margin-top: 14px;
  text-align: center;
  padding: 16px;
  border-radius: 14px;
  background: #F7F8FC;
  border: 1px solid var(--line);
}
.origin-img {
  display: block;
  max-width: 100%;
  max-height: 460px;
  margin: 0 auto;
  border-radius: 8px;
}
/* 透明 PNG / GIF 用棋盘格，一眼看出哪里是透明的 */
.checker {
  background-color: #FFFFFF;
  background-image:
    linear-gradient(45deg, #E9ECF3 25%, transparent 25%, transparent 75%, #E9ECF3 75%),
    linear-gradient(45deg, #E9ECF3 25%, transparent 25%, transparent 75%, #E9ECF3 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.origin-badge {
  position: absolute;
  top: 26px;
  right: 26px;
  padding: 5px 12px;
  font-size: 12px;
  color: #4C5BFF;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 999px;
  pointer-events: none;
}
@media (max-width: 719px) {
  .origin-img { max-height: 300px; }
  .origin-badge { top: 22px; right: 22px; }
}

/* ========== 裁剪框（修改尺寸页：框动图不动） ========== */
/* 🔴 必须 block + fit-content：inline-block 宽度由内容(img)决定，而 img 的
      max-width:100% 又参照容器 → 循环依赖，max-width 失效 → 大图冲出面板。
      fit-content 会被 max-width:100% 钳住 → img 有确定参照正常收缩 */
.origin-stage {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
}
.crop-tools {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.crop-toggle.is-on {
  background: #4C5BFF;
  border-color: #4C5BFF;
  color: #FFFFFF;
}
.origin-preview .crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid #4C5BFF;
  /* 框外变暗（9999px 大扩散代替四块遮罩，省一层 DOM） */
  box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.45);
  cursor: move;
  touch-action: none;
}
.origin-preview .crop-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 18px;
  height: 18px;
  background: #4C5BFF;
  border: 2px solid #FFFFFF;
  border-radius: 5px;
  cursor: nwse-resize;
  touch-action: none;
}
/* 框外变暗要盖住整个预览容器 → 预览容器不能裁切 */
.origin-preview:has(.crop-box:not([hidden])) { overflow: visible; }

/* ========== 取景器（修改尺寸页 · 对齐小程序交互：框不动图动） ========== */
.vp-wrap {
  background: #22273A;
  border-radius: 14px;
  padding: 12px;
}
/* 🔴 stage 尺寸确定（宽随容器、高固定），框/图都绝对定位其上——无循环依赖 */
.vp-stage {
  position: relative;
  height: 460px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  border-radius: 8px;
}
.vp-stage.is-drag { cursor: grabbing; }
.vp-img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
}
/* 取景框：白色细边 + 三分线 + 框外大扩散变暗（同 erase 拍色技法） */
/* 框不动图动模式：框居中钉死（left/top/大小由 JS layout 设置），
   pointer-events:none 让拖框区域的事件穿透到图片 */
.vp-box {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 9999px rgba(10, 14, 23, 0.55);
  pointer-events: none;
}
.vp-handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #4C5BFF;
  border: 2px solid #FFFFFF;
  border-radius: 5px;
  cursor: nwse-resize;
}
.vp-box::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 33.33%; height: 33.33%;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}
.vp-box::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 33.33%; width: 33.33%;
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
}
.vp-tag {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  font-size: 12px;
  color: #FFFFFF;
  background: rgba(17, 24, 39, 0.72);
  border-radius: 999px;
  white-space: nowrap;
}
/* 取景工具行：− 缩放滑块 ＋ 旋转 重置 */
.vp-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.vp-tools .vp-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--line);
  background: #FFFFFF;
  border-radius: 10px;
  font-size: 18px;
  color: var(--ink, #1F2430);
  cursor: pointer;
}
.vp-tools input[type="range"] { flex: 1; }
@media (max-width: 719px) {
  .vp-stage { height: 300px; }
  .vp-tools .vp-btn { width: 36px; height: 36px; }
}
