/* 本地图片压缩工具 — 沿用 main.css 变量风格 */
.ic-tool {
  min-height: calc(100vh - 56px);
  background: linear-gradient(180deg, #f6faff 0%, #fff 40%);
}
.ic-tool-main {
  padding: 24px 0 48px;
  max-width: 960px;
  margin: 0 auto;
}
body.ic-has-settings-dock .ic-tool-main {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
.ic-tool-head {
  text-align: center;
  margin-bottom: 24px;
}
.ic-tool-head h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.ic-tool-head p {
  margin: 0;
  color: #6e7781;
  font-size: .92rem;
}
.ic-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 12px;
  background: #e8f5e9;
  color: #1b5e20;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
}

/* 模式切换 */
.ic-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.ic-mode-tab {
  padding: 8px 20px;
  border: 1px solid #eaeef2;
  border-radius: 999px;
  background: #fff;
  color: #57606a;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
}
.ic-mode-tab.is-active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

/* 拖放区 */
.ic-dropzone {
  position: relative;
  border: 2px dashed #c8d1da;
  border-radius: 16px;
  background: #fff;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.ic-dropzone:hover,
.ic-dropzone.is-dragover {
  border-color: #1f6feb;
  background: #f0f6ff;
}
.ic-dropzone-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 12px;
  opacity: .7;
}
.ic-dropzone-title {
  font-weight: 600;
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.ic-dropzone-hint {
  margin: 0;
  color: #6e7781;
  font-size: .88rem;
}
.ic-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* 极简参数条 */
.ic-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  font-size: .85rem;
  color: #57606a;
}
.ic-quick-bar strong { color: #1f2328; }
.ic-link-btn {
  border: 0;
  background: none;
  color: #1f6feb;
  font-size: .85rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 底部参数 Dock */
.ic-settings-dock {
  position: fixed;
  z-index: 200;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.ic-settings-dock:not([hidden]) {
  pointer-events: auto;
}
.ic-settings-dock-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #d0d7de;
  box-shadow: 0 -4px 24px rgba(31, 35, 40, .1);
  cursor: pointer;
  order: 2;
}
.ic-settings-dock-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #f6f8fa;
  color: #57606a;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ic-settings-dock-toggle:hover {
  background: #eef5ff;
  border-color: #1f6feb;
  color: #1f6feb;
}
.ic-settings-dock-chevron {
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(225deg);
  margin-top: 4px;
  transition: transform .25s ease;
}
.ic-settings-dock.is-collapsed .ic-settings-dock-chevron {
  transform: rotate(45deg);
  margin-top: -2px;
}
.ic-settings-dock-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ic-settings-dock-title {
  font-size: .92rem;
  font-weight: 600;
  color: #1f2328;
}
.ic-dock-summary {
  font-size: .82rem;
  color: #6e7781;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.ic-settings-dock-body {
  order: 1;
  max-height: 0;
  overflow: hidden;
  background: #fff;
  border-top: 1px solid transparent;
  transition: max-height .28s ease, border-color .28s ease;
}
.ic-settings-dock.is-expanded .ic-settings-dock-body {
  max-height: min(62vh, 480px);
  overflow-y: auto;
  border-top-color: #eaeef2;
  -webkit-overflow-scrolling: touch;
}
.ic-settings-dock.is-collapsed .ic-settings-dock-body {
  max-height: 0;
  border-top-color: transparent;
}

/* 参数面板 */
.ic-settings {
  margin-top: 0;
  padding: 16px 16px 8px;
  background: #fff;
  border: 0;
  border-radius: 0;
}
.ic-live-badge {
  font-size: .75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ddf4ff;
  color: #0969da;
  font-weight: 600;
}
.ic-preset-label {
  font-size: .82rem;
  color: #6e7781;
  margin: 0 0 8px;
}
.ic-section-title {
  font-size: .78rem;
  color: #6e7781;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 4px 0 0;
  padding-top: 6px;
  border-top: 1px dashed #d0d7de;
}
.ic-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.ic-preset-btn {
  padding: 6px 14px;
  border: 1px solid #d0d7de;
  border-radius: 999px;
  background: #f6f8fa;
  color: #24292f;
  font-size: .82rem;
  font-weight: 500;
  transition: all .15s;
}
.ic-preset-btn:hover { border-color: #1f6feb; color: #1f6feb; }
.ic-preset-btn.is-active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}
.ic-advanced-details {
  margin-top: 16px;
}
.ic-advanced-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .92rem;
  color: #1f6feb;
  padding: 8px 0;
  list-style: none;
}
.ic-advanced-details summary::-webkit-details-marker { display: none; }
.ic-advanced-details[open] summary { margin-bottom: 12px; }
.ic-field-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}
.ic-field-check input { width: auto; }
.ic-resize-result-line {
  margin: 0;
  font-size: .88rem;
  color: #57606a;
}
.ic-resize-result-line strong {
  color: #1f2328;
  font-weight: 600;
}
.ic-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.ic-settings-actions .btn { min-width: 140px; }

@media (min-width: 768px) {
  .ic-settings-dock {
    left: auto;
    right: 20px;
    bottom: 20px;
    width: min(400px, calc(100vw - 40px));
    max-width: 400px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(31, 35, 40, .15);
  }
  .ic-settings-dock-bar {
    border-top: 0;
    border-radius: 0;
    padding: 12px 14px;
    order: 2;
  }
  .ic-settings-dock.is-collapsed {
    border-radius: 14px;
  }
  .ic-settings-dock.is-collapsed .ic-settings-dock-body {
    display: none;
  }
  .ic-settings-dock-body {
    border-top: 1px solid #eaeef2;
  }
  body.ic-has-settings-dock .ic-tool-main {
    padding-bottom: 48px;
  }
}
@media (min-width: 900px) {
  .ic-tool-main.ic-layout-work {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 24px;
    align-items: start;
  }
}
.ic-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.ic-field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #24292f;
}
.ic-field input,
.ic-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
}
.ic-field input[type="range"] { padding: 0; }
.ic-field-hint {
  font-size: .78rem;
  color: #6e7781;
  margin-top: 4px;
}
.ic-range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ic-range-row input { flex: 1; }
.ic-range-val {
  min-width: 36px;
  text-align: right;
  font-weight: 600;
  font-size: .9rem;
}

