/* Palette: blue = the model / what the agent does itself, orange = the harness, grey = environment, green = success. */
.viz {
  --ink: #111; --ink2: #444; --mid: #8a8a8a; --soft: #d9d9d9; --faint: #eeeeee; --paper: #f7f7f7;
  --a: #2f6fed; --a-ink: #2458c9; --a-mid: #9dbbf7; --a-soft: #d7e4fd; --a-tint: #eff4ff;
  --h: #ee6b2d; --h-ink: #bf4f17; --h-mid: #f6b48d; --h-soft: #fbdac7; --h-tint: #fff3ec;
  --ok: #1f9d55;
}
.viz-ctl { display: flex; gap: 8px; flex-wrap: wrap; }
.viz-seg button, .viz-btn { white-space: nowrap; }
.viz-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; flex-shrink: 0; }
.viz-dot.a { background: var(--a); }
.viz-dot.h { background: var(--h); }
.viz-tip { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; transition: opacity .15s; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.45; padding: 6px 9px; border-radius: 6px; white-space: nowrap; z-index: 5; }
.viz-tip span { color: #bdbdbd; }
.prose .viz pre { margin: 0; padding: 0; background: none !important; font-size: 11.5px; line-height: 1.5; border-radius: 0; overflow: visible; }
.prose .viz code { background: none; padding: 0; font-size: 1em; }
.prose .viz li { margin: 0; }
@keyframes viz-nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0); } 50% { box-shadow: 0 0 0 5px rgba(47, 111, 237, .18); } }
@keyframes viz-blink { 50% { opacity: 0; } }

/* 1. Harness */
.h-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.h-model { fill: var(--a); }
.h-eye { fill: #fff; }
.h-mouth { fill: none; stroke: #fff; stroke-linecap: round; }
.h-sweat { fill: var(--a-mid); }
.h-ghost { stroke: var(--a-mid); stroke-width: 1.5; stroke-dasharray: 4 4; }
.h-post { fill: none; stroke: var(--h); stroke-width: 5; stroke-linecap: round; }
.h-bar { fill: none; stroke: var(--h-mid); stroke-width: 3; stroke-linecap: round; }
.h-block rect { fill: var(--h-tint); stroke: var(--h-soft); }
.h-block text { font-size: 11px; font-weight: 500; fill: var(--h-ink); }
.h-lbl { font-size: 12px; fill: var(--mid); }
.h-hlbl { fill: var(--h-ink); font-weight: 600; }
.halo { paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.h-floor { stroke: var(--soft); stroke-width: 1.5; }
.h-axis { stroke: var(--faint); stroke-width: 2; }
.h-guide { stroke-width: 1.2; stroke-dasharray: 2 3; }
.h-guide.w { stroke: var(--h); }
.h-guide.wo { stroke: var(--a); }
.h-mark { opacity: .55; transition: opacity .2s; }
.h-mark.on { opacity: 1; }
.h-mark line { stroke-width: 2; }
.h-mark circle { opacity: 0; }
.h-mark.on circle { opacity: 1; }
.h-mark text { font-size: 11.5px; }
.h-mark.on text { font-weight: 600; }
.h-mark.w line { stroke: var(--h-mid); }
.h-mark.w circle { fill: var(--h); }
.h-mark.w text { fill: var(--h-ink); }
.h-mark.wo line { stroke: var(--a-mid); }
.h-mark.wo circle { fill: var(--a); }
.h-mark.wo text { fill: var(--a-ink); }
.h-pill { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.h-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.h-pill.w { background: var(--h-tint); color: var(--h-ink); }
.h-pill.w::before { background: var(--h); }
.h-pill.wo { background: var(--a-tint); color: var(--a-ink); }
.h-pill.wo::before { background: var(--a); }
.h-name { font-size: 22px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; }
.h-desc { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; min-height: 4.5em; }
.h-slider { margin: 18px 0 20px; }
.h-sl-title { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.h-range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; --p: 22%; }
.h-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--a) var(--p), var(--faint) var(--p)); }
.h-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--a); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.h-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--faint); }
.h-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--a); }
.h-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--a); }
.h-range:focus-visible { outline: 2px solid var(--a-soft); outline-offset: 4px; border-radius: 4px; }
.h-scale { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--muted); }
.h-toggle.nudge { animation: viz-nudge 1.2s ease-in-out 2; }

