.deck-article, .viz-tip {
  --s-hero: #c98500;
  --s-rest: color-mix(in srgb, var(--text) 26%, var(--bg));
  --box-bg: color-mix(in srgb, var(--text) 5%, var(--bg));
  --box-bg-hi: color-mix(in srgb, var(--text) 12%, var(--bg));
}
:root[data-theme="light"] .deck-article, :root[data-theme="light"] .viz-tip {
  --s-hero: #eda100;
  --s-rest: color-mix(in srgb, var(--text) 22%, var(--bg));
  --box-bg: color-mix(in srgb, var(--text) 4%, var(--bg));
  --box-bg-hi: color-mix(in srgb, var(--text) 10%, var(--bg));
}
.viz-host[data-viz="suppression"], .viz-host[data-viz="order"] { container-type: inline-size; }
.viz-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.viz-title { margin-right: auto; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.viz-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); }
.viz-seg button {
  border: 0; background: none; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
  font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted);
}
.viz-seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.viz-tip {
  position: fixed; z-index: 80; pointer-events: none;
  min-width: 150px; max-width: 260px; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 92%, var(--text)); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 12.5px; line-height: 1.5; color: var(--text);
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s ease, transform 0.12s ease;
}
.viz-tip.on { opacity: 1; transform: none; }
.viz-tip b { display: block; font-size: 13px; margin-bottom: 4px; }
.viz-tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 6px; }
.viz-tip .row span:first-child { color: var(--muted); }

.flow-sub { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.flow-ctl { margin-bottom: 20px; }
.flow { display: flex; align-items: flex-start; }
.flow-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: stretch; transition: opacity 0.25s ease; }
.flow-node {
  min-height: 78px; box-sizing: border-box; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--box-bg);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}
.flow-node b { font-size: 14px; line-height: 1.25; color: var(--text); }
.flow-node span { font-size: 12px; line-height: 1.35; color: var(--muted); }
.flow-step:not(.is-end) .flow-node { cursor: default; }
.flow-step:not(.is-end) .flow-node:hover, .flow-step:not(.is-end) .flow-node:focus-visible { background: var(--box-bg-hi); }
.flow-link { flex: 0 0 34px; height: 78px; display: flex; align-items: center; justify-content: center; color: var(--s-rest); transition: color 0.25s ease, opacity 0.25s ease; }
.flow-arrow { display: block; line-height: 0; }
.flow-link svg { width: 26px; height: 8px; }
.flow-rej { height: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 6px; color: var(--s-rest); transition: color 0.25s ease; }
.flow-rej svg { width: 8px; height: 30px; }
.flow-rej code, .flow-case code {
  font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--text);
}
.flow-rej code { opacity: 0; transition: opacity 0.25s ease; }
.flow-step.is-end .flow-rej { padding-top: 42px; }
.flow-step.on .flow-node { border-color: var(--s-hero); box-shadow: inset 0 0 0 1px var(--s-hero); }
.flow-link.on { color: var(--s-hero); }
.flow-step.stop .flow-rej { color: var(--s-hero); }
.flow-step.stop .flow-rej code { opacity: 1; }
.flow-step.off, .flow-link.off { opacity: 0.4; }
.flow-note { margin: 0; font-size: 12.5px; font-style: italic; text-align: center; color: var(--muted); }
.flow-case { margin: 10px 0 0; font-size: 13px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }

@container (max-width: 540px) {
  .flow { flex-direction: column; align-items: stretch; }
  .flow-step { flex-direction: row; align-items: center; }
  .flow-node { flex: 1 1 auto; min-height: 66px; }
  .flow-rej { flex: 0 0 104px; height: auto; flex-direction: row; justify-content: flex-start; padding: 0 0 0 10px; gap: 8px; }
  .flow-rej .flow-arrow { transform: rotate(-90deg); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
  .flow-step.is-end .flow-rej { padding: 0 0 0 48px; }
  .flow-link { flex: 0 0 auto; height: 30px; margin-right: 104px; }
  .flow-link .flow-arrow { transform: rotate(90deg); }
  .flow-note { text-align: right; margin-top: 8px; }
}

.seq { list-style: none; margin: 8px 0 0; padding: 0; display: flex; gap: 8px; counter-reset: none; }
.seq-step {
  flex: 1 1 0; min-width: 0; box-sizing: border-box; padding: 12px 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--box-bg);
  cursor: default; outline: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.viz-host ol.seq { padding: 0; margin: 8px 0 0; }
.viz-host .seq-step { margin: 0; }
.viz-host .seq-step::marker { content: none; }
.seq-step b { font-size: 14px; line-height: 1.25; color: var(--text); }
.seq-step span { font-size: 12px; line-height: 1.4; color: var(--muted); }
.seq:has(.seq-step.on) .seq-step:not(.on) { opacity: 0.55; }
.seq-step { transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease; }
.seq-step.on { background: var(--box-bg-hi); border-color: var(--text); }
.seq-step.on span { color: var(--text); }
.seq-rule { margin: 16px 0 0; min-height: 3em; font-size: 13px; line-height: 1.5; font-style: italic; text-align: center; color: var(--muted); }
.seq-rule.is-rule { font-style: normal; color: var(--text); }

@container (max-width: 540px) {
  .seq { flex-direction: column; gap: 6px; }
  .seq-step { padding: 10px 14px; }
}

.viz-host[data-viz="test-evidence"] { container-type: inline-size; min-width: 0; }
.viz-cap { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.viz-gl { display: block; width: 100%; aspect-ratio: 16 / 10; }
.ev { display: flex; gap: 20px; align-items: stretch; margin-top: 8px; }
.ev-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ev-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 2px; }
.ev-h b { font-size: 14px; color: var(--text); }
.ev-h span { font-size: 12px; color: var(--muted); }
.ev-areas { display: grid; gap: 8px; }
.ev-area {
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--box-bg);
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.ev-target {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--text) 40%, var(--border)); border-radius: 10px;
  cursor: default; outline: none; transition: background 0.2s ease;
}
.ev-target:hover, .ev-target:focus-visible { background: var(--box-bg); }
.ev-target b { font-size: 14px; color: var(--text); }
.ev-target > span { font-size: 12px; line-height: 1.4; color: var(--muted); }
.ev-wave { position: relative; margin-top: 6px; }
.ev-wave .viz-gl { aspect-ratio: 4 / 1; }
.ev-lab { position: absolute; font-size: 11px; color: var(--muted); pointer-events: none; }
.ev-lab-thr { right: 0; top: -2px; }
.ev-lab-room { left: 0; bottom: -2px; }
.ev-codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ev-codes code {
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; color: var(--text);
}
@container (max-width: 540px) {
  .ev { flex-direction: column; gap: 16px; }
  .ev-areas { grid-template-columns: 1fr 1fr; }
}
