/*
 * 图片压缩小组件
 *
 * 参照 mtab 的 imageConversion 组件做外壳，压缩逻辑来自「轻压」单页工具
 * （image-compressor.html），原样搬过来，只做了一件事：
 * 所有选择器都套进 .ic-app 作用域，变量也从 :root 挪到 .ic-app 上，
 * 免得 .panel / .field / .toast 这些通用类名把 NavTab 自己的样式带跑。
 */

.ic-app *, .ic-app *::before, .ic-app *::after {box-sizing: border-box;}
.ic-app {scroll-behavior: smooth;}
.ic-app, .ic-app h1, .ic-app h2, .ic-app p {margin: 0;}
.ic-app button, .ic-app input {font: inherit;}
.ic-app button {color: inherit;}
.ic-app button, .ic-app [role="option"] {-webkit-tap-highlight-color: transparent;}
.ic-app img {display: block; max-width: 100%;}
.ic-app [hidden] {display: none !important;}
.ic-app :focus:not(:focus-visible) {outline: none;}
.ic-app {min-height: 100vh;
      background: var(--canvas);
      color: var(--text-primary);
      font-family: var(--font-ui);
      font-size: 14px;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;}
.ic-app {color-scheme: light;
      --canvas: #f6f8fb;
      --surface: #ffffff;
      --surface-2: #eef4fb;
      --surface-hover: #e3edf8;
      --overlay: rgba(12, 20, 32, .62);
      --nav-surface: rgba(246, 248, 251, .9);
      --on-dark-weak: rgba(255, 255, 255, .12);
      --on-dark-hover: rgba(255, 255, 255, .18);

      --brand: #0d84f7;
      --brand-hover: #0a72d6;
      --brand-active: #095fb4;
      --brand-weak: #e4f1fe;
      --on-brand: #ffffff;

      --text-strong: #0f1721;
      --text-primary: #26313c;
      --text-secondary: #5a6773;
      --text-tertiary: #79858f;
      --text-disabled: #a4ada8;

      --success: #2e6d52;
      --success-bg: #e7f1ec;
      --warning: #855d24;
      --warning-bg: #f5eee3;
      --danger: #9a4545;
      --danger-bg: #f8eaea;
      --info: #456879;
      --info-bg: #e9f0f3;

      --border: #d9e1ea;
      --border-strong: #a9b8c7;
      --border-weak: #e9eef4;

      --shadow-sm: 0 2px 8px rgba(16, 26, 40, .06);
      --shadow-md: 0 8px 24px rgba(20, 28, 24, .09);
      --shadow-lg: 0 8px 32px rgba(20, 28, 24, .12);

      --radius-control: 8px;
      --radius-surface: 12px;
      --radius-overlay: 16px;
      --max: 1240px;
      --gutter: 24px;
      --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
      --ease: cubic-bezier(.33, 1, .68, 1);}
.ic-app * {scrollbar-width: thin;
      scrollbar-color: var(--border-strong) var(--surface-2);}
.ic-app *::-webkit-scrollbar {width: 10px; height: 10px;}
.ic-app *::-webkit-scrollbar-track {background: var(--surface-2);
      border-radius: var(--radius-control);}
.ic-app *::-webkit-scrollbar-thumb {background: var(--border-strong);
      border: 3px solid var(--surface-2);
      border-radius: var(--radius-control);
      transition: background-color 180ms ease;}
.ic-app *::-webkit-scrollbar-thumb:hover {background: var(--text-tertiary);}
.ic-app .shell {width: min(var(--max), calc(100% - (var(--gutter) * 2)));
      margin: 0 auto;
      padding-bottom: 32px;}
.ic-app .topbar {position: sticky;
      top: 0;
      z-index: 100;
      min-height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 0;
      background: var(--nav-surface);
      border-bottom: 1px solid var(--border-weak);
      backdrop-filter: blur(14px);}
.ic-app .brand {display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;}
.ic-app .brand-mark {width: 34px;
      height: 34px;
      display: grid;
      flex: 0 0 auto;
      place-items: center;
      border-radius: var(--radius-control);
      background: var(--brand);
      color: var(--on-brand);
      box-shadow: none;}
.ic-app .brand-mark svg {width: 18px; height: 18px;}
.ic-app .brand-name {display: block;
      color: var(--text-strong);
      font-size: 15px;
      font-weight: 600;
      letter-spacing: 0;}
.ic-app .brand-sub {display: block;
      margin-top: 0;
      color: var(--text-tertiary);
      font-family: var(--font-mono);
      font-size: 12px;
      line-height: 1.25;}
.ic-app .privacy-pill {display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border: 0;
      border-radius: var(--radius-control);
      /* 跟着主色走（原来是绿色，绿只留给「成功」提示） */
      background: var(--brand-weak);
      color: var(--brand);
      font-size: 12px;
      font-weight: 600;
      white-space: nowrap;}
