/* Diagrams + stepped animations (engine: viz.js). Static fallback shows the last frame
   plus the numbered step list; viz-live (added by JS) swaps the list for the player. */
.viz { margin: 0 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-2); padding: var(--sp-3); outline: none; }
.viz:focus-visible { box-shadow: var(--focus); }
.viz-stage { overflow-x: auto; }
.vz-svg { display: block; min-width: 420px; max-height: 420px; font-family: var(--font); }
.viz figcaption { font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-2); }
.viz figcaption strong { color: var(--accent); }
.viz-fallback { font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-2) 0 0; padding-left: 1.4em; }
.viz.viz-live .viz-fallback { display: none; }
.viz-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.viz:not(.viz-live) .viz-controls { display: none; }
.viz-btn { font-size: var(--fs-xs); padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text-2); cursor: pointer; }
.viz-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.viz-btn:disabled { opacity: .4; cursor: default; }
.viz-btn.is-playing { border-color: var(--accent); color: var(--accent); }
.viz-count { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.viz-progress { flex: 1 1 80px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; min-width: 60px; }
.viz-progress-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.viz-note { flex-basis: 100%; margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--text); min-height: 1.6em; }

/* SVG parts */
.vz-box { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.5; transition: fill .3s ease, stroke .3s ease; }
.vz-box-rim { fill: none; stroke: var(--line); stroke-width: 1.5; }
.vz-label { fill: var(--text); font-size: 13px; text-anchor: middle; }
.vz-rowlabel { fill: var(--muted); font-size: 12px; text-anchor: end; }
.vz-line { fill: none; stroke: var(--faint); stroke-width: 1.8; transition: stroke .3s ease; }
.vz-head { fill: var(--faint); transition: fill .3s ease; }
.vz-elabel { fill: var(--text-2); font-size: 11.5px; text-anchor: middle; font-family: var(--mono); }
.vz-elabel.vz-left { text-anchor: start; }
.vz-elabel-bg { fill: var(--bg-2); }
.vz-lifeline { stroke: var(--line); stroke-dasharray: 4 5; }
.vz-node, .vz-edge, .vz-cell, .vz-row { transition: opacity .3s ease; }
.vz-edge.is-dash .vz-line { stroke-dasharray: 6 5; }

.vz-node.tone-accent .vz-box { stroke: var(--accent); }
.vz-node.tone-ok .vz-box { stroke: var(--ok); }
.vz-node.tone-warn .vz-box { stroke: var(--warn); }
.vz-node.tone-bad .vz-box { stroke: var(--bad); }
.vz-node.tone-muted .vz-box { fill: var(--bg-2); stroke-dasharray: 4 3; }

.is-hl > .vz-box, .vz-cell.is-hl .vz-box, .vz-row.is-hl .vz-box { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.2; }
.vz-edge.is-hl .vz-line { stroke: var(--accent); stroke-width: 2.6; }
.vz-edge.is-hl .vz-head { fill: var(--accent); }
.vz-edge.is-hl .vz-elabel { fill: var(--text); font-weight: 600; }
.vz-edge.is-past .vz-line { stroke: var(--muted); }
.vz-edge.is-past .vz-head { fill: var(--muted); }
.is-bad > .vz-box, .vz-cell.is-bad .vz-box { fill: var(--bad-soft); stroke: var(--bad); }
.is-dim { opacity: .3; }
.is-hidden { opacity: 0; }
.vz-cell.is-empty .vz-box { fill: transparent; stroke-dasharray: 4 3; }
