@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Prompt Blue and AI Green with their tints; tests/test_web.py checks the contrast of the text pairs */
:root {
  --prompt-blue: #041130;
  --ai-green: #3ffd94;
  --bg: #ffffff;
  --surface: #f4f6fa;
  --card: #ffffff;
  --text: #041130;
  --muted: #4a5675;
  --line: #d6dce8;
  --chip: #e8ecf4;
  --accent: #3ffd94;
  --accent-soft: #d9feea;
  --accent-ink: #041130;
  --brand: #041130;
  --on-brand: #ffffff;
  --on-brand-muted: #b8c2d9;
  --focus: #041130;
  --error: #b42330;
  --error-soft: #fdecee;
  --shadow: 0 1px 2px rgba(4, 17, 48, 0.06), 0 8px 24px rgba(4, 17, 48, 0.06);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --gutter: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #041130; --surface: #071838; --card: #0b1d44; --text: #e8edf6; --muted: #a1acc5; --line: #1d305e;
    --chip: #13265a; --accent-soft: #123c4f; --brand: #020b22; --focus: #3ffd94; --error: #ff8f9a; --error-soft: #3a1726;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #041130; --surface: #071838; --card: #0b1d44; --text: #e8edf6; --muted: #a1acc5; --line: #1d305e;
  --chip: #13265a; --accent-soft: #123c4f; --brand: #020b22; --focus: #3ffd94; --error: #ff8f9a; --error-soft: #3a1726;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text);
       font-family: var(--font-sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
main { flex: 1 0 auto; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.4rem, 1.5vw + 1rem, 1.9rem); }
h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--font-mono); font-size: 0.88em; font-variant-ligatures: none; }
::selection { background: var(--ai-green); color: var(--prompt-blue); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.site-header :focus-visible, .hero :focus-visible { outline-color: var(--ai-green); }
[id] { scroll-margin-top: 88px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 10; padding: 8px 14px; border-radius: 8px; font-weight: 600;
        background: var(--accent); color: var(--accent-ink); }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.id { font-family: var(--font-mono); font-size: 0.85rem; white-space: nowrap; }
.hash { font-family: var(--font-mono); font-size: 0.85rem; overflow-wrap: anywhere; }

.site-header { position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--on-brand);
               border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em;
         text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; font-weight: 500; text-decoration: none;
         color: var(--on-brand-muted); }
.nav a:hover { color: var(--on-brand); background: rgba(255, 255, 255, 0.06); }
.nav a[aria-current="page"] { color: var(--on-brand); box-shadow: inset 0 -2px 0 var(--ai-green); border-radius: 8px 8px 0 0; }
.user { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
        background: rgba(255, 255, 255, 0.08); color: var(--on-brand); font-size: 0.9rem; font-weight: 500; }
.user img, .avatar { width: 24px; height: 24px; border-radius: 50%; }
.avatar { display: inline-grid; place-items: center; background: var(--ai-green); color: var(--prompt-blue); font-size: 0.75rem;
          font-weight: 700; }
.nav .sign-in { margin-left: 8px; border: 1px solid rgba(255, 255, 255, 0.28); color: var(--on-brand); }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px;
               background: transparent; color: var(--on-brand-muted); cursor: pointer; }
.icon-button:hover { color: var(--on-brand); background: rgba(255, 255, 255, 0.08); }
.icon-button svg { width: 20px; height: 20px; }
.menu-button, .icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.hero { position: relative; overflow: hidden; background: var(--brand); color: var(--on-brand); }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
                background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
                                  linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
                background-size: 48px 48px; mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%); }
.hero::after { content: ""; position: absolute; width: 560px; height: 560px; right: -140px; top: -180px; pointer-events: none;
               background: radial-gradient(circle, rgba(63, 253, 148, 0.2), transparent 65%); }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
              gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 104px; }
