:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #18202a;
  --muted: #5b6573;
  --line: #dde2e8;
  --accent: #1f5fae;
  --ok: #1f7a4d;
  --ok-bg: #e7f4ec;
  --bad: #b4232c;
  --bad-bg: #fbeaeb;
  --warn: #9a6200;
  --warn-bg: #fdf3e1;
  --run: #1f5fae;
  --run-bg: #eaf1fb;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d; --surface: #182029; --ink: #e6ebf1; --muted: #9aa6b4; --line: #2a3542;
    --accent: #7fb0ec; --ok: #6fcf9c; --ok-bg: #16301f; --bad: #f08a90; --bad-bg: #3a1d21;
    --warn: #e8b45c; --warn-bg: #352812; --run: #7fb0ec; --run-bg: #17283b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 16px; }
header h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.15; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.lede { margin: 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }
label { display: block; font-weight: 600; margin-bottom: 8px; }
.opt { font-weight: 400; color: var(--muted); }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--warn); }
.hint.is-error { color: var(--bad); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.between h2 { margin: 0; }
input[type=text] { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
select { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.row + label { margin-top: 14px; }
button { padding: 10px 18px; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; white-space: nowrap; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 6px 14px; }
button:disabled { opacity: .55; cursor: progress; }
.muted { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.verdict { border-radius: 12px; padding: 18px 20px; border: 1px solid var(--line); }
.verdict.ok { background: var(--ok-bg); border-color: var(--ok); }
.verdict.bad { background: var(--bad-bg); border-color: var(--bad); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn); }
.verdict-title { margin: 0; font-size: 21px; font-weight: 700; }
.verdict.ok .verdict-title { color: var(--ok); }
.verdict.bad .verdict-title { color: var(--bad); }
.verdict.warn .verdict-title { color: var(--warn); }
.verdict-next { margin: 6px 0 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.step { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.badge { align-self: start; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 0; border-radius: 999px; background: var(--bg); color: var(--muted); }
.badge.running { background: var(--run-bg); color: var(--run); }
.badge.pass { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--run-bg); color: var(--run); }
.step-title { font-weight: 600; }
.step-detail { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.step-logs { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.step-logs .error { color: var(--bad); }
.step-logs .warning { color: var(--warn); }
textarea { width: 100%; margin-top: 12px; padding: 10px; font: 13px/1.45 var(--mono); color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 520px) {
  header h1 { font-size: 26px; }
  .row { flex-wrap: wrap; }
  .row button { width: 100%; }
  .row.between button { width: auto; }
  .step { grid-template-columns: 76px 1fr; }
}

/* ---- Motion ---------------------------------------------------------- */

/* Signal icon by the title: still at rest, ripples while a test runs. */
header h1 { display: flex; align-items: center; gap: 12px; }
.signal { position: relative; width: 30px; height: 30px; flex: none; }
.signal b { position: absolute; inset: 11px; border-radius: 50%; background: var(--accent); }
.signal i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.is-running .signal i { animation: ripple 1.8s cubic-bezier(.2, .6, .4, 1) infinite; }
.is-running .signal i:nth-child(2) { animation-delay: .6s; }
.is-running .signal i:nth-child(3) { animation-delay: 1.2s; }
.is-running .signal b { animation: beat 1.8s ease-in-out infinite; }
.signal.done-ok b { background: var(--ok); }
.signal.done-bad b { background: var(--bad); }
.signal.done-warn b { background: var(--warn); }
@keyframes ripple { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* Button spinner. */
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; }
.is-running .btn-spin { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar: fills as steps finish, with a moving sheen while running. */
.progress { margin-top: 14px; height: 6px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.progress-bar { position: relative; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .45s ease; overflow: hidden; }
.is-running .progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: sheen 1.2s linear infinite; }
.progress.done-ok .progress-bar { background: var(--ok); }
.progress.done-bad .progress-bar { background: var(--bad); }
.progress.done-warn .progress-bar { background: var(--warn); }
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Running badge gets a small spinning ring; finished badges pop in. */
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.badge.running::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.badge.pop { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.step.is-active { background: linear-gradient(90deg, var(--run-bg), transparent 70%); border-radius: 8px; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Verdict slides up, with an icon that draws itself. */
.verdict { display: flex; gap: 14px; align-items: flex-start; }
.verdict.show { animation: rise .45s ease both; }
.verdict-icon { flex: none; width: 36px; height: 36px; }
.verdict-icon svg { width: 36px; height: 36px; }
.verdict-icon circle { fill: none; stroke-width: 3; stroke-dasharray: 101; stroke-dashoffset: 101; animation: draw .5s ease forwards; }
.verdict-icon path { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .4s ease forwards; }
.verdict.ok .verdict-icon * { stroke: var(--ok); }
.verdict.bad .verdict-icon * { stroke: var(--bad); }
.verdict.warn .verdict-icon * { stroke: var(--warn); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Respect "reduce motion": keep the information, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .verdict-icon circle, .verdict-icon path { stroke-dashoffset: 0; }
  .is-running .signal i { opacity: .35; transform: scale(1); }
}

/* "Your connection" box. */
.conn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.conn-grid > div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.conn-grid dt { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.conn-grid dd { margin: 4px 0 2px; font: 600 16px/1.35 var(--mono); overflow-wrap: anywhere; }
.conn-note { margin: 0; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .conn-grid { grid-template-columns: 1fr; } }
