:root {
  --ink: #17202a;
  --muted: #52606d;
  --bg: #f3f6f8;
  --card: #ffffff;
  --border: #d5dde5;
  --brand: #123a63;
  --brand-dark: #0b2947;
  --accent: #ffdd00;
  --focus: #ffbf47;
  --good: #00703c;
  --good-bg: #e8f5ec;
  --bad: #b42318;
  --bad-bg: #fff0ee;
  --warn: #b45d00;
  --warn-bg: #fff4e5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

.top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0.8rem;
  background: var(--brand-dark);
  color: #fff;
}
.top h1 { margin: 0; font-size: 1.3rem; }
.mark {
  display: grid; place-items: center;
  width: 2.4rem; height: 1.9rem;
  background: var(--accent); color: #111;
  border-radius: 0.25rem; font-weight: 800; font-size: 0.95rem;
}

main { padding: 1rem; max-width: 34rem; margin-inline: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.06);
}
.big-label { display: block; font-weight: 700; margin-bottom: 0.6rem; }

.plate {
  display: block;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 3px solid #111;
  border-radius: 0.5rem;
  background: #fff9c2;
  color: #111;
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}
.plate-small { font-size: 1.5rem; background: #fff; }
.plate[aria-invalid="true"] { border-color: var(--bad); }
.plate::placeholder { color: #9aa3ad; letter-spacing: 0.1em; }

.error { min-height: 1.4rem; margin: 0.4rem 0 0; color: var(--bad); font-weight: 700; }

.go {
  width: 100%;
  min-height: 3.5rem;
  margin-top: 0.6rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
}
.go:active { background: var(--brand-dark); }
.go:disabled { opacity: 0.6; }
.go-secondary { background: var(--brand-dark); font-size: 1.05rem; min-height: 3rem; }

.again {
  width: 100%;
  min-height: 3.2rem;
  margin-top: 1.25rem;
  border: 2px solid var(--brand);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-weight: 800;
}

.small { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.92rem; }

.status { margin: 1rem 0 0; font-weight: 700; text-align: center; }
.status.is-error {
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  background: var(--bad-bg);
  color: var(--bad);
  text-align: left;
}
.status.is-busy::before {
  content: "";
  display: inline-block;
  width: 1rem; height: 1rem;
  margin-right: 0.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  vertical-align: -0.15rem;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.plate-shown {
  width: fit-content;
  margin: 1.25rem auto 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 3px solid #111;
  border-radius: 0.4rem;
  background: #fff9c2;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.car-line { margin: 0 0 1rem; text-align: center; font-weight: 700; color: var(--muted); }

.traffic { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.light {
  display: grid;
  gap: 0.1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 0.5rem solid var(--muted);
}
.light strong { font-size: 1.45rem; line-height: 1.2; }
.light span:last-child { color: var(--muted); font-size: 0.9rem; }
.light-label { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.light.good { border-top-color: var(--good); background: var(--good-bg); }
.light.good strong { color: var(--good); }
.light.bad { border-top-color: var(--bad); background: var(--bad-bg); }
.light.bad strong { color: var(--bad); }
.light.warn { border-top-color: var(--warn); background: var(--warn-bg); }
.light.warn strong { color: var(--warn); }

.fold {
  margin-top: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0 1rem;
}
.fold summary {
  padding: 1rem 0;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; margin-left: auto; color: var(--brand); font-size: 1.4rem; }
.fold[open] summary::after { content: "–"; }
.fold > :not(summary) { margin-bottom: 1rem; }
.fold .small { margin-top: 0; }
.count {
  padding: 0.05rem 0.55rem;
  border-radius: 1rem;
  background: var(--bg);
  font-size: 0.85rem;
  color: var(--muted);
}
.count.bad { background: var(--bad-bg); color: var(--bad); }
.count.good { background: var(--good-bg); color: var(--good); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0 0 1rem; }
.facts div { padding: 0.6rem 0.75rem; border-radius: 0.6rem; background: var(--bg); }
.facts dt { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.facts dd { margin: 0.1rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }

.tests { display: grid; gap: 0.6rem; padding: 0; margin: 0 0 1rem; list-style: none; }
.test {
  padding: 0.8rem 0.9rem;
  border-radius: 0.6rem;
  background: var(--bg);
  border-left: 0.4rem solid var(--muted);
}
.test.good { border-left-color: var(--good); }
.test.bad { border-left-color: var(--bad); }
.test.warn { border-left-color: var(--warn); }
.test-head { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 800; }
.test.good .test-head strong { color: var(--good); }
.test.bad .test-head strong { color: var(--bad); }
.test-sub { color: var(--muted); font-size: 0.92rem; }
.test ul { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.95rem; }
.test ul li { margin: 0.2rem 0; }
.tag { font-weight: 800; font-size: 0.78rem; text-transform: uppercase; }
.tag.bad { color: var(--bad); }
.test a { display: inline-block; margin-top: 0.4rem; font-weight: 700; }

.foot {
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p { margin: 0.3rem 0; }

@media (prefers-reduced-motion: reduce) { .status.is-busy::before { animation: none; } }
.logo { display: block; height: 2.5rem; width: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.foot a { margin: 0 0.4rem; }
.consent { position: fixed; left: 0.75rem; right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom)); z-index: 50; padding: 1rem; border-radius: 1rem; background: var(--brand-dark); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
.consent p { margin: 0 0 0.75rem; font-size: 0.95rem; }
.consent a { color: var(--accent); font-weight: 700; }
.consent-actions { display: flex; gap: 0.6rem; }
.consent button { flex: 1; min-height: 2.75rem; border: 2px solid var(--accent); border-radius: 0.6rem; background: var(--accent); color: #111; font: inherit; font-weight: 800; }
.consent button.secondary { background: transparent; color: #fff; }