.ic-app .privacy-pill svg {width: 14px; height: 14px;}
.ic-app .privacy-dot {width: 7px;
      height: 7px;
      flex: 0 0 auto;
      border-radius: 50%;
      background: var(--brand);}
.ic-app .hero {display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      margin: 0;
      padding: 22px 0 20px;}
.ic-app .hero-main {min-width: 0;}
.ic-app h1 {max-width: none;
      color: var(--text-strong);
      font-size: 20px;
      font-weight: 600;
      line-height: 1.25;
      letter-spacing: 0;}
.ic-app .hero-copy {max-width: none;
      margin-top: 4px;
      color: var(--text-secondary);
      font-size: 13px;
      line-height: 1.5;}
.ic-app .hero-accent {color: inherit;}
.ic-app .hero-note {display: none;}
.ic-app .format-flow {display: grid;
      grid-template-columns: auto 28px auto;
      align-items: center;
      gap: 8px;
      min-width: 286px;
      padding: 8px 10px;
      border-radius: var(--radius-control);
      background: var(--surface-2);
      color: var(--text-secondary);}
.ic-app .flow-node {min-width: 0;
      padding: 4px 8px;
      border-radius: 6px;
      background: var(--surface);
      font-family: var(--font-mono);
      font-size: 11px;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;}
.ic-app .flow-node.output {background: var(--brand);
      color: var(--on-brand);
      transition: background-color 180ms ease, transform 180ms var(--ease);}
.ic-app .flow-node.output.is-updating {transform: scale(.96);}
.ic-app .flow-arrow {width: 28px;
      height: 20px;
      color: var(--text-tertiary);}
.ic-app .workspace {display: grid;
      grid-template-columns: 288px minmax(0, 1fr);
      gap: 16px;
      align-items: start;}
.ic-app .panel {border: 1px solid var(--border);
      border-radius: var(--radius-surface);
      background: var(--surface);
      box-shadow: none;}
.ic-app .settings {position: sticky;
      top: 80px;
      z-index: 20;
      padding: 18px;}
.ic-app .main-panel {min-width: 0;
      min-height: 520px;
      overflow: visible;}
.ic-app .panel-title {display: flex;
      align-items: center;
      gap: 8px;
      margin: 0 0 18px;
      color: var(--text-strong);
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0;}
.ic-app .panel-title svg {width: 16px; height: 16px; color: var(--brand);}
.ic-app .settings-grid {display: block;}
.ic-app .field {margin-bottom: 18px;}
.ic-app .field:last-child {margin-bottom: 0;}
.ic-app .label-row, .ic-app .check-row {display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 8px;}
.ic-app label, .ic-app .field-label {color: var(--text-primary);
      font-size: 12px;
      font-weight: 600;}
.ic-app .help {margin-top: 6px;
      color: var(--text-tertiary);
      font-size: 12px;
      line-height: 1.45;}
.ic-app .settings-foot {display: flex;
      gap: 8px;
      margin-top: 18px;
      padding-top: 16px;
      border-top: 1px solid var(--border-weak);
      color: var(--text-tertiary);
      font-size: 12px;
      line-height: 1.5;}
.ic-app .settings-foot svg {width: 14px;
      height: 14px;
      flex: 0 0 auto;
      margin-top: 1px;
      color: var(--info);}
.ic-app .value-badge {min-width: 44px;
      padding: 3px 6px;
      border-radius: 6px;
      background: var(--brand-weak);
      color: var(--brand);
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 600;
      text-align: center;}
