:root {
  --ink: var(--tools-text);
  --muted: var(--tools-muted);
  --paper: var(--tools-bg);
  --surface: var(--tools-surface);
  --surface-soft: var(--tools-surface-soft);
  --line: var(--tools-line);
  --green: var(--tools-green);
  --green-dark: var(--tools-green-strong);
  --green-soft: var(--tools-green-soft);
  --red: var(--tools-red);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--tools-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--green) 8%, transparent), transparent 25rem),
    var(--paper);
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

main {
  width: min(1140px, calc(100% - 40px));
  margin: 0 auto;
}
.hero {
  max-width: 900px;
  margin: 42px auto 50px;
  text-align: center;
}
.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--green-dark);
  font: 700 .72rem/1.3 var(--tools-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 auto;
  font-family: var(--tools-serif);
  font-size: clamp(2.7rem, 6vw, 4.9rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.055em;
}
.hero-copy {
  max-width: 720px;
  margin: 26px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.7;
}
.hero-proof {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px 20px;
  margin: 22px 0 0;
  padding: 0;
  color: var(--green-dark);
  font-size: .77rem;
  font-weight: 750;
  list-style: none;
}
.hero-proof li { display: inline-flex; align-items: center; gap: 6px; }
.hero-proof svg { width: 14px; height: 14px; flex: 0 0 auto; }

.workspace {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--tools-shadow);
  transition: border-color .2s, transform .2s;
}
.workspace.is-dragging { border-color: var(--green); transform: scale(1.003); }
.empty-state {
  min-height: 440px;
  padding: clamp(34px, 7vw, 72px);
  display: grid;
  grid-template-columns: minmax(210px, .8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: clamp(30px, 6vw, 72px);
}
.empty-visual {
  width: min(100%, 350px);
  height: auto;
  aspect-ratio: 3 / 2;
  justify-self: center;
  object-fit: contain;
}
.empty-copy h2, .batch-heading h2, .privacy-heading h2 {
  margin: 0;
  font-family: var(--tools-serif);
  font-size: clamp(1.95rem, 4vw, 2.8rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.04em;
}
.empty-copy > p:not(.step-label) { margin: 12px 0 0; color: var(--muted); line-height: 1.65; }
.empty-copy .button-primary { margin-top: 24px; }
.format-hint { display: block; margin-top: 10px; color: var(--muted); font-size: .72rem; }
.empty-copy .drop-hint { margin-top: 8px !important; font-size: .72rem; }
.empty-copy .privacy-note {
  margin-top: 18px !important;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--green-dark) !important;
  font-size: .75rem;
}
.privacy-note svg { width: 17px; height: 17px; flex: 0 0 auto; }

.button {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  font-weight: 750;
  transition: transform .18s cubic-bezier(.23, 1, .32, 1), background .18s cubic-bezier(.23, 1, .32, 1), box-shadow .18s cubic-bezier(.23, 1, .32, 1);
}
.button-primary {
  min-height: 50px;
  padding-inline: 22px;
  color: var(--tools-on-action);
  background: var(--tools-action);
  box-shadow: 0 10px 25px color-mix(in srgb, var(--green) 24%, transparent);
}
.button-secondary { color: var(--green-dark); border-color: var(--line); background: var(--surface); }
.button-icon, .button-icon svg, .button > span > svg, .button > svg { width: 19px; height: 19px; display: block; }

.batch-workspace { padding: clamp(24px, 4vw, 46px); }
.batch-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.batch-heading > div { max-width: 720px; }
.batch-heading p:last-child { margin: 11px 0 0; color: var(--muted); font-size: .78rem; }
.batch-layout {
  margin-top: 30px;
  display: grid;
  grid-template-columns: minmax(235px, 285px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}
.settings-panel {
  position: sticky;
  top: 18px;
  padding: 20px;
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.settings-panel h3 {
  margin: 0;
  font-family: var(--tools-serif);
  font-size: 1.35rem;
  font-weight: 500;
}
.field { display: grid; gap: 8px; }
.field > span:first-child, .mode-options legend {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}
.field input, .field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.setting-note { margin: -9px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.mode-options { margin: 0; padding: 0; display: grid; gap: 8px; border: 0; }
.mode-options legend { margin-bottom: 8px; }
.mode-options label {
  min-height: 68px;
  padding: 11px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.mode-options label.selected { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.mode-options input { margin-top: 3px; accent-color: var(--green); }
.mode-options label > span { display: grid; gap: 3px; }
.mode-options strong { font-size: .76rem; }
.mode-options small, .check-field small { color: var(--muted); font-size: .65rem; line-height: 1.4; }
.range-field { display: grid; gap: 9px; }
.range-field strong { color: var(--muted); font-size: .72rem; }
.range-field input { width: 100%; accent-color: var(--green); }
.number-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.number-with-unit input { min-width: 0; border: 0; background: transparent; }
.number-with-unit > span { padding-inline: 10px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.check-field { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check-field input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--green); }
.check-field > span { display: grid; gap: 3px; }
.check-field strong { font-size: .76rem; }
.dimension-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.file-list { min-width: 0; display: grid; gap: 14px; }
.file-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.file-card.is-success { border-color: color-mix(in srgb, var(--green) 36%, var(--line)); }
.file-card.is-error { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); }
.file-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.file-name { min-width: 0; display: grid; gap: 3px; }
.file-name strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.file-name span { color: var(--muted); font-size: .66rem; }
.remove-file {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--red);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}
.remove-file svg { width: 18px; height: 18px; display: block; }
.comparison {
  margin-top: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.comparison figure { min-width: 0; margin: 0; }
.comparison figcaption { min-height: 26px; display: flex; align-items: center; font-size: .65rem; }
.preview-shell {
  width: 100%;
  height: 178px;
  padding: 0;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%) 0 8px / 16px 16px,
    var(--surface-soft);
}
.preview-shell img { width: 100%; height: 100%; display: block; object-fit: contain; }
.preview-button { color: var(--ink); cursor: zoom-in; }
.preview-affordance {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 8px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 5px 16px rgb(0 0 0 / 12%);
  font-size: .65rem;
  font-weight: 750;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s, transform .16s;
}
.preview-affordance svg { width: 16px; height: 16px; display: block; }
.preview-button:hover .preview-affordance, .preview-button:focus-visible .preview-affordance { opacity: 1; transform: none; }
.result-preview { color: var(--muted); text-align: center; }
.empty-preview, .processing-preview { max-width: 220px; padding: 16px; font-size: .68rem; line-height: 1.5; }
.processing-preview { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--green-dark); }
.result-row {
  margin-top: 13px;
  padding-top: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
}
.result-copy { min-width: 0; display: grid; gap: 4px; }
.result-copy strong { color: var(--green-dark); font-size: .76rem; }
.result-copy span, .result-copy small { color: var(--muted); font-size: .65rem; line-height: 1.45; }
.size-comparison { display: inline-flex; align-items: center; gap: 8px; }
.size-comparison > span { display: inline-flex; align-items: center; }
.size-comparison svg { width: 17px; height: 17px; display: block; }
.result-copy small { max-width: 470px; }

.message {
  padding: 13px 15px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 10px;
  font-size: .76rem;
}
.message > span:first-child, .message > span:first-child svg { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.message > span:last-child { display: grid; gap: 3px; }
.message small { font-size: .7rem; line-height: 1.45; }
.message-error { color: color-mix(in srgb, var(--red) 88%, var(--ink)); border: 1px solid color-mix(in srgb, var(--red) 40%, var(--line)); background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.message-success { color: var(--green-dark); border: 1px solid color-mix(in srgb, var(--green) 32%, var(--line)); background: var(--green-soft); }
.empty-copy .message { margin-top: 16px; }
.item-error { margin-top: 13px; }
.batch-message { margin-top: 18px; }
.progress-area {
  margin-top: 18px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green-dark);
  border: 1px solid color-mix(in srgb, var(--green) 32%, var(--line));
  border-radius: 10px;
  background: var(--green-soft);
  font-size: .76rem;
  font-weight: 700;
}
.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
  border: 2px solid color-mix(in srgb, var(--green) 25%, transparent);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.batch-actions {
  margin-top: 24px;
  padding-top: 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.drop-overlay {
  position: absolute;
  z-index: 20;
  inset: 10px;
  display: grid;
  place-content: center;
  gap: 12px;
  color: var(--green-dark);
  text-align: center;
  border: 2px dashed var(--green);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}
.drop-overlay > span, .drop-overlay svg { width: 42px; height: 42px; display: block; margin: auto; }

.privacy-guide {
  margin: 68px 0 76px;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-soft);
}
.privacy-heading { max-width: 800px; }
.privacy-heading h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.privacy-heading > p:last-child { margin: 18px 0 0; color: var(--muted); line-height: 1.65; }
.privacy-grid { margin-top: 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.privacy-grid article { padding-top: 18px; display: flex; gap: 13px; border-top: 1px solid var(--line); }
.privacy-grid h3 { margin: 0; font-family: var(--tools-serif); font-size: 1.08rem; font-weight: 500; }
.privacy-grid p { margin: 7px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.58; }
.trust-number { color: var(--green-dark); font: 700 .67rem/1.5 var(--tools-mono); }
.image-preview-dialog {
  width: min(1120px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgb(0 0 0 / 28%);
}
.image-preview-dialog::backdrop { background: rgb(7 16 20 / 72%); backdrop-filter: blur(4px); }
.image-preview-dialog-content { padding: 20px; display: grid; gap: 14px; }
.image-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.image-preview-heading h2 { max-width: 850px; margin: 0; overflow: hidden; font: 500 clamp(1.35rem, 3vw, 2rem)/1.05 var(--tools-serif); letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-heading button { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.image-preview-heading svg { width: 18px; height: 18px; display: block; }
.preview-switcher { width: fit-content; padding: 3px; display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.preview-switcher button { min-height: 38px; padding: 0 16px; color: var(--muted); border: 0; border-radius: 7px; background: transparent; font-size: .75rem; font-weight: 750; }
.preview-switcher button[aria-selected="true"] { color: var(--green-dark); background: var(--surface); box-shadow: 0 1px 5px rgb(0 0 0 / 8%); }
.dialog-preview-shell {
  height: min(68vh, 720px);
  min-height: 280px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%) 0 0 / 20px 20px,
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%) 0 10px / 20px 20px,
    var(--surface-soft);
}
.dialog-preview-shell img { width: 100%; height: 100%; display: block; object-fit: contain; }
.dialog-preview-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; font-size: .75rem; }
.dialog-preview-meta span { color: var(--muted); }

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .7rem;
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 65%, white); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .button:hover:not(:disabled) { transform: translateY(-1px); }
  .button-primary:hover:not(:disabled) { background: var(--tools-action-hover); }
  .remove-file:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
  .image-preview-heading button:hover { background: var(--green-soft); }
}
.button:active:not(:disabled), .remove-file:active:not(:disabled) { transform: scale(.97); }

@media (max-width: 900px) {
  .batch-layout { grid-template-columns: 1fr; }
  .settings-panel { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-panel h3, .mode-options, .check-field, .setting-note, .dimension-grid { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  main, footer { width: min(100% - 28px, 1140px); }
  .hero { margin: 34px auto 38px; }
  .hero h1 { font-size: clamp(2.45rem, 13vw, 3.7rem); }
  .empty-state { min-height: 0; grid-template-columns: 1fr; padding: 30px 22px; text-align: center; }
  .empty-visual { width: min(70%, 260px); }
  .empty-copy .button { width: 100%; }
  .empty-copy .privacy-note { justify-content: center; text-align: left; }
  .batch-workspace { padding: 22px 15px; }
  .batch-heading { align-items: flex-start; flex-direction: column; }
  .batch-heading .button { width: 100%; }
  .settings-panel { grid-template-columns: 1fr; padding: 16px; }
  .settings-panel h3, .mode-options, .check-field, .setting-note, .dimension-grid { grid-column: auto; }
  .dimension-grid { grid-template-columns: 1fr; }
  .file-card { padding: 13px; }
  .comparison { grid-template-columns: 1fr; }
  .preview-shell { height: 210px; }
  .result-row { align-items: stretch; flex-direction: column; }
  .result-row .button { width: 100%; }
  .batch-actions { align-items: stretch; flex-direction: column; }
  .batch-actions .button { width: 100%; }
  .privacy-guide { margin: 48px 0 56px; padding: 28px 20px; }
  .privacy-grid { grid-template-columns: 1fr; }
  .image-preview-dialog { width: calc(100% - 24px); max-height: calc(100vh - 24px); border-radius: 16px; }
  .image-preview-dialog-content { padding: 14px; }
  .image-preview-heading h2 { white-space: normal; overflow-wrap: anywhere; }
  .dialog-preview-shell { height: min(58vh, 560px); min-height: 220px; }
  .preview-switcher { width: 100%; }
  .preview-switcher button { flex: 1; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  .preview-shell { height: 170px; }
  .hero-proof { align-items: center; flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--green) 10%, transparent), transparent 25rem),
      var(--paper);
  }
  .button-primary { box-shadow: 0 10px 25px color-mix(in srgb, var(--green) 16%, transparent); }
}

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