/* Bulwark design system: monochrome, editorial, precise.
   Ink on paper, Inter 300 for display, pill controls, generous whitespace.
   Colour carries meaning only: pass / broke a rule / crash / hang / runaway,
   and the resilience gradient. Shared by the landing page and the app. */
:root {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f4f4f6;
  --surface-inverse: #0a0a0a;

  --fg: #0a0a0a;
  --fg-muted: rgba(10, 10, 10, 0.56);
  --fg-dim: rgba(10, 10, 10, 0.38);
  --fg-inverse: #ffffff;
  --fg-inverse-muted: rgba(255, 255, 255, 0.58);

  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --line-bold: rgba(0, 0, 0, 0.35);
  --line-inverse: rgba(255, 255, 255, 0.12);

  /* Meaning */
  --pass: #15803d;
  --pass-soft: rgba(21, 128, 61, 0.08);
  --broken: #b45309;
  --broken-soft: rgba(180, 83, 9, 0.08);
  --crash: #dc2626;
  --crash-soft: rgba(220, 38, 38, 0.08);
  --hung: #6d28d9;
  --runaway: #be185d;
  --pending: #e7e7ea;
  --resilience-grad: linear-gradient(90deg, #ef4444 0%, #f59e0b 45%, #10b981 100%);

  /* Agents: one quiet mark each */
  --red-agent: #dc2626;
  --blue-agent: #1d4ed8;
  --judge-agent: #0a0a0a;
  --guard: #0f766e;

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.04), 0 24px 60px -24px rgba(0, 0, 0, 0.25);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100vw; overflow-x: clip; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { font-weight: 300; letter-spacing: -0.035em; line-height: 1.04; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0; }
::selection { background: #0a0a0a; color: #fff; }
:focus-visible { outline: 2px solid #0a0a0a; outline-offset: 2px; border-radius: 6px; }

/* ---- Shared components ---- */

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* Eyebrow: dot + small muted label */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-muted); }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fg); flex: none; }
.eyebrow.live::before { background: var(--pass); box-shadow: 0 0 0 4px var(--pass-soft); }
.inverse .eyebrow { color: var(--fg-inverse-muted); }
.inverse .eyebrow::before { background: var(--fg-inverse); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out);
}
.pill:hover { border-color: var(--line-bold); }
.pill.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.pill.muted { background: var(--surface-muted); border-color: transparent; color: var(--fg-muted); }
.pill.ink { background: var(--fg); color: var(--fg-inverse); border-color: var(--fg); }
.pill:disabled { opacity: .5; cursor: progress; }

/* Primary action: black pill with a white circular arrow */
.cta {
  display: inline-flex; align-items: center; gap: 14px; height: 52px; padding: 0 6px 0 24px;
  border-radius: var(--pill); background: var(--fg); color: var(--fg-inverse);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.cta .arrow {
  width: 40px; height: 40px; border-radius: 50%; background: var(--fg-inverse); color: var(--fg);
  display: grid; place-items: center; transition: transform .3s var(--ease-spring);
}
.cta:hover .arrow { transform: rotate(45deg); }
.cta.sm { height: 44px; padding-left: 20px; gap: 12px; font-size: 14px; }
.cta.sm .arrow { width: 32px; height: 32px; }
.cta:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: none; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card.inverse { background: var(--surface-inverse); color: var(--fg-inverse); border-color: var(--surface-inverse); box-shadow: var(--shadow-lg); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, 0.82); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.brand svg { flex: none; }
.topbar nav { display: flex; align-items: center; gap: 6px; }
.topbar nav a.link { padding: 8px 14px; border-radius: var(--pill); font-size: 14px; color: var(--fg-muted); transition: color .2s, background .2s; }
.topbar nav a.link:hover { color: var(--fg); background: var(--surface-muted); }

/* Segmented status switch (e.g. "Simulated · Claude via 0G") */
.segment { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--surface-muted); font-size: 13px; }
.segment span { padding: 6px 12px; border-radius: var(--pill); color: var(--fg-muted); display: inline-flex; align-items: center; gap: 6px; }
.segment span.on { background: var(--fg); color: var(--fg-inverse); }
.segment span .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }

/* Trial squares (shared vocabulary) */
.sq { width: 12px; height: 12px; border-radius: 3px; background: var(--pending); display: inline-block; }
.sq.pass { background: var(--pass); } .sq.broken { background: var(--broken); } .sq.crashed { background: var(--crash); }
.sq.hung { background: var(--hung); } .sq.runaway { background: var(--runaway); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--fg-muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

/* Agent tags */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font: 600 11px/1 var(--font-mono); letter-spacing: .04em; color: #fff; }
.tag.red { background: var(--red-agent); } .tag.blue { background: var(--blue-agent); } .tag.judge { background: var(--judge-agent); } .tag.guard { background: var(--guard); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- Mobile menu: a "+ Menu" pill that opens a full-screen sheet (below 768px) ---- */
.menu-pill {
  display: none; align-items: center; gap: 8px; height: 36px; padding: 4px 14px 4px 4px;
  border-radius: var(--pill); background: var(--surface-inverse); color: var(--fg-inverse);
  transition: background .2s, transform .4s var(--ease-out);
}
.menu-pill:hover { background: #262626; }
.menu-pill:active { transform: scale(.97); }
.menu-pill .mi { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--fg); display: grid; place-items: center; transition: transform .5s var(--ease-out); }
.menu-pill .ml { font-size: 11px; font-weight: 500; letter-spacing: .01em; }
@media (max-width: 767px) { .menu-pill { display: inline-flex; } }

.msheet { position: fixed; inset: 0; z-index: 800; display: flex; flex-direction: column; background: var(--bg); overscroll-behavior: contain; clip-path: inset(0 0 100% 0); transition: clip-path .6s var(--ease-out); }
.msheet.open { clip-path: inset(0 0 0 0); }
.msheet.closing { clip-path: inset(0 0 100% 0); transition-duration: .42s; }
.msheet .ms-top { position: relative; z-index: 1; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 64px; padding: env(safe-area-inset-top) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left)); }
.msheet .ms-top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: linear-gradient(to bottom, var(--bg), rgba(255,255,255,0)); pointer-events: none; }
.msheet .ms-close .mi { transform: rotate(45deg); }
.msheet .ms-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px calc(16px + env(safe-area-inset-right)) 24px calc(16px + env(safe-area-inset-left)); }
.msheet .ms-section { margin-top: 28px; }
.msheet .ms-heading { margin-bottom: 10px; padding-left: 2px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); }
.msheet .ms-card { padding: 16px; border-radius: var(--radius); background: var(--surface-inverse); color: var(--fg-inverse); box-shadow: var(--shadow); }
.msheet .ms-card .ms-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 500; color: rgba(255,255,255,.6); }
.msheet .ms-card .ms-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.msheet .ms-card .ms-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.msheet .ms-card .ms-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.msheet .ms-card .ms-stat b { font-size: 26px; font-weight: 300; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msheet .ms-card .ms-stat span { font-size: 13px; color: rgba(255,255,255,.7); }
.msheet .ms-card .ms-note { margin-top: 12px; font-size: 13px; line-height: 1.45; color: rgba(255,255,255,.6); }
.msheet .ms-slot > * { max-width: 100%; }
.msheet .ms-slot .segment { display: flex; width: 100%; flex-wrap: wrap; }
.msheet .ms-slot .segment span { flex: 1; justify-content: center; padding: 10px 12px; }
.msheet .ms-list { list-style: none; margin: 0 -8px; }
.msheet .ms-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; text-align: left; transition: background .2s; }
.msheet .ms-row:active, .msheet .ms-row:focus-visible { background: var(--surface-muted); }
.msheet .ms-ri { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-muted); color: var(--fg); display: grid; place-items: center; flex: none; }
.msheet .ms-row[aria-current="page"] .ms-ri { background: var(--surface-inverse); color: var(--fg-inverse); }
.msheet .ms-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.msheet .ms-rl { font-size: 15px; font-weight: 500; }
.msheet .ms-rh { font-size: 12.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msheet .ms-chev { width: 28px; height: 28px; display: grid; place-items: center; color: var(--fg-dim); flex: none; transition: transform .4s var(--ease-out); }
.msheet .ms-row:active .ms-chev { color: var(--fg); transform: translateX(2px); }
.msheet .ms-foot { flex: none; position: relative; padding: 12px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); background: var(--bg); }
.msheet .ms-foot::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 24px; background: linear-gradient(to top, var(--bg), rgba(255,255,255,0)); pointer-events: none; }
.msheet .ms-cta { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: var(--pill); background: var(--surface-inverse); color: var(--fg-inverse); font-size: 14px; font-weight: 500; }
.msheet .ms-cta .mi { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--fg); display: grid; place-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { .msheet, .msheet.closing { transition: opacity .2s; clip-path: none; opacity: 0; } .msheet.open { opacity: 1; } }
