/* ANCHOR verifier — one stylesheet, no framework.
 *
 * Design notes:
 *
 * - Near-black background, one accent. The page is about one number
 *   (a root) and one verdict (verified/rejected). Chrome should not compete.
 * - Monospace for anything that is or describes data: roots, keys, hex,
 *   layer names. Proportional for prose.
 * - The two verdict states are the only saturated colours on the page.
 *   Green means "the arithmetic checks out", red means "someone lied or
 *   something broke". Nothing else earns colour.
 * - No web fonts. The page must render identically with the network off,
 *   which is the same constraint the verifier runs under.
 */

:root {
  --bg: #0b0d10;
  --bg-card: #14171c;
  --bg-inset: #1a1e25;
  --border: #262b33;
  --text: #e6e9ee;
  --text-dim: #8b939f;
  --text-faint: #5c646f;
  --accent: #5b9dff;
  --pass: #35d07f;
  --fail: #ff5c6a;
  --warn: #ffb454;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── header ───────────────────────────────────────────────────────────── */

header {
  padding: 2.5rem 1.5rem 0;
  max-width: 900px;
  margin: 0 auto;
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header h1::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
}

.tag {
  margin: 0.3rem 0 1.5rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
}

nav button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

nav button:hover { color: var(--text); }

nav button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── layout ───────────────────────────────────────────────────────────── */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.hint {
  margin: 0 0 1rem;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.65;
}

.hint code, .prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-inset);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: var(--text);
}

/* ── inputs ───────────────────────────────────────────────────────────── */

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  tab-size: 2;
}

textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea::placeholder { color: var(--text-faint); }

select {
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

button {
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

button:hover {
  background: #202530;
  border-color: #33393f;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #05070a;
  font-weight: 600;
}

button.primary:hover { background: #74acff; }

/* ── status pills ─────────────────────────────────────────────────────── */

.status {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-transform: lowercase;
}

.status.pass {
  color: var(--pass);
  border-color: color-mix(in srgb, var(--pass) 40%, transparent);
  background: color-mix(in srgb, var(--pass) 10%, transparent);
}

.status.fail {
  color: var(--fail);
  border-color: color-mix(in srgb, var(--fail) 40%, transparent);
  background: color-mix(in srgb, var(--fail) 10%, transparent);
}

.status.busy {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

/* ── verdict ──────────────────────────────────────────────────────────── */

.verdict {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0.3rem 0 1rem;
}

.verdict.pass { color: var(--pass); }
.verdict.fail { color: var(--fail); }

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.2rem;
  margin: 0;
  font-size: 0.88rem;
}

dt {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}

dd { margin: 0; }

/* ── code blocks ──────────────────────────────────────────────────────── */

.mono, pre.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

pre.mono {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  overflow-x: auto;
  margin: 0.8rem 0 0;
  white-space: pre;
  color: var(--text-dim);
  line-height: 1.55;
}

pre.mono:empty { display: none; }

/* ── agent cards ──────────────────────────────────────────────────────── */

.agents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.8rem;
}

.agent {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  position: relative;
}

.agent-name {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.agent-cap {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.agent-key {
  color: var(--text-faint);
  font-size: 0.76rem;
}

.agent-status {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.agent-status.online::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--pass);
  margin-right: 0.35em;
  vertical-align: 0.05em;
}

/* ── prose ────────────────────────────────────────────────────────────── */

.prose p {
  margin: 0 0 0.9rem;
  line-height: 1.75;
}

.prose ol, .prose ul {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  color: var(--text-dim);
}

.prose li strong { color: var(--text); }

.runtime-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:.7rem;margin-bottom:1.2rem}.runtime-metric{background:var(--bg-card);border:1px solid var(--border);border-radius:8px;padding:.85rem}.runtime-metric small{display:block;color:var(--text-faint);font-size:.68rem;letter-spacing:.08em;text-transform:uppercase}.runtime-metric strong{display:block;margin-top:.35rem;font-family:var(--mono);font-size:1.35rem}.runtime-metric span{color:var(--text-dim);font-size:.72rem}.dispatch-history{display:grid;gap:.55rem;margin-top:1rem}.history-item{display:grid;grid-template-columns:auto 1fr auto;gap:.75rem;align-items:center;background:var(--bg-inset);border:1px solid var(--border);border-radius:8px;padding:.75rem}.history-dot{width:.5rem;height:.5rem;border-radius:50%;background:var(--pass)}.history-dot.fail{background:var(--fail)}.history-item h3{margin:0;font-family:var(--mono);font-size:.8rem}.history-item p{margin:.2rem 0 0;color:var(--text-dim);font-size:.72rem}.history-item button{padding:.35rem .55rem;font-size:.72rem}.history-empty{padding:1.2rem;text-align:center;color:var(--text-faint);font-size:.8rem;border:1px dashed var(--border);border-radius:8px}@media(max-width:700px){.runtime-metrics{grid-template-columns:repeat(2,1fr)}.history-item{grid-template-columns:auto 1fr}.history-item button{grid-column:2;justify-self:start}}

/* ── footer ───────────────────────────────────────────────────────────── */

footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.76rem;
  border-top: 1px solid var(--border);
}

/* ── narrow screens ───────────────────────────────────────────────────── */

@media (max-width: 620px) {
  header { padding: 1.5rem 1rem 0; }
  main { padding: 1rem; }
  dl { grid-template-columns: 1fr; gap: 0.15rem 0; }
  dt { margin-top: 0.5rem; }
  .verdict { font-size: 1.5rem; }
}