.ic-app input[type="number"] {width: 100%;
      height: 38px;
      border: 1px solid transparent;
      border-radius: var(--radius-control);
      background: var(--surface-2);
      padding: 0 10px;
      color: var(--text-primary);
      font-family: var(--font-mono);
      font-size: 12px;
      outline: none;
      transition:
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;}
.ic-app input[type="number"]:hover {background: var(--surface-hover);}
.ic-app input[type="number"]:focus-visible {border-color: var(--brand);
      box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app input[type="number"]:disabled {opacity: .45;
      cursor: not-allowed;}
.ic-app input[type="range"] {width: 100%;
      height: 5px;
      margin: 8px 0 2px;
      border-radius: var(--radius-control);
      appearance: none;
      background: var(--border);
      outline: none;
      accent-color: var(--brand);
      cursor: pointer;
      transition: opacity 180ms ease, background-color 180ms ease;}
.ic-app input[type="range"]::-webkit-slider-thumb {width: 17px;
      height: 17px;
      border: 3px solid var(--surface);
      border-radius: 50%;
      appearance: none;
      background: var(--brand);
      box-shadow: var(--shadow-sm);
      cursor: grab;
      transition: background-color 180ms ease, transform 100ms ease;}
.ic-app input[type="range"]::-webkit-slider-thumb:active {background: var(--brand-active);
      cursor: grabbing;
      transform: scale(.94);}
.ic-app input[type="range"]:focus-visible {box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app input[type="range"]:disabled {opacity: .45;
      cursor: not-allowed;}
.ic-app .switch {position: relative;
      z-index: 0;
      width: 38px;
      height: 22px;
      flex: 0 0 auto;
      border-radius: 12px;}
.ic-app .switch input {position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;}
.ic-app .switch-track {position: absolute;
      inset: 0;
      border-radius: 12px;
      background: var(--border-strong);
      cursor: pointer;
      transition: background-color 180ms ease, box-shadow 180ms ease;}
.ic-app .switch-track::after {content: "";
      position: absolute;
      width: 16px;
      height: 16px;
      left: 3px;
      top: 3px;
      border-radius: 50%;
      background: var(--surface);
      box-shadow: var(--shadow-sm);
      transition: transform 180ms var(--ease);}
.ic-app .switch input:checked + .switch-track {background: var(--brand);}
.ic-app .switch input:checked + .switch-track::after {transform: translateX(16px);}
.ic-app .switch input:focus-visible + .switch-track {box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .dimension-fields {display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      max-height: 80px;
      opacity: 1;
      overflow: hidden;
      transform: translateY(0);
      transition:
        max-height 220ms var(--ease),
        opacity 180ms ease,
        transform 220ms var(--ease);}
.ic-app .dimension-fields.is-hidden {max-height: 0;
      opacity: 0;
      transform: translateY(-4px);
      pointer-events: none;}
.ic-app .mini-label {display: block;
      margin-bottom: 5px;
      color: var(--text-secondary);
      font-size: 11.5px;
      font-weight: 500;}
.ic-app .format-select {position: relative;
      z-index: 40;}
.ic-app .format-native {position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;}
.ic-app .format-trigger {position: relative;
      z-index: 1;
      width: 100%;
      min-height: 40px;
      display: flex;
      align-items: center;
      padding: 0 38px 0 11px;
      border: 1px solid transparent;
      border-radius: var(--radius-control);
      background: var(--surface-2);
      color: var(--text-primary);
      text-align: left;
      cursor: pointer;
      outline: none;
      transition:
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease,
        transform 100ms ease;}
.ic-app .format-trigger:hover {background: var(--surface-hover);}
.ic-app .format-trigger:focus-visible {border-color: var(--brand);
      box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .format-trigger:active {transform: scale(.985);}
.ic-app .format-trigger[aria-expanded="true"] {background: var(--surface);
      border-color: var(--brand);
      box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .format-trigger > span {min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 12px;
      font-weight: 500;}
.ic-app .format-chevron {position: absolute;
      z-index: 2;
      right: 11px;
      top: 50%;
      width: 16px;
      height: 16px;
      transform: translateY(-50%) rotate(0);
      color: var(--text-tertiary);
      transition: transform 180ms var(--ease), color 180ms ease;}
.ic-app .format-trigger[aria-expanded="true"] .format-chevron {color: var(--brand);
      transform: translateY(-50%) rotate(180deg);}
.ic-app .format-menu {position: absolute;
      left: 0;
      right: 0;
      top: calc(100% + 6px);
      z-index: 200;
      max-height: 264px;
      padding: 6px;
      overflow-y: auto;
      border-radius: var(--radius-surface);
      background: var(--surface);
      box-shadow: var(--shadow-md);
      opacity: 0;
      transform: translateY(-6px) scale(.99);
      transform-origin: top center;
      visibility: hidden;
      transition:
        opacity 180ms ease,
        transform 180ms var(--ease),
        visibility 180ms ease;}
.ic-app .format-menu.opens-up {top: auto;
      bottom: calc(100% + 6px);
      transform-origin: bottom center;
      transform: translateY(6px) scale(.99);}
.ic-app .format-menu.is-open {opacity: 1;
      transform: translateY(0) scale(1);
      visibility: visible;}
.ic-app .format-menu.is-closing {opacity: 0;
      transform: translateY(-4px) scale(.99);
      visibility: visible;
      transition-duration: 150ms;}
.ic-app .format-menu.opens-up.is-closing {transform: translateY(4px) scale(.99);}
.ic-app .format-option {width: 100%;
      min-height: 38px;
      display: grid;
      grid-template-columns: 18px minmax(0, 1fr) auto;
      align-items: center;
      gap: 8px;
      padding: 7px 9px;
      border: 0;
      border-radius: var(--radius-control);
      background: transparent;
      color: var(--text-primary);
      text-align: left;
      cursor: pointer;
      outline: none;
      transition: background-color 160ms ease, color 160ms ease;}
.ic-app .format-option:hover, .ic-app .format-option.is-highlighted {background: var(--surface-hover);}
.ic-app .format-option:focus-visible {background: var(--brand-weak);
      box-shadow: inset 0 0 0 1px var(--brand);}
.ic-app .format-option[aria-selected="true"] {background: var(--brand-weak);
      color: var(--brand);}
.ic-app .format-option:disabled {opacity: .45;
      cursor: not-allowed;}
.ic-app .format-option .option-check {width: 15px;
      height: 15px;
      opacity: 0;
      transition: opacity 160ms ease, transform 160ms var(--ease);}
.ic-app .format-option[aria-selected="true"] .option-check {opacity: 1; transform: scale(1);}
.ic-app .format-option .option-name {min-width: 0; font-size: 12px; font-weight: 600;}
.ic-app .format-option .option-note {color: var(--text-tertiary); font-size: 10px;}
.ic-app .dropzone {position: relative;
      z-index: 1;
      min-height: 438px;
      display: grid;
      place-items: center;
      margin: 10px;
      border: 1px dashed var(--border-strong);
      border-radius: var(--radius-control);
      background: var(--canvas);
      text-align: center;
      cursor: copy;
      outline: none;
      transition:
        min-height 220ms var(--ease),
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms var(--ease);}
.ic-app .dropzone:hover, .ic-app .dropzone.is-dragging {border-color: var(--brand);
      background: var(--brand-weak);
      box-shadow: inset 0 0 0 1px var(--brand);}
.ic-app .dropzone.is-dragging {transform: scale(.995);}
.ic-app .drop-inner {padding: 32px 20px;}
.ic-app .upload-icon {position: relative;
      z-index: 0;
      width: 56px;
      height: 56px;
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      border: 0;
      border-radius: var(--radius-surface);
      background: var(--brand-weak);
      color: var(--brand);
      box-shadow: none;
      transition: transform 200ms var(--ease), background-color 180ms ease;}
.ic-app .dropzone:hover .upload-icon {transform: translateY(-2px); background: var(--surface);}
.ic-app .upload-icon::before {display: none;}
.ic-app .upload-icon svg {width: 24px; height: 24px;}
.ic-app .drop-title {margin: 0 0 4px;
      color: var(--text-strong);
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0;}
.ic-app .drop-copy {margin: 0;
      color: var(--text-secondary);
      font-size: 12px;
      line-height: 1.5;}
.ic-app .choose-btn, .ic-app .btn {min-height: 38px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 0 13px;
      border: 1px solid var(--border);
      border-radius: var(--radius-control);
      background: var(--surface);
      color: var(--text-primary);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      outline: none;
      box-shadow: none;
      transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease,
        transform 100ms ease,
        opacity 180ms ease;}
.ic-app .choose-btn {margin-top: 14px;
      border-color: transparent;
      background: var(--brand);
      color: var(--on-brand);}
.ic-app .choose-btn:hover, .ic-app .btn.primary:hover {background: var(--brand-hover);}
.ic-app .choose-btn:active, .ic-app .btn:active {transform: scale(.97);}
.ic-app .choose-btn:focus-visible, .ic-app .btn:focus-visible {box-shadow: 0 0 0 3px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .choose-btn svg, .ic-app .btn svg {width: 14px; height: 14px;}
.ic-app .btn:hover {background: var(--surface-hover); border-color: var(--border-strong);}
.ic-app .btn.primary {border-color: transparent;
      background: var(--brand);
      color: var(--on-brand);}
.ic-app .btn:disabled, .ic-app .choose-btn:disabled {opacity: .45;
      cursor: not-allowed;
      transform: none;}
.ic-app #fileInput {position: absolute;
      z-index: 0;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;}
.ic-app .formats {display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 5px;
      margin-top: 14px;
      color: var(--text-tertiary);
      font-family: var(--font-mono);
      font-size: 11.5px;}
.ic-app .formats span {padding: 2px 5px;
      border: 0;
      border-radius: 4px;
      background: var(--surface-2);}
.ic-app .queue {max-height: 0;
      overflow: hidden;
      opacity: 0;
      visibility: hidden;
      transform: translateY(6px);
      transition:
        max-height 250ms var(--ease),
        opacity 180ms ease,
        transform 220ms var(--ease),
        visibility 220ms ease;}
.ic-app .queue.is-visible {max-height: 5200px;
      opacity: 1;
      visibility: visible;
      transform: translateY(0);}
.ic-app .queue.is-clearing {opacity: 0; transform: translateY(4px);}
.ic-app .dropzone.is-compact {min-height: 112px;}
.ic-app .dropzone.is-compact .drop-inner {width: 100%;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px 18px;
      text-align: left;}
.ic-app .dropzone.is-compact .upload-icon {width: 42px;
      height: 42px;
      flex: 0 0 42px;
      margin: 0;
      border-radius: var(--radius-control);}
.ic-app .dropzone.is-compact .upload-icon svg {width: 19px; height: 19px;}
.ic-app .dropzone.is-compact .drop-title {font-size: 13px;}
.ic-app .dropzone.is-compact .drop-copy {font-size: 11px;}
.ic-app .dropzone.is-compact .choose-btn, .ic-app .dropzone.is-compact .formats {display: none;}
.ic-app .queue-head {display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 14px 16px;
      border-top: 1px solid var(--border-weak);
      border-bottom: 1px solid var(--border-weak);}
.ic-app .queue-title {display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text-strong);
      font-size: 13px;
      font-weight: 600;}
.ic-app .count {min-width: 22px;
      height: 20px;
      display: grid;
      place-items: center;
      padding: 0 6px;
      border-radius: 10px;
      background: var(--brand-weak);
      color: var(--brand);
      font-family: var(--font-mono);
      font-size: 11.5px;}
.ic-app .queue-actions {display: flex; align-items: center; gap: 8px;}
.ic-app .summary {display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0;
      background: var(--surface-2);
      border-bottom: 1px solid var(--border-weak);}
.ic-app .metric {min-width: 0;
      padding: 12px 16px;
      background: transparent;}
.ic-app .metric + .metric {border-left: 1px solid var(--border);}
.ic-app .metric-label {margin-bottom: 2px;
      color: var(--text-tertiary);
      font-size: 11.5px;}
.ic-app .metric-value {overflow: hidden;
      color: var(--text-strong);
      font-family: var(--font-mono);
      font-size: 13px;
      font-weight: 600;
      text-overflow: ellipsis;
      white-space: nowrap;}
.ic-app .metric-value.positive {color: var(--success);}
.ic-app .file-list {display: grid; gap: 0;}
.ic-app .file-card {display: grid;
      grid-template-columns: 64px minmax(0, 1fr) 78px;
      gap: 12px;
      align-items: center;
      min-height: 84px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--border-weak);
      opacity: 1;
      transform: translateY(0);
      animation: file-in 220ms var(--ease) both;
      transition:
        background-color 180ms ease,
        opacity 180ms ease,
        transform 180ms var(--ease);}
.ic-app .file-card:last-child {border-bottom: 0;}
.ic-app .file-card:hover {background: var(--canvas);}
.ic-app .file-card.is-removing {opacity: 0; transform: translateX(8px);}
@keyframes file-in {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }
.ic-app .thumb {position: relative;
      z-index: 0;
      width: 64px;
      height: 56px;
      display: block;
      padding: 0;
      overflow: hidden;
      border: 0;
      border-radius: var(--radius-control);
      background: var(--surface-2);
      cursor: zoom-in;
      outline: none;
      box-shadow: inset 0 0 0 1px var(--border);
      transition: box-shadow 180ms ease, transform 180ms var(--ease);}
.ic-app .thumb img {width: 100%;
      height: 100%;
      aspect-ratio: 8 / 7;
      object-fit: cover;
      background: var(--surface-2);
      transition: transform 200ms var(--ease);}
.ic-app .thumb:focus-visible {box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .file-main {min-width: 0;}
.ic-app .file-name {overflow: hidden;
      margin-bottom: 5px;
      color: var(--text-strong);
      font-size: 12px;
      font-weight: 600;
      text-overflow: ellipsis;
      white-space: nowrap;}
.ic-app .file-meta {display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 5px;
      color: var(--text-secondary);
      font-family: var(--font-mono);
      font-size: 11.5px;}
.ic-app .saving {padding: 2px 5px;
      border-radius: 4px;
      background: var(--success-bg);
      color: var(--success);
      font-family: var(--font-ui);
      font-weight: 600;}
.ic-app .saving.is-worse {background: var(--warning-bg); color: var(--warning);}
.ic-app .saving.is-original {background: var(--surface-2); color: var(--text-secondary);}
.ic-app .error-text {color: var(--danger);
      font-family: var(--font-ui);
      white-space: normal;}
.ic-app .progress {width: min(260px, 100%);
      height: 3px;
      margin-top: 7px;
      overflow: hidden;
      border-radius: 2px;
      background: var(--border);}
.ic-app .progress > span {display: block;
      width: 42%;
      height: 100%;
      border-radius: 2px;
      background: var(--brand);
      animation: progress 1.1s ease-in-out infinite alternate;}
@keyframes progress {
      from { transform: translateX(-20%); }
      to { transform: translateX(160%); }
    }
.ic-app .file-actions {display: grid;
      grid-template-columns: 34px 34px;
      gap: 6px;
      justify-content: end;
      margin-left: auto;}
.ic-app .icon-btn {width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      padding: 0;
      border: 1px solid var(--border);
      border-radius: var(--radius-control);
      background: var(--surface);
      color: var(--text-secondary);
      cursor: pointer;
      outline: none;
      transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease,
        transform 100ms ease,
        opacity 180ms ease;}
.ic-app .icon-btn:hover {background: var(--surface-hover); border-color: var(--border-strong); color: var(--brand);}
.ic-app .icon-btn.danger:hover {background: var(--danger-bg); border-color: var(--danger); color: var(--danger);}
.ic-app .icon-btn:focus-visible {box-shadow: 0 0 0 2px var(--brand-weak), inset 0 0 0 1px var(--brand);}
.ic-app .icon-btn:active {transform: scale(.94);}
.ic-app .icon-btn:disabled {opacity: .45; cursor: not-allowed; transform: none;}
.ic-app .icon-btn svg {width: 15px; height: 15px;}
.ic-app .toast-region {position: fixed;
      top: 18px;
      right: 18px;
      bottom: auto;
      z-index: 999;
      display: grid;
      gap: 8px;
      pointer-events: none;}
.ic-app .toast {display: flex;
      align-items: center;
      gap: 8px;
      max-width: 340px;
      padding: 10px 12px;
      border: 0;
      border-radius: var(--radius-control);
      background: var(--text-strong);
      color: var(--surface);
      box-shadow: var(--shadow-md);
      font-size: 11px;
      opacity: 1;
      transform: translateY(0);
      animation: toast-in 200ms var(--ease) both;
      transition: opacity 180ms ease, transform 180ms var(--ease);}
.ic-app .toast svg {width: 15px; height: 15px; color: var(--success-bg);}
@keyframes toast-in {
      from { opacity: 0; transform: translateY(-8px); }
      to { opacity: 1; transform: translateY(0); }
    }
.ic-app dialog {width: min(920px, calc(100% - 32px));
      padding: 0;
      overflow: hidden;
      border: 0;
      border-radius: var(--radius-overlay);
      background: var(--text-strong);
      color: var(--surface);
      box-shadow: var(--shadow-lg);
      opacity: 0;
      transform: translateY(10px) scale(.985);}
.ic-app dialog[open].is-opening {animation: dialog-in 220ms var(--ease) forwards;}
.ic-app dialog[open].is-closing {animation: dialog-out 160ms ease forwards;}
.ic-app dialog::backdrop {background: var(--overlay); backdrop-filter: blur(4px);}
.ic-app dialog.is-opening::backdrop {animation: backdrop-in 220ms ease forwards;}
.ic-app dialog.is-closing::backdrop {animation: backdrop-out 160ms ease forwards;}
@keyframes dialog-in {
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
@keyframes dialog-out {
      from { opacity: 1; transform: translateY(0) scale(1); }
      to { opacity: 0; transform: translateY(6px) scale(.99); }
    }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
.ic-app .preview-head {display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px 10px 16px;
      border-bottom: 1px solid var(--on-dark-weak);}
.ic-app .preview-title {min-width: 0;
      overflow: hidden;
      font-size: 12px;
      font-weight: 600;
      text-overflow: ellipsis;
      white-space: nowrap;}
.ic-app .preview-close {width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      padding: 0;
      border: 0;
      border-radius: var(--radius-control);
      background: var(--on-dark-weak);
      color: var(--surface);
      cursor: pointer;
      outline: none;
      transition: background-color 180ms ease, transform 100ms ease, box-shadow 180ms ease;}
.ic-app .preview-close:hover {background: var(--on-dark-hover);}
.ic-app .preview-close:active {transform: scale(.94);}
.ic-app .preview-close:focus-visible {box-shadow: 0 0 0 2px var(--surface);}
.ic-app .preview-close svg {width: 17px; height: 17px;}
.ic-app .preview-body {min-height: 300px;
      max-height: min(75vh, 720px);
      display: grid;
      place-items: center;
      padding: 18px;
      overflow: auto;}
.ic-app .preview-body img {width: auto;
      height: auto;
      max-height: calc(75vh - 70px);
      aspect-ratio: auto;
      object-fit: contain;
      background: var(--surface-2);}
.ic-app .sr-only {position: absolute;
      z-index: 0;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;}
@media (hover: hover) and (pointer: fine) {
.ic-app .thumb:hover img {transform: scale(1.04);}
.ic-app .thumb:hover {box-shadow: inset 0 0 0 1px var(--brand);}}
@media (max-width: 900px) {
.ic-app .workspace {grid-template-columns: 250px minmax(0, 1fr);}
.ic-app .settings {padding: 16px;}
.ic-app .format-flow {min-width: 250px;}
.ic-app .file-card {grid-template-columns: 56px minmax(0, 1fr) 78px;}
.ic-app .thumb {width: 56px; height: 50px;}}
@media (max-width: 768px) {
.ic-app {--gutter: 14px;}
.ic-app .topbar {min-height: 58px;}
.ic-app .brand-sub {display: none;}
.ic-app .hero {align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 16px 0;}
.ic-app .format-flow {width: 100%; min-width: 0;}
.ic-app .workspace {grid-template-columns: 1fr;}
.ic-app .settings {position: static; z-index: 30;}
.ic-app .settings-grid {display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 16px;}
.ic-app .settings-foot {margin-top: 12px;}
.ic-app .main-panel {min-height: 420px;}
.ic-app .dropzone {min-height: 340px;}}
@media (max-width: 520px) {
.ic-app .privacy-pill {padding: 6px 8px;}
.ic-app .privacy-pill svg {display: none;}
.ic-app .hero-copy {max-width: 310px;}
.ic-app .settings-grid {grid-template-columns: 1fr;}
.ic-app .dropzone {min-height: 300px;}
.ic-app .dropzone.is-compact {min-height: 98px;}
.ic-app .dropzone.is-compact .drop-inner {padding: 14px;}
.ic-app .queue-head {align-items: flex-start; padding: 12px;}
.ic-app .queue-actions {flex-wrap: wrap; justify-content: flex-end;}
.ic-app .summary {grid-template-columns: 1fr;}
.ic-app .metric {display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 12px;}
.ic-app .metric + .metric {border-left: 0; border-top: 1px solid var(--border);}
.ic-app .metric-label {margin-bottom: 0;}
.ic-app .file-card {grid-template-columns: 54px minmax(0, 1fr);
        gap: 10px;
        padding: 12px;}
.ic-app .thumb {width: 54px; height: 48px;}
.ic-app .file-actions {grid-column: 2; justify-content: end;}
.ic-app .formats span:nth-child(n + 7) {display: none;}
.ic-app .toast-region {left: 14px; right: 14px; top: 14px;}
.ic-app .toast {max-width: none;}}
@media (prefers-reduced-motion: reduce) {
.ic-app *, .ic-app *::before, .ic-app *::after {scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;}}
/* ---------- 弹窗外壳（原文件是整页，这里装进弹窗） ---------- */

.ic-root {
    position: relative;
    width: min(1080px, 100%);
    height: min(740px, 100%);
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(8, 12, 22, .34);
}

/* 原文件这里是 min-height:100vh（整页），弹窗里要收回来 */
.ic-app {
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--canvas);
}

.ic-head {
    flex: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-weak);
    background: var(--surface);
}

.ic-head-text {
    flex: 1;
    min-width: 0;
}

/* 原文件顶栏那颗「本地处理」标：现在夹在副标题和关闭按钮之间 */
.ic-head .privacy-pill {
    flex: none;
    align-self: center;
    margin-right: 4px;
}

.ic-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-strong);
    letter-spacing: .2px;
}

.ic-sub {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--text-tertiary);
}

