@scope (.testing-explained) {
  :scope {
    --card: var(--surface);
    --ink-soft: var(--muted);
    --ink-faint: var(--muted);
    --line-soft: var(--line);
    --indigo: var(--accent);
    --indigo-deep: var(--accent-ink);
    --indigo-bright: var(--accent);
    --indigo-wash: var(--tint);
    --green: light-dark(#24644b, #8bd1ae);
    --amber: light-dark(#8a4e10, #f1ba78);
    --red: light-dark(#9c3838, #f2a6a6);
  }
  .testing-banner { display: block; width: 100%; height: auto; border-radius: 12px; margin: 0 0 20px; }
  .snapshot-date { margin: 0 0 4px; }
  .snapshot-note { margin: 0 0 16px; font-size: 15px; color: var(--muted); }
  .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
  .stat .num { display: inline-block; font-size: clamp(23px, 3vw, 33px); line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
  .stat .label { display: block; margin-top: 5px; font-size: 13px; line-height: 1.4; color: var(--muted); }
  ul.toc { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 0 0; }
  ul.toc > li, ul.toc > li + li { margin: 0; }
  .toc a { font-size: 15px; color: var(--accent-ink); text-decoration: underline; text-underline-offset: .2em; }
  .toc a:hover { text-decoration-thickness: 2px; }
  section[id] { margin-top: 38px; scroll-margin-top: 140px; }
  .caption { font-size: 14px; color: var(--muted); margin-top: 12px; }
  @media (max-width: 600px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

  /* ================= CALLOUT ================= */

  .callout {
    margin: 30px 0 0;
    padding: 22px 26px;
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 16px;
  }
  .callout p { margin: 0; max-width: 62ch; }
  .callout p + p { margin-top: 10px; }
  .callout strong { color: var(--indigo-deep); }

  /* ================= CHART CARD ================= */

  .chart-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px 26px 18px;
    box-shadow: var(--shadow);
    margin-top: 30px;
  }

  .chart-card h3 { margin: 0 0 4px; font-size: 17px; }
  .chart-card .sub { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-faint); }

  .chart-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }

  .ladder-mobile { display: none; }

  svg.chart { display: block; width: 100%; height: auto; }
  svg.chart text { fill: var(--ink-soft); }

  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
  }

  .legend span { display: inline-flex; align-items: center; gap: 8px; }

  .swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

  /* ================= SPLIT CARD (donut) ================= */

  .split {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: center;
  }

  .split .ring { max-width: 300px; }

  .split h3 { margin-top: 0; }

  .legend-list { list-style: none; margin: 14px 0 0; padding: 0; }

  .legend-list li {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 15px;
  }
  .legend-list li:last-child { border-bottom: none; }
  .legend-list .pct { font-variant-numeric: tabular-nums; color: var(--ink-faint); font-size: 14px; }
  .legend-list .nm small { display: block; color: var(--ink-faint); font-size: 12.5px; }

  /* ================= PIPELINE ================= */

  .stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 28px 0 36px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .stepper .node {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--indigo);
    color: var(--indigo-deep);
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .stepper .node.end { background: var(--indigo); color: var(--on-accent); border-color: var(--indigo); }

  .stepper .link { flex: 1 0 22px; height: 2px; background: linear-gradient(90deg, var(--indigo), #c3c7f5); }

  .pipeline { margin-top: 8px; }

  .stage {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 20px;
    padding: 0 0 24px;
    position: relative;
  }

  .stage:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 27px;
    top: 56px;
    bottom: 4px;
    width: 2px;
    background: linear-gradient(180deg, var(--indigo), #d8daf6);
  }

  .stage .n {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--indigo);
    color: var(--on-accent);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Figtree, system-ui, sans-serif;
    font-size: 22px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 18px -10px rgba(47,55,128,.9);
  }

  .stage.stop .n { background: #24644b; color: #fff; box-shadow: 0 8px 18px -10px rgba(47,125,92,.9); }

  .stage .:scope {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 20px 18px;
    box-shadow: var(--shadow);
  }

  .stage .title { font-weight: 700; font-size: 17px; margin: 0 0 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

  .tag {
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: .09em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    white-space: nowrap;
  }

  .tag.heavy { background: light-dark(#f8eddd, #382a1b); color: var(--amber); }
  .tag.instant { background: light-dark(#e4f2ea, #1d352d); color: var(--green); }

  .stage .what { margin: 0; color: var(--ink-soft); font-size: 15.5px; max-width: 62ch; }

  /* ================= CARDS ================= */

  .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 28px;
  }

  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px 22px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
  }

  .card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--indigo), var(--indigo-bright));
  }

  .card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(25,24,33,.06), 0 18px 40px -20px rgba(25,24,33,.3); }

  .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
  }

  .icon svg { width: 21px; height: 21px; }

  .card h3 { margin: 0 0 6px; font-size: 16.5px; }
  .card p { margin: 0; font-size: 15px; color: var(--ink-soft); max-width: none; }

  .card .who {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 12.5px;
    letter-spacing: .03em;
    color: var(--ink-faint);
  }

  /* ================= TABLES ================= */

  .tablewrap { overflow-x: auto; margin-top: 24px; border-radius: 12px; box-shadow: var(--shadow); }

  table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--card); }

  th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }

  th {
    background: var(--tint);
    font-size: 12.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 700;
  }

  td.n { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: Figtree, system-ui, sans-serif; font-size: 19px; color: var(--indigo-deep); }
  tr:last-child td { border-bottom: none; }
  tbody tr:hover td { background: var(--tint); }

  /* ================= TRIO ================= */

  .trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 28px; }

  .tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    box-shadow: var(--shadow);
  }

  .tile .big {
    font-family: Figtree, system-ui, sans-serif;
    font-size: 40px;
    line-height: 1;
    color: var(--indigo-deep);
    letter-spacing: -.02em;
  }

  .tile .not {
    display: inline-block;
    margin: 10px 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--red);
    background: light-dark(#f7e9e9, #382526);
    border-radius: 999px;
    padding: 3px 10px;
  }

  .tile p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }

  /* ================= GLOSSARY ================= */

  dl.glossary {
    margin: 28px 0 0;
    display: grid;
    grid-template-columns: 200px 1fr;
    border-top: 1px solid var(--line);
  }

  dl.glossary dt {
    font-weight: 700;
    font-size: 15px;
    padding: 15px 20px 15px 0;
    border-bottom: 1px solid var(--line-soft);
    color: var(--indigo-deep);
  }

  dl.glossary dd {
    margin: 0;
    padding: 15px 0;
    font-size: 15px;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line-soft);
    max-width: 66ch;
  }

  /* ================= TERMINAL ================= */

  .terminal {
    margin: 24px 0 0;
    background: #1e1d26;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 50px -30px rgba(25,24,33,.85);
  }

  .terminal .bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    background: #2a2935;
    border-bottom: 1px solid #35343f;
  }

  .terminal .bar i { width: 11px; height: 11px; border-radius: 50%; display: block; }
  .terminal .bar i:nth-child(1) { background: #e06c6c; }
  .terminal .bar i:nth-child(2) { background: #e0b96c; }
  .terminal .bar i:nth-child(3) { background: #6cc08a; }
  .terminal .bar span { margin-left: 10px; font-size: 12px; color: #8f8ca3; }

  pre {
    margin: 0;
    padding: 20px 22px;
    overflow-x: auto;
    color: #eae7f2;
    font-size: 14px;
    line-height: 1.75;
  }

  code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .93em; }
  p code, li code, td code { background: var(--tint); padding: 1px 5px; border-radius: 3px; color: var(--indigo-deep); }
  .terminal code { color: #d9d5ec; }
  .terminal .cmt { color: #7f7b95; }

  /* ================= TRADE ================= */

  .trade { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 26px; }

  .trade > div {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
  }

  .trade h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: .09em; text-transform: uppercase; }
  .trade .good h3 { color: var(--green); }
  .trade .cost h3 { color: var(--amber); }

  .trade ul { margin: 0; padding-left: 18px; }
  .trade li { margin-bottom: 10px; font-size: 15px; color: var(--ink-soft); }
  .trade li:last-child { margin-bottom: 0; }
  .trade li::marker { color: var(--indigo); }

  /* ================= FOOTER ================= */

  footer {
    margin-top: 84px;
    padding-top: 26px;
    border-top: 2px solid var(--ink);
    font-size: 13.5px;
    color: var(--ink-faint);
  }
  footer p { max-width: 74ch; }

  /* ================= RESPONSIVE ================= */

  @media (max-width: 780px) {
    :scope { font-size: 16px; }
    .chart-card { padding: 20px 16px 14px; }
    .chart-scroll { display: none; }
    .stepper { display: none; }
    .ladder-mobile { display: block; margin-top: 4px; }
    .lm-row { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
    .lm-row:last-child { border-bottom: none; }
    .lm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
    .lm-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
    .lm-name small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
    .lm-num { font-size: 15px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
    .lm-track { height: 12px; background: var(--indigo-wash); border-radius: 3px; margin-top: 8px; overflow: hidden; }
    .lm-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #4f5bd5, #7b86f0); }
    .lm-bar.soft { background: linear-gradient(90deg, #7b86f0, #a7aff7); }
    .split { grid-template-columns: 1fr; }
    .split .ring { margin: 0 auto; }
    dl.glossary { grid-template-columns: 1fr; }
    dl.glossary dt { padding-bottom: 2px; border-bottom: none; }
    dl.glossary dd { padding-top: 2px; }
    .trade { grid-template-columns: 1fr; }
    .stage { grid-template-columns: 42px 1fr; gap: 14px; }
    .stage .n { width: 42px; height: 42px; font-size: 17px; }
    .stage:not(:last-child)::before { left: 20px; top: 42px; }
  }

  @media print {
    :scope { background: #fff; font-size: 10.5pt; }
    .stat { border-color: #bbb; background: #fff; }
    .stat .num, .stat .label { color: #000; }
    section { page-break-inside: avoid; }
    .card, .stage .body, .chart-card, .tile { box-shadow: none; }
    .terminal { background: #f4f4f4; }
    pre, .terminal code { color: #000; }
  }

  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
.chart-style-1 { width:17.2%; }
.chart-style-2 { width:19.3%; }
.chart-style-3 { width:64.7%; }
.chart-style-4 { width:72.6%; }
.chart-style-5 { width:56.7%; }
.chart-style-6 { width:100%; }
.chart-style-7 { width:78.7%; }
.chart-style-8 { width:90.6%; }
.chart-style-9 { width:43.9%; }
.chart-style-10 { background:#4f5bd5; }
.chart-style-11 { background:#a7aff7; }
.chart-style-12 { margin-bottom:0; }
.chart-style-13 { background:#4f5bd5; }
.chart-style-14 { background:#a8641b; }
.chart-style-15 { background:#2f7d5c; }
.chart-style-16 { background:#a7aff7; }
  .stat .num { position: relative; }
  .is-counting .count-final { opacity: 0; }
  .count-display { position: absolute; inset: 0; }
  .split .ring text { fill: var(--ink); }
  @media (prefers-reduced-motion: reduce), print {
    .is-counting .count-final { opacity: 1; }
    .count-display { display: none; }
  }
}
