:root {
  color-scheme: light;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --border: #d8d3cc;
  --text: #2b2926;
  --text-muted: #6b6660;
  --accent: #b5652f;
  --accent-hover: #9a5427;
  --error-bg: #fdecea;
  --error-text: #7a1f1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-block: 2rem;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding-inline: 1.25rem;
}

h1 {
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.dropzones {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.dropzone {
  flex: 1 1 300px;
  min-width: 0;
}

.dropzone > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.dropzone-inner {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 1.25rem;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone-inner.dragover {
  border-color: var(--accent);
  background: #fbf1e8;
}

.dropzone-hint {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

.preview {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: contain;
}

.notes-field {
  margin-bottom: 1.25rem;
}

.notes-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.notes-field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
}

.btn-primary,
.btn-secondary {
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  padding: 0.65rem 1.4rem;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  background: #cbb7a8;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.error-banner {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #f3c2bd;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  color: var(--text-muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.result-section {
  margin-top: 2rem;
}

.result-section img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1c1a18;
    --surface: #26231f;
    --border: #423d37;
    --text: #eee9e3;
    --text-muted: #a89f96;
    --accent: #d98a4f;
    --accent-hover: #e6a06c;
    --error-bg: #3a1f1c;
    --error-text: #f3a79f;
  }
}