.ic-close {
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: var(--surface-2);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.ic-close:hover {
    color: var(--text-strong);
    background: var(--surface-hover);
}

/* 原文件整页滚动，这里让中间这块自己滚 */
.ic-app .shell {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* 上：离标题栏 18px。注意只能用简写写全 —— 之前写 padding-top 又被这行简写冲掉了 */
    padding: 18px 18px 20px;
}

/* 原文件 hero 是首屏大标题区，弹窗里只留输出格式那条 */
.ic-app .hero {
    padding: 12px 0;
}

.ic-app .settings {
    position: static;
}

/* 队列的提示条相对弹窗定位，不然 fixed 会跑到视口底 */
.ic-app .toast-region {
    position: absolute;
    inset: auto 0 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 60;
}

@media (max-height: 760px) {
    .ic-app .settings {
        padding: 14px;
    }
}

/* ---------- 卡片 ---------- */

.app-card--image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* 1x1：骨架用链接图标的 .app-icon，图标满铺 */
.app-icon.image-mini {
    border: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .5),
        inset 0 -1px 1px rgba(15, 23, 42, .1),
        0 6px 14px rgba(15, 23, 42, .16),
        0 1px 3px rgba(15, 23, 42, .12);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-icon.image-mini:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        0 12px 22px rgba(15, 23, 42, .22);
}

