/* ============================================================
   PixelPress — 图片批量压缩工具
   样式层：仅负责视觉与布局，不含业务逻辑
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #f4f5f8;
  --bg-grad-1: #eef1ff;
  --bg-grad-2: #f7f4ff;

  --surface: #ffffff;
  --surface-2: #fafafc;
  --surface-3: #f2f3f7;

  --ink: #0f1420;
  --ink-2: #3d4453;
  --muted: #6b7280;
  --faint: #9aa1ae;

  --line: #e8eaf0;
  --line-strong: #d6d9e2;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(79, 70, 229, 0.22);

  --good: #0f9f6e;
  --good-soft: #e9fbf3;
  --danger: #e11d48;
  --danger-soft: #fef1f4;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(15, 20, 32, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 20, 32, 0.04), 0 2px 8px rgba(15, 20, 32, 0.04);
  --shadow-md: 0 2px 6px rgba(15, 20, 32, 0.05), 0 12px 28px -12px rgba(15, 20, 32, 0.14);
  --shadow-lg: 0 32px 80px -24px rgba(15, 20, 32, 0.32), 0 8px 24px rgba(15, 20, 32, 0.08);

  --ease: cubic-bezier(0.22, 0.68, 0.32, 1);
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 12% -8%, var(--bg-grad-1), transparent 62%),
    radial-gradient(760px 460px at 92% 4%, var(--bg-grad-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }

button { font: inherit; color: inherit; }

img { display: block; max-width: 100%; }

::selection { background: var(--accent-ring); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 数字统一等宽，避免跳动 */
.num, .summary strong, .stat strong, .thumb-sizes, .count, .quality-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 3. 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; }

/* 顶栏左组：品牌 + 站群导航，用一条竖线和主标题分开 */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.links {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.2;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.links:hover { color: var(--accent); background: var(--accent-soft); }
.links:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
.links:active { transform: translateY(0.5px); }

.logo-title { letter-spacing: 0.01em; }

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #6366f1, #4f46e5 55%, #4338ca);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-text h1 {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-text p {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* 右侧：可隐藏的汇总区 + 常驻的「本地处理」标签。
   justify-content: flex-end 保证标签永远贴右，左侧内容出现/消失都不带动它 */
.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.topbar-live {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  animation: topbar-in 0.24s var(--ease) both;
}

.topbar-live.is-off { display: none; }

@keyframes topbar-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.tag-safe { color: var(--good); background: var(--good-soft); border-color: rgba(15, 159, 110, 0.16); }

/* ---------- 4. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 560;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s var(--ease);
}

.btn:active { transform: translateY(1px) scale(0.995); }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #5b53ea, var(--accent));
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 8px 18px -10px rgba(79, 70, 229, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #514ae0, var(--accent-hover));
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3), 0 12px 24px -12px rgba(79, 70, 229, 1);
}

.btn-soft {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.14);
}

.btn-soft:hover { background: #e4e7ff; }

.btn-ghost {
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-ghost:hover { background: var(--surface-3); border-color: #c3c7d2; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.icon-btn:hover { color: var(--ink); background: var(--surface-3); }
.icon-btn--danger:hover { color: var(--danger); background: var(--danger-soft); }

.link {
  color: var(--accent);
  font-weight: 550;
  text-decoration: none;
}

/* ---------- 5. 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  max-width: 1460px;
  margin: 0 auto;
  padding: 22px 28px 72px;
}

.sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* 卡片变多后可能高过视口：给个上限，粘住时也能滚到底部的「压缩策略」 */
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 4px;
  margin-right: -4px;
}

.content { min-width: 0; }

/* ---------- 6. 卡片 ---------- */
.card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- 7. 上传引导区（原 dropzone 已并入空状态） ---------- */
.empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(340px, 56vh, 540px);
  padding: 56px 24px;
  text-align: center;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px) border-box;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease),
    box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.empty:hover {
  border-color: rgba(79, 70, 229, 0.5);
  background: var(--accent-soft);
}

.empty:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.empty.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-ring);
  transform: scale(1.004);
}

.empty[hidden] { display: none; }

/* 比 .empty p 更高优先级，避免被正文样式覆盖 */
.empty .empty-formats {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--faint);
}

/* ---------- 8. 质量滑杆 ---------- */
.quality-value {
  min-width: 38px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 7px;
}

