:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --ink: #292a26;
  --muted: #77776f;
  --line: #d9d5cc;
  --line-strong: #bdb8ad;
  --accent: #2f704d;
  --accent-dark: #23583b;
  --accent-soft: #eaf2ec;
  --accent-rgb: 47, 112, 77;
  --warning: #85630f;
  --warning-soft: #f5f0df;
  --green: #286b4a;
  --green-soft: #e5eee7;
  --danger: #a13928;
  --topbar-height: 72px;
  --sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
}

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -1.4px;
  text-decoration: none;
}

.wordmark-mark { width: 30px; height: 30px; display: block; flex: 0 0 auto; }
.wordmark-mark svg { display: block; width: 100%; height: 100%; }

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.github-link:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

.workbench {
  width: min(1220px, calc(100% - 56px));
  min-height: calc(100vh - var(--topbar-height));
  min-height: calc(100svh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  padding: 50px 0 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: 1.1;
}

.intro-copy {
  max-width: 320px;
  margin: 0 3px 5px 0;
  color: #585a54;
  font-size: 15px;
  line-height: 1.65;
}

.intro-aside { width: min(100%, 390px); margin: 0 3px 2px 0; }
.intro-aside .intro-copy { margin: 0; }

.ingest { margin-bottom: 30px; }

.drop-zone {
  min-height: 102px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid #cbc7bd;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(35, 36, 32, .035);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.drop-zone:hover, .drop-zone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 3px 12px rgba(70, 48, 32, .08);
}

.drop-zone:focus-within { outline: 3px solid var(--accent-dark); outline-offset: 3px; }
.drop-zone.is-over { outline: 3px solid rgba(var(--accent-rgb), .2); outline-offset: 2px; }

.drop-icon {
  width: 46px;
  height: 46px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .22);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.drop-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.drop-copy { display: grid; gap: 2px; }
.drop-copy strong { font-size: 15px; font-weight: 680; }
.drop-copy > span { color: var(--muted); font-size: 13px; }
.browse-link { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.drop-hint { min-height: 39px; display: inline-flex; align-items: center; gap: 14px; margin-left: auto; padding: 0 12px; border: 1px solid #d7d2c8; border-radius: 5px; background: #fff; color: #45463f; font-size: 12px; font-weight: 650; }
.drop-hint span:last-child { color: var(--accent-dark); font-size: 16px; }
.queue-message { min-height: 20px; margin: 9px 2px 0; color: #686a63; font-size: 12px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 25px;
  min-height: 180px;
  margin: 8px 0 58px;
  padding: 28px 36px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.empty-grid {
  width: 87px;
  height: 87px;
  display: grid;
  flex: 0 0 auto;
  grid-template: repeat(2, 1fr) / repeat(2, 1fr);
  gap: 5px;
  transform: rotate(-4deg);
}

.empty-grid span { border: 1px solid #b8b3a9; border-radius: 2px; background: #faf8f2; }
.empty-grid span:nth-child(2) { background: #ede9de; }
.empty-grid span:nth-child(3) { background: #f6e5d7; border-color: #d5a586; }
.empty-grid span:nth-child(4) { background: #e4ece5; border-color: #b5c3b6; }
.empty-state h2 { margin: 0 0 6px; font-family: var(--sans); font-size: 22px; font-weight: 650; letter-spacing: -.035em; }
.empty-state p { max-width: 420px; margin: 0; color: var(--muted); font-size: 14px; }

.queue-section { margin-top: 6px; }
.queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 16px; border-bottom: 1px solid var(--line-strong); }
.queue-title-wrap { display: flex; align-items: center; gap: 11px; }
.queue-title-wrap h2 { margin: 0; font-family: var(--sans); font-size: 23px; font-weight: 650; letter-spacing: -.035em; }
.count-pill { min-width: 25px; height: 25px; display: grid; place-items: center; padding: 0 7px; border-radius: 20px; background: #e9e5dc; color: #52534d; font-size: 12px; font-weight: 650; }
.queue-actions { display: flex; align-items: center; gap: 10px; }

.button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { border-color: var(--accent); background: var(--accent); color: white; }
.button-primary:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
.button-quiet { border-color: var(--line); background: transparent; color: #55564f; }
.button-quiet:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(255,255,255,.42); }

.image-item { padding: 22px 0 28px; border-bottom: 1px solid var(--line-strong); }
.image-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; }
.image-name-wrap { min-width: 0; display: flex; align-items: center; gap: 12px; }
.file-mark { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #d5cfc4; border-radius: 5px; color: #737168; font-size: 9px; font-weight: 750; letter-spacing: .06em; }
.image-title-group { min-width: 0; }
.image-name { overflow: hidden; margin: 0; font-size: 15px; font-weight: 675; text-overflow: ellipsis; white-space: nowrap; }
.image-source-meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.remove-button { padding: 6px 2px 6px 8px; border: 0; background: transparent; color: #686961; font-size: 12px; cursor: pointer; }
.remove-button:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.remove-button span { margin-left: 3px; font-size: 17px; line-height: 0; vertical-align: -1px; }

.image-work-area { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 29px; align-items: start; }
.visual-column { min-width: 0; }

.comparison-frame {
  --split: 50%;
  position: relative;
  min-height: 290px;
  max-height: 630px;
  aspect-ratio: 1.62 / 1;
  overflow: hidden;
  border: 1px solid #d5d1c8;
  border-radius: 5px;
  background-color: var(--surface);
  touch-action: pan-y;
  user-select: none;
}

.checkerboard {
  background-image: linear-gradient(45deg, #e7e4dc 25%, transparent 25%), linear-gradient(-45deg, #e7e4dc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e7e4dc 75%), linear-gradient(-45deg, transparent 75%, #e7e4dc 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.source-window, .result-window {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.source-window { z-index: 0; }
.result-window { z-index: 2; left: var(--split); }

.source-image, .result-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  transform-origin: center;
  pointer-events: none;
  will-change: transform;
}

.empty-result { position: absolute; z-index: 1; inset: 0 0 0 var(--split); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; border-left: 1px solid rgba(52,52,48,.16); background: rgba(255,255,255,.86); color: #85837b; }
.empty-result span { padding: 4px 8px; border: 1px solid #d9d5cc; border-radius: 3px; background: #ffffff; color: #686961; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.empty-result p { margin: 0; font-size: 12px; line-height: 1.45; text-align: center; }
.compare-label { position: absolute; z-index: 3; top: 12px; padding: 5px 8px; border: 1px solid rgba(41,42,38,.13); border-radius: 3px; background: rgba(255,255,255,.94); color: #383a34; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.compare-before { left: 12px; }
.compare-after { right: 12px; }
.compare-line { position: absolute; z-index: 4; inset: 0 auto 0 var(--split); width: 1px; background: #ffffff; box-shadow: 0 0 0 1px rgba(35,36,32,.24); pointer-events: none; }
.compare-line span { position: absolute; top: 50%; left: 50%; width: 30px; height: 40px; border: 1px solid rgba(35,36,32,.25); border-radius: 6px; background: #ffffff; transform: translate(-50%, -50%); box-shadow: 0 2px 7px rgba(24,24,20,.12); pointer-events: auto; cursor: ew-resize; touch-action: none; }
.compare-line span::before, .compare-line span::after { content: ""; position: absolute; top: 50%; width: 5px; height: 5px; border-top: 1.5px solid #55564f; border-right: 1.5px solid #55564f; }
.compare-line span::before { left: 6px; transform: translateY(-50%) rotate(-135deg); }
.compare-line span::after { right: 6px; transform: translateY(-50%) rotate(45deg); }
.compare-range { position: absolute; z-index: 5; inset: 0; width: 100%; height: 100%; margin: 0; opacity: .001; pointer-events: none; cursor: ew-resize; }
.compare-range:focus-visible { opacity: .001; outline: none; }
.comparison-frame:has(.compare-range:focus-visible) { outline: 3px solid var(--accent-dark); outline-offset: 3px; }
.compare-instruction { position: absolute; z-index: 4; bottom: 10px; left: 50%; padding: 3px 7px; border-radius: 3px; background: rgba(41,42,38,.68); color: #fff; font-size: 10px; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.comparison-frame.has-result .empty-result { display: none; }
.comparison-frame.has-result .compare-instruction { opacity: .7; }
.comparison-frame.is-zoomed { touch-action: none; cursor: grab; }
.comparison-frame.is-panning { cursor: grabbing; }

.preview-tools { display: grid; gap: 5px; padding: 9px 1px 10px; border-bottom: 1px solid var(--line); }
.zoom-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.zoom-heading { margin-right: 2px; color: #555750; font-size: 11px; font-weight: 650; }
.zoom-button { width: 29px; height: 29px; display: grid; place-items: center; padding: 0; border: 1px solid #d3cfc6; border-radius: 4px; background: #fff; color: var(--ink); font-size: 17px; line-height: 1; cursor: pointer; }
.zoom-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }
.zoom-button:disabled { color: #92938c; cursor: not-allowed; opacity: .55; }
.zoom-range { width: clamp(70px, 12vw, 140px); height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.zoom-value { min-width: 38px; color: #555750; font-size: 11px; font-variant-numeric: tabular-nums; }
.zoom-reset { min-height: 29px; padding: 0 8px; border: 1px solid #d3cfc6; border-radius: 4px; background: transparent; color: #555750; font-size: 11px; cursor: pointer; }
.zoom-reset:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }
.zoom-reset:disabled { color: #92938c; cursor: not-allowed; }
.preview-help { margin: 0; color: #77776f; font-size: 10px; line-height: 1.4; }

.comparison-caption { display: flex; justify-content: space-between; gap: 12px; padding: 8px 1px 11px; color: #62645d; font-size: 11px; }
.result-dimensions { text-align: right; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-stats > div { display: grid; gap: 3px; padding: 11px 12px; border-right: 1px solid var(--line); }
.result-stats > div:first-child { padding-left: 1px; }
.result-stats > div:last-child { border-right: 0; }
.result-stats span { color: var(--muted); font-size: 10px; }
.result-stats strong { font-size: 13px; font-weight: 680; }
.result-stats .saved-amount.is-saving { color: var(--green); }
.result-stats .saved-amount.is-larger { color: var(--warning); }

.settings-column { min-width: 0; padding: 3px 0 0; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.settings-heading h4 { margin: 0; font-family: var(--sans); font-size: 18px; font-weight: 650; letter-spacing: -.035em; }
.reset-button { padding: 4px 0 4px 6px; border: 0; background: none; color: #66675f; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.reset-button:hover { color: var(--accent-dark); }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 14px; padding: 15px 0 17px; }
.field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > label, .field > legend, .field-label-line label { display: block; margin: 0 0 6px; color: #464841; font-size: 11px; font-weight: 650; }
.field select { width: 100%; height: 37px; padding: 0 30px 0 10px; border: 1px solid #c7c2b8; border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 12px; }
.format-note { margin: 6px 0 0; color: #707169; font-size: 11px; line-height: 1.4; }
.format-note.is-warning { color: var(--warning); }
.field-label-line { display: flex; align-items: center; justify-content: space-between; }
.field-label-line label { margin-bottom: 0; }
.quality-value { min-width: 36px; color: var(--accent-dark); font-size: 11px; font-weight: 700; text-align: right; }
.quality-range { width: 100%; height: 20px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }
.quality-range:disabled { cursor: not-allowed; opacity: .42; }
.quality-note { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.dimensions-field { margin: 0; padding: 0; border: 0; }
.dimensions-field legend { padding: 0; }
.dimension-inputs { display: grid; grid-template-columns: 1fr 14px 1fr; align-items: end; gap: 8px; }
.dimension-inputs label { display: grid; gap: 4px; color: #77776f; font-size: 10px; }
.number-wrap { height: 36px; display: flex; align-items: center; overflow: hidden; border: 1px solid #c7c2b8; border-radius: 4px; background: var(--surface); }
.number-wrap:focus-within { outline: 3px solid var(--accent-dark); outline-offset: 2px; }
.number-wrap input { width: 100%; min-width: 0; height: 100%; padding: 0 2px 0 9px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.number-wrap input:focus-visible { outline: none; }
.number-wrap > span { padding: 0 8px 0 3px; color: #77776f; font-size: 10px; }
.dimension-times { padding-bottom: 10px; color: #929087; font-size: 12px; text-align: center; }
.checkbox-row { display: grid; gap: 10px; padding: 12px 0 0; border-top: 1px solid #e2ded6; }
.check-label { display: flex; align-items: center; gap: 9px; color: #474942; font-size: 12px; cursor: pointer; }
.check-label input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.background-field { padding: 12px 0 0; border-top: 1px solid #e2ded6; }
.background-choice { display: flex; align-items: center; gap: 9px; color: #64665e; font-size: 11px; }
.background-color { width: 29px; height: 25px; padding: 2px; border: 1px solid #c7c2b8; border-radius: 4px; background: white; cursor: pointer; }
.transparency-warning { margin: 9px 0 0; padding: 8px 9px; border-left: 2px solid var(--warning); background: var(--warning-soft); color: #574714; font-size: 11px; line-height: 1.45; }

.item-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 13px; border-top: 1px solid var(--line); }
.item-status { min-width: 0; margin: 0; color: #686a63; font-size: 11px; line-height: 1.4; }
.item-status.is-error { color: var(--danger); }
.item-status.is-success { color: var(--green); }
.item-status.is-progress { color: #56574f; }
.item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; flex: 0 0 auto; }
.item-actions .button { min-height: 38px; padding: 0 14px; font-size: 12px; }
.download-link { color: var(--green); font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.download-link:hover { color: #174d33; }

.page-footer { display: flex; justify-content: space-between; gap: 15px; margin-top: auto; padding: 23px 0 18px; color: #77776f; font-size: 11px; }

@media (max-width: 850px) {
  .workbench { width: min(100% - 40px, 680px); }
  .image-work-area { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .comparison-frame { aspect-ratio: 1.5 / 1; min-height: 270px; }
  .settings-column { padding-top: 0; }
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  :root { --topbar-height: 61px; }
  body { font-size: 14px; }
  .topbar { padding: 0 18px; }
  .wordmark { font-size: 22px; }
  .workbench { width: calc(100% - 36px); }
  .intro { align-items: start; flex-direction: column; gap: 13px; padding: 34px 0 23px; }
  .eyebrow { margin-bottom: 10px; font-size: 10px; }
  h1 { font-size: clamp(34px, 10vw, 42px); }
  .intro-copy { max-width: 350px; margin: 0; font-size: 13px; }
  .ingest { margin-bottom: 23px; }
  .drop-zone { min-height: 84px; gap: 12px; padding: 14px; }
  .drop-icon { width: 38px; height: 38px; }
  .drop-icon svg { width: 19px; height: 19px; }
  .drop-copy strong { font-size: 13px; }
  .drop-copy > span { max-width: 210px; font-size: 11px; line-height: 1.4; }
  .drop-hint { display: none; }
  .empty-state { min-height: 155px; gap: 16px; margin: 7px 0 35px; padding: 21px 6px; }
  .empty-grid { width: 62px; height: 62px; gap: 4px; }
  .empty-state h2 { font-size: 20px; }
  .empty-state p { font-size: 12px; }
  .queue-title-wrap h2 { font-size: 23px; }
  .queue-heading { align-items: flex-end; }
  .queue-actions { gap: 6px; }
  .queue-actions .button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  .image-item { padding: 18px 0 23px; }
  .image-heading { padding-bottom: 13px; }
  .image-name { max-width: 225px; font-size: 13px; }
  .image-source-meta { font-size: 11px; }
  .file-mark { width: 31px; height: 31px; }
  .comparison-frame { min-height: 230px; aspect-ratio: 1.12 / 1; }
  .compare-label { top: 8px; padding: 4px 6px; font-size: 9px; }
  .compare-before { left: 8px; }
  .compare-after { right: 8px; }
  .compare-line span { width: 27px; height: 36px; }
  .zoom-controls { gap: 6px; }
  .zoom-range { width: 84px; }
  .result-stats > div { padding: 9px 8px; }
  .result-stats strong { font-size: 11px; }
  .result-stats span { font-size: 9px; }
  .comparison-caption { font-size: 10px; }
  .control-grid { gap: 13px 11px; }
  .item-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
  .item-actions { width: 100%; justify-content: space-between; }
  .page-footer { padding-bottom: 14px; font-size: 10px; }
}

@media (max-width: 360px) {
  .queue-actions .button-quiet { padding: 0 7px; }
  .queue-actions .button-primary { padding: 0 8px; }
  .image-name { max-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}


