.deck-article, .viz-tip {
  --s-hero: #c98500; --s-rival: #3987e5;
  --s-rest: color-mix(in srgb, var(--text) 26%, var(--bg));
  --viz-grid: color-mix(in srgb, var(--text) 10%, transparent);
  --viz-surface: var(--bg);
}
:root[data-theme="light"] .deck-article, :root[data-theme="light"] .viz-tip {
  --s-hero: #eda100; --s-rival: #2a78d6;
  --s-rest: color-mix(in srgb, var(--text) 22%, var(--bg));
}
.viz-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.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; 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-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-legend i.dash { height: 0; border-radius: 0; border-top: 1.5px dashed var(--muted); }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-svg text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.viz-svg .grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-svg .ref { stroke: color-mix(in srgb, var(--text) 40%, transparent); stroke-width: 1; stroke-dasharray: 4 4; }
.viz-svg .flag { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.viz-svg .flag-zone { fill: color-mix(in srgb, var(--text) 4%, transparent); }
.viz-svg .line-hero { fill: none; stroke: var(--s-hero); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .line-rival { fill: none; stroke: var(--s-rival); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.viz-svg .cross { stroke: color-mix(in srgb, var(--text) 45%, transparent); stroke-width: 1; }
.viz-svg .dot-hero { fill: var(--s-hero); stroke: var(--viz-surface); stroke-width: 2; }
.viz-svg .dot-rival { fill: var(--s-rival); stroke: var(--viz-surface); stroke-width: 2; }
.viz-svg .mark { fill: var(--viz-surface); stroke: var(--text); stroke-width: 1.5; }
.viz-svg .val { fill: var(--text); font-weight: 600; }
.viz-tip {
  position: fixed; z-index: 80; pointer-events: none;
  min-width: 150px; max-width: 240px; 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; }
.viz-tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.viz-tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.viz-tip q { display: block; margin-bottom: 6px; color: var(--muted); font-style: italic; }
.hb { display: grid; gap: 14px; }
.hb-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; align-items: center; gap: 12px; cursor: default; outline: none; }
.hb-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.hb-name small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.hb-track { position: relative; height: 14px; }
.hb-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--s-rest); }
.hb-row.is-hero .hb-fill { background: var(--s-hero); }
.hb-row:hover .hb-fill, .hb-row:focus-visible .hb-fill { filter: brightness(1.2); }
.hb-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.hb-rule { position: absolute; top: -7px; bottom: -7px; border-left: 1.5px dashed var(--muted); pointer-events: none; }
.hb-wrap { position: relative; }
.hb-axis { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hb-axis > div { position: relative; height: 14px; }
.hb-axis span { position: absolute; transform: translateX(-50%); }
@media (max-width: 640px) {
  .hb-row, .hb-axis { grid-template-columns: 112px minmax(0, 1fr) 32px; gap: 8px; }
  .hb-name { font-size: 12px; }
  .hb-name small { font-size: 10.5px; }
}
.viz-host { width: 100%; 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; }
@media (max-width: 640px) { .viz-gl { aspect-ratio: 4 / 3; } }
.fc { display: flex; align-items: stretch; gap: 8px; }
.fc-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fc-h { font-size: 12px; color: var(--muted); }
.fc-arrow { flex: 0 0 24px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.fc-arrow svg { display: block; }
.fc-metric {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: none; cursor: pointer;
  font-family: var(--font); text-align: left; color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.fc-metric b { font-size: 13.5px; }
.fc-metric span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fc-metric:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.fc-metric[aria-pressed="true"] { border-color: var(--s-hero); box-shadow: inset 0 0 0 1px var(--s-hero); }
.fc-metric[aria-pressed="true"] span { color: var(--text); }
.fc-note { font-size: 12px; line-height: 1.4; color: var(--muted); }
.fc-flags { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.fc-flag {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--muted); opacity: 0.45;
  transition: opacity 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.fc-flag.on { opacity: 1; color: var(--text); border-color: var(--s-hero); }
.fc-flag.is-src { opacity: 1; background: color-mix(in srgb, var(--text) 8%, transparent); }
.fc-slot {
  display: flex; align-items: center; min-height: 40px; padding: 0 12px; box-sizing: border-box;
  border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.fc-slot.on { border-style: solid; border-color: color-mix(in srgb, var(--text) 55%, var(--border)); color: var(--text); font-weight: 600; }
.viz-host.is-stack .fc { flex-direction: column; gap: 6px; }
.viz-host.is-stack .fc-arrow { flex-basis: 22px; }
.viz-host.is-stack .fc-arrow svg { transform: rotate(90deg); }
.df-panel[hidden] { display: none; }
.df-sent { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; padding: 8px 0 4px; }
.df-tok {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--mono, ui-monospace, monospace); font-size: 14px; color: var(--muted); cursor: default; outline: none;
}
.df-tok.is-hit { color: var(--text); border-color: color-mix(in srgb, var(--text) 55%, var(--border)); }
.df-pair { position: relative; display: flex; gap: 8px; padding-bottom: 30px; }
.df-pair .df-tok { color: var(--text); border-color: var(--s-hero); }
.df-pair::after { content: ""; position: absolute; left: 4px; right: 4px; top: 44px; height: 8px; border: 1.5px solid var(--s-hero); border-top: 0; border-radius: 0 0 6px 6px; }
.df-pairlab { position: absolute; left: 0; top: 56px; white-space: nowrap; font-size: 12px; color: var(--text); }
.df-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.df-list span { margin-right: 4px; }
.df-list code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--text); }
.df-list code.is-dead { text-decoration: line-through; text-decoration-color: var(--s-hero); text-decoration-thickness: 2px; }
.df-wave { position: relative; }
.df-labs { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr; pointer-events: none; }
.df-lab { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; align-content: flex-start; font-size: 12px; color: var(--muted); }
.df-lab b { font-size: 13px; color: var(--text); }
.df-lab.is-low span { color: var(--text); }
.viz-svg.dg text { font-size: 11.5px; }
.dg .dg-zone { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; fill: var(--muted); }
.dg .dg-bound { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.dg .dg-link { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.dg .dg-head { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dg .dg-node rect { fill: var(--bg); stroke: var(--border); stroke-width: 1; transition: fill 0.15s ease; }
.dg .dg-node.is-hero rect { stroke: var(--s-hero); stroke-width: 1.5; }
.dg .dg-node:hover rect, .dg .dg-node:focus-visible rect { fill: color-mix(in srgb, var(--text) 6%, var(--bg)); }
.dg .dg-node { outline: none; cursor: default; }
.dg .dg-name { font-size: 13.5px; font-weight: 700; fill: var(--text); }
