/* A single explanation surface, inside the existing graph card. */
.feature-explorer{position:absolute;inset:0;z-index:5;background:var(--surface);display:flex;flex-direction:column;
  padding:clamp(10px,1.2vw,28px);gap:8px;container-type:inline-size;animation:fx-enter .25s ease-out}
.feature-explorer[hidden]{display:none}
.stage.exploring>#gfx,.stage.exploring>.ovl,.stage.exploring>.divider{visibility:hidden}
.fx-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px;flex:none}
.fx-head strong{font-size:clamp(14px,2.7cqw,25px);font-weight:500;line-height:1.25}
.fx-head strong>b{font-size:.78em;letter-spacing:.04em;color:var(--primary);margin-right:8px}
.fx-close,.fx-play{display:inline-flex;justify-content:center;align-items:center;width:30px;height:30px;
  flex:none;background:transparent;border:1px solid var(--outline);border-radius:5px;color:var(--ink2);cursor:pointer;padding:3px}
.fx-controls{display:flex;flex-wrap:wrap;gap:4px;flex:none;min-height:30px}
.fx-controls button,.fx-inspect button,.explore-launch{font:500 clamp(12px,2.3cqw,19px) 'Roboto',sans-serif;
  color:var(--ink2);background:var(--surface);border:1px solid var(--outline);border-radius:5px;padding:5px 10px;cursor:pointer;white-space:nowrap}