.hero h1 { max-width: 18ch; }
.hero h1 em { font-style: normal; color: var(--ai-green); }
.lead { max-width: 58ch; font-size: clamp(1.05rem, 0.5vw + 1rem, 1.2rem); color: var(--on-brand-muted); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 0.8rem; font-weight: 600;
           letter-spacing: 0.08em; text-transform: uppercase; color: var(--ai-green); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-green);
                   box-shadow: 0 0 0 4px rgba(63, 253, 148, 0.2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.example { padding: 22px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius);
           background: rgba(255, 255, 255, 0.04); box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25); }
.example-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.85rem;
                color: var(--on-brand-muted); }
.example-head a { color: var(--on-brand); }
.example dl { margin: 0; }
.example dt { margin-top: 16px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
              color: var(--on-brand-muted); }
.example dd { margin: 6px 0 0; }
.example pre { margin: 0; color: #e8edf6; background: rgba(0, 0, 0, 0.28); border-color: rgba(255, 255, 255, 0.08); }
.worlds { display: flex; flex-wrap: wrap; gap: 8px; }
.world-pill { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px; border: 1px solid rgba(255, 255, 255, 0.16);
              border-radius: 999px; font-size: 0.8rem; }
.world-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ai-green); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border: 1px solid transparent; border-radius: 10px;
       font: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer;
       transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(63, 253, 148, 0.35); }
