:root {
  color-scheme: light dark;
  --bg: #f6f8f4;
  --surface: #ffffff;
  --text: #1c2a1e;
  --muted: #4f5f52;
  --border: #cfd9cf;
  --accent: #23753a;
  --accent-text: #ffffff;
  --accent-soft: #e3f1e5;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --error: #b42318;
  --error-soft: #fdecea;
  --focus: #1f6feb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111611;
    --surface: #1a211b;
    --text: #e6eee6;
    --muted: #a9b8aa;
    --border: #364238;
    --accent: #5cc77a;
    --accent-text: #0c1a0f;
    --accent-soft: #1f3324;
    --warn: #f2c04c;
    --warn-soft: #332a14;
    --error: #ff8a80;
    --error-soft: #3a1c1a;
    --focus: #79b8ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page { max-width: 1040px; margin: 0 auto; padding: 24px 16px 32px; }
header h1 { margin: 0 0 4px; font-size: 1.75rem; }
header p { margin: 0 0 16px; color: var(--muted); }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
h3 { margin: 16px 0 8px; font-size: 1rem; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.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;
}

.status {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--warn-soft); color: var(--text); border: 1px solid var(--border);
}
.status[data-state="ready"] { background: var(--accent-soft); }
.status[data-state="error"] { background: var(--error-soft); color: var(--error); }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

.card {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}

.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 260px; padding: 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 10px; color: var(--muted);
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop-zone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-zone img { max-width: 100%; max-height: 320px; border-radius: 8px; object-fit: contain; }

button {
  margin-top: 12px; width: 100%; padding: 12px 16px; font: inherit; font-weight: 600;
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-text);
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

.label { margin-top: 0; font-size: 1.35rem; }
.label.uncertain { color: var(--warn); font-size: 1.15rem; }
.message { margin: 0; color: var(--muted); }
.message.error { color: var(--error); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }

.top3 { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.top3 li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.top3 .pct { font-variant-numeric: tabular-nums; }
.top3 .bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.top3 .bar span { display: block; height: 100%; background: var(--accent); }

details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); }
pre {
  margin: 8px 0 0; padding: 12px; max-height: 320px; overflow: auto; border-radius: 8px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); font-size: 0.85rem;
}

.disclaimer { margin: 20px 0 8px; color: var(--muted); font-style: italic; }
footer { color: var(--muted); font-size: 0.9rem; }