.app-icon.image-mini img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    -webkit-user-drag: none;
}

/*
 * 2x2：mtab 那张卡片是「左侧两行大字 + 右侧插画图标」，
 * 我们只有 174×180，字缩到 17px、图标挪到右下角，其余（蓝紫渐变插画底）照搬。
 */
.image-card {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px;
    border-radius: var(--icon-radius);
    overflow: hidden;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .22),
        0 6px 14px rgba(15, 23, 42, .16),
        0 1px 3px rgba(15, 23, 42, .12);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-card--image .image-card:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .26),
        0 14px 26px rgba(15, 23, 42, .22);
}

/* 底图偏亮，压一层深色保证白字看得清 */
.image-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(12, 20, 40, .35), rgba(12, 20, 40, .1) 60%);
    pointer-events: none;
}

.image-card-text {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #fff;
}

.image-card-text strong {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .3px;
    text-shadow: 0 1px 4px rgba(8, 12, 22, .35);
}

.image-card-text small {
    font-size: 11px;
    line-height: 1.3;
    opacity: .85;
    letter-spacing: .2px;
}

.image-card-ico {
    position: absolute;
    right: 12px;
    bottom: 12px;
    color: #fff;
    opacity: .55;
    pointer-events: none;
}

.image-card-ico svg {
    width: 30px;
    height: 30px;
    display: block;
}