.btn-ghost { color: var(--on-brand); border-color: rgba(255, 255, 255, 0.28); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-outline { color: var(--text); background: var(--card); border-color: var(--line); }
.btn-outline:hover { border-color: var(--text); }

.section { padding: 80px 0; }
.section-alt { background: var(--surface); }
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head p { color: var(--muted); }
.kicker { display: block; margin-bottom: 8px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
          color: var(--muted); }

.stats { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: -48px 0 0; }
.stat { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.stat dt { font-size: 0.9rem; color: var(--muted); }
.stat dd { margin: 4px 0 0; font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }

.grid { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.card h3 { margin-bottom: 6px; }
.card p, .plain p { margin-bottom: 0; color: var(--muted); }
.step-number { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-bottom: 16px; border-radius: 10px;
               background: var(--accent-soft); color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.plain h3 { padding-top: 16px; border-top: 2px solid var(--accent); }

.result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.result > div > p { color: var(--muted); }
.meter-card { margin: 0; box-shadow: var(--shadow); }
.meter-card figcaption { color: var(--muted); }
.meters { display: grid; gap: 18px; margin-top: 22px; }
.meter-label { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.meter-label strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.meter-track { height: 10px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.meter-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--text); }
.meter-sm { max-width: 140px; height: 6px; margin-top: 8px; }
.share { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); align-items: center; gap: 10px; min-width: 140px; }
.share .meter-track { height: 6px; }
.ci { display: block; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.small { font-size: 0.85rem; }

.board { padding-top: 28px; padding-bottom: 72px; }
.board .table-wrap { margin-bottom: 16px; }
.board th, .board td { padding-left: 14px; padding-right: 14px; }
.note { font-size: 0.9rem; }
.run { padding-bottom: 72px; }
.run h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.run .table-wrap { margin-bottom: 40px; }
.stats-flat { margin: 32px 0 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.quick-links a { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
                 font-size: 0.92rem; font-weight: 500; text-decoration: none; }
.quick-links a:hover { border-color: var(--text); }
.gap-note { max-width: 72ch; margin: 28px 0 0; color: var(--muted); }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.duo-card { display: flex; flex-direction: column; padding: 32px; }
.duo-card h2 { font-size: clamp(1.3rem, 1vw + 1rem, 1.6rem); }
.duo-card p + p { margin-top: 12px; }
.duo-card .actions { margin-top: auto; padding-top: 24px; }
.stat dd small { display: block; margin-top: 6px; font-size: 0.8rem; font-weight: 400; letter-spacing: 0; line-height: 1.4;
                 color: var(--muted); }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 24px 0 40px; }
.panel-note { margin: 12px 0 0; font-size: 0.85rem; }
table.mini { font-size: 0.92rem; }
table.mini th { padding: 6px 12px 6px 0; background: none; }
table.mini td { padding: 8px 12px 8px 0; }
table.mini tbody tr:hover { background: none; }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500;
        white-space: nowrap; background: var(--chip); color: var(--text); }
.chip-green { background: var(--accent-soft); }
.chip-mono { font-family: var(--font-mono); font-size: 0.78rem; white-space: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.page-head { padding: 48px 0 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.page-head h1 { font-size: clamp(1.9rem, 2vw + 1rem, 2.6rem); }
.page-head p { max-width: 70ch; margin-bottom: 0; color: var(--muted); }
.page-head .chips { margin-top: 18px; }
.page-head .task-title { max-width: 36ch; font-size: clamp(1.5rem, 1.5vw + 1rem, 2.1rem); }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 28px 0 20px; }
.field { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
select { min-width: 180px; padding: 9px 36px 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit;
         font-size: 0.95rem; color: var(--text); background-color: var(--card); appearance: none; cursor: pointer;
         background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
         background-position: right 18px top 52%, right 13px top 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.count { margin: 0 0 10px auto; font-size: 0.9rem; color: var(--muted); }
.empty { margin-bottom: 72px; padding: 48px 24px; text-align: center; }
.empty p { margin-bottom: 16px; }

.table-wrap { margin-bottom: 72px; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { text-align: left; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
     background: var(--surface); }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

pre { margin: 12px 0 0; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; line-height: 1.55;
      background: var(--surface); }
pre.wrap-lines { white-space: pre-wrap; }
.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 28px; margin: 0; }
.meta dt { font-weight: 500; color: var(--muted); }
.meta dd { margin: 0; }
.callout { padding: 16px 20px; border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-soft); }
.callout p { margin: 0; }
.callout-error { margin: 0 0 20px; border-left-color: var(--error); background: var(--error-soft); }
.notice { margin: 0 0 20px; }
.callout-error ul { margin: 8px 0 0; padding-left: 1.2em; }

.submit-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: start;
                 padding: 40px var(--gutter) 80px; }
.form { display: grid; gap: 20px; }
.form .field { font-size: 0.9rem; color: var(--text); }
.form .btn { justify-self: start; }
.form p { margin: 0; }
.hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="url"], input[type="file"] { width: 100%; padding: 10px 12px; border: 1px solid var(--line);
                                                            border-radius: 10px; font: inherit; font-size: 0.95rem; color: var(--text);
                                                            background: var(--card); }
input::placeholder { color: var(--muted); opacity: 0.85; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
                                           font: inherit; font-weight: 600; color: var(--text); background: var(--surface);
                                           cursor: pointer; }
.guide section + section { margin-top: 28px; }
.guide h2, .sign-in-card h2, .job-card h2 { font-size: 1.15rem; letter-spacing: -0.01em; }
.guide p { color: var(--muted); }
.job { padding-top: 40px; padding-bottom: 80px; }
.job-card { max-width: 640px; }
.job-card .meter-track { margin: 16px 0; }
.chip-link { text-decoration: none; }
.chip-link:hover { text-decoration: underline; }

.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; padding: 40px var(--gutter) 80px; }
.task-main > section + section { margin-top: 40px; }
.task-main h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.task-main h2 + p { margin-bottom: 0; }
.task-main p + .chips { margin-top: 12px; }
.reading { margin-top: 20px; }
.reading h3 { font-size: 1rem; margin-bottom: 4px; }
.reading p { margin-bottom: 0; color: var(--muted); }
.details { position: sticky; top: 88px; }
.details .meta { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.details .meta dt { font-size: 0.8rem; }
.details .meta dd { margin-bottom: 12px; }
.details .meta dd:last-child { margin-bottom: 0; }
.tag-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }

.doc { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 56px; padding: 40px var(--gutter) 80px; }
.toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 2px; font-size: 0.92rem; }
.toc a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); background: var(--surface); }
.doc section + section { margin-top: 56px; }
.pipeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.lane { padding: 22px 22px 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.lane h3 { margin-bottom: 18px; }
.flow { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.flow li { position: relative; padding: 0 0 18px 46px; }
.reproduce { padding-bottom: 80px; }
.steps { max-width: 84ch; }
.steps li { padding-bottom: 28px; }
.steps p + p, .steps pre + p { margin-top: 10px; }
.steps pre { margin: 10px 0 0; font-size: 0.82rem; }
.doc .flow li { max-width: none; margin: 0; }
.flow li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 0; display: grid;
                   place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft);
                   color: var(--text); font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }
.flow li::after { content: ""; position: absolute; top: 34px; bottom: 4px; left: 14px; width: 2px; background: var(--line); }
.flow li:last-child::after { display: none; }
.flow li.human::before { background: var(--accent); color: var(--accent-ink); }
.flow strong { display: block; line-height: 1.5; }
.flow p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.flow .worlds { margin-top: 10px; }
.flow .world-pill { border-color: var(--line); }
.stats-compact { grid-template-columns: repeat(3, 1fr); margin: 20px 0 24px; }

.sim-card { --sim-cell: #e8ecf4; --sim-pick: #184f95; --sim-ring: #041130; --sim-fail: #b42330; --sim-wire: #9aa6c0;
            display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: center;
            margin: 24px 0 8px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
            background: var(--card); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sim-card { --sim-cell: #13265a; --sim-pick: #b7d3f6; --sim-ring: #e8edf6;
                                              --sim-fail: #ff8f9a; --sim-wire: #4a5b85; }
}
:root[data-theme="dark"] .sim-card { --sim-cell: #13265a; --sim-pick: #b7d3f6; --sim-ring: #e8edf6; --sim-fail: #ff8f9a;
                                     --sim-wire: #4a5b85; }
.sim { margin: 0; }
.sim svg { display: block; width: 100%; height: auto; }
.sim-node rect { fill: var(--card); stroke: var(--line); stroke-width: 1.25; }
.sim-title { fill: var(--text); font: 600 12px var(--font-sans); text-anchor: middle; }
.sim-sub { fill: var(--muted); font: 10px var(--font-sans); text-anchor: middle; }
.sim-start { text-anchor: start; }
.sim-code { fill: var(--text); font: 8.5px var(--font-mono); }
.sim-wire { fill: none; stroke: var(--sim-wire); stroke-width: 1.25; }
.sim .sim-cell { fill: var(--sim-cell); stroke: none; }
.sim .sim-pick { fill: var(--sim-pick); }
.sim-card[data-scenario="miss"] .sim .sim-extra { fill: var(--sim-fail); }
.sim .sim-ring { fill: none; stroke: var(--sim-ring); stroke-width: 1.25; }
.sim-mark { fill: var(--text); font: 700 14px var(--font-sans); text-anchor: middle; }
.sim-mark.sim-fail { fill: var(--sim-fail); }
.sim-card[data-scenario="miss"] .sim-pass, .sim-card[data-scenario="pass"] .sim-miss { display: none; }
.sim-text h3 { margin-bottom: 8px; }
.sim-text p { color: var(--muted); font-size: 0.95rem; }
.sim-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sim-controls .btn { padding: 8px 14px; font-size: 0.9rem; }
.sim-controls [aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.btn-quiet { color: var(--text); background: none; text-decoration: underline; text-underline-offset: 3px; }
.sim-card.play .sim-node, .sim-card.play .sim-mark { animation: sim-in .4s ease-out var(--d) both; }
.sim-card.play .sim-wire { stroke-dasharray: 1; animation: sim-draw .45s ease-out var(--d) both; }
.sim-card.play .sim-pick, .sim-card.play[data-scenario="miss"] .sim-extra { animation: sim-pick .35s ease-out var(--d) both; }
.sim-card.play .sim-work rect { animation: sim-work .8s ease-in-out calc(var(--d) + .3s); }
@keyframes sim-in { from { opacity: 0; } }
@keyframes sim-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sim-pick { from { fill: var(--sim-cell); } }
@keyframes sim-work { 50% { stroke: var(--text); stroke-width: 2.5; } }
.flow.play li::before { animation: step-on .45s ease-out calc(var(--i, 0) * .4s) both; }
.flow.play li::after { transform-origin: top; animation: step-line .4s ease-out calc(var(--i, 0) * .4s + .2s) both; }
@keyframes step-on { from { background: var(--chip); color: var(--muted); } }
@keyframes step-line { from { transform: scaleY(0); } }
.sim-card.pending .sim-node, .sim-card.pending .sim-mark, .sim-card.pending .sim-wire { opacity: 0; }
.flow.pending li::before { background: var(--chip); color: var(--muted); }
.flow.pending li::after { transform: scaleY(0); }
@media (prefers-reduced-motion: reduce) {
  .sim-card.play *, .flow.play li::before, .flow.play li::after { animation: none !important; }
}

.viz { --viz-real: #86b6ef; --viz-every: #184f95; --viz-both: #2a78d6; --viz-execution: #eb6834; --viz-grade: #1baf7a;
       --viz-neither: #eda100; --viz-q0: #cde2fb; --viz-q1: #86b6ef; --viz-q2: #3987e5; --viz-q3: #1c5cab;
       --viz-q4: #0d366b; padding-top: 8px; padding-bottom: 80px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .viz {
    --viz-real: #2a78d6; --viz-every: #b7d3f6; --viz-both: #3987e5; --viz-execution: #d95926; --viz-grade: #199e70;
    --viz-neither: #c98500; --viz-q0: #0d366b; --viz-q1: #1c5cab; --viz-q2: #3987e5; --viz-q3: #86b6ef; --viz-q4: #cde2fb;
  }
}
:root[data-theme="dark"] .viz {
  --viz-real: #2a78d6; --viz-every: #b7d3f6; --viz-both: #3987e5; --viz-execution: #d95926; --viz-grade: #199e70;
  --viz-neither: #c98500; --viz-q0: #0d366b; --viz-q1: #1c5cab; --viz-q2: #3987e5; --viz-q3: #86b6ef; --viz-q4: #cde2fb;
}
.viz-section { margin-top: 64px; }
.viz-section > p { max-width: 72ch; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 20px; font-size: 0.88rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key.dot-real, .key.dot-every { border-radius: 50%; }
.key-ci { width: 20px; height: 6px; border-radius: 3px; background: var(--viz-every); opacity: 0.22; }
.viz-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.viz-panel { padding: 20px 22px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.viz-panel h3 { margin-bottom: 12px; }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li, .axis { display: grid; grid-template-columns: minmax(0, 10.5rem) minmax(0, 1fr) 4.5rem; align-items: center; gap: 12px; }
.rows li { padding: 6px 0; border-radius: 8px; }
.rows li:hover, .rows li:focus-within { background: var(--surface); }
.axis { position: relative; height: 18px; font-size: 0.75rem; color: var(--muted); }
.axis span { grid-column: 2; grid-row: 1; justify-self: start; }
.axis span:nth-child(2) { justify-self: center; }
.axis span:nth-child(3) { justify-self: end; }
.row-label { overflow: hidden; font-size: 0.88rem; font-weight: 500; text-decoration: none; text-overflow: ellipsis;
             white-space: nowrap; }
.row-value { font-size: 0.88rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 22px; background-image: linear-gradient(var(--line), var(--line)),
         linear-gradient(var(--line), var(--line)), linear-gradient(var(--line), var(--line));
         background-position: 0 0, 50% 0, 100% 0; background-repeat: no-repeat; background-size: 1px 100%; }
.track .ci { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--viz-every);
             opacity: 0.22; }
.track .link { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--viz-real); }
.track .dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
              box-shadow: 0 0 0 2px var(--card); }
.dot-real { background: var(--viz-real); }
.dot-every { background: var(--viz-every); }
.stack { display: flex; gap: 2px; height: 14px; }
.seg { flex: 1 1 0; min-width: 2px; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.seg-both { background: var(--viz-both); }
.seg-execution { background: var(--viz-execution); }
.seg-grade { background: var(--viz-grade); }
.seg-neither { background: var(--viz-neither); }
.twin { margin-top: 16px; }
.twin summary { cursor: pointer; font-size: 0.92rem; font-weight: 500; }
.twin .table-wrap { margin-top: 12px; }
.heatmap-title { margin: 24px 0 8px; font-size: 1rem; }
.heatmap-wrap { overflow-x: auto; }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 2px; }
.heatmap th { padding: 6px 8px; border: 0; background: none; font-size: 0.72rem; letter-spacing: 0.02em;
              text-transform: none; vertical-align: bottom; }
.heatmap tbody th { color: var(--text); font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.heatmap td { min-width: 48px; height: 30px; padding: 0; border: 0; border-radius: 4px; }
.heatmap tbody tr:hover { background: none; }
.heatmap td[data-tip]:hover { box-shadow: inset 0 0 0 2px var(--text); }
.q0 { background: var(--viz-q0); }
.q1 { background: var(--viz-q1); }
.q2 { background: var(--viz-q2); }
.q3 { background: var(--viz-q3); }
.q4 { background: var(--viz-q4); }
.tip { position: absolute; z-index: 50; display: grid; gap: 2px; max-width: 300px; padding: 8px 12px; border: 1px solid var(--line);
       border-radius: 10px; background: var(--card); box-shadow: var(--shadow); color: var(--muted); font-size: 0.82rem;
       line-height: 1.45; pointer-events: none; }
.tip strong { color: var(--text); font-size: 0.9rem; }
.doc section > p, .doc li { max-width: 72ch; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 6px; }
.doc .table-wrap { margin: 20px 0 0; }

.error-page { max-width: 560px; text-align: center; }
.error-page p { color: var(--muted); }

.site-footer { padding: 32px 0 40px; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.site-footer a { color: var(--text); }
.site-footer .canary { flex-basis: 100%; font-size: 0.8rem; overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .hero .wrap, .result, .task-layout, .doc, .panels, .submit-layout { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .details { position: static; }
  .doc { gap: 24px; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 8px; }
  .toc a { padding: 4px 12px; border-radius: 999px; background: var(--chip); color: var(--text); }
  .viz-panels, .duo, .sim-card { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .pipeline { grid-template-columns: minmax(0, 1fr); }
  .rows li, .axis { grid-template-columns: minmax(0, 5.5rem) minmax(0, 1fr) 5.2rem; gap: 8px; }
  .row-label, .row-value { font-size: 0.8rem; }
  .viz-panel { padding: 16px 14px 10px; }
  :root { --gutter: 16px; }
  .site-header .wrap { gap: 8px; }
  .menu-button { display: inline-grid; }
  .theme-toggle { margin-left: auto; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
         padding: 8px 16px 16px; background: var(--brand); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
  .site-header[data-open] .nav { display: flex; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--ai-green); border-radius: 0 8px 8px 0; }
  .nav .user, .nav .sign-in { align-self: flex-start; margin: 8px 0 0; }
  .hero .wrap { gap: 36px; padding-top: 48px; padding-bottom: 88px; }
  .section { padding: 56px 0; }
  .stats { gap: 12px; }
  .stat { padding: 16px; }
  .stat dd { font-size: 1.6rem; }
  select { width: 100%; min-width: 0; }
  .field { flex: 1 1 140px; }
  .count { width: 100%; margin: 4px 0 0; }
  .table-wrap thead { display: none; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap tr { display: flex; flex-direction: column; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-wrap td.primary { order: -1; margin-bottom: 6px; }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap td { padding: 3px 0; border: 0; }
  .table-wrap td:first-child { margin-bottom: 6px; }
  .table-wrap td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 7.5rem; font-size: 0.8rem;
                                       font-weight: 600; color: var(--muted); }
  .meta { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .meta dd { margin-bottom: 10px; }
  .card { padding: 18px; }
  table.mini th, table.mini td { padding-right: 8px; }
  table.mini .id { font-size: 0.78rem; }
  .share { grid-template-columns: 3.2rem minmax(24px, 1fr); gap: 8px; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
