:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #5d5d58;
  --border: #e2e1dc;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --good: #1d7a46;
  --good-bg: #e8f5ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --bad: #b3261e;
  --bad-bg: #fce9e7;
  --unknown: #4f5560;
  --unknown-bg: #eceef1;
  --quiet: #1f6f8b;
  --quiet-bg: #e3f1f6;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --surface: #1e1f1c;
    --text: #ecebe6;
    --muted: #a6a59f;
    --border: #33342f;
    --accent: #6ea2f2;
    --accent-text: #0d1a2e;
    --good: #6fcf97;
    --good-bg: #17291f;
    --warn: #f0c060;
    --warn-bg: #2d2412;
    --bad: #f28b82;
    --bad-bg: #331a18;
    --unknown: #b4bac4;
    --unknown-bg: #24262a;
    --quiet: #7cc4dc;
    --quiet-bg: #15262d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

header.site, main, footer.site {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px;
}

header.site {
  padding-top: 20px;
  padding-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
}
header.site nav { display: flex; gap: 16px; flex-wrap: wrap; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover, header.site nav a:focus-visible { color: var(--text); text-decoration: underline; }
.brand { font-weight: 650; color: var(--text); text-decoration: none; }

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 0.4em 0; }
h2 { font-size: 1.15rem; margin: 0; }

.lede { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }

.hero { padding: 24px 0 8px; }

button.primary, a.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 14px 28px;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
}
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.primary:focus-visible, a.button:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }

.consent { font-size: 0.9rem; color: var(--muted); max-width: 36rem; }
.status-line { font-weight: 600; min-height: 1.5em; }

.explain, .limits { padding: 16px 0; }
.checks { padding-left: 1.2em; }
.checks li { margin-bottom: 0.6em; }

.summary {
  margin: 16px 0;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--status, var(--border));
}
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--muted); }
.meta { display: grid; gap: 4px; margin: 12px 0 0; }
.meta div { display: flex; gap: 8px; flex-wrap: wrap; }
.meta dt { color: var(--muted); min-width: 6.5rem; }
.meta dd { margin: 0; overflow-wrap: anywhere; }

.cards { display: grid; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--status);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card .headline { font-weight: 600; margin: 10px 0 6px; }
.card .facts { padding-left: 1.2em; margin: 6px 0; }
.card .facts li { overflow-wrap: anywhere; margin-bottom: 4px; }
.card .note { color: var(--muted); font-size: 0.95rem; margin: 6px 0; }
.fix { margin-top: 10px; }
.fix summary { cursor: pointer; font-weight: 600; }
.fix ol { padding-left: 1.4em; }

.pill {
  font-size: 0.85rem;
  font-weight: 650;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--status);
  background: var(--status-bg);
  white-space: nowrap;
}

.status-good { --status: var(--good); --status-bg: var(--good-bg); }
.status-warn { --status: var(--warn); --status-bg: var(--warn-bg); }
.status-bad { --status: var(--bad); --status-bg: var(--bad-bg); }
.status-quiet { --status: var(--quiet); --status-bg: var(--quiet-bg); }
.status-unknown { --status: var(--unknown); --status-bg: var(--unknown-bg); }

footer.site { padding-top: 24px; padding-bottom: 40px; color: var(--muted); font-size: 0.92rem; }
footer.site h2 { font-size: 1rem; color: var(--text); }

.wifi {
  margin: 20px 0 8px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.checklist { padding-left: 1.4em; }
.checklist li { margin-bottom: 0.6em; }
footer.site a { color: var(--accent); }
.isp-help {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.isp-help-title { font-weight: 600; margin: 0 0 4px; }
.isp-help ul { padding-left: 1.2em; margin: 4px 0; }
.small { font-size: 0.85rem; }

.isp-box { margin: 8px 0 20px; }
.guide h2 { margin-top: 1.6em; }
.guide ul, .guide ol { padding-left: 1.3em; }
.guide li { margin-bottom: 0.4em; }
.checks-dl dt { font-weight: 650; margin-top: 12px; }
.checks-dl dd { margin: 4px 0 0; }
.legend { list-style: none; padding: 0; }
.legend li { margin-bottom: 8px; }
.legend .pill { display: inline-block; min-width: 8.5rem; text-align: center; margin-right: 6px; }
main a { color: var(--accent); }
main a.button { color: var(--accent-text); }
.isp-callout {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  max-width: 36rem;
}
.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 1px 8px;
  margin-left: 4px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* --- scan progress ------------------------------------------------------------ */

.scan-panel {
  margin-top: 8px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.scan-title { font-size: 1.25rem; margin: 14px 0 12px; }

.radar {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 10%, transparent) 0 60%, transparent 61%);
}
.radar img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
}
.radar .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}
.radar .ring-2 { animation-delay: 1.2s; }
.radar .sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 290deg, color-mix(in srgb, var(--accent) 45%, transparent) 360deg);
  animation: spin 2s linear infinite;
}
@keyframes pulse {
  0% { transform: scale(0.45); opacity: 0.7; }
  100% { transform: scale(1.05); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan-steps {
  list-style: none;
  padding: 0;
  margin: 0 auto 10px;
  max-width: 24rem;
  text-align: left;
}
.scan-steps li {
  position: relative;
  padding: 6px 0 6px 32px;
  color: var(--muted);
}
.scan-steps li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-sizing: border-box;
}
.scan-steps li.active { color: var(--text); }
.scan-steps li.active::before {
  border-color: var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.scan-steps li.done { color: var(--text); }
.scan-steps li.done::before {
  border-color: var(--good);
  background: var(--good);
}
.scan-steps li.done::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  width: 4px;
  height: 8px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ticker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  color: var(--accent);
  min-height: 1.4em;
  margin: 4px 0 12px;
}
.scan-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  max-width: 24rem;
  margin: 0 auto;
}
.scan-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
}
/* About 15 seconds in total; it slows near the end and never claims to be finished. */
.scan-panel.running .scan-bar span { animation: fill 16s cubic-bezier(0.2, 0.6, 0.3, 1) forwards; }
@keyframes fill { from { width: 0; } to { width: 94%; } }

/* Result cards slide in one after another. */
.cards .card { animation: rise 0.35s ease-out both; }
.cards .card:nth-child(2) { animation-delay: 0.08s; }
.cards .card:nth-child(3) { animation-delay: 0.16s; }
.cards .card:nth-child(4) { animation-delay: 0.24s; }
.cards .card:nth-child(5) { animation-delay: 0.32s; }
.cards .card:nth-child(n + 6) { animation-delay: 0.4s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .radar .ring, .radar .sweep, .scan-steps li.active::before, .cards .card { animation: none; }
  .radar .ring { opacity: 0.3; }
  .scan-panel.running .scan-bar span { animation: none; width: 50%; }
}