/* ============================================================
 * 版式重做：照 PxEvapo —— 左边文件列表（主区域），右边输出选项
 * 只覆盖布局与新增控件，压缩逻辑一行没动
 * ============================================================ */

/* 通用隐藏：给那些「留着当数据源」的原控件用 */
.ic-hide {
    display: none !important;
}

/* 弹窗内不该按 100vh 撑，交给 .ic-app 自己滚 */
.ic-app {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.ic-root {
    height: min(780px, 100%);
    width: min(1120px, 100%);
}

.ic-app .shell {
    padding-bottom: 18px;
}

/* 左宽右窄：主区域是文件列表 */
.ic-app .workspace {
    grid-template-columns: minmax(0, 1fr) 316px;
    gap: 18px;
    align-items: stretch;
}

.ic-app .settings {
    position: static;
    top: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px 16px 14px;
}

.ic-app .main-panel {
    min-height: 0;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- 右栏标题 + 当前输出徽标 ---------- */

.ic-app .panel-title {
    margin-bottom: 14px;
}

.flow-pill {
    margin-left: auto;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--brand-weak);
    color: var(--brand);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

/* ---------- 格式按钮网格 ---------- */

.ic-app .fmt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 9px;
}

.ic-app .fmt-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.ic-app .fmt-chip b {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.35;
}

.ic-app .fmt-chip small {
    font-size: 11.5px;
    color: var(--text-tertiary);
    line-height: 1.35;
    white-space: nowrap;
}

.ic-app .fmt-chip:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.ic-app .fmt-chip.is-active {
    border-color: var(--brand);
    background: var(--brand);
    box-shadow: 0 2px 8px rgba(13, 132, 247, .26);
}

.ic-app .fmt-chip.is-active b {
    color: var(--on-brand);
}

.ic-app .fmt-chip.is-active small {
    color: rgba(255, 255, 255, .74);
}

.ic-app .fmt-chip:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ---------- 画质分段控件 ---------- */

.ic-app .q-seg {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
}

.ic-app .q-seg button {
    padding: 5px 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.ic-app .q-seg button:hover {
    color: var(--text-strong);
}

.ic-app .q-seg button.is-active {
    background: var(--surface);
    color: var(--brand);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 19, .12);
}

.ic-app .q-seg.is-disabled {
    opacity: .5;
    pointer-events: none;
}

/* ---------- 输出尺寸下拉 ---------- */

.ic-app .ic-select {
    width: 100%;
    height: 34px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b857f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 15px;
    color: var(--text-primary);
    font-size: 12.5px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.ic-app .ic-select:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

/* ---------- 底部主按钮 ---------- */

.ic-app .settings-cta {
    margin-top: auto;
    padding-top: 14px;
}

.ic-app .btn.block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
}

.ic-app .btn.block svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* ---------- 左栏：拖拽区与队列更贴合 ---------- */

.ic-app .dropzone {
    margin: 0;
}

.ic-app .queue {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-surface);
    background: var(--surface);
    padding: 14px;
    overflow: visible;
}

