:root {
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --ink: #26252b;
  --muted: #6b6772;
  --line: #ddd6c8;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --error: #b42318;
  --shadow: 0 10px 30px rgba(38, 37, 43, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171c;
    --paper: #222128;
    --ink: #eeebe4;
    --muted: #a7a2ad;
    --line: #37353e;
    --accent: #e0814f;
    --accent-ink: #1b1a1f;
    --error: #ff8a7a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 40px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 44px);
  letter-spacing: -0.02em;
}

.hero p {
  margin: 6px 0 24px;
  color: var(--muted);
  font-size: 16px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 16px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone:hover,
.dropzone.is-dragging,
.dropzone:focus-within {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.dropzone-icon {
  color: var(--accent);
}

.dropzone-title {
  font-size: 18px;
  font-weight: 700;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 14px;
}

.panes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 720px) {
  .panes {
    grid-template-columns: 1fr 1fr;
  }
}

/* On phones keep both images short enough that the buttons stay close to the fold. */
@media (max-width: 719px) {
  .pane .frame {
    min-height: 160px;
  }

  .pane .frame img {
    max-height: 38vh;
  }
}

.pane {
  margin: 0;
}

.pane figcaption {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.frame-note {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.frame.is-loading::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.status {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.status.is-error {
  color: var(--error);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn[hidden] {
  display: none;
}

.footer {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .frame.is-loading::after {
    animation: none;
  }
}