.range-wrap { margin-bottom: 14px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 82%), var(--surface-3) var(--fill, 82%));
  border: 1px solid var(--line);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  background: #fff;
  border: 1px solid rgba(15, 20, 32, 0.08);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 20, 32, 0.16), 0 4px 10px -4px rgba(15, 20, 32, 0.24);
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease);
}

input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(0.96); box-shadow: 0 0 0 6px var(--accent-ring); }

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border: 1px solid rgba(15, 20, 32, 0.12);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 20, 32, 0.16);
}

.range-track-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--faint);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.chip:hover { border-color: var(--line-strong); background: var(--surface-3); }

.chip.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.28);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.06);
}

/* ---------- 9. 格式选择网格 ---------- */
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.fmt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 7px 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.fmt b {
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

.fmt span { font-size: 10px; color: var(--faint); }

.fmt:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-strong); }

.fmt.is-active {
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.08);
}

.fmt.is-active b { color: var(--accent); }

.fmt:disabled { opacity: 0.38; cursor: not-allowed; }

.fmt--wide { grid-column: 1 / -1; flex-direction: row; gap: 6px; }
.fmt--wide span { font-size: 10.5px; }

.field-note {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
}

.field-note b {
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- 10. 表单元素 ---------- */
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.field-label { font-size: 13px; color: var(--ink-2); }

.field + .field { margin-top: 6px; }

.input-suffix {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input-suffix:focus-within {
  border-color: rgba(79, 70, 229, 0.5);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: #fff;
}

.input-suffix input {
  width: 64px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: right;
  background: transparent;
  border: none;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.input-suffix input::placeholder { color: var(--faint); font-size: 12px; }

.input-suffix span { font-size: 11.5px; color: var(--faint); }

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0 0;
  margin-top: 11px;
  border-top: 1px solid var(--line);
}

.switch-title { font-size: 13px; color: var(--ink-2); }
.switch-sub { font-size: 11px; color: var(--faint); margin-top: 1px; }

.switch { position: relative; flex: none; cursor: pointer; }

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  display: block;
  width: 38px;
  height: 22px;
  padding: 2px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(15, 20, 32, 0.22);
  transition: transform 0.22s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- 11. 顶栏汇总 ---------- */
/* 高度与 .btn 一致（38px），配合 .topbar-right 的 align-items:center 实现完全对齐 */
.topbar-summary {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "line save";
  align-items: center;
  gap: 0 16px;
  height: 38px;
  min-width: 0;
}

.ts-line {
  grid-area: line;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.ts-k { font-size: 11.5px; color: var(--faint); }

.ts-line strong,
.ts-save strong {
  font-size: 13px;
  font-weight: 620;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ts-arrow { flex: none; color: var(--line-strong); }

/* 「压缩后」的两种非终态：重编中给占位符（旧值不可信），试算中给估算值 */
.ts-line strong.is-pending {
  color: var(--faint);
  animation: busy-pulse 1.2s ease-in-out infinite;
}
.ts-line strong.is-est { color: var(--muted); }

.ts-save {
  grid-area: save;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  min-width: 126px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.ts-save strong { color: var(--good); }
.ts-save strong.is-busy { color: var(--accent); animation: busy-pulse 1.2s ease-in-out infinite; }

/* 进度条贴在汇总块底部，不占行高，右端与「共节省」右边缘对齐 */
.ts-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 3px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.ts-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, var(--good));
  transition: width 0.4s var(--ease);
}

/* 计算中的进度条改用主色，和「节省」的绿色区分开 */
.ts-bar.is-progress i {
  background: var(--accent);
}

/* ---------- 12. 内容区头部 ---------- */
.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.content-title { display: flex; align-items: center; gap: 8px; }

.content-title h2 { font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }

.count {
  min-width: 22px;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.content-tools { display: flex; align-items: center; gap: 8px; }

/* ---------- 13. 图片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.thumb {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.24s var(--ease),
    border-color 0.2s var(--ease);
  animation: card-in 0.34s var(--ease) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.thumb:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.thumb-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    linear-gradient(45deg, #eef0f4 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #eef0f4 25%, transparent 25%) 0 8px / 16px 16px,
    linear-gradient(45deg, transparent 75%, #eef0f4 75%) 8px -8px / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #eef0f4 75%) -8px 0 / 16px 16px,
    var(--surface-2);
  cursor: zoom-in;
}

.thumb-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
}

.thumb:hover .thumb-media img { transform: scale(1.035); }

.thumb-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
  background: rgba(15, 159, 110, 0.94);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(15, 20, 32, 0.18);
  font-variant-numeric: tabular-nums;
}

.thumb-badge--muted { background: rgba(107, 114, 128, 0.9); }
.thumb-badge--warn { background: rgba(217, 119, 6, 0.94); }

.thumb-fmt {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 5px;
  backdrop-filter: blur(4px);
}

/* 参数来源：跟随全局 / 自定义（左下角，与右上角的格式标签对称） */
.thumb-tags {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}

.thumb-scope {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 5px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.thumb-scope--own {
  color: var(--accent);
  background: rgba(238, 240, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.3);
}

/* 已裁剪：绿色，表示「内容被改过」，与参数来源是两个维度 */
.thumb-cropped {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #0b7a55;
  background: rgba(233, 251, 243, 0.96);
  border: 0;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(15, 159, 110, 0.3);
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.16s var(--ease);
}

.thumb-cropped:hover { background: #d6f7e9; }

.thumb-cropped svg { flex: none; opacity: 0.85; }

.thumb-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(to top, rgba(15, 20, 32, 0.55), transparent 52%);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.thumb:hover .thumb-hover { opacity: 1; }

.thumb-hover .icon-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(8px);
}

.thumb-hover .icon-btn:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
.thumb-hover .icon-btn--danger:hover { background: rgba(225, 29, 72, 0.85); }

.thumb-body { padding: 10px 11px 12px; }

.thumb-name {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-sizes {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--faint);
}

.thumb-sizes .after { color: var(--ink-2); font-weight: 600; }

/* 拖动质量时的估算值：降一档视觉权重，避免和精确值混淆 */
.thumb-sizes .after.is-est { color: var(--muted); font-weight: 500; }

.thumb-sizes svg { flex: none; color: var(--line-strong); }

/* ---------- 14. 空状态（内容样式，容器样式见第 7 节 .empty） ---------- */
.empty-art { margin-bottom: 18px; opacity: 0.9; transition: transform 0.2s var(--ease); }

.empty:hover .empty-art { transform: translateY(-2px); }

.empty h3 { font-size: 16px; font-weight: 620; margin-bottom: 5px; }

.empty p { max-width: 400px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.empty-actions { display: flex; gap: 8px; margin-top: 20px; }

/* ---------- 15. 对比预览弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.22s var(--ease), visibility 0.22s;
}

.modal.is-open { visibility: visible; opacity: 1; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 32, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.26s var(--ease);
}

.modal.is-open .modal-panel { transform: none; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

/* 文件名/元信息单行省略：避免文字变长时把弹层头部撑高、连带舞台下移 */
.modal-file { min-width: 0; }

.modal-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-meta {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 单张参数调节条 */
.modal-tools {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

/* 三列定宽栅格：滑块宽度只由舞台宽度决定，与提示文字长短、按钮显隐无关 */
.tool-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 196px;
  align-items: center;
  gap: 10px;
  min-height: 26px;
}

.tool-label {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.tool-label output {
  display: inline-block;
  min-width: 25px; /* 1 / 82 / 100 位数不同，占位保持一致，滑块起点不跳 */
  margin-left: 5px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.tool-row input[type="range"] { width: 100%; min-width: 0; }

/* 右侧元信息固定宽度：文字超长省略，不挤占滑块 */
.tool-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.tool-hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  color: var(--faint);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-meta .link-btn { flex: none; }

.tool-field {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

/* 宽 / 高 两个输入框 */
.tool-size {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tool-x {
  flex: none;
  font-size: 11px;
  color: var(--faint);
}

.tool-field:focus-within {
  border-color: rgba(79, 70, 229, 0.5);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.tool-field input {
  width: 62px;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  text-align: right;
  background: transparent;
  border: none;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.tool-field input::placeholder { color: var(--faint); font-size: 11.5px; }

.tool-unit { font-size: 11px; color: var(--faint); }

input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.link-btn {
  flex: none;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.link-btn:hover { color: var(--accent); border-color: rgba(79, 70, 229, 0.35); }

/* 「没变小」的原因：舞台顶部悬浮胶囊，脱离文档流，出现/消失都不挤动布局 */
.stage-note {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 4;
  max-width: calc(100% - 220px);
  margin: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #fff;
  background: rgba(15, 20, 32, 0.72);
  border-radius: 7px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  pointer-events: none;
}

.stage-note--warn { background: rgba(180, 83, 9, 0.88); }

.stage-note[hidden] { display: none; }

/* 对比舞台 */
.stage {
  position: relative;
  flex: none;
  height: clamp(320px, 56vh, 540px);
  overflow: hidden;
  background:
    linear-gradient(45deg, #eef0f4 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, #eef0f4 25%, transparent 25%) 0 9px / 18px 18px,
    linear-gradient(45deg, transparent 75%, #eef0f4 75%) 9px -9px / 18px 18px,
    linear-gradient(-45deg, transparent 75%, #eef0f4 75%) -9px 0 / 18px 18px,
    var(--surface-2);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

/* 缩放容器：左右两个 pane 各持一份，变换字符串同步，保证中缝与手柄严格对齐 */
.stage-pane {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.stage-pane--top {
  clip-path: inset(0 50% 0 0);
  will-change: clip-path;
}

.stage-zoom {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.stage-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.stage-label {
  position: absolute;
  top: 12px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 20, 32, 0.62);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.stage-label--left { left: 12px; }
.stage-label--right { right: 12px; }

.stage-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 20, 32, 0.12), 0 0 18px rgba(15, 20, 32, 0.24);
  transform: translateX(-1px);
  pointer-events: none;
}

.handle-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #fff;
  background: rgba(15, 20, 32, 0.82);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(15, 20, 32, 0.35);
  transform: translate(-50%, -50%);
  transition: transform 0.16s var(--ease);
}

.stage-handle.is-dragging .handle-knob { transform: translate(-50%, -50%) scale(1.08); }

/* 中缝的加宽命中区（放大后可单独拖它调整对比位置） */
.handle-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 34px;
  margin-left: -17px;
  pointer-events: auto;
  cursor: ew-resize;
}

/* 拖动即平移 */
.stage.is-panning { cursor: grabbing; }

/* 缩放提示与控件 */
.stage-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(15, 20, 32, 0.52);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}

.stage:hover .stage-hint,
.stage.is-zoomed .stage-hint { opacity: 1; }

.stage-zoombar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(15, 20, 32, 0.62);
  border-radius: 9px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.stage:hover .stage-zoombar,
.stage:focus-within .stage-zoombar,
.stage.is-zoomed .stage-zoombar { opacity: 1; transform: none; pointer-events: auto; }

.zoom-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s var(--ease), opacity 0.14s var(--ease);
}

.zoom-btn:hover { background: rgba(255, 255, 255, 0.16); }
.zoom-btn:disabled { opacity: 0.32; cursor: not-allowed; background: transparent; }

.zoom-value {
  min-width: 48px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s var(--ease);
}

.zoom-value:hover { background: rgba(255, 255, 255, 0.16); }

/* 底部统计 */
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.compare-stats { display: flex; align-items: center; gap: 14px; }

.stat { display: flex; flex-direction: column; gap: 1px; }

.stat-label {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat strong { font-size: 14px; font-weight: 650; }

.stat-good { color: var(--good); }
/* 体积反而变大：这是负收益，不能沿用「节省」的绿色 */
.stat-worse { color: var(--danger); }

.stat-arrow { color: var(--line-strong); margin-top: 8px; }

.modal-foot-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 16. 提示条与全局态 ---------- */
[hidden] { display: none !important; }

/* 压缩中：卡片蒙层 */
.thumb.is-busy .thumb-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(1px);
  animation: busy-pulse 1.1s ease-in-out infinite;
}

@keyframes busy-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

.thumb.is-busy .thumb-badge { background: rgba(79, 70, 229, 0.92); }

/* 状态行改为读屏专用：忙碌状态改由「共节省」位置显示，避免多一行撑高顶栏 */
.summary-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 舞台正在重新编码 */
.stage.is-busy::after {
  content: "正在重新压缩…";
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 11px;
  color: #fff;
  background: rgba(15, 20, 32, 0.68);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

body.no-scroll { overflow: hidden; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 520;
  color: #fff;
  background: rgba(15, 20, 32, 0.9);
  border-radius: 10px;
  box-shadow: 0 12px 32px -12px rgba(15, 20, 32, 0.5);
  backdrop-filter: blur(8px);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.toast--warn { background: rgba(190, 24, 93, 0.94); }

/* ---------- 16.5 裁剪弹层 ---------- */
.crop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s var(--ease), visibility 0.2s;
}

.crop.is-open { visibility: visible; opacity: 1; }

.crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 12, 20, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.crop-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1180px, 100%);
  height: min(86vh, 820px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.988);
  transition: transform 0.26s var(--ease);
}

.crop.is-open .crop-panel { transform: none; }

.crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.crop-file { min-width: 0; }

.crop-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crop-meta {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.crop-head-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.crop-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 218px;
  flex: 1;
  min-height: 0;
}

/* 画布区 */
.crop-stage {
  position: relative;
  overflow: hidden;
  background-color: #0e1119;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.028) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.028) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.028) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.028) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.crop-stage.is-panning { cursor: grabbing; }

.crop-canvas {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

/* 裁剪框：靠巨大的外阴影压暗框外，不用四个遮罩层 */
.crop-box {
  position: absolute;
  z-index: 2;
  outline: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 9999px rgba(8, 11, 18, 0.62);
  pointer-events: none;
}

.crop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 1px, transparent 1px);
  background-size: 33.3333% 33.3333%;
}

.crop-hit {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: move;
}

.crop-handle {
  position: absolute;
  z-index: 3;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  pointer-events: auto;
}

.crop-handle::after {
  content: '';
  position: absolute;
  inset: 6px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(8, 11, 18, 0.4), 0 1px 3px rgba(0, 0, 0, 0.35);
}

.crop-handle[data-dir="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.crop-handle[data-dir="n"] { left: 50%; top: 0; cursor: ns-resize; }
.crop-handle[data-dir="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.crop-handle[data-dir="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.crop-handle[data-dir="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-handle[data-dir="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.crop-handle[data-dir="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.crop-handle[data-dir="w"] { left: 0; top: 50%; cursor: ew-resize; }

/* 侧栏 */
.crop-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
  overflow-y: auto;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
}

.crop-group { display: flex; flex-direction: column; gap: 9px; }

.crop-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  color: var(--faint);
}

.crop-chips { gap: 5px; }

.crop-chips .chip {
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
  line-height: 24px;
}

.crop-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.crop-tool {
  display: grid;
  place-items: center;
  height: 34px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.crop-tool:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.35);
}

.crop-tool:active { transform: translateY(1px); }

.crop-readout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  padding: 10px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.crop-k { font-size: 11.5px; color: var(--faint); }

.crop-readout strong {
  justify-self: end;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.crop-tip {
  margin-top: auto;
  font-size: 11px;
  line-height: 1.75;
  color: var(--faint);
}

.crop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.crop-hint { font-size: 11.5px; color: var(--faint); }
.crop-foot-actions { display: flex; gap: 8px; }

/* ---------- 17. 响应式 ---------- */
@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 18px 18px 64px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    margin-right: 0;
  }

  /* 窄屏顶栏：隐藏「原始/压缩后/共节省」字样，只留数字，避免撑爆 */
  .ts-k { display: none; }
  .topbar-right { gap: 12px; }

  /* 裁剪弹层在窄屏直接铺满，把空间都留给画布 */
  .crop { padding: 0; }
  .crop-panel { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
}

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
  .topbar-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; row-gap: 8px; }
  .brand-text p { display: none; }
  /* 站群导航收窄，保证和品牌同一行放得下 */
  .topbar-left { flex: 1 1 auto; min-width: 0; }
  .brand { min-width: 0; }
  .brand-text { min-width: 0; }
  .brand-text h1 {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .site-nav { margin-left: 4px; padding-left: 8px; gap: 0; flex: none; }
  .links { padding: 5px 7px; font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .modal { padding: 12px; }
  .modal-panel { max-height: calc(100vh - 24px); }
  .stage { height: clamp(240px, 44vh, 380px); }
  .stage-hint { display: none; }
  .stage-zoombar { opacity: 1; transform: none; pointer-events: auto; }
  /* 窄屏放不下顶部胶囊：改成舞台底部整条提示，允许换行 */
  .stage-note {
    top: auto;
    bottom: 44px;
    left: 12px;
    right: 12px;
    max-width: none;
    transform: none;
    white-space: normal;
  }
  /* 窄屏：提示换行到滑块下方，滑块仍然独占一行不吃挤压 */
  .tool-row {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 4px;
  }
  .tool-meta { grid-column: 1 / -1; justify-content: space-between; }
  .tool-hint { text-align: left; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  /* 底部多了「完成」，窄屏放不下就换行，别把主按钮挤出去 */
  .modal-foot-actions { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; }

  /* 裁剪：侧栏改为底部横排，画布吃掉剩余高度 */
  .crop-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .crop-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    max-height: 40vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .crop-group { flex: 1 1 150px; }
  .crop-tip { display: none; }
  .crop-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