.ic-app .queue-title {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* 窄屏：右栏收到 300，再窄就上下排 */
@media (max-width: 1100px) {
    .ic-app .workspace {
        grid-template-columns: minmax(0, 1fr) 292px;
    }
}

@media (max-width: 900px) {
    .ic-app .workspace {
        grid-template-columns: 1fr;
    }

    .ic-app .settings {
        position: static;
    }

    .ic-app .settings-cta {
        margin-top: 14px;
    }
}

@media (max-width: 560px) {
    .ic-app .fmt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- 左栏：空状态拖拽区撑满，有文件时收成一条 ---------- */

.ic-app .main-panel .dropzone {
    flex: 1;
    min-height: 200px;
}

.ic-app .main-panel .dropzone.has-files {
    flex: none;
    min-height: 0;
}

/* 文件列表吃掉剩余高度，列表长了在自己里面滚 */
.ic-app .main-panel .queue {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ic-app .main-panel .file-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* 文件列表撑高后，卡片别在行里垂直居中（会拉出一大块空隙） */
.ic-app .main-panel .file-list {
    align-content: start;
}

/* 弹窗高度跟着内容走，别固定 780 留一截空白 */
.ic-root {
    height: auto;
    max-height: min(780px, 100%);
}

.ic-app {
    height: auto;
    max-height: min(780px, 100%);
}

/* ============================================================
 * 抖动修复：切格式时窗口高度乱跳
 *
 * 两个来源：
 *   1) .ic-root 是 height:auto，右栏说明文字一行/两行切换会把整个弹窗撑高缩矮；
 *   2) #formatHelp / #qualityHelp 文案按格式变，行数一变，下面的控件就上下挪。
 * 现在弹窗高度固定（左右两栏本身都能撑满），说明区留出两行位置，换文案不再位移。
 * ============================================================ */

.ic-root {
    height: min(780px, 100%);
}

.ic-app {
    height: 100%;
    max-height: none;
}

.ic-app .field .help {
    /*
     * 先占住两行的高度（11px 字号 × 1.45 行高 ≈ 16px/行，两行 32px）。
     * 之前写 2.75em 只有 30px，PNG 那条文案一满两行就多出 2px，
     * 下面的画质/尺寸/按钮跟着上下跳 —— 就是「切格式窗口抖」的残余。
     */
    min-height: 3.2em;
}
