:root {
  color-scheme: light;
  --paper: #f2f0e9;
  --surface: #fffef9;
  --ink: #20211e;
  --muted: #6d6e68;
  --line: #d8d6ce;
  --accent: #dfff4f;
  --accent-dark: #c7e83c;
  --danger: #a52a24;
  --radius-large: 28px;
  --radius-medium: 18px;
  --shadow: 0 24px 80px rgba(32, 33, 30, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
label,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
main,
footer {
  width: min(100% - 48px, 1180px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand__mark {
  width: 17px;
  height: 17px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 5px -5px 0 -3px var(--accent);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.privacy-note svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.hero {
  padding: clamp(30px, 4vw, 52px) 0 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 1000px;
  margin: 0;
  font-size: clamp(46px, 6.2vw, 78px);
  font-weight: 750;
  letter-spacing: -0.065em;
  line-height: 0.83;
}

.hero h1 span {
  position: relative;
  display: inline-block;
  margin-top: 0.12em;
  padding-right: 0.13em;
  z-index: 0;
}

.hero h1 span::after {
  position: absolute;
  right: 0;
  bottom: -0.02em;
  left: -0.03em;
  height: 0.19em;
  background: var(--accent);
  content: "";
  transform: rotate(-1deg);
  z-index: -1;
}

.hero__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-top: 22px;
}

.hero__footer > p:first-child {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 17px);
}

.formats {
  flex: 0 0 auto;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.formats span {
  margin-inline: 8px;
  color: var(--muted);
}

.tool,
.result {
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 36px;
}

.section-number {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.drop-zone {
  display: flex;
  min-height: 390px;
  padding: 48px 24px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 1.5px dashed #a5a59e;
  border-radius: 22px;
  background-color: #f8f7f2;
  background-image: radial-gradient(#d8d6ce 0.8px, transparent 0.8px);
  background-size: 18px 18px;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--ink);
  background-color: #f4facd;
  transform: scale(1.005);
}

.drop-zone__icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
}

.drop-zone__icon svg {
  width: 30px;
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-zone h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.035em;
}

.drop-zone p {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.drop-zone small {
  margin-top: 19px;
  color: var(--muted);
  font-size: 12px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  padding: 0 22px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button--dark {
  background: var(--ink);
  color: #fff;
}

.button--dark:hover {
  background: #343530;
}

.button--accent {
  border-color: #bedb3b;
  background: var(--accent);
  color: var(--ink);
}

.button--accent:hover {
  background: var(--accent-dark);
}

.button--wide {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
}

.button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button:disabled,
.button.is-loading {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.message {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
}

.message--error {
  border: 1px solid #e4b7b3;
  background: #fff0ee;
  color: var(--danger);
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 28px;
}

.source-card,
.settings-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

.source-card {
  display: flex;
  flex-direction: column;
  background: #f8f7f2;
}

.source-summary {
  display: flex;
  margin: 8px 0 14px;
  padding: 16px 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.source-summary strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.source-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.source-list {
  display: grid;
  max-height: 476px;
  padding-right: 4px;
  gap: 10px;
  overflow-y: auto;
}

.source-item {
  display: grid;
  min-width: 0;
  padding: 13px;
  align-items: center;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.source-item__format {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.source-item__info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.source-item__info strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item__info span {
  color: var(--muted);
  font-size: 10px;
}

.source-item__info .source-item__target {
  color: var(--ink);
  font-weight: 700;
}

.card-heading {
  display: flex;
  min-height: 30px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-heading .eyebrow {
  margin-bottom: 0;
}

.text-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.preview-frame {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background-color: #deddd7;
  background-image:
    linear-gradient(45deg, #cac9c2 25%, transparent 25%),
    linear-gradient(-45deg, #cac9c2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cac9c2 75%),
    linear-gradient(-45deg, transparent 75%, #cac9c2 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.preview-frame--source {
  min-height: 390px;
  margin: 8px 0 22px;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-frame--source img {
  max-height: 480px;
}

.file-details,
.result-stats {
  display: grid;
  margin: auto 0 0;
  grid-template-columns: 1.5fr 1fr 0.8fr;
  gap: 14px;
}

.file-details div,
.result-stats div {
  min-width: 0;
}

.file-details dt,
.result-stats dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.file-details dd,
.result-stats dd {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card {
  background: var(--surface);
}

.settings-card .card-heading {
  margin-bottom: 20px;
}

.field-group {
  padding: 0;
  margin: 0;
  border: 0;
}

.field-group legend,
.field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.format-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.format-option {
  position: relative;
  cursor: pointer;
}

.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-option > span {
  display: flex;
  min-height: 105px;
  padding: 15px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f5;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.format-option strong {
  margin-bottom: 8px;
  font-size: 19px;
}

.format-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.format-option input:checked + span {
  border-color: var(--ink);
  background: #f5f8df;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.format-option input:focus-visible + span {
  outline: 3px solid rgba(32, 33, 30, 0.22);
  outline-offset: 2px;
}

.divider {
  height: 1px;
  margin: 24px 0;
  background: var(--line);
}

.resize-heading,
.range-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.resize-heading .field-label {
  margin-bottom: 2px;
}

.resize-heading p,
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch > span:first-of-type {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;
  border: 1px solid #b8b8b1;
  border-radius: 99px;
  background: #d8d7d1;
  transition: background 140ms ease, border-color 140ms ease;
}

.switch > span:first-of-type::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  content: "";
  transition: transform 140ms ease;
}

.switch input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(32, 33, 30, 0.22);
  outline-offset: 2px;
}

.resize-fields {
  margin-top: 20px;
}

.number-field {
  display: flex;
  height: 50px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f5;
}

.number-field:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.number-field input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  appearance: textfield;
}

.number-field input::-webkit-inner-spin-button,
.number-field input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-field span {
  padding-right: 14px;
  color: var(--muted);
  font-size: 12px;
}

.field-hint {
  margin-top: 7px;
}

.quality-group {
  margin-top: 22px;
}

.range-heading .field-label {
  margin-bottom: 0;
}

.range-heading output {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 8px 0 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--ink) var(--range-progress, 83.33%), var(--line) var(--range-progress, 83.33%));
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: var(--line);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--ink);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}

.output-summary {
  display: flex;
  margin: 22px 0 18px;
  padding: 14px 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.output-summary span {
  color: var(--muted);
}

.output-summary strong {
  font-size: 14px;
}

.local-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.result {
  margin-top: 28px;
  scroll-margin-top: 24px;
}

.result-list {
  display: grid;
  gap: 18px;
}

.result-list.is-batch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-card {
  display: grid;
  padding: 24px;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 28px;
  border-radius: var(--radius-medium);
  background: #f8f7f2;
}

.preview-frame--result {
  min-height: 360px;
}

.preview-frame--result img {
  max-height: 520px;
}

.result-info {
  display: flex;
  min-width: 0;
  padding: 10px 4px 4px;
  flex-direction: column;
}

.result-name {
  overflow: hidden;
  margin: 0 0 26px;
  font-size: clamp(19px, 2.5vw, 26px);
  font-weight: 750;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-stats {
  display: grid;
  margin: 0 0 32px;
  grid-template-columns: 1fr 0.7fr 0.8fr;
}

.result-info .button {
  margin-top: auto;
}

.result-list.is-batch .result-card {
  padding: 18px;
  grid-template-columns: 1fr;
  gap: 18px;
}

.result-list.is-batch .preview-frame--result {
  min-height: 220px;
  height: 220px;
}

.result-list.is-batch .preview-frame--result img {
  max-height: 220px;
}

.result-list.is-batch .result-info {
  padding: 0;
}

.result-list.is-batch .result-name {
  margin-bottom: 18px;
  font-size: 18px;
}

.result-list.is-batch .result-stats {
  margin-bottom: 22px;
}

footer {
  display: flex;
  min-height: 116px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

footer p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid rgba(32, 33, 30, 0.35);
  outline-offset: 3px;
}

@media (max-width: 850px) {
  .editor,
  .result-card {
    grid-template-columns: 1fr;
  }

  .result-list.is-batch {
    grid-template-columns: 1fr;
  }

  .preview-frame--source,
  .preview-frame--result {
    min-height: 320px;
  }

  .result-info {
    padding: 4px;
  }
}

@media (max-width: 600px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  .privacy-note {
    max-width: 150px;
    justify-content: flex-end;
    font-size: 10px;
    text-align: right;
  }

  .hero {
    padding: 32px 0 28px;
  }

  .hero h1 {
    font-size: clamp(40px, 11vw, 52px);
  }

  .hero__footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
    margin-top: 18px;
  }

  .tool,
  .result {
    padding: 22px 16px;
    border-radius: 20px;
  }

  .section-heading {
    gap: 12px;
    margin-bottom: 24px;
  }

  .section-number {
    width: 31px;
    height: 31px;
  }

  .drop-zone {
    min-height: 340px;
    padding-inline: 16px;
  }

  .source-card,
  .settings-card,
  .result-card {
    padding: 16px;
  }

  .preview-frame--source,
  .preview-frame--result {
    min-height: 260px;
  }

  .file-details,
  .result-stats {
    grid-template-columns: 1fr 1fr;
  }

  .file-details div:first-child {
    grid-column: 1 / -1;
  }

  .format-options {
    grid-template-columns: 1fr;
  }

  .format-option > span {
    min-height: 82px;
  }

  footer {
    min-height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
