:root {
  color-scheme: light;
  --ink: #15151a;
  --muted: #656979;
  --paper: #f7f2eb;
  --panel: #ffffff;
  --line: #d9d4cc;
  --accent: #0f6b5f;
  --accent-dark: #09463f;
  --blue: #1d3f73;
  --red: #9d2f2f;
  --shadow: 0 18px 55px rgba(21, 21, 26, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(15, 107, 95, 0.1), transparent 34%),
    linear-gradient(245deg, rgba(29, 63, 115, 0.13), transparent 34%),
    var(--paper);
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.72fr);
  gap: 34px;
  align-items: stretch;
}

.copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 620px;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(4.2rem, 13vw, 9.4rem);
  line-height: 0.82;
  letter-spacing: 0;
}

.lead {
  max-width: 780px;
  margin: 32px 0 0;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.35;
  font-weight: 720;
}

.fine-print {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.uploader {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin-top: 34px;
}

.dropzone {
  display: grid;
  min-width: min(100%, 330px);
  min-height: 74px;
  padding: 13px 18px;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  align-self: end;
  font-size: 1rem;
  font-weight: 830;
}

.drop-subtitle {
  align-self: start;
  max-width: 290px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.download {
  display: inline-flex;
  min-height: 74px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(15, 107, 95, 0.22);
}

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

button:disabled {
  cursor: wait;
  opacity: 0.76;
}

button.is-busy {
  gap: 12px;
  opacity: 0.9;
}

button.is-busy::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: none;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  button.is-busy::before {
    animation-duration: 2.4s;
  }
}

.preview-panel {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(21, 21, 26, 0.1);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.preview-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.workbench {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 32px rgba(21, 21, 26, 0.08);
}

.state {
  padding: 24px;
}

.state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.state-title {
  margin-bottom: 5px !important;
  color: var(--ink) !important;
  font-size: 1.08rem;
  font-weight: 850;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ded6;
  margin-bottom: 17px;
}

.meter span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  animation: scan 1.25s ease-in-out infinite alternate;
}

#resultImage {
  display: block;
  width: min(100%, 560px);
  margin: 18px 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.error {
  border-left: 5px solid var(--red);
}

.hidden {
  display: none;
}

@keyframes scan {
  from {
    transform: translateX(-12%);
  }
  to {
    transform: translateX(132%);
  }
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 560px);
    padding-top: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .copy {
    min-height: auto;
    padding-top: 20px;
  }

  h1 {
    font-size: clamp(3.4rem, 19vw, 6rem);
  }

  .preview-panel {
    min-height: 460px;
  }

  .uploader,
  button,
  .dropzone {
    width: 100%;
  }
}