/* 单张预览区（位于参数面板上方） */
.ic-workspace {
  display: none;
  margin: 20px 0 24px;
  padding: 20px;
  background: #fff;
  border: 1px solid #eaeef2;
  border-radius: 12px;
}
.ic-workspace.is-visible { display: block; }
.ic-preview-actions {
  margin-top: 16px;
  gap: 12px;
}
.ic-preview-actions .btn-primary { min-width: 160px; }
.ic-compare {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1117;
  aspect-ratio: 16 / 10;
  max-height: 420px;
  user-select: none;
  touch-action: none;
}
.ic-compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.ic-compare-after {
  clip-path: inset(0 50% 0 0);
}
/* 拖拽对比条：与 JS 中 rAF 合并更新配合，提示合成层减轻 clip-path 连续重绘 */
.ic-compare.is-compare-dragging .ic-compare-after {
  will-change: clip-path;
}
.ic-compare.is-compare-dragging .ic-compare-handle {
  will-change: top, left;
}
.ic-compare-badge {
  position: absolute;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
}
.ic-compare-badge-before {
  top: 10px;
  right: 10px;
  left: auto;
}
.ic-compare:not(.is-vertical) .ic-compare-badge-after {
  top: 10px;
  left: 10px;
  right: auto;
}
.ic-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 2;
  box-shadow: 0 0 8px rgba(0,0,0,.4);
}
.ic-compare-handle::after {
  content: "◀ ▶";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #1f2328;
  font-size: 10px;
  padding: 8px 6px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: -2px;
}
.ic-compare.is-vertical .ic-compare-after {
  clip-path: inset(0 0 50% 0);
}
.ic-compare.is-vertical .ic-compare-handle {
  top: 50%;
  left: 0;
  right: 0;
  bottom: auto;
  width: auto;
  height: 3px;
  transform: translateY(-50%);
  cursor: ns-resize;
}
.ic-compare.is-vertical .ic-compare-handle::after {
  content: "▲ ▼";
  letter-spacing: -1px;
}
.ic-compare.is-vertical .ic-compare-badge-before {
  top: auto;
  bottom: 10px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
.ic-compare.is-vertical .ic-compare-badge-after {
  top: 10px;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
.ic-compare-labels {
  display: none;
}
@media (max-width: 767px) {
  .ic-compare {
    aspect-ratio: unset;
    max-height: none;
    width: 100%;
    min-height: 180px;
  }
  .ic-workspace {
    padding: 16px;
  }
}
.ic-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
  font-size: .88rem;
}
.ic-stat {
  padding: 8px 14px;
  background: #f6f8fa;
  border-radius: 8px;
  border: 1px solid #eaeef2;
}
.ic-stat strong { color: #1f6feb; }

/* 批量工作区（列表 + 结果，位于参数面板上方） */
.ic-batch-workspace {
  display: none;
  margin: 20px 0 24px;
}
.ic-batch-workspace.is-visible { display: block; }
.ic-batch-workspace .ic-batch-list {
  margin-top: 0;
}
.ic-batch-workspace .ic-results {
  margin-top: 20px;
  padding: 20px;
  background: #fff;
  border: 1px solid #eaeef2;
  border-radius: 12px;
}
.ic-batch-list {
  display: block;
}
.ic-batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #eaeef2;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: .88rem;
}
.ic-batch-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-batch-item-status { color: #6e7781; flex-shrink: 0; }
.ic-batch-item-status.is-done { color: #1a7f37; }
.ic-batch-item-status.is-error { color: #cf222e; }
.ic-progress-wrap {
  height: 6px;
  background: #eaeef2;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
  display: none;
}
.ic-progress-wrap.is-visible { display: block; }
.ic-progress-bar {
  height: 100%;
  background: #1f6feb;
  width: 0%;
  transition: width .2s;
}

/* 结果区 */
.ic-results {
  display: none;
  text-align: center;
}
.ic-results.is-visible { display: block; }
.ic-results-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.ic-results h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.ic-results-summary {
  color: #57606a;
  font-size: .92rem;
  margin-bottom: 20px;
}
.ic-result-files {
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 20px;
  border: 1px solid #eaeef2;
  border-radius: 10px;
  background: #f6f8fa;
}
.ic-result-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #eaeef2;
  font-size: .85rem;
}
.ic-result-file:last-child { border-bottom: 0; }
.ic-result-file a {
  flex-shrink: 0;
  font-weight: 600;
  font-size: .82rem;
}
.ic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.ic-actions .btn { min-width: 120px; }
.ic-results-hint {
  margin-top: 16px;
  font-size: .8rem;
  color: #6e7781;
}

.ic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

@media (min-width: 768px) {
  .ic-tool-head h1 { font-size: 1.8rem; }
  .ic-form-grid { grid-template-columns: repeat(2, 1fr); }
  .ic-form-grid .ic-field-span2 { grid-column: span 2; }
  .ic-compare { max-height: 480px; }
}

@media (min-width: 1024px) {
  .ic-tool-main { padding: 32px 0 64px; }
}