.fx-controls button[aria-pressed=true]{color:var(--primary);background:var(--primary-soft);border-color:var(--primary)}
.fx-controls button:disabled{opacity:.4;cursor:default}
.fx-tabs,.fx-options{display:flex;gap:4px;flex-wrap:wrap}
.fx-tabs{padding-right:8px;margin-right:4px;border-right:1px solid var(--outline2)}
.fx-tabs button{border-color:transparent;padding-inline:6px}
.fx-visual{flex:1;min-height:0;position:relative;overflow:hidden;background:var(--surface2);border-radius:6px}
.fx-visual svg{display:block;width:100%;height:100%;font-family:'Roboto',sans-serif;color:var(--ink);fill:var(--ink2)}
.fx-visual text{font-size:15px;pointer-events:none}
.fx-visual path{pointer-events:none}
.fx-visual .fx-title{font-size:17px;font-weight:700}
.fx-visual .fx-label{font-size:15px;font-weight:500;fill:var(--ink2)}
.fx-visual .fx-small{font-size:14px}
.fx-visual .fx-tile{font-size:12px;font-weight:500}
.fx-visual .fx-order{font:500 12px 'Roboto Mono',monospace;fill:var(--ink2)}
.fx-visual .fx-edge{font:500 11px 'Roboto Mono',monospace;fill:var(--ink2)}
.fx-visual .fx-value{font:500 14px 'Roboto Mono',monospace}
.fx-visual .fx-node-letter{font-size:16px;font-weight:700}
.fx-schema{cursor:pointer;outline:none}
.fx-schema:focus-visible{outline:2px solid var(--primary);outline-offset:3px}
.fx-schema:hover rect{stroke-width:2.5}
.fx-binding,.fx-skipped{stroke-dasharray:4 5}
.fx-skipped{opacity:.35}
.fx-waste{opacity:.35;stroke-dasharray:3 4}
.fx-flow{stroke-linecap:round}
.fx-inspect{font-size:clamp(12px,2.45cqw,21px);line-height:1.4;color:var(--ink2);min-height:3em;flex:none}
.fx-inspect strong{color:var(--ink);font-weight:500}
.fx-inspect button{padding:2px 7px;color:var(--primary);margin-left:4px;font-size:inherit}
.fx-replay{display:flex;align-items:center;gap:8px;flex:none;min-height:30px}
.fx-replay input{min-width:44px;flex:1;accent-color:var(--primary);cursor:ew-resize}
.fx-replay>span{font-size:clamp(10px,1.95cqw,15px);color:var(--ink2);white-space:nowrap}
.explore-launch{position:absolute;right:12px;bottom:12px;z-index:3;box-shadow:var(--shadow);color:var(--primary);font-size:13px}
.explore-launch[hidden]{display:none}
.glrow.inspected{outline:2px solid var(--primary);outline-offset:-1px;background:var(--primary-soft)!important;opacity:1!important}
#q-pred.explained{outline:2px solid var(--primary);outline-offset:3px;border-radius:3px}
.step.preview{color:var(--primary);border-color:var(--primary);background:var(--primary-soft)}
.rail-source{font-size:clamp(11px,3cqw,20px);color:var(--ink2);margin-bottom:6px}
.run-comparison{width:100%;height:100%;flex:1;border-collapse:collapse;font-size:clamp(13px,4cqw,27px);font-variant-numeric:tabular-nums;table-layout:fixed}
.run-comparison th,.run-comparison td{padding:3px 4px;text-align:right;border-bottom:1px solid var(--outline2);white-space:nowrap}
.run-comparison thead th{color:var(--ink2);font-size:.85em;font-weight:400;padding-top:0}
.run-comparison th:first-child{width:30%;text-align:left;font-weight:400}
.run-comparison th:nth-child(2){width:42%}
.run-comparison td{font-family:'Roboto Mono',monospace}
.run-comparison tbody th small{font-size:.72em;display:inline-block;color:var(--good);margin-left:5px}
.run-comparison tbody th small.slower{color:var(--bad)}
.run-comparison .run-execute{position:relative}
.run-comparison .run-execute span{position:relative}
.run-comparison .unit{font:400 .68em 'Roboto',sans-serif;color:var(--ink2)}
.run-comparison tr.current th{color:var(--primary)}
.run-comparison tr.running .run-execute span{font:400 .85em 'Roboto',sans-serif;color:var(--primary)}
@media(max-width:1200px){
  .run-comparison{font-size:clamp(13px,2.4vw,18px)}
  .rail-source{font-size:clamp(11px,1.8vw,14px)}
}
@container(max-width:500px){.fx-tabs{width:100%;border-right:0}.fx-options{width:100%}.fx-options button{flex:1;padding-inline:6px}}
@container(max-width:350px){.fx-head strong{font-size:13px}.fx-head strong>b{margin-right:3px}.fx-replay>span{max-width:110px;white-space:normal;line-height:1.2}.fx-inspect{font-size:12px}.fx-visual{min-height:200px;overflow:auto}.fx-visual svg{min-width:440px}.fx-controls button{font-size:11px;padding-inline:7px}}
@keyframes fx-enter{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.feature-explorer{animation:none}}
/* SSRF: keep the original graph and inspect its intermediate rows below. */
.feature-explorer.profile-explorer{background:transparent;padding:0;display:block;pointer-events:none;animation:none}
.profile-explorer button{pointer-events:auto;cursor:pointer;font-family:'Roboto',sans-serif}
.stage.exploring-profile>.disclose{visibility:hidden}
.profile-tether{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
.profile-tether path{fill:none;stroke-width:1;stroke-dasharray:3 3;opacity:.16;transition:opacity .3s,stroke-width .3s}
.profile-tether path.done{opacity:.36}
.profile-tether path.selected{stroke-width:1.5;opacity:.8}
.profile-pin{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;border:1px solid #6a1b9a;border-radius:50%;padding:5px;background:#fff;color:#6a1b9a;box-shadow:0 0 0 3px #fff8}
.profile-pin i{width:9px;height:9px;background:#6a1b9a;border-radius:50%;flex:none}
.profile-pin.selected{outline:2px solid #6a1b9a;outline-offset:2px}
.attached-profiles{position:absolute;left:15%;right:15%;display:flex;justify-content:space-around;gap:5px}
.attached-profiles button{border:0;padding:3px;background:#fffffff2;color:var(--profile-color);display:flex;align-items:center;border-radius:50%}
.attached-profiles i{font-style:normal;border-radius:50%;background:var(--profile-color);color:#fff;display:grid;place-items:center;width:22px;height:22px;font-size:12px}
.attached-profiles button.done{opacity:.82}
.attached-profiles button.selected{outline:1.5px solid var(--profile-color);outline-offset:1px}
.profile-bar{position:absolute;bottom:8px;left:50%;transform:translateX(-50%);display:flex;align-items:center;padding:5px 9px;border:1px solid var(--outline);border-radius:6px;background:#fffffff2;font-size:clamp(10px,1.65cqw,16px);color:var(--ink2);white-space:nowrap}
.profile-bar>span{display:flex;align-items:center;gap:9px}.profile-bar strong{color:var(--primary);font-weight:500}.profile-bar i{font-style:normal;color:var(--ink3)}
.profile-query #q-profile-attach{outline:2px dashed var(--primary);outline-offset:5px;border-radius:3px;background:var(--primary-soft);cursor:pointer}
.tab[hidden]{display:none}
.intermediate{height:100%;display:flex;flex-direction:column;gap:6px;min-height:210px;font-family:'Roboto',sans-serif}
.intermediate-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:0 2px}
.intermediate-head strong{font-size:clamp(15px,1.25cqw,25px);font-weight:500;display:block}
.intermediate-head small{font-size:clamp(12px,.94cqw,19px);color:var(--ink2);display:block;margin-top:1px}
.intermediate-progress{font:400 clamp(20px,1.8cqw,32px) 'Roboto Mono',monospace;color:var(--primary);font-variant-numeric:tabular-nums}
.intermediate-progress i{font-size:.58em;font-style:normal;color:var(--ink3);margin-left:2px}
.intermediate-compare{flex:1;min-height:148px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;align-items:stretch;overflow:hidden}
.iformat{min-width:0;display:flex;flex-direction:column;border:1px solid var(--outline);border-radius:7px;overflow:hidden;background:var(--surface)}
.iformat header,.iformat footer{height:32px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 9px;color:var(--ink2);font-size:clamp(13px,1cqw,19px)}
.iformat header{border-bottom:1px solid var(--outline2)}.iformat header span{color:var(--ink);font-weight:500}.iformat header small{font-size:.92em}
.iformat footer{border-top:1px solid var(--outline2);font-family:'Roboto Mono',monospace;font-variant-numeric:tabular-nums}
.iformat.columnar footer .null-total{color:#a33b35}.iformat.ssrf-output footer span:last-child{color:var(--primary)}
.union-columns{height:22px;flex:none;display:grid;grid-template-columns:minmax(76px,.58fr) minmax(0,2.1fr);align-items:center;gap:4px;padding:0 6px;color:var(--ink3);font-size:clamp(11px,.8cqw,15px);text-align:center;border-bottom:1px solid var(--outline2)}
.iformat-rows{flex:1;min-height:0;display:grid;grid-template-rows:repeat(5,minmax(21px,1fr));gap:1px;padding:2px;background:var(--surface2)}
.iformat-row,.tuple-row{min-width:0;border:0;border-radius:3px;padding:2px 4px;display:grid;align-items:center;gap:3px;background:var(--surface);color:var(--ink3);font:400 clamp(12px,.88cqw,17px) 'Roboto Mono',monospace;opacity:.34;transition:opacity .3s,background-color .3s,box-shadow .3s,transform .3s;cursor:pointer}
.columnar .iformat-row{grid-template-columns:minmax(76px,.58fr) minmax(0,2.1fr)}
.iformat-row.done,.tuple-row.done{opacity:1}.iformat-row.selected,.tuple-row.selected{box-shadow:inset 2px 0 var(--primary);background:var(--primary-soft);transform:translateX(1px)}
.irecord{min-width:0;display:flex;align-items:center;gap:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:'Roboto',sans-serif;color:var(--ink2)}
.irecord i{width:7px;height:7px;border-radius:50%;background:var(--profile-color);flex:none}
.islots{min-width:0;display:grid;grid-template-columns:repeat(5,minmax(8px,1fr));gap:2px}
.islot{height:13px;min-width:0;border-radius:2px;background:color-mix(in srgb,var(--profile-color) 76%,white);overflow:hidden}
.islot small{display:block;padding:1px 2px;color:#fff;font-size:.68em;line-height:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.union-track{position:relative;height:17px;min-width:0;border:1px solid #d8dce1;border-radius:3px;overflow:hidden;background:repeating-linear-gradient(45deg,#e1e4e8 0 2px,#f5f6f7 2px 6px)}
.union-values{position:absolute;left:var(--slot-start);top:0;bottom:0;width:18%;min-width:82px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:1px}
.union-values .islot{height:100%;border-radius:1px}.union-values .islot small{line-height:15px}
.ssrf-body{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1.48fr) minmax(210px,1.12fr);gap:3px;padding:2px;background:var(--surface2)}
.tuple-store{min-height:0;display:grid;grid-template-rows:18px repeat(5,minmax(19px,1fr));gap:1px}
.ssrf-label{display:grid;grid-template-columns:38px minmax(90px,1fr) 62px;align-items:center;text-align:center;color:var(--ink3);font-size:clamp(10px,.75cqw,14px);background:var(--surface)}
.ssrf-label b{font-weight:500;color:var(--ink2)}
.tuple-row{grid-template-columns:36px minmax(100px,1fr) 60px}
.tuple-offset{text-align:right;color:var(--ink3);font-variant-numeric:tabular-nums}
.tuple-row:not(.done)>.tuple-offset,.tuple-row:not(.done)>.islots,.tuple-row:not(.done)>.schema-pointer{visibility:hidden;opacity:0}
.tuple-row.done.selected .islot{animation:tuple-slot-in .32s ease-out both}.tuple-row.done.selected .islot:nth-child(2){animation-delay:.05s}.tuple-row.done.selected .islot:nth-child(3){animation-delay:.10s}.tuple-row.done.selected .islot:nth-child(4){animation-delay:.15s}.tuple-row.done.selected .islot:nth-child(5){animation-delay:.20s}
.schema-pointer{justify-self:end;display:flex;align-items:center;gap:4px;color:var(--ink2);font-size:.82em;transition:opacity .2s .25s}.schema-pointer i{width:8px;height:8px;border-radius:50%;background:var(--profile-color);flex:none}.schema-pointer span{white-space:nowrap}
.schema-infos{min-height:0;display:grid;grid-template-rows:18px repeat(5,minmax(19px,1fr));gap:1px;font:400 clamp(10px,.76cqw,14px) 'Roboto Mono',monospace;overflow:hidden;border-left:1px solid var(--outline2)}
.schema-infos>b{display:grid;place-items:center;background:var(--surface);color:var(--ink2);font:500 1em 'Roboto',sans-serif}
.schema-infos>span{min-width:0;display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);align-items:center;gap:8px;padding:1px 7px;background:var(--surface);color:var(--ink3);white-space:nowrap;overflow:hidden;transition:background-color .25s,box-shadow .25s}
.schema-infos>span.selected{background:var(--primary-soft);box-shadow:inset 2px 0 var(--primary)}.schema-infos small{font-size:1em;color:var(--ink)}.schema-infos>span>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.schema-infos code{min-width:0;justify-self:end;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink3);font:inherit}
@container(max-width:650px){.intermediate{min-height:240px}.intermediate-compare{grid-template-columns:1fr;gap:4px;overflow:auto}.iformat{min-height:145px}.intermediate-head small{max-width:250px}}
@container(max-width:350px){.attached-profiles{left:5%;right:5%}.attached-profiles button span{display:none}.profile-pin{font-size:10px}.profile-bar>span{font-size:10px;line-height:1.2}.intermediate-head{flex-wrap:wrap}}
@media(prefers-reduced-motion:reduce){.iformat-row,.tuple-row,.schema-infos>span{transition:none}}
@keyframes tuple-slot-in{from{opacity:0;transform:translateX(-7px)}to{opacity:1;transform:none}}
/* SI and GEM explain the existing canvas instead of replacing it. */
.feature-explorer.graph-feature{background:transparent;padding:0;display:block;pointer-events:none;animation:none}
.graph-feature button{pointer-events:auto;cursor:pointer}
.graph-feature-overlay{position:absolute;inset:0;width:100%;height:calc(100% - 48px);overflow:visible;pointer-events:none}
.graph-feature-overlay text{font:500 11px 'Roboto',sans-serif}
.gem-search-hud{position:absolute;z-index:4;top:10px;left:50%;transform:translateX(-50%);
  width:min(92%,860px);padding:7px 10px;border:1px solid var(--outline);border-radius:8px;
  background:color-mix(in srgb,var(--surface) 94%,transparent);box-shadow:var(--shadow);
  color:var(--ink);pointer-events:none;transition:opacity .3s ease,transform .3s ease}
.gem-search-hud[hidden]{display:none}
.gem-hud-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:5px}
.gem-hud-title{font:400 clamp(16px,2.05cqw,22px) 'Roboto',sans-serif;color:var(--ink2)}
.gem-equation{font:500 clamp(18px,2.45cqw,27px) 'Roboto Mono',monospace;color:var(--ink);white-space:nowrap}
.gem-equation span{transition:opacity .45s ease,transform .45s ease}
.gem-equation .gem-old-space{color:var(--ink3);text-decoration:line-through;text-decoration-thickness:1px}
.gem-equation .gem-arrow{display:inline-block;margin:0 .55em;color:var(--primary);text-decoration:none}
.gem-candidates{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}
.gem-candidate,.gem-group{display:flex;align-items:center;justify-content:center;min-width:0;padding:4px 5px;
  border:1px solid var(--outline2);border-radius:5px;background:var(--surface2);color:var(--ink3);
  font:400 clamp(13px,1.7cqw,17px) 'Roboto Mono',monospace;white-space:nowrap;
  transition:opacity .25s ease,background-color .25s ease,border-color .25s ease,color .25s ease,transform .25s ease}
.gem-candidate.done{color:var(--ink2);border-color:var(--outline)}
.gem-candidate.active{color:var(--bad);border-color:var(--bad);background:var(--bad-soft);transform:translateY(-1px)}
.gem-candidates:has(.gem-group){grid-template-columns:repeat(2,minmax(0,1fr))}
.gem-group.m{color:var(--fh2);border-color:var(--fh);background:var(--fh-soft)}
.gem-group.o{color:var(--ot2);border-color:var(--ot);background:var(--ot-soft)}
.gem-group.active{box-shadow:inset 0 0 0 1px currentColor;transform:translateY(-1px)}
.gem-lane-factors{position:absolute;z-index:4;top:50px;left:0;right:0;height:40px;pointer-events:none}
.gem-lane-factors[hidden]{display:none}
.gem-lane-factors span{position:absolute;top:0;transform:translateX(-50%);width:36px;height:36px;
  display:grid;place-items:center;border:1px solid currentColor;border-radius:50%;background:var(--surface);
  box-shadow:var(--shadow);font:500 18px 'Roboto Mono',monospace;transition:opacity .12s linear}
.gem-lane-factors .m{color:var(--fh2);border-color:var(--fh)}
.gem-lane-factors .o{color:var(--ot2);border-color:var(--ot)}
.gem-lane-factors i{position:absolute;left:50%;top:7px;transform:translateX(-50%);font:400 18px 'Roboto',sans-serif;
  color:var(--ink3);font-style:normal}
.graph-feature-bar{position:absolute;left:12px;right:12px;bottom:9px;display:flex;align-items:center;gap:7px;padding:6px 8px;border:1px solid var(--outline);border-radius:6px;background:#fff;box-shadow:var(--shadow);font-size:clamp(10px,1.9cqw,17px);color:var(--ink2);pointer-events:auto}
.graph-feature-bar>strong{font-size:.9em;color:var(--primary)}.graph-feature-summary{flex:1}.graph-feature-summary b{color:var(--ink);font-weight:500}
.graph-feature-options{display:flex;gap:3px}
.graph-feature-options button{border:1px solid var(--outline);border-radius:5px;padding:4px 7px;background:#fff;color:var(--ink2);font:500 clamp(10px,1.7cqw,15px) 'Roboto',sans-serif;white-space:nowrap}
.graph-feature-options button[aria-pressed=true]{color:var(--primary);border-color:var(--primary);background:var(--primary-soft)}
.graph-feature-bar>[data-action]{border:0;background:none;color:var(--ink2);padding:2px;display:flex}.graph-feature-bar .ms{font-size:18px}
.graph-feature[data-feature=gem] .graph-feature-bar{display:none}
.si-keep ellipse{fill:#e6f4ea55;stroke:var(--good);stroke-width:1.5;stroke-dasharray:5 4}.si-keep text{fill:var(--good)}
.si-rejected{transition:opacity .45s,transform .45s;transform-origin:center}.si-rejected rect{fill:#fdecebdd;stroke:var(--bad);stroke-width:1}.si-rejected text{fill:var(--bad);font-size:9px}.si-rejected path{fill:none;stroke:var(--bad);stroke-width:1;stroke-dasharray:3 4;opacity:.45}
.graph-feature.si-on .si-rejected{opacity:0;transform:scale(.55)}
.stage.exploring-graph>.disclose{visibility:hidden}
@container(max-width:500px){.graph-feature-bar{flex-wrap:wrap}.graph-feature-summary{min-width:45%}.graph-feature-options{order:3;width:100%}.graph-feature-options button{flex:1}.graph-feature-overlay{height:calc(100% - 80px)}}
@container(max-width:500px){.gem-search-hud{width:calc(100% - 16px);top:8px}.gem-hud-head{gap:6px}.gem-candidates{gap:2px}.gem-candidate{padding-inline:2px}}
@container(max-width:350px){.graph-feature-summary{font-size:10px}.graph-feature-options button{padding-inline:3px;font-size:9px}.si-rejected text{font-size:8px}}
.spin{display:inline-block;width:1em;height:1em;border:.14em solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .75s linear infinite;flex:none;box-sizing:border-box}
.step .spin{font-size:.95em}
@keyframes spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.spin{animation-duration:1.8s}}
#kpi-total{display:grid;grid-template-rows:minmax(0,1fr) auto;align-items:stretch;justify-content:normal}
#kpi-total .run-comparison{height:100%;min-height:0;align-self:stretch}