/* 2. Freehand */
.fh-row { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-top: 1px solid var(--line); align-items: center; }
.fh-row:first-child { border-top: 0; padding-top: 0; }
.fh-row:last-child { padding-bottom: 0; }
.fh-k { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.fh-v { margin-top: 3px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.fh-v .m { color: var(--h-ink); }
.fh-v .f { color: var(--a-ink); }
.fh-swap { display: inline-grid; }
.fh-swap > span { grid-area: 1 / 1; transition: opacity .4s, transform .4s; }
.fh-swap .f { opacity: 0; transform: translateY(4px); }
.is-free .fh-swap .m { opacity: 0; transform: translateY(-4px); }
.is-free .fh-swap .f { opacity: 1; transform: none; }
.fh-note { margin-top: 10px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.fh-pages { display: flex; gap: 8px; height: 62px; align-items: flex-start; }
.fh-page { width: 48px; height: 62px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; padding: 7px 6px; overflow: hidden; border: 1px solid var(--h-soft); border-radius: 5px; background: #fff; transition: all .5s ease var(--d); }
.fh-page i { display: block; height: 3px; flex-shrink: 0; border-radius: 2px; background: var(--h-mid); transition: all .4s ease var(--d); }
.is-free .fh-page:not(:first-child) { width: 0; padding: 0; margin-left: -8px; opacity: 0; border-color: transparent; }
.is-free .fh-page:first-child { width: 62px; height: 30px; border-color: var(--a); background: var(--a-tint); }
.is-free .fh-page:first-child i { background: var(--a); }
.is-free .fh-page:first-child i.x { height: 0; margin-top: -4px; opacity: 0; }
.fh-chips { position: relative; display: flex; flex-wrap: wrap; gap: 5px; }
.fh-chip { padding: 0 7px; font-size: 11.5px; line-height: 1.7; border: 1px solid var(--h-soft); border-radius: 5px; color: var(--h-ink); background: var(--h-tint); transition: opacity .35s ease var(--d), transform .35s ease var(--d), background .3s, color .3s, border-color .3s; }
.is-free .fh-chip:not(.keep) { opacity: 0; transform: translateY(6px) scale(.9); }
.is-free .fh-chip.keep { background: var(--a); border-color: var(--a); color: #fff; transition-delay: .35s; }
.fh-aside { position: absolute; left: 54px; right: 0; top: 1px; font-size: 12.5px; line-height: 1.5; color: var(--a-ink); opacity: 0; transition: opacity .4s .5s; pointer-events: none; }
.is-free .fh-aside { opacity: 1; }
.fh-bar { position: relative; display: flex; gap: 4px; padding-top: 20px; }
.fh-slot { flex: 1; height: 22px; display: grid; place-items: center; border: 1.5px solid transparent; border-radius: 4px; background: var(--h-soft); transition: all .4s ease var(--d); }
.fh-slot.empty { background: transparent; border: 1.5px dashed var(--soft); }
.fh-slot.bell { background: var(--h); }
.fh-slot b { font-size: 12px; color: #fff; transition: opacity .3s; }
.fh-slot em { font-style: normal; font-size: 13px; line-height: 1; color: var(--a-mid); opacity: 0; transition: opacity .3s ease var(--d); }
.fh-limit { position: absolute; left: 90%; top: 0; bottom: -4px; border-left: 2px solid var(--h); transition: opacity .4s; }
.fh-limit span { position: absolute; top: -1px; right: 6px; white-space: nowrap; font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--h-ink); }
.is-free .fh-limit { opacity: 0; }
.is-free .fh-slot:not(.empty) { background: var(--a); }
.is-free .fh-slot.prune { background: transparent; border: 1.5px dashed var(--a-mid); }
.is-free .fh-slot.prune em { opacity: 1; }
.is-free .fh-slot.bell b { opacity: 0; }

/* 3. Results */
.rs-sub { margin: 0 0 14px; line-height: 1.4; }
.rs-sub b { display: block; font-size: 13px; font-weight: 600; }
.rs-sub span { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.rs-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 20px; font-size: 12.5px; color: var(--ink2); }
.lg { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; box-sizing: border-box; }
.lg.fh { background: var(--a); }
.lg.fp { border: 2px solid var(--h); background: #fff; }
.lg.ot { background: #c4c4c4; }
.rs-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.rs-panel { min-width: 0; }
.rs-ph { margin-bottom: 8px; line-height: 1.4; }
.rs-ph b { display: block; font-size: 12.5px; font-weight: 600; }
.rs-ph span { display: block; font-size: 12px; color: var(--muted); }
.rs-bench { font-size: 12px; fill: var(--ink2); }
.rs-axis { stroke: var(--faint); }
.rs-grid { stroke: #f4f4f4; }
.rs-zero { stroke: var(--h-mid); stroke-dasharray: 3 3; }
.rs-tick { font-size: 11px; fill: var(--mid); }
.rs-dot { transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.rs-dot.ot > circle:first-child, .rs-dot.ot > path { fill: #c4c4c4; }
.rs-dot.fp > circle:first-child, .rs-dot.fp > path { fill: #fff; stroke: var(--h); stroke-width: 2; }
.rs-dot.fh > circle:first-child, .rs-dot.fh > path { fill: var(--a); }
.rs-dot .hit { fill: transparent; cursor: default; }
.rs-val { font-size: 11.5px; font-weight: 650; fill: var(--a-ink); }
.rs-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.rs-note:empty { display: none; }
.cc { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.cc-row { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: center; height: 30px; }
.cc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-name span { font-size: 13.5px; }
.cc-name small { font-size: 12px; color: var(--muted); }
.cc-track { position: relative; height: 100%; }
.cc-track::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1.5px solid var(--soft); }
.cc-group > div:first-child { align-self: end; padding-bottom: 3px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.cc-axis { height: 22px; }
.cc-axis .cc-track::before { display: none; }
.cc-axis .cc-track span { position: absolute; top: 0; white-space: nowrap; font-size: 12px; font-weight: 600; }
.cc-axis .l { right: calc(50% + 10px); color: var(--h-ink); }
.cc-axis .r { left: calc(50% + 10px); color: var(--a-ink); }
.cc-bar { position: absolute; top: 7px; height: 16px; width: 0; transition: width .9s cubic-bezier(.2, .7, .2, 1); }
.cc.in .cc-bar { width: var(--w); }
.cc-bar.neg { background: var(--h); border-radius: 4px 0 0 4px; }
.cc-bar.pos { background: var(--a); border-radius: 0 4px 4px 0; }
.cc-val { position: absolute; top: 6px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .3s .8s; }
.cc-bar.neg + .cc-val { color: var(--h-ink); }
.cc-bar.pos + .cc-val { color: var(--a-ink); }
.cc.in .cc-val { opacity: 1; }

/* 4. Code mode timeline */
.cm-svg { display: block; }
.cm-dot.h { fill: var(--h); }
.cm-dot.a { fill: var(--a); }
.cm-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.cm-stats { font-size: 12px; fill: var(--ink2); font-variant-numeric: tabular-nums; }
.cm-meter-lbl { font-size: 11px; fill: var(--mid); }
.cm-meter-bg { fill: var(--faint); }
.cm-meter.h { fill: var(--h); }
.cm-meter.a { fill: var(--a); }
.cm-row { font-size: 11.5px; fill: var(--mid); }
.cm-lane { stroke: var(--faint); }
.cm-grid { stroke: #f3f3f3; }
.cm-sep { stroke: var(--faint); }
.cm-tick { font-size: 11px; fill: var(--mid); }
.cm-model.h { fill: var(--h); }
.cm-model.a { fill: var(--a); }
.cm-api { fill: #cdcdcd; }
.cm-blabel { font-size: 11px; font-weight: 600; fill: #fff; transition: opacity .2s; }
.cm-head { stroke: var(--ink); stroke-dasharray: 2 2; }
.cm-done { font-size: 12px; font-weight: 650; }
.cm-done.a { fill: var(--a-ink); }

/* 5. Printer */
.pr { display: grid; grid-template-columns: 1fr 1fr; }
.pr-panel { min-width: 0; padding: 0 20px; }
.pr-panel:first-child { padding-left: 0; border-right: 1px solid var(--line); }
.pr-panel:last-child { padding-right: 0; }
.pr-h { display: flex; align-items: baseline; flex-wrap: wrap; line-height: 1.4; }
.pr-h b { margin-right: 8px; font-size: 13px; font-weight: 600; }
.pr-h span { font-size: 12px; color: var(--muted); }
.pr-svg { margin-top: 8px; }
.pr-status { min-height: 1.6em; margin-top: 6px; font-size: 13px; text-align: center; color: var(--ink2); }
.pr-status b { font-weight: 700; }
.pr-status.bad { color: var(--h-ink); }
.pr-status.ok { color: var(--ok); }
.pr-head { fill: #f3f3f3; stroke: #a3a3a3; stroke-width: 1.5; }
.pr-recess { fill: #3a3a3a; }
.pr-mark { font-size: 22px; font-weight: 700; }
.pr-mark.bad { fill: var(--h); }
.pr-mark.ok { fill: var(--ok); }
.pr-tray { fill: var(--faint); stroke: var(--soft); }
.pr-tool .ink { fill: var(--h); }
.pr-tool .hdl { fill: #fff; stroke: var(--h); stroke-width: 1.5; }
.pr-tool .jaw { fill: none; stroke: var(--h); stroke-width: 4; stroke-linecap: round; }
.pr-tool .arm { fill: none; stroke: var(--h); stroke-width: 3.5; stroke-linecap: round; }
.pr-tool .pin { fill: #fff; stroke: var(--h); stroke-width: 1.5; }
.pr-frame { fill: #fafafa; stroke: #a3a3a3; stroke-width: 1.5; }
.pr-bed { fill: #a3a3a3; }
.pr-rail { stroke: #d0d0d0; stroke-width: 2; }
.pr-nozzle { fill: #fff; stroke: #666; stroke-width: 1.5; }
.pr-tipn { fill: #666; }
.pr-bit { fill: var(--a); }

/* 6. Browser */
.br { display: grid; grid-template-columns: 1fr 1fr; }
.br-col { min-width: 0; padding: 0 20px; }
.br-col:first-child { padding-left: 0; border-right: 1px solid var(--line); }
.br-col:last-child { padding-right: 0; }
.br-h { margin-bottom: 12px; }
.br-t { display: flex; align-items: baseline; flex-wrap: wrap; line-height: 1.4; }
.br-t b { margin-right: 8px; font-size: 13px; font-weight: 600; }
.br-t span { font-size: 12px; color: var(--muted); }
.br-count { margin-top: 3px; font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: pre; }
.br-count.done.h { color: var(--h-ink); }
.br-count.done.a { color: var(--a-ink); }
.mk { overflow: hidden; border: 1px solid var(--soft); border-radius: 8px; font-size: 11px; line-height: 1.3; background: #fff; }
.mk-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--paper); border-bottom: 1px solid var(--faint); }
.mk-bar i { width: 6px; height: 6px; border-radius: 50%; background: var(--soft); }
.mk-bar span { flex: 1; margin-left: 6px; padding: 1px 8px; border-radius: 4px; background: #fff; font-size: 10.5px; color: var(--mid); }
.mk-page { position: relative; height: 160px; padding: 12px; transition: box-shadow .2s; }
.mk-search { display: flex; gap: 6px; }
.mk-input { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; border: 1px solid var(--soft); border-radius: 6px; transition: border-color .2s, box-shadow .2s; }
.mk-ph { color: #aaa; }
.mk-input:has(.mk-q:not(:empty)) .mk-ph { display: none; }
.mk-caret { display: none; width: 1px; height: 12px; margin-left: 1px; background: var(--ink); animation: viz-blink 1s steps(1) infinite; }
.mk.focus .mk-caret { display: block; }
.mk.results .mk-caret { display: none; }
.mk.h.focus .mk-input { border-color: var(--h); box-shadow: 0 0 0 3px var(--h-tint); }
.mk.a.focus .mk-input { border-color: var(--a); box-shadow: 0 0 0 3px var(--a-tint); }
.mk-btn { height: 26px; display: grid; place-items: center; padding: 0 11px; border-radius: 6px; background: var(--ink2); color: #fff; font-weight: 600; transition: transform .1s; }
.mk.press .mk-btn { transform: scale(.9); }
.mk-results { display: grid; gap: 3px; margin-top: 10px; opacity: 0; transition: opacity .3s; }
.mk.loading .mk-results { opacity: .25; }
.mk.results .mk-results { opacity: 1; }
.mk-row { display: flex; align-items: center; gap: 8px; height: 22px; padding: 0 5px; border-radius: 5px; transition: background .3s; }
.mk-row i { width: 14px; height: 14px; flex-shrink: 0; border-radius: 3px; background: var(--faint); }
.mk-row > div { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.mk-row b { font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.mk-row span { flex: 1; max-width: 90px; height: 3px; border-radius: 2px; background: var(--faint); }
.mk.read.h .mk-row { background: var(--h-tint); }
.mk.read.a .mk-row { background: var(--a-tint); }
.mk.scan .mk-page { box-shadow: inset 0 0 0 2px var(--h-mid); }
.mk-cursor { position: absolute; left: 62%; top: 104px; width: 11px; height: 16px; background: var(--ink); clip-path: polygon(0 0, 0 82%, 26% 64%, 45% 100%, 62% 92%, 44% 58%, 82% 58%); transition: left .35s ease, top .35s ease; }
.br-calls { list-style: none; margin: 12px 0 0; padding: 0; font-size: 12px; }
.br-calls li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; opacity: .3; transition: opacity .25s, background .25s; }
.br-n { font-size: 11px; color: var(--mid); font-variant-numeric: tabular-nums; }
.br-calls li code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.br-calls li code b { font-weight: 600; color: var(--h-ink); }
.br-calls .br-ret { font-size: 11.5px; white-space: nowrap; color: var(--mid); opacity: 0; transition: opacity .2s; }
.br-calls li.think { opacity: 1; background: var(--paper); }
.br-calls li.run { opacity: 1; background: var(--h-tint); }
.br-calls li.done { opacity: 1; }
.br-calls li.done .br-ret { opacity: 1; }
.br-code { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--paper); font-size: 11px; line-height: 1.6; color: var(--ink2); }
.br-callhead b { font-weight: 600; color: var(--a-ink); }
.br-lines { padding-left: 12px; }
.br-lines .ln { display: block; white-space: pre-wrap; overflow-wrap: anywhere; opacity: .3; transition: opacity .2s; }
.br-lines .ln.on { opacity: 1; }
.br-code .k { font-weight: 600; color: var(--a-ink); }
.br-code .s { color: #2f7d55; }
.br-out { display: flex; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--a-tint); color: var(--a-ink); font-size: 11.5px; line-height: 1.5; opacity: 0; transition: opacity .3s; }
.br-out.on { opacity: 1; }
.br-arrow { font-weight: 700; }

/* 7. Context */
.cx-meter { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.cx-mlbl { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.cx-track { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--faint); }
.cx-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ink2); }
.mode-self .cx-fill { background: var(--a); }
.mode-compact .cx-fill { background: var(--h); }
.cx-90 { position: absolute; left: 90%; top: -4px; bottom: -4px; border-left: 1.5px solid var(--ink2); }
.cx-90 span { position: absolute; bottom: 14px; left: 0; transform: translateX(-50%); font-size: 10.5px; font-style: normal; color: var(--mid); }
.cx-mtxt { min-width: 112px; text-align: right; color: var(--ink2); font-variant-numeric: tabular-nums; }
.cx-cmd { min-height: 34px; margin: 14px 0 12px; padding: 7px 12px; border-radius: 8px; background: #161616; color: #eee; font-size: 11.5px; line-height: 1.4; opacity: 0; transition: opacity .3s; }
.cx-cmd.on { opacity: 1; }
.cx-cmd .who { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #fff; }
.mode-self .cx-cmd .who { background: var(--a); }
.mode-compact .cx-cmd .who { background: var(--h); }
.cx-cmd .ps, .cx-cmd em { color: #8a8a8a; font-style: normal; }
.cx-cmd .ps { margin-right: 6px; }
.cx-file { overflow: hidden; border: 1px solid var(--soft); border-radius: 8px; }
.cx-fname { display: flex; justify-content: space-between; padding: 6px 12px 6px 32px; font-size: 11px; color: var(--mid); background: var(--paper); border-bottom: 1px solid var(--faint); }
.cx-lines { min-height: 190px; margin: 0; padding: 6px 0; list-style: none; counter-reset: ln; font-size: 11.5px; line-height: 1.5; }
.cx-lines li { counter-increment: ln; display: grid; grid-template-columns: 22px minmax(0, 1fr) 56px; gap: 10px; align-items: center; max-height: 5em; padding: 3px 12px 3px 0; overflow: hidden; transition: max-height .5s ease, opacity .4s ease, background .3s, padding .5s; }
.cx-lines li::before { content: counter(ln); text-align: right; color: #bbb; }
.cx-t { overflow-wrap: anywhere; color: var(--ink2); }
.cx-w { height: 6px; }
.cx-w i { display: block; height: 100%; margin-left: auto; border-radius: 3px; background: var(--soft); }
.cx-lines li.stale .cx-w i { background: var(--mid); }
.mode-self .cx-lines li.del { background: var(--a-tint); }
.cx-lines li.del .cx-t { text-decoration: line-through; color: var(--mid); }
.mode-compact .cx-lines li.sel { background: var(--h-tint); }
.cx-lines li.gone { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.cx-lines mark { background: none; color: inherit; border-radius: 2px; transition: background .3s, color .3s, box-shadow .3s; }
.cx-lines.facts mark { background: var(--a-soft); color: var(--a-ink); box-shadow: 0 0 0 2px var(--a-soft); }
.cx-lines li.cx-sum { counter-increment: none; background: var(--h-tint); }
.cx-lines li.cx-sum::before { content: '1'; }
.cx-lines li.cx-sum .cx-t { color: var(--h-ink); }
.cx-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 30px; margin-top: 12px; font-size: 12.5px; opacity: 0; transition: opacity .4s; }
.cx-note.on { opacity: 1; }
.cx-note b { margin-right: 4px; font-weight: 600; }
.cx-chip { padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.cx-chip.kept { background: var(--a-tint); color: var(--a-ink); }
.cx-chip.lost { background: var(--h-tint); color: var(--h-ink); text-decoration: line-through; }

/* 8. Architecture */
.ar { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; padding: 32px 14px 0; }
.ar-bg { grid-column: 1 / -1; grid-row: 1 / 3; margin: -32px -14px 0; border: 1.5px dashed var(--soft); border-radius: 12px; position: relative; pointer-events: none; }
.ar-bg span { position: absolute; top: 8px; left: 14px; font-size: 11px; color: var(--mid); }
.ar-card { grid-row: 1; grid-column: var(--c); position: relative; z-index: 1; padding: 10px 12px 12px; border: 1.5px solid var(--a); border-radius: 8px; background: #fff; }
.ar-ct { margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.prose .viz .ar-card pre { font-size: 11px; line-height: 1.55; color: var(--ink2); white-space: pre-wrap; word-break: break-all; }
.ar-card pre i { font-style: normal; border-radius: 3px; transition: background .4s, color .4s; }
.ar.hood .ar-card pre i { padding: 0 4px; background: var(--h); color: #fff; }
.ar-under { grid-row: 2; grid-column: var(--c); position: relative; z-index: 1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s ease; }
.ar.hood .ar-under { grid-template-rows: 1fr; }
.ar-under ol { min-height: 0; margin: 0; padding: 0 0 0 32px; overflow: hidden; list-style: none; }
.prose .viz .ar-under li { position: relative; display: flex; align-items: center; min-height: 46px; margin: 10px 0; padding: 6px 10px; border: 1px solid var(--h-soft); border-radius: 6px; background: var(--h-tint); font-size: 12px; line-height: 1.35; color: var(--ink2); opacity: 0; transform: translateY(-4px); transition: opacity .3s ease var(--d), transform .3s ease var(--d); }
.ar-under li::before { content: ''; position: absolute; left: -16px; top: 50%; width: 16px; border-top: 1.5px solid var(--h-mid); }
.prose .viz .ar.hood .ar-under li { opacity: 1; transform: none; }
.ar-wire { position: absolute; left: 16px; top: 0; bottom: 0; border-left: 1.5px solid var(--h-mid); }
.ar-packet { position: absolute; left: -4.5px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--h); opacity: 0; }
.ar.hood .ar-packet { animation: ar-packet 2.4s ease-in-out infinite; }
@keyframes ar-packet { 0% { top: 0; opacity: 0; } 10%, 85% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
.ar-end { grid-row: 3; grid-column: var(--c); position: relative; padding-top: 26px; }
.ar-end::before { content: ''; position: absolute; left: 16px; top: 0; height: 26px; border-left: 1.5px solid var(--a-mid); transition: border-color .4s; }
.ar.hood .ar-end::before { border-left-color: var(--h-mid); }
.ar-swap { display: inline-grid; padding: 4px 12px; border: 1px solid var(--soft); border-radius: 999px; background: var(--paper); font-size: 12.5px; color: var(--ink2); }
.ar-swap span { grid-area: 1 / 1; transition: opacity .4s; }
.ar-swap .b { opacity: 0; }
.ar.hood .ar-swap .a { opacity: 0; }
.ar.hood .ar-swap .b { opacity: 1; }

@media (max-width: 600px) {
  .viz-seg button, .viz-btn { font-size: 12px; padding: 6px 9px; }
  .viz-rl { display: none; }
  .h-grid { grid-template-columns: 1fr; gap: 12px; }
  .h-desc { min-height: 0; }
  .h-lbl, .h-mark text { font-size: 13.5px; }
  .h-block text { font-size: 12.5px; }
  .fh-row { grid-template-columns: 1fr; gap: 10px; }
  .fh-chip { padding: 0 5px; font-size: 10.5px; }
  .fh-aside { left: 48px; }
  .rs-panels { grid-template-columns: 1fr; gap: 20px; }
  .cc-row { grid-template-columns: 1fr; height: auto; gap: 2px; margin-bottom: 6px; }
  .cc-row .cc-track { height: 30px; }
  .cc-group { margin-top: 6px; }
  .cc-group .cc-track { display: none; }
  .cc-axis .cc-name { display: none; }
  .pr, .br { grid-template-columns: 1fr; }
  .pr-panel, .br-col { padding: 0 !important; border-right: 0 !important; }
  .pr-panel + .pr-panel, .br-col + .br-col { margin-top: 20px; padding-top: 20px !important; border-top: 1px solid var(--line); }
  .ar { grid-template-columns: 1fr; padding: 0; }
  .ar-bg { display: none; }
  .ar-card, .ar-under, .ar-end { grid-column: 1; grid-row: auto; }
  .ar-end { margin-bottom: 20px; }
  .ar-end:last-child { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .viz *, .viz *::before { transition: none !important; animation: none !important; }
}
