:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #66706c;
  --paper: #f4f1e9;
  --panel: #fffdf8;
  --line: #d9d7cf;
  --green: #b8ef5a;
  --coral: #ff765f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 88% 9%, rgb(184 239 90 / 18%), transparent 22rem), var(--paper);
}
button, input, select { font: inherit; }
button { color: inherit; }

.site-header {
  width: min(1400px, calc(100% - 48px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(23 32 29 / 14%);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--ink); transform: rotate(-4deg); }
.brand-mark span { width: 13px; height: 13px; display: block; border: 3px solid var(--green); border-top-color: transparent; border-radius: 50%; }
.privacy-pill { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 13px; border: 1px solid rgb(23 32 29 / 16%); border-radius: 999px; color: #4e5854; background: rgb(255 255 255 / 46%); font-size: 12px; font-weight: 700; }
.privacy-pill span { color: #4d9e36; font-size: 10px; }

main { width: min(1400px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 72px 0 50px; }
.eyebrow, .step-label { margin: 0 0 14px; color: #52605a; font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { max-width: 940px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(58px, 8.2vw, 120px); font-weight: 400; line-height: .83; letter-spacing: -.065em; }
.hero h1 em { color: #467e36; font-weight: 400; }
.hero-copy { max-width: 570px; margin: 34px 0 0 auto; color: #505b57; font-size: 17px; line-height: 1.65; }

.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); min-height: 670px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 22px 70px rgb(32 42 38 / 9%); }
.control-panel { padding: 28px; border-right: 1px solid var(--line); background: #faf8f2; }
.control-heading, .settings-title, .progress-copy, .file-name-row, .results-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.control-heading .step-label, .settings-title .step-label, .results-header .step-label { margin: 0; }
.local-note { color: var(--muted); font-size: 10px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
.drop-zone { position: relative; margin: 18px 0 28px; padding: 38px 20px 28px; display: flex; flex-direction: column; align-items: center; border: 1.5px dashed #9da49d; border-radius: 16px; background: #fffefa; cursor: pointer; text-align: center; transition: border-color .18s, background .18s, transform .18s; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragging { outline: none; border-color: #3f762f; background: #f4fae9; transform: translateY(-2px); }
.upload-icon { width: 56px; height: 56px; margin-bottom: 17px; display: grid; place-items: center; border: 1px solid #aeb5ae; border-radius: 50%; background: white; }
.upload-arrow { font-size: 25px; line-height: 1; transform: translateY(-2px); }
.drop-zone strong { font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.drop-zone > span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.drop-zone small { margin-top: 14px; color: #818984; font-size: 10px; }

.primary-button, .download-button { border: 0; border-radius: 9px; font-weight: 800; cursor: pointer; transition: transform .15s, opacity .15s, background .15s; }
.primary-button { display: inline-block; margin-top: 18px; padding: 11px 19px; color: white; background: var(--ink); font-size: 12px; line-height: normal; text-align: center; }
.drop-zone:has(.visually-hidden:focus-visible) .primary-button { outline: 3px solid #3f762f; outline-offset: 3px; }
.primary-button:hover, .download-button:hover:not(:disabled) { transform: translateY(-1px); }
.settings { padding-top: 26px; border-top: 1px solid var(--line); }
.settings-title output { min-width: 36px; padding: 5px 8px; border-radius: 6px; color: #1f391d; background: var(--green); text-align: center; font-size: 11px; font-weight: 900; }
.settings > label { display: block; margin: 17px 0 9px; font-size: 12px; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: #4d8438; cursor: pointer; }
.inline-label { font-size: 12px; font-weight: 800; }
.tolerance-group { margin-top: 17px; }
.tolerance-group input[type="range"] { margin-top: 9px; }
.field-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.notice { margin: 11px 0 0; padding: 9px 11px; border: 1px solid #ecd2a6; border-radius: 8px; color: #6b4a14; background: #fff7e6; font-size: 10px; line-height: 1.5; }
.notice[hidden] { display: none; }
.range-labels { display: flex; justify-content: space-between; color: #8a918d; font-size: 9px; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 13px; top: 9px; pointer-events: none; }
select { width: 100%; padding: 11px 38px 11px 12px; appearance: none; border: 1px solid #cfd2cc; border-radius: 9px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 650; }
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.color-control { min-width: 0; color: var(--muted); font-size: 10px; font-weight: 700; }
.color-input-wrap { margin-top: 7px; padding: 7px; display: flex; align-items: center; gap: 7px; overflow: hidden; border: 1px solid #d4d6d1; border-radius: 8px; background: white; }
input[type="color"] { width: 24px; height: 24px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.color-input-wrap span { overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
.panel-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.text-button { padding: 0; border: 0; color: #7f3830; background: none; font-size: 11px; font-weight: 800; cursor: pointer; }
.text-button:disabled { opacity: .35; cursor: default; }

.results-panel { min-width: 0; padding: 28px; background: #fff; }
.results-header { align-items: flex-end; }
.results-header h2 { margin: 8px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.view-switcher { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #f5f3ed; }
.view-button { padding: 8px 10px; border: 0; border-radius: 7px; color: #707873; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.view-button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgb(0 0 0 / 8%); }
.progress-panel { margin-top: 20px; padding: 13px 15px; border: 1px solid #cfe0b6; border-radius: 10px; background: #f6fbe9; font-size: 11px; }
.progress-copy strong { color: #466832; }
.progress-track { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #dce7cb; }
.progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: #5a8e3e; transition: width .2s; }
.progress-track.is-indeterminate span { width: 35%; animation: progress-slide 1.3s ease-in-out infinite; }
@keyframes progress-slide { from { margin-left: -35%; } to { margin-left: 100%; } }
.compare-control { margin: 18px 0 -5px; padding: 12px 14px; border-radius: 10px; background: #f6f5f0; }
.compare-control label { display: block; font-size: 10px; font-weight: 800; }
.compare-control input { margin: 8px 0 2px; }
.compare-control > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }

.empty-state { min-height: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state h2 { margin: 20px 0 7px; color: var(--ink); font-family: Georgia, serif; font-weight: 500; }
.empty-state p { max-width: 310px; margin: 0; font-size: 12px; line-height: 1.6; }
.empty-art { position: relative; width: 130px; height: 100px; }
.empty-frame { position: absolute; inset: 12px 16px; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 9px; transform: rotate(-3deg); }
.empty-frame::before { content: ""; position: absolute; width: 25px; height: 25px; right: 14px; top: 12px; border-radius: 50%; background: var(--coral); }
.empty-frame::after { content: ""; position: absolute; width: 90px; height: 55px; left: 2px; bottom: -28px; background: var(--green); transform: rotate(31deg); }
.empty-frame span { position: absolute; z-index: 1; width: 80px; height: 45px; right: -23px; bottom: -19px; background: #b8d1ff; transform: rotate(-28deg); }
.empty-spark { position: absolute; font-family: Georgia, serif; font-size: 22px; }
.spark-one { top: 0; right: 0; color: #527b3d; transform: rotate(18deg); }
.spark-two { left: 0; bottom: 2px; color: var(--coral); transform: rotate(-11deg); }

.results-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.image-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.card-preview { position: relative; height: 275px; display: grid; place-items: center; overflow: hidden; }
.checkerboard { background-color: #f8f8f6; background-image: linear-gradient(45deg, #e4e5e1 25%, transparent 25%), linear-gradient(-45deg, #e4e5e1 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e4e5e1 75%), linear-gradient(-45deg, transparent 75%, #e4e5e1 75%); background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0; }
.checkerboard.checker-strong { background-color: #fff; background-size: 30px 30px; background-position: 0 0, 0 15px, 15px -15px, -15px 0; }
.card-preview canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.card-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #59625e; background: rgb(250 249 245 / 88%); font-size: 11px; }
.spinner { width: 17px; height: 17px; border: 2px solid #bdc2bc; border-top-color: #39622e; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.image-card.is-ready .card-loading, .image-card.is-error .card-loading { display: none; }
.image-card.is-error .card-preview::after { content: "Could not process"; color: #873c35; font-family: Georgia, serif; font-size: 18px; }
.card-body { padding: 14px; display: flex; align-items: center; gap: 12px; }
.file-info { flex: 1; min-width: 0; }
.file-name-row { justify-content: flex-start; gap: 8px; }
.file-name { min-width: 0; margin: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 4px; color: #4f653b; background: #eaf4da; font-size: 8px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.is-error .status-badge { color: #8b3b35; background: #ffe6df; }
.file-meta, .file-error { margin: 5px 0 0; color: #818985; font-size: 9px; }
.file-error { color: #9a3c33; line-height: 1.4; }
.download-button { flex: 0 0 auto; padding: 9px 11px; color: white; background: var(--ink); font-size: 9px; }
.download-button:disabled { opacity: .32; cursor: default; }

.trust-row { padding: 40px 0 70px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgb(23 32 29 / 14%); margin-top: 72px; }
.trust-row article { padding: 0 28px; display: flex; gap: 17px; border-right: 1px solid rgb(23 32 29 / 12%); }
.trust-row article:first-child { padding-left: 0; }
.trust-row article:last-child { border: 0; }
.trust-row article > span { color: #6f9461; font-family: Georgia, serif; font-size: 18px; font-style: italic; }
.trust-row h3 { margin: 0 0 6px; font-size: 12px; }
.trust-row p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.credits { padding: 26px 0 60px; border-top: 1px solid rgb(23 32 29 / 14%); color: var(--muted); font-size: 11px; line-height: 1.6; }
.credits h2 { margin: 0 0 8px; color: var(--ink); font-size: 13px; }
.credits p { margin: 0 0 8px; }
.credits ul { margin: 0; padding-left: 18px; }
.credits li { margin-bottom: 6px; }
.credits a { color: #3f6f2d; }
.credits code { font-size: 10px; }

@media (max-width: 900px) {
  .hero { padding-top: 55px; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .results-grid { grid-template-columns: 1fr; }
  .trust-row { grid-template-columns: 1fr; gap: 25px; }
  .trust-row article { padding: 0; border: 0; }
}
@media (max-width: 560px) {
  .site-header, main { width: min(100% - 28px, 1400px); }
  .privacy-pill { display: none; }
  .site-header { height: 68px; }
  .hero { padding: 46px 0 38px; }
  .hero h1 { font-size: clamp(48px, 17vw, 78px); }
  .hero-copy { margin-top: 24px; font-size: 14px; }
  .control-panel, .results-panel { padding: 20px; }
  .results-header { align-items: flex-start; flex-direction: column; }
  .view-switcher { width: 100%; }
  .view-button { flex: 1; }
  .card-preview { height: 235px; }
  .card-body { align-items: flex-start; flex-direction: column; }
  .download-button { width: 100%; }
  .color-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.image-card.is-previewing .card-loading { inset: auto 8px 8px 8px; padding: 6px 10px; justify-content: flex-start; border-radius: 8px; }
