:root {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg2: #0f1218;
  --card: #131720;
  --card2: #181d28;
  --line: #232a38;
  --text: #e7eaf1;
  --muted: #8a93a8;
  --dim: #5d6579;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --ok: #34d399;
  --info: #60a5fa;
  --warn: #fbbf24;
  --crit: #f87171;
  --spectrum: linear-gradient(90deg, #22d3ee, #818cf8 35%, #e879f9 65%, #fbbf24);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(129, 140, 248, .12), transparent 60%),
    radial-gradient(700px 400px at -10% 10%, rgba(34, 211, 238, .08), transparent 60%),
    var(--bg);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 17, .7);
  backdrop-filter: blur(10px);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .18em; font-size: 14px; }
.brand b { font-weight: 800; background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo {
  width: 28px; height: 26px; position: relative; flex: none;
  background: var(--spectrum);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.logo::after {
  content: ""; position: absolute; inset: 7px 8px 3px;
  background: var(--bg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.tag { color: var(--muted); font-size: 13px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line);
  color: var(--muted); background: var(--bg2); white-space: nowrap;
}
.pill.on { color: var(--green); border-color: rgba(52, 211, 153, .35); }
.pill.off { color: var(--red); border-color: rgba(248, 113, 113, .35); }

main { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
}
h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 13px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.grad { background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.hero p.lead { color: var(--muted); font-size: 16px; max-width: 56ch; }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.feature-list li::before { content: "◆"; margin-right: 8px; font-size: 10px; background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.start-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.go {
  width: 190px; height: 190px; border-radius: 50%;
  border: 0; cursor: pointer; position: relative;
  font: 700 20px/1 inherit; letter-spacing: .12em; color: var(--text);
  background: var(--card2);
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(129, 140, 248, .18);
  transition: transform .15s ease, box-shadow .2s ease;
}
.go::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, #22d3ee, #818cf8, #e879f9, #fbbf24, #22d3ee);
  animation: spin 6s linear infinite;
}
.go:hover { transform: scale(1.03); box-shadow: 0 0 0 1px var(--line), 0 24px 80px rgba(129, 140, 248, .3); }
.go:disabled { opacity: .6; cursor: wait; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 320px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=search] {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; width: 100%;
}
input:focus { border-color: #4f5b78; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #3a4560; text-decoration: none; }
.btn.primary { background: linear-gradient(90deg, rgba(34, 211, 238, .18), rgba(167, 139, 250, .18)); border-color: rgba(129, 140, 248, .5); }
.btn.danger { color: var(--red); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- live run ---------- */
.steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 24px; flex-wrap: wrap; }
.steps li {
  flex: 1 1 120px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--dim); font-size: 13px; font-weight: 600; letter-spacing: .04em; position: relative; overflow: hidden;
  background: var(--bg2);
}
.steps li.active { color: var(--text); border-color: #4b5675; }
.steps li.active::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--spectrum); animation: pulse 1.4s ease-in-out infinite;
}
.steps li.done { color: var(--green); }
.steps li.done::before { content: "✓ "; }
@keyframes pulse { 50% { opacity: .35; } }
.live { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.live .stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.live .stat .v { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.live .stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.live .stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.chart-wrap { position: relative; width: 100%; height: 260px; }
.chart-wrap.tall { height: 300px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.tip {
  position: absolute; pointer-events: none; background: rgba(15, 18, 24, .95); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; z-index: 2;
}
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- results ---------- */
.result-head { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.grade-ring {
  width: 120px; height: 120px; border-radius: 50%; flex: none;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--gc, var(--green)) calc(var(--pct, 0) * 1%), var(--line) 0);
}
.grade-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--card); }
.grade-ring span { position: relative; font-size: 44px; font-weight: 800; }
.grade-ring small { position: absolute; bottom: 22px; font-size: 11px; color: var(--muted); }
.sid { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.metric .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.metric .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.metric .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.metric .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; min-width: 34px; text-align: center; padding: 1px 8px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.g-A\+, .g-A { background: rgba(52, 211, 153, .15); color: var(--green); }
.g-B { background: rgba(163, 230, 53, .14); color: #a3e635; }
.g-C { background: rgba(251, 191, 36, .14); color: var(--amber); }
.g-D, .g-F { background: rgba(248, 113, 113, .15); color: var(--red); }
.g-none { background: var(--line); color: var(--muted); }
.findings { display: flex; flex-direction: column; gap: 10px; }
.finding {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--sev); border-radius: 10px; padding: 12px 14px;
}
.finding .sev { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sev); padding-top: 2px; min-width: 40px; }
.finding .t { font-weight: 600; }
.finding .area { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; margin-left: 8px; font-weight: 500; }
.finding .dt { color: var(--muted); font-size: 14px; margin-top: 2px; }
.sev-ok { --sev: var(--ok); }
.sev-info { --sev: var(--info); }
.sev-warn { --sev: var(--warn); }
.sev-crit { --sev: var(--crit); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.error-box { background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .35); color: #fecaca; border-radius: 10px; padding: 12px 14px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: var(--bg2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: rgba(129, 140, 248, .06); }
td.num, th.num { text-align: right; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-word; }
.sev-dot { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 700; text-align: center; }
.sev-dot.c { background: rgba(248, 113, 113, .16); color: var(--red); }
.sev-dot.w { background: rgba(251, 191, 36, .16); color: var(--amber); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input { max-width: 420px; }
.foot { text-align: center; color: var(--dim); font-size: 12px; padding: 24px 16px 40px; }

@media (max-width: 860px) {
  .hero, .grid2, .grid3 { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .go { width: 160px; height: 160px; }
}
