/* Theme-aware, self-contained. Light palette on :root; dark overrides under
   prefers-color-scheme. No external fonts or assets. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #d9dde3;
  --text: #1a1d21;
  --muted: #5b6470;
  --accent: #2f6fed;
  --accent-contrast: #ffffff;
  --pass: #1a7f4b;
  --pass-bg: #e6f4ec;
  --fail: #b4321f;
  --fail-bg: #fbeae7;
  --crit: #8a5a00;
  --crit-bg: #fbf1dc;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #232833;
    --border: #333a45;
    --text: #e7eaee;
    --muted: #9aa4b2;
    --accent: #6ea0ff;
    --accent-contrast: #0d1016;
    --pass: #4fd18b;
    --pass-bg: #16301f;
    --fail: #ff8a76;
    --fail-bg: #351a15;
    --crit: #e7b45a;
    --crit-bg: #332a13;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.site-head h1 {
  margin: 0 0 .25rem;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
}
.tagline { margin: 0 0 .5rem; color: var(--text); }
.scope-note {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
  border-left: 3px solid var(--border);
  padding-left: .75rem;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin: 1.75rem 0 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 12rem; flex: 1; }
.field label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
select {
  padding: .5rem .6rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
}
select:disabled { opacity: .55; }
.hint { font-size: .75rem; color: var(--muted); min-height: 1em; }

button#run {
  padding: .6rem 1.2rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
button#run:disabled { opacity: .6; cursor: progress; }

.status { min-height: 1.2em; color: var(--muted); font-size: .9rem; margin: .25rem 0 1rem; }
.status.error { color: var(--fail); }

/* Results */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}
.panel h2 { margin: 0 0 .75rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.verdict {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  align-items: baseline;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.verdict .outcome { font-size: 1.3rem; font-weight: 700; }
.verdict .metric { font-size: .9rem; color: var(--muted); }
.verdict .metric b { color: var(--text); font-variant-numeric: tabular-nums; }
.gate-ok { color: var(--pass); font-weight: 600; }
.gate-bad { color: var(--fail); font-weight: 600; }

/* Rubric */
.criterion {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: .5rem .75rem;
  align-items: baseline;
  padding: .45rem .1rem;
  border-top: 1px solid var(--border);
}
.criterion:first-child { border-top: none; }
.badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.pass { color: var(--pass); background: var(--pass-bg); }
.badge.fail { color: var(--fail); background: var(--fail-bg); }
.crit-tag {
  font-size: .68rem;
  font-weight: 700;
  color: var(--crit);
  background: var(--crit-bg);
  padding: .1rem .4rem;
  border-radius: 4px;
}
.cid { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.cdesc { font-size: .9rem; }
.cweight { font-family: var(--mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Trajectory */
.trajectory { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.trajectory li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: .6rem;
  padding: .5rem 0;
  border-top: 1px solid var(--border);
}
.trajectory li:first-child { border-top: none; }
.trajectory li::before {
  counter-increment: step;
  content: counter(step);
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  text-align: right;
}
.tool { font-family: var(--mono); font-weight: 600; font-size: .9rem; }
.args { font-family: var(--mono); font-size: .8rem; color: var(--muted); word-break: break-word; }
.tresult { font-size: .78rem; color: var(--muted); }
.tresult.err { color: var(--fail); }
