/* Demo page styles: light theme, mobile first (works down to 360px). */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #566070;
  --line: #e2e7ef;
  --brand: #2453d6;
  --brand-strong: #1b3fa8;
  --brand-soft: #eaf0ff;
  --ok: #0f7a55;     --ok-soft: #e4f6ee;
  --warn: #9a5b00;   --warn-soft: #fff3dc;
  --bad: #c0262d;    --bad-soft: #fdeaea;
  --info: #3b4a63;   --info-soft: #eef1f6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system,
          "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere;
}
main { flex: 1; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Top bar and hero */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 10px; height: 56px; }
.logo { color: var(--brand); display: inline-flex; }
.brand { font-weight: 700; letter-spacing: -.01em; }
.pill {
  font-size: .75rem; font-weight: 700; color: var(--brand); background: var(--brand-soft);
  padding: 2px 8px; border-radius: 999px;
}
.hero { padding: 28px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.3; letter-spacing: -.02em; }
.lead { margin: 0; color: var(--muted); }

/* Upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 180px; padding: 24px 16px; text-align: center; cursor: pointer;
  background: var(--surface); border: 2px dashed #c3cddd; border-radius: var(--radius);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.dropzone:hover { border-color: var(--brand); }
.dropzone:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(36, 83, 214, .18); }
.dropzone.is-dragging { border-color: var(--brand); border-style: solid; background: var(--brand-soft); }
.dropzone.is-busy { cursor: progress; opacity: .6; }
.dz-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px;
}
.dz-title { font-weight: 700; font-size: 1.05rem; }
.dz-title u { color: var(--brand); text-underline-offset: 3px; }
.dz-hint { color: var(--muted); font-size: .88rem; }

.alert {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--bad-soft); color: var(--bad); border: 1px solid #f5c7c9;
}
.alert p { margin: 0; }
.alert-msg { font-weight: 600; }
.alert-ref { font-size: .8rem; opacity: .85; margin-top: 2px !important; }

/* Results */
.results { padding: 24px 0 32px; scroll-margin-top: 12px; }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.summary strong { font-size: 1.15rem; }
.notice {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-soft); color: #6b4000; border: 1px solid #f1d9a8; font-size: .92rem;
}
.results-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .results-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .stage-wrap { position: sticky; top: 16px; }
}

/* Photo with overlay */
.stage-wrap { margin: 0; min-width: 0; }
.stage-wrap figcaption { margin-top: 8px; text-align: center; }
.stage {
  position: relative; width: fit-content; max-width: 100%; margin: 0 auto;
  border-radius: 12px; overflow: hidden; background: #0f172a; box-shadow: var(--shadow);
}
.stage img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; }
.overlay { position: absolute; inset: 0; }
.stage.is-loading img { filter: brightness(.55) saturate(.8); }
.loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: #fff; font-weight: 600; text-align: center; padding: 16px;
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.vehicle-box {
  position: absolute; border: 2px dashed rgba(255, 255, 255, .75); border-radius: 6px;
  background: rgba(255, 255, 255, .06); pointer-events: none;
}
.vehicle-tag {
  position: absolute; left: 4px; top: 4px; font-size: .7rem; font-weight: 600; line-height: 1.4;
  padding: 1px 6px; border-radius: 4px; background: rgba(15, 23, 42, .65); color: #fff;
}
.plate-box {
  --tone: var(--ok);
  position: absolute; padding: 0; margin: 0; cursor: pointer; background: transparent;
  border: 2.5px solid var(--tone); border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9), 0 0 0 3px rgba(0, 0, 0, .25);
  transition: box-shadow .15s, background-color .15s;
}
.plate-box.tone-warn { --tone: #f0a020; }
.plate-box.tone-bad { --tone: #ef4444; }
.plate-box.tone-ok { --tone: #22c55e; }
.plate-box:hover, .plate-box.is-active, .plate-box:focus-visible {
  outline: none; background: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 2px #fff, 0 0 0 6px var(--tone);
}
.plate-tag {
  position: absolute; left: -2.5px; bottom: 100%; margin-bottom: 3px;
  min-width: 22px; padding: 0 6px; border-radius: 6px; font-size: .78rem; font-weight: 800;
  line-height: 20px; text-align: center; color: #111827; background: var(--tone);
}
.plate-box.tag-below .plate-tag { bottom: auto; top: 100%; margin: 3px 0 0; }

/* Plate cards */
.cards { display: grid; gap: 12px; min-width: 0; align-content: start; }
.plate-card {
  --tone: var(--ok); --tone-soft: var(--ok-soft);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; min-width: 0; scroll-margin: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.plate-card.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.plate-card.tone-bad { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.plate-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36, 83, 214, .2), var(--shadow); }
.plate-card:focus { outline: none; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.index-chip {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center;
  justify-content: center; font-size: .8rem; font-weight: 800; background: var(--tone-soft); color: var(--tone);
}
.card-title { flex: 1; min-width: 0; font-weight: 600; font-size: .92rem; color: var(--muted); }
.badge {
  flex: none; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--tone-soft); color: var(--tone);
}
.badge.tone-ok { background: var(--ok-soft); color: var(--ok); }
.badge.tone-warn { background: var(--warn-soft); color: var(--warn); }
.badge.tone-bad { background: var(--bad-soft); color: var(--bad); }
.crop-frame {
  display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 8px;
  border-radius: 10px; background: #eef1f6;
}
.crop { display: block; max-height: 110px; max-width: 100%; border-radius: 4px; image-rendering: auto; }
.crop-empty { color: var(--muted); font-size: .85rem; }
.plate-number {
  margin: 12px 0 8px; font-size: clamp(1.5rem, 6vw, 1.9rem); font-weight: 800; line-height: 1.25;
  letter-spacing: .02em; font-variant-numeric: tabular-nums; text-align: center;
}
.plate-number.is-failed { color: var(--bad); font-size: 1.3rem; }
.conf-line { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 4px; }
.conf-track { height: 8px; border-radius: 999px; background: #e6eaf1; overflow: hidden; }
.conf-fill { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width .4s ease; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:focus-visible { outline: 3px solid rgba(36, 83, 214, .4); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-light { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-light:hover:not(:disabled) { border-color: #b9c4d6; background: #f8fafc; }

/* Report form */
.report { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.report-toggle { width: 100%; }
.report-panel { margin-top: 10px; }
.report-form { display: grid; gap: 12px; }
.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.choice legend { width: 100%; margin-bottom: 4px; padding: 0; }
.radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .95rem; }
.radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.form-row { display: grid; gap: 4px; }
.form-label { font-size: .85rem; font-weight: 700; }
.label-line { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-size: .78rem; color: var(--muted); }
.field {
  width: 100%; padding: 9px 12px; border: 1px solid #c9d2e0; border-radius: 10px; background: #fff;
  font-size: 1rem; resize: vertical;
}
.field:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36, 83, 214, .18); }
.privacy {
  margin: 0; padding: 8px 10px; border-radius: 8px; font-size: .8rem; line-height: 1.5;
  color: var(--info); background: var(--info-soft);
}
.form-error { margin: 0; font-size: .88rem; font-weight: 600; color: var(--bad); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.report-result { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.report-result.tone-ok { background: var(--ok-soft); color: var(--ok); }
.report-result.tone-info { background: var(--info-soft); color: var(--info); }

.empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
}
.empty p { margin: 0; }
.empty-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px !important; }

/* Footer */
.footer { border-top: 1px solid var(--line); background: var(--surface); padding: 18px 0 24px; font-size: .85rem; }
.footer p { margin: 0 0 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
}
