/* How AI Works — interactive module styles (lab.js). Dark lab palette from index.html :root. */

code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #dcf8ff; }
.fine-print { margin: 12px 0 0; color: var(--lab-dim); font-size: 12.5px; line-height: 1.5; }
.fine-print b { color: var(--lab-gold); }

/* ---------- scroll reveal + rail ---------- */
.js-reveal .lab-card, .js-reveal .act-banner { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.js-reveal .lab-card.in-view, .js-reveal .act-banner.in-view { opacity: 1; transform: none; }
.rail-progress { height: 4px; margin-top: 14px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.rail-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lab-green), var(--lab-cyan), var(--lab-gold)); transition: width .15s linear; }
.rail-act { display: block; margin: 10px 2px 0; color: var(--lab-gold); font-size: 10.5px; font-weight: 900; letter-spacing: 0.13em; text-transform: uppercase; }
.lab-nav a.current { border-color: var(--lab-line-hot); background: rgba(57,207,255,0.16); color: #fff; box-shadow: inset 3px 0 0 var(--lab-cyan); }
.lab-rail { max-height: calc(100vh - 36px); overflow-y: auto; scrollbar-width: thin; }

.act-banner { position: relative; margin: 40px 0 18px; padding: 22px 24px; border-left: 3px solid var(--lab-gold); border-radius: 0 14px 14px 0; background: linear-gradient(90deg, rgba(230,189,103,0.14), rgba(57,207,255,0.03) 70%, transparent); scroll-margin-top: 20px; }
.act-banner span { color: var(--lab-gold); font-size: 12px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; }
.act-banner h2 { margin-top: 4px; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.act-banner p { max-width: 720px; margin: 8px 0 0; color: #c1d3df; line-height: 1.55; }

/* ---------- system map ---------- */
[hidden] { display: none !important; }
.map-layout { grid-template-columns: 1fr !important; }
.map-figure { margin: 0; aspect-ratio: 1500 / 844; min-height: 0 !important; }
.map-figure img { position: absolute; inset: 0; min-height: 0 !important; }
.map-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.map-side > .control-row { grid-column: 1 / -1; }
.map-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-zoom { position: absolute; inset: 0; transform-origin: var(--zx, 50%) var(--zy, 50%); transition: transform .8s cubic-bezier(.2,.8,.2,1); }
.map-zoom.zoomed { transform: scale(1.9); }
.map-flow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-flow path { fill: none; stroke: rgba(120,225,255,0.85); stroke-width: 3; stroke-dasharray: 6 9; vector-effect: non-scaling-stroke; animation: flow-dash 1.6s linear infinite; }
.map-flow path.glow { stroke: rgba(230,189,103,0.25); stroke-width: 7; stroke-dasharray: none; filter: blur(2px); animation: none; }
@keyframes flow-dash { to { stroke-dashoffset: -14; } }
.map-sparks { position: absolute; inset: 0; pointer-events: none; }
.map-sparks i { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 3px var(--lab-cyan), 0 0 22px 6px rgba(57,207,255,0.5); }
.map-sparks i.gold { box-shadow: 0 0 10px 3px var(--lab-gold), 0 0 24px 8px rgba(230,189,103,0.6); width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.map-marker { z-index: 2; transition: transform .3s ease; }
.map-marker::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1px solid rgba(57,207,255,0.6); animation: marker-pulse 2.4s ease-out infinite; animation-delay: calc(var(--i, 0) * 0.3s); pointer-events: none; }
.map-marker.active::after { border-color: var(--lab-gold); }
.map-marker.lit { transform: translate(-50%, -50%) scale(1.25); }
@keyframes marker-pulse { from { transform: scale(0.7); opacity: 0.9; } to { transform: scale(1.8); opacity: 0; } }
.map-unzoom { position: absolute; right: 12px; bottom: 12px; z-index: 3; min-height: 34px !important; padding: 6px 12px !important; background: rgba(3,13,26,0.86) !important; }

/* ---------- generation loop ---------- */
.genloop { position: relative; padding: 16px; border: 1px solid rgba(110,159,205,0.24); border-radius: 12px; background: radial-gradient(circle at 50% 0%, rgba(57,207,255,0.08), transparent 60%), rgba(0,0,0,0.22); }
.gl-text { display: flex; flex-wrap: wrap; gap: 5px; min-height: 42px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(2,8,18,0.9); border: 1px solid rgba(255,255,255,0.07); }
.gl-tok { padding: 4px 7px; border-radius: 6px; font: 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: #dcf8ff; background: rgba(57,207,255,0.1); border: 1px solid rgba(57,207,255,0.28); white-space: pre; }
.gl-tok.new { color: #10202b; background: linear-gradient(135deg, var(--lab-gold), #ffd49a); border-color: transparent; animation: tok-land .55s cubic-bezier(.2,1.4,.4,1); }
@keyframes tok-land { from { transform: translateY(80px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.gl-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.gl-stage { position: relative; display: grid; align-content: start; gap: 8px; min-height: 176px; padding: 12px; border: 1px solid rgba(57,207,255,0.22); border-radius: 10px; color: var(--lab-text); background: rgba(255,255,255,0.03); text-align: left; cursor: pointer; transition: border-color .3s, background .3s, box-shadow .3s; }
.gl-stage b { position: absolute; top: 10px; right: 12px; color: var(--lab-dim); font-size: 12px; }
.gl-stage strong { font-size: 12.5px; color: #f8ecd8; letter-spacing: 0.02em; }
.gl-stage.active { border-color: rgba(230,189,103,0.8); background: rgba(230,189,103,0.09); box-shadow: 0 0 26px rgba(230,189,103,0.2); }
.gl-stage + .gl-stage::before { content: ""; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px; background: var(--lab-cyan); opacity: 0.6; }
.gl-ids { display: flex; flex-wrap: wrap; gap: 4px; }
.gl-ids span { padding: 2px 5px; border-radius: 4px; font: 11px ui-monospace, monospace; color: #bfe9ff; background: rgba(57,207,255,0.1); }
.gl-stage.active .gl-ids span { animation: id-pop .4s ease backwards; animation-delay: calc(var(--i) * 40ms); }
@keyframes id-pop { from { transform: scale(0.4); opacity: 0; } }
.gl-vecs { display: grid; gap: 3px; }
.gl-vecs div { display: grid; grid-template-columns: repeat(16, 1fr); gap: 1px; height: 9px; }
.gl-vecs i { border-radius: 1px; }
.gl-stage.active .gl-vecs div { animation: vec-in .5s ease backwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes vec-in { from { transform: scaleX(0); transform-origin: left; } }
.gl-layers { display: grid; gap: 4px; }
.gl-layers i { display: block; height: 11px; border-radius: 3px; background: rgba(157,134,255,0.16); border: 1px solid rgba(157,134,255,0.3); }
.gl-stage.active .gl-layers i { animation: layer-fire .9s ease both; animation-delay: calc((7 - var(--i)) * 90ms); }
@keyframes layer-fire { 40% { background: rgba(157,134,255,0.85); box-shadow: 0 0 14px rgba(157,134,255,0.7); } 100% { background: rgba(157,134,255,0.3); } }
.gl-probs { display: grid; gap: 5px; }
.gl-probs div { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; font: 11.5px ui-monospace, monospace; color: #dcf8ff; }
.gl-probs div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.gl-probs em { display: block; height: 9px; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--lab-cyan), var(--lab-green)); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.gl-probs div.win em { background: linear-gradient(90deg, var(--lab-gold), #ff8b74); box-shadow: 0 0 12px rgba(230,189,103,0.6); }
.gl-probs div.win { color: #fff; font-weight: 800; }
.gl-probs small { color: var(--lab-muted); text-align: right; }
.gl-return { display: block; width: 100%; height: 26px; margin-top: 6px; overflow: visible; }
.gl-return path { fill: none; stroke: var(--lab-gold); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-dasharray: 6 6; animation: flow-dash 1.2s linear infinite reverse; opacity: 0.8; }
.gl-return-label { margin-top: -4px; color: var(--lab-gold); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.genloop.firing .gl-return path { stroke-width: 2.6; opacity: 1; filter: drop-shadow(0 0 6px var(--lab-gold)); }

.orbit-diagram { display: block; width: 100%; max-width: 360px; margin: 10px auto 0; }
.orbit-track { fill: none; stroke: rgba(230,189,103,0.4); stroke-width: 1.4; stroke-dasharray: 4 5; }
.orbit-dot { fill: var(--lab-cyan); filter: drop-shadow(0 0 5px var(--lab-cyan)); }
.orbit-nodes text { fill: #e2f8ff; font: 800 11px Inter, system-ui, sans-serif; text-anchor: middle; }
.orbit-core { fill: var(--lab-gold); font: 900 9.5px Inter, system-ui, sans-serif; letter-spacing: 0.1em; text-anchor: middle; text-transform: uppercase; }
.cm-diagram { display: grid; grid-template-columns: 1fr 34px 1.3fr 34px 0.9fr; gap: 4px; align-items: center; margin-top: 14px; }
.cm-diagram > div:not(.cm-arrow) { display: grid; gap: 5px; padding: 9px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.16); }
.cm-diagram strong { color: #fff; font-size: 12px; }
.cm-diagram span { padding: 4px 6px; border-radius: 6px; font-size: 11px; font-weight: 800; color: #e2f8ff; background: rgba(57,207,255,0.08); border: 1px solid rgba(57,207,255,0.24); }
.cm-drawer { border-color: rgba(157,134,255,0.45) !important; }
.cm-drawer span, .cm-window .cm-mem { background: rgba(157,134,255,0.14); border-color: rgba(157,134,255,0.45); color: #e8e1ff; }
.cm-window .cm-mem { animation: mem-slide 3.2s ease-in-out infinite; }
@keyframes mem-slide { 0%, 25% { transform: translateX(-40px); opacity: 0; } 45%, 100% { transform: none; opacity: 1; } }
.cm-model { border-color: rgba(57,207,255,0.45) !important; }
.cm-model span { background: transparent; border: 0; color: var(--lab-muted); padding: 0; }
.cm-arrow { position: relative; display: grid; justify-items: center; gap: 2px; }
.cm-arrow i { display: block; width: 100%; height: 2px; background: linear-gradient(90deg, transparent, var(--lab-gold)); }
.cm-arrow em { color: var(--lab-gold); font-size: 9px; font-style: normal; font-weight: 900; text-transform: uppercase; text-align: center; }

/* ---------- tokens ---------- */
.token-output { max-height: 320px; overflow: auto; }
.token { white-space: pre; transition: transform .15s ease; animation: id-pop .3s ease backwards; animation-delay: calc(min(var(--i), 40) * 12ms); }
.token:hover { transform: translateY(-2px); }
.token.c0 { background: rgba(57,207,255,0.14); border-color: rgba(57,207,255,0.4); }
.token.c1 { background: rgba(132,227,122,0.14); border-color: rgba(132,227,122,0.4); color: #e3ffdf; }
.token.c2 { background: rgba(230,189,103,0.15); border-color: rgba(230,189,103,0.45); color: #fff0d0; }
.token.c3 { background: rgba(157,134,255,0.16); border-color: rgba(157,134,255,0.45); color: #ece6ff; }
.token.c4 { background: rgba(255,127,156,0.14); border-color: rgba(255,127,156,0.42); color: #ffe3ea; }
.token .sp { color: var(--lab-gold); opacity: 0.8; }
.token.byte { font-style: italic; opacity: 0.8; }
.token-output.ids .token { color: #bfe9ff; }
#tokenIdsToggle[aria-pressed="true"] { border-color: var(--lab-gold); color: #fff; }

/* ---------- next-token machine ---------- */
.nt-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; margin-top: 6px; }
.nt-text { min-height: 120px; padding: 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); background: rgba(2,8,18,0.92); font: 15px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cfe3ee; }
.nt-text .prompt { color: #fff; }
.nt-text .gen { padding: 2px 3px; border-radius: 4px; background: rgba(57,207,255,0.12); color: #dcf8ff; white-space: pre-wrap; }
.nt-text .gen.fresh { animation: tok-glow 1.1s ease; }
.nt-text .gen.odd { background: rgba(255,127,156,0.18); color: #ffe3ea; }
.nt-text .caret { display: inline-block; width: 9px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: var(--lab-gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes tok-glow { from { background: rgba(230,189,103,0.8); color: #10202b; } }
.nt-temp { margin: 14px 0; padding: 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }
.nt-temp label { display: flex; justify-content: space-between; color: var(--lab-muted); font-size: 13px; font-weight: 800; }
.nt-temp label strong { color: var(--lab-gold); font-size: 16px; }
.nt-temp input { margin-top: 8px; accent-color: var(--lab-gold); }
.nt-temp-scale { display: flex; justify-content: space-between; color: var(--lab-dim); font-size: 11px; font-weight: 800; }
.nt-temp p { margin: 8px 0 0; color: #c9dbe6; font-size: 13px; line-height: 1.45; min-height: 38px; }
.nt-right { display: grid; grid-template-columns: 1fr; gap: 14px; justify-items: center; align-content: start; }
.nt-bars { width: 100%; }
.nt-wheel-wrap { position: relative; width: 190px; height: 190px; }
.nt-wheel { width: 100%; height: 100%; filter: drop-shadow(0 0 18px rgba(57,207,255,0.2)); }
#ntWheelSpin { transition: transform 1.6s cubic-bezier(.12,.72,.18,1); }
#ntWheelSpin.instant { transition: none; }
.nt-wheel path { stroke: #020813; stroke-width: 1.2; transition: opacity .3s; }
.nt-wheel path.win { filter: brightness(1.35); }
.nt-pointer { position: absolute; top: -6px; left: 50%; width: 0; height: 0; margin-left: -9px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 18px solid #fff; filter: drop-shadow(0 0 6px var(--lab-gold)); }
.nt-wheel-hub { position: absolute; inset: 62px; display: grid; place-items: center; border-radius: 50%; background: #020813; border: 1px solid rgba(230,189,103,0.6); color: #fff; font: 800 12px ui-monospace, monospace; text-align: center; padding: 4px; overflow: hidden; white-space: pre; }
.nt-bars { display: grid; gap: 4px; }
.nt-bar { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 56px; gap: 6px; align-items: center; font: 12px ui-monospace, monospace; color: #dcf8ff; }
.nt-bar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.nt-bar em { display: block; height: 11px; border-radius: 999px; background: var(--c); width: 0; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.nt-bar small { color: var(--lab-muted); text-align: right; }
.nt-bar.win { color: #fff; font-weight: 800; }
.nt-bar.win small { color: var(--lab-gold); }
.nt-bar.other { color: var(--lab-dim); }
.nt-runs { display: grid; gap: 6px; margin-top: 14px; }
.nt-runs:empty { display: none; }
.nt-run { padding: 8px 12px; border-left: 3px solid var(--lab-cyan); border-radius: 0 8px 8px 0; background: rgba(255,255,255,0.035); font: 13px/1.5 ui-monospace, monospace; color: #cfe3ee; white-space: pre-wrap; animation: id-pop .4s ease backwards; animation-delay: calc(var(--i) * 120ms); }
.nt-run b { color: var(--lab-gold); font-weight: 800; }

/* ---------- attention ---------- */
.attn-stage { position: relative; margin-top: 8px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.22); overflow-x: auto; scrollbar-width: thin; }
.attn-inner { position: relative; width: max-content; min-width: 100%; padding: 150px 6px 18px; box-sizing: border-box; }
.attn-arcs { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.attn-arcs path { fill: none; stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw-arc .8s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: var(--d, 0s); }
@keyframes draw-arc { to { stroke-dashoffset: 0; } }
.attn-arcs text { fill: #fff; font: 800 11px ui-monospace, monospace; text-anchor: middle; opacity: 0; animation: fade-in .4s ease forwards; animation-delay: .6s; }
@keyframes fade-in { to { opacity: 1; } }
.attn-words { position: relative; display: flex; flex-wrap: nowrap; gap: 4px; justify-content: center; }
.attn-word { position: relative; padding: 6px 7px; border-radius: 8px; border: 1px solid rgba(57,207,255,0.3); background: rgba(57,207,255,0.07); color: #e2f8ff; font: 700 13px Inter, system-ui, sans-serif; white-space: nowrap; cursor: pointer; transition: background .25s, border-color .25s, box-shadow .25s; }
.attn-word:hover { border-color: var(--lab-line-hot); }
.attn-word.src { border-color: var(--lab-gold); background: rgba(230,189,103,0.2); color: #fff; box-shadow: 0 0 18px rgba(230,189,103,0.35); }
.attn-word.tgt { background: rgba(57,207,255, calc(0.08 + var(--w) * 0.5)); border-color: rgba(57,207,255, calc(0.3 + var(--w) * 0.7)); }
.attn-word.swap { color: var(--lab-rose); border-color: rgba(255,127,156,0.6); }
.attn-probe { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border-radius: 10px; border: 1px solid rgba(230,189,103,0.3); background: rgba(230,189,103,0.06); }
.attn-probe strong { color: #f8ecd8; font-size: 13.5px; }
.probe-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; font: 800 12px Inter, system-ui, sans-serif; }
.probe-bar span { display: grid; place-items: center; color: #10202b; transition: flex-basis .9s cubic-bezier(.2,.8,.2,1); white-space: nowrap; overflow: hidden; }
.probe-bar .pt { background: linear-gradient(90deg, var(--lab-gold), #ffd49a); }
.probe-bar .ps { background: linear-gradient(90deg, var(--lab-cyan), #9be8ff); }

/* ---------- embeddings ---------- */
.emb-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 4px; }
.emb-side { display: grid; gap: 10px; }
.emb-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; align-content: start; }
.emb-results h3, .emb-results > p { grid-column: 1 / -1; }
.emb-map { position: relative; border-radius: 12px; border: 1px solid rgba(86,163,232,0.3); background: radial-gradient(ellipse at 50% 50%, rgba(22,40,80,0.55), rgba(2,8,19,0.95)); overflow: hidden; }
.emb-map svg { display: block; width: 100%; height: auto; }
.emb-star { cursor: pointer; transition: opacity .4s, r .3s; }
.emb-star circle.halo { opacity: 0.25; }
.emb-star.dim { opacity: 0.22; }
.emb-star:hover circle.core { r: 13; }
.emb-cluster { fill: rgba(255,255,255,0.4); font: 900 24px Inter, system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; text-anchor: middle; pointer-events: none; }
.emb-link { stroke: var(--lab-gold); stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw-arc .7s ease forwards; animation-delay: var(--d); }
.emb-query circle { fill: #fff; filter: drop-shadow(0 0 10px var(--lab-gold)) drop-shadow(0 0 22px var(--lab-gold)); animation: star-in .6s cubic-bezier(.2,1.5,.4,1) backwards; transform-box: fill-box; transform-origin: center; }
@keyframes star-in { from { transform: scale(0); } }
.emb-query text { fill: #fff; font: 800 26px Inter, system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #020813; stroke-width: 5px; }
.emb-label { fill: #e8f4fa; font: 700 21px Inter, system-ui, sans-serif; paint-order: stroke; stroke: #020813; stroke-width: 4px; pointer-events: none; }
.emb-tip { position: absolute; z-index: 2; padding: 6px 9px; border-radius: 7px; background: rgba(2,8,19,0.94); border: 1px solid var(--lab-line-hot); color: #fff; font-size: 12.5px; pointer-events: none; transform: translate(-50%, -130%); white-space: nowrap; }
.emb-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.emb-results { padding: 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); background: #020812; min-height: 150px; }
.emb-results h3 { font-size: 1.05rem; margin-bottom: 10px; }
.emb-results p { margin: 0; color: var(--lab-muted); font-size: 13.5px; line-height: 1.5; }
.emb-hit { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 4px 8px; margin-bottom: 9px; font-size: 13px; color: #dfeef6; }
.emb-hit em { grid-column: 1 / -1; display: block; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--lab-gold), var(--lab-cyan)); width: 0; transition: width .7s ease; }
.emb-hit small { color: var(--lab-gold); font: 800 12px ui-monospace, monospace; text-align: right; }

/* ---------- context tank ---------- */
.ctx-controls { display: grid; grid-template-columns: repeat(3, auto); gap: 16px; justify-content: start; margin-bottom: 14px; }
.ctx-field > span { display: block; margin-bottom: 6px; color: var(--lab-dim); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.ctx-field .lab-button { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.ctx-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.ctx-tank { position: relative; display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; padding: 12px; border-radius: 12px; border: 2px solid rgba(57,207,255,0.45); background: repeating-linear-gradient(0deg, rgba(57,207,255,0.03) 0 1px, transparent 1px 20px), rgba(1,6,14,0.92); box-shadow: inset 0 0 40px rgba(57,207,255,0.08); }
.ctx-tank.overflow { animation: tank-shake .45s ease; border-color: var(--lab-rose); }
@keyframes tank-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.ctx-cell { aspect-ratio: 1; border-radius: 3px; background: rgba(255,255,255,0.035); transition: background .35s, opacity .35s, box-shadow .35s; }
.ctx-cell.k-sys { background: #8fb3c9; }
.ctx-cell.k-mem { background: var(--lab-violet); box-shadow: 0 0 8px rgba(157,134,255,0.6); }
.ctx-cell.k-user { background: var(--lab-green); }
.ctx-cell.k-asst { background: var(--lab-cyan); }
.ctx-cell.k-tool { background: var(--lab-orange); }
.ctx-cell.k-sum { background: var(--lab-gold); box-shadow: 0 0 8px rgba(230,189,103,0.55); }
.ctx-cell.fresh { animation: cell-pop .45s cubic-bezier(.2,1.5,.4,1) backwards; animation-delay: calc(var(--j) * 6ms); }
@keyframes cell-pop { from { transform: scale(0); } }
.ctx-cell.hl { outline: 2px solid #fff; outline-offset: 1px; }
.ctx-tank.heat .ctx-cell[class*="k-"] { opacity: var(--recall, 1); }
.ctx-heat-legend { display: grid; grid-template-columns: auto 1fr auto 1fr auto; gap: 8px; align-items: center; margin-top: 8px; color: var(--lab-dim); font-size: 11px; font-weight: 800; }
.ctx-heat-legend i { height: 6px; border-radius: 999px; background: linear-gradient(90deg, #fff, rgba(255,255,255,0.35)); }
.ctx-heat-legend i:last-of-type { background: linear-gradient(90deg, rgba(255,255,255,0.35), #fff); }
.ctx-side { display: grid; align-content: start; gap: 10px; }
.ctx-meter { height: 12px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ctx-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lab-green), var(--lab-cyan), var(--lab-gold), var(--lab-rose)); background-size: 400px 100%; transition: width .5s ease; }
.ctx-readout { padding: 12px; border-radius: 10px; background: #020812; border: 1px solid rgba(255,255,255,0.08); color: #d8eaf2; font-size: 13.5px; line-height: 1.5; min-height: 96px; }
.ctx-readout strong { color: var(--lab-gold); }
.ctx-log { display: grid; gap: 5px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.ctx-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,0.035); font-size: 12.5px; color: #cfe3ee; cursor: default; transition: opacity .3s, background .3s; }
.ctx-row i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.ctx-row small { color: var(--lab-dim); font: 11px ui-monospace, monospace; }
.ctx-row.dropped { opacity: 0.38; text-decoration: line-through; }
.ctx-row.summarized { opacity: 0.6; }
.ctx-row.summarized small::after { content: " → summary"; color: var(--lab-gold); }
.ctx-row:hover { background: rgba(57,207,255,0.1); }

/* ---------- prompt pruning ---------- */
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.prompt-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; border: 1px dashed rgba(230,189,103,0.5); color: #f4dfb5; background: transparent; font-size: 12.5px; font-weight: 800; cursor: pointer; transition: all .25s; }
.prompt-chip::before { content: "+"; font-weight: 900; }
.prompt-chip.on { border-style: solid; border-color: var(--lab-gold); background: rgba(230,189,103,0.16); color: #fff; }
.prompt-chip.on::before { content: "✓"; color: var(--lab-green); }
.prompt-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.prompt-tree-wrap { max-width: 720px; width: 100%; justify-self: center; }
.prompt-output { min-height: 0; }
.prompt-output mark { padding: 0 2px; border-radius: 3px; background: rgba(230,189,103,0.22); color: #fff; animation: tok-glow 1s ease; }
.ambiguity { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-top: 12px; color: var(--lab-dim); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.ambiguity .meter { margin: 0; }
.ambiguity .meter span { background: linear-gradient(90deg, var(--lab-green), var(--lab-gold), var(--lab-rose)); background-size: 100% 100%; transition: width .6s ease; }
.prompt-result { margin: 12px 0 0 !important; color: #d8eaf2 !important; }
.prompt-tree-wrap { border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.22); }
.prompt-tree { display: block; width: 100%; height: auto; }
.pt-edge { fill: none; stroke: rgba(57,207,255,0.45); stroke-width: 1.6; transition: stroke .5s, opacity .5s, stroke-width .5s; }
.pt-leaf rect { fill: rgba(57,207,255,0.1); stroke: rgba(57,207,255,0.45); transition: all .5s; }
.pt-leaf text, .pt-node text { fill: #e2f8ff; font: 700 11.5px Inter, system-ui, sans-serif; transition: fill .5s; }
.pt-leaf { transition: opacity .6s, transform .6s; transform-box: fill-box; }
.pt-leaf.pruned { opacity: 0.2; }
.pt-leaf.pruned rect { fill: rgba(255,127,156,0.06); stroke: rgba(255,127,156,0.4); }
.pt-leaf.pruned text { fill: #ff9fb4; text-decoration: line-through; }
.pt-edge.pruned { stroke: rgba(255,127,156,0.2); stroke-dasharray: 3 4; }
.pt-leaf.kept rect { fill: rgba(132,227,122,0.2); stroke: var(--lab-green); filter: drop-shadow(0 0 8px rgba(132,227,122,0.5)); }
.pt-edge.kept { stroke: var(--lab-green); stroke-width: 2.6; }
.pt-root rect { fill: rgba(230,189,103,0.16); stroke: var(--lab-gold); }
.pt-root text { fill: #fff; font-weight: 900; }
.pt-extra { opacity: 0; transition: opacity .6s; }
.pt-extra.on { opacity: 1; }
.pt-extra rect { fill: rgba(157,134,255,0.18); stroke: var(--lab-violet); }
.pt-extra text { fill: #ece6ff; font: 800 11px Inter, system-ui, sans-serif; }
.pt-extra path { fill: none; stroke: var(--lab-violet); stroke-width: 2; stroke-dasharray: 4 4; animation: flow-dash 1.2s linear infinite; }

/* ---------- tool call pipe ---------- */
#tools .tool-grid { grid-template-columns: 1fr; }
#tools .tool-list { display: flex; flex-wrap: wrap; gap: 8px; }
.toolcall { display: grid; grid-template-columns: 1fr; gap: 0; }
.tc-step { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 14px; align-items: start; padding: 11px 13px; border-radius: 10px; border: 1px solid rgba(110,159,205,0.24); background: rgba(255,255,255,0.03); opacity: 0.35; transition: opacity .4s, border-color .4s, box-shadow .4s; }
.tc-step > :not(b) { grid-column: 2; }
.tc-step.on { opacity: 1; }
.tc-step.now { border-color: var(--lab-gold); box-shadow: 0 0 22px rgba(230,189,103,0.22); }
.tc-step b { grid-row: 1 / span 2; padding-top: 3px; color: var(--lab-gold); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.tc-step pre { margin: 0; padding: 8px 10px; border-radius: 7px; background: #020812; color: #bfe9ff; font: 12px/1.45 ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; min-height: 1.45em; }
.tc-step span { color: #d8eaf2; font-size: 13.5px; line-height: 1.5; min-height: 1.5em; }
.tc-step .lab-button { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.tc-step .tc-approve { margin-top: 8px; }
.tc-pipe { position: relative; height: 20px; display: grid; justify-items: start; padding-left: 74px; }
.tc-pipe i { display: block; width: 2px; height: 100%; background: rgba(57,207,255,0.35); position: relative; overflow: visible; }
.tc-pipe.flow i::after { content: ""; position: absolute; left: -4px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px var(--lab-cyan); animation: pipe-run-v .5s linear forwards; }
@keyframes pipe-run-v { to { top: calc(100% - 10px); } }

/* ---------- agent circuit ---------- */
.circuit-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.circuit-wrap { position: relative; max-width: 460px; width: 100%; margin: 0 auto; }
.circuit { display: block; width: 100%; height: auto; overflow: visible; }
.circuit .ring { fill: none; stroke: rgba(57,207,255,0.2); stroke-width: 14; }
.circuit .ring-lit { fill: none; stroke: url(#ringGrad); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 0 6px rgba(57,207,255,0.8)); }
.circuit .node circle { fill: #06182c; stroke: rgba(57,207,255,0.45); stroke-width: 2; transition: all .35s; }
.circuit .node text { fill: #e2f8ff; font: 800 16px Inter, system-ui, sans-serif; text-anchor: middle; pointer-events: none; }
.circuit .node .ico { fill: none; stroke: #bfe9ff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.circuit .node.done circle { stroke: var(--lab-green); fill: rgba(132,227,122,0.14); }
.circuit .node.active circle { stroke: var(--lab-gold); fill: rgba(230,189,103,0.24); filter: drop-shadow(0 0 12px rgba(230,189,103,0.7)); }
.circuit .node.fail circle { stroke: var(--lab-rose); fill: rgba(255,127,156,0.2); filter: drop-shadow(0 0 12px rgba(255,127,156,0.7)); }
.circuit .node.gate circle { stroke: var(--lab-orange); stroke-dasharray: 4 3; }
.circuit .packet { fill: #fff; filter: drop-shadow(0 0 8px var(--lab-gold)) drop-shadow(0 0 16px var(--lab-gold)); }
.circuit .core-label { fill: var(--lab-muted); font: 700 14px Inter, system-ui, sans-serif; text-anchor: middle; }
.circuit .core-title { fill: #f8ecd8; font: 800 24px Georgia, serif; text-anchor: middle; }
.circuit-lap { position: absolute; top: 4px; left: 4px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(230,189,103,0.5); color: var(--lab-gold); font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; background: rgba(2,8,19,0.8); }
.circuit-lap.bump { animation: tok-glow 1s ease; }
.circuit-gate { padding: 10px; border-radius: 10px; border: 1px dashed var(--lab-orange); background: rgba(255,176,96,0.08); animation: gate-pulse 1.4s ease-in-out infinite; }
@keyframes gate-pulse { 50% { box-shadow: 0 0 22px rgba(255,176,96,0.35); } }
.ctx-strip-label { display: flex; justify-content: space-between; color: var(--lab-dim); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.ctx-strip-label strong { color: var(--lab-gold); font-family: ui-monospace, monospace; }
.ctx-strip { display: flex; height: 26px; border-radius: 7px; overflow: hidden; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.ctx-strip span { flex: 0 0 auto; height: 100%; background: var(--c); border-right: 1px solid #020812; animation: strip-in .5s cubic-bezier(.2,.8,.2,1) backwards; transform-origin: left; }
@keyframes strip-in { from { transform: scaleX(0); } }

/* ---------- builder: isometric stack + radar ---------- */
.builder-visuals { display: grid; grid-template-columns: 1fr; gap: 6px; justify-items: center; }
.builder-visuals .iso-stage { width: 100%; }
.builder-visuals .radar { max-width: 250px; }
.iso-stage { display: grid; place-items: center; height: 280px; perspective: 900px; }
.iso-stack { position: relative; width: 170px; height: 170px; transform: rotateX(58deg) rotateZ(-42deg); transform-style: preserve-3d; margin-top: 90px; }
.iso-layer { position: absolute; inset: 0; border-radius: 10px; background: color-mix(in srgb, var(--layer-color) 30%, #06182c); border: 2px solid var(--layer-color); box-shadow: 0 0 22px color-mix(in srgb, var(--layer-color) 45%, transparent); transform: translateZ(calc(var(--z) * 26px)); transition: transform .6s cubic-bezier(.2,1.3,.4,1), opacity .4s; display: grid; place-items: center; }
.iso-layer.enter { animation: layer-drop .7s cubic-bezier(.2,1.3,.4,1) backwards; }
@keyframes layer-drop { from { transform: translateZ(calc(var(--z) * 26px + 160px)); opacity: 0; } }
.iso-layer span { transform: rotateZ(42deg); color: #fff; font: 900 12px Inter, system-ui, sans-serif; text-shadow: 0 1px 3px #000; letter-spacing: 0.04em; }
.iso-empty { color: var(--lab-muted); font-size: 13px; text-align: center; }
.radar { width: 100%; height: auto; overflow: visible; }
.radar .grid { fill: none; stroke: rgba(255,255,255,0.1); }
.radar .axis { stroke: rgba(255,255,255,0.14); }
.radar .shape { fill: rgba(57,207,255,0.22); stroke: var(--lab-cyan); stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 8px rgba(57,207,255,0.5)); }
.radar text { fill: #dfeef6; font: 800 11px Inter, system-ui, sans-serif; text-anchor: middle; }
.radar text.val { fill: var(--lab-gold); font-size: 12px; }

/* ---------- hallucination game ---------- */
.hal-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; }
.hal-label { display: block; margin-bottom: 8px; color: var(--lab-dim); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.hal-source { padding: 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); background: repeating-linear-gradient(180deg, rgba(255,255,255,0.02) 0 27px, rgba(57,207,255,0.07) 27px 28px), #031020; }
.hal-source ol { margin: 0; padding-left: 22px; color: #d8eaf2; font: 13px/28px ui-monospace, monospace; }
.hal-source li { padding-left: 4px; border-radius: 5px; transition: background .4s, color .4s; }
.hal-source li.cite { background: rgba(132,227,122,0.2); color: #fff; animation: tok-glow 1.2s ease; }
.hal-source li.clash { background: rgba(255,127,156,0.2); color: #fff; }
#halClaims { display: grid; gap: 8px; }
.hal-claim { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(110,159,205,0.26); background: rgba(255,255,255,0.035); color: #e8f4fa; font-size: 14px; line-height: 1.45; text-align: left; cursor: pointer; transition: all .25s; }
.hal-claim i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3); font-style: normal; font-size: 12px; font-weight: 900; }
.hal-claim.flagged { border-color: var(--lab-rose); background: rgba(255,127,156,0.1); }
.hal-claim.flagged i { background: var(--lab-rose); color: #10202b; border-color: transparent; }
.hal-claim.flagged i::before { content: "?"; }
.hal-claim.revealed { cursor: default; }
.hal-claim.ok { border-color: rgba(132,227,122,0.6); }
.hal-claim.bad { border-color: rgba(255,127,156,0.7); }
.hal-claim .verdict { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 800; }
.hal-claim.ok .verdict { color: var(--lab-green); }
.hal-claim.bad .verdict { color: var(--lab-rose); }
.hal-claim.right { box-shadow: inset 4px 0 0 var(--lab-green); }
.hal-claim.wrong { box-shadow: inset 4px 0 0 var(--lab-rose); }

@media (max-width: 980px) {
  .gl-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-stage + .gl-stage::before { display: none; }
  .nt-grid, .emb-grid, .ctx-grid, .prompt-grid, .circuit-board, .hal-grid, .builder-visuals { grid-template-columns: 1fr; }
  .ctx-controls { grid-template-columns: 1fr; }
  .lab-rail { max-height: none; }
}
@media (max-width: 680px) {
  .tc-step { grid-template-columns: 1fr; }
  .tc-step > :not(b) { grid-column: 1; }
  .tc-step b { grid-row: auto; }
  .tc-pipe { padding-left: 20px; }
  .map-side { grid-template-columns: 1fr; }
  .gl-stages { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gl-stage { min-height: 150px; padding: 10px; }
  .cm-diagram { grid-template-columns: 1fr; }
  .cm-arrow i { width: 2px; height: 16px; background: linear-gradient(180deg, transparent, var(--lab-gold)); }
  .ctx-tank { grid-template-columns: repeat(16, 1fr); gap: 2px; padding: 8px; }
  .attn-inner { padding-top: 120px; }
  .iso-stage { height: 230px; }
  .act-banner { margin-top: 28px; padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .lab-card, .js-reveal .act-banner { opacity: 1; transform: none; transition: none; }
  .map-flow path, .gl-return path, .pt-extra path, .map-marker::after, .cm-window .cm-mem, .circuit-gate { animation: none !important; }
  #ntWheelSpin, .map-zoom { transition-duration: .01s !important; }
}

/* =================== v2: beginner layer =================== */
.gist { display: flex; gap: 10px; align-items: baseline; max-width: 720px; margin: 12px 0 0 !important; padding: 9px 12px; border-left: 3px solid var(--lab-gold); border-radius: 0 8px 8px 0; background: rgba(230,189,103,0.08); color: #f4e6c8 !important; font-size: 15px; line-height: 1.45 !important; }
.gist b { flex: 0 0 auto; color: var(--lab-gold); font-size: 10.5px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }

.calm-toggle { display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 12px; padding: 8px 10px; border: 1px solid rgba(96,156,216,0.28); border-radius: 8px; color: var(--lab-muted); background: rgba(255,255,255,0.03); font-size: 12px; font-weight: 800; text-align: left; cursor: pointer; }
.calm-dot { position: relative; flex: 0 0 auto; width: 28px; height: 16px; border-radius: 999px; background: rgba(255,255,255,0.14); transition: background .25s; }
.calm-dot::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .25s; }
.calm-toggle[aria-pressed="true"] { color: #fff; border-color: var(--lab-green); }
.calm-toggle[aria-pressed="true"] .calm-dot { background: var(--lab-green); }
.calm-toggle[aria-pressed="true"] .calm-dot::after { transform: translateX(12px); }
html.calm *, html.calm *::before, html.calm *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
html.calm .js-reveal .lab-card, html.calm .js-reveal .act-banner, html.calm.js-reveal .lab-card, html.calm.js-reveal .act-banner { opacity: 1; transform: none; }
html.calm [data-space-fx], html.calm .map-sparks { display: none; }
html.calm body::before, html.calm body::after, html.calm .ai-lab::before { animation: none !important; }

/* keyboard focus everywhere */
.ai-lab :is(button, a, input, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--lab-gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* go-deeper drawers */
.deeper-wrap { padding-top: 0 !important; }
.deeper { border: 1px dashed rgba(157,134,255,0.5); border-radius: 12px; background: rgba(157,134,255,0.05); }
.deeper summary { display: flex; align-items: center; gap: 12px; padding: 13px 16px; color: #ece6ff; font-weight: 800; cursor: pointer; list-style: none; }
.deeper summary::-webkit-details-marker { display: none; }
.deeper summary span { padding: 3px 8px; border-radius: 999px; background: rgba(157,134,255,0.22); color: #d8ceff; font-size: 10.5px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.deeper summary::after { content: "+"; margin-left: auto; color: var(--lab-violet); font-size: 20px; line-height: 1; transition: transform .25s; }
.deeper[open] summary::after { transform: rotate(45deg); }
.deeper-body { padding: 0 16px 16px; animation: fade-in .4s ease; }
.deeper-body > p { margin: 0 0 12px; color: #c9dbe6; line-height: 1.55; }

/* maths */
.maths-card { display: grid; gap: 12px; padding: 14px; border-radius: 10px; background: #020812; border: 1px solid rgba(255,255,255,0.08); }
.maths-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; }
.maths-row > b { color: var(--lab-dim); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.maths-toks { display: flex; flex-wrap: wrap; gap: 5px; }
.maths-big { font: 800 22px ui-monospace, monospace; color: #fff; letter-spacing: 0.02em; }
.maths-big.wrong { color: var(--lab-rose); text-decoration: line-through; text-decoration-thickness: 2px; }
.maths-big.right { color: var(--lab-green); }
.maths-verdict { font-size: 13.5px; color: #d8eaf2; }
.maths-calc { color: var(--lab-green); font: 800 22px ui-monospace, monospace; animation: tok-glow 1s ease; }

/* next-token pick hint */
.nt-hint { margin: 0; color: var(--lab-gold); font-size: 12.5px; font-weight: 700; text-align: center; min-height: 1.2em; }
.nt-bar.pickable { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; background: transparent; border: 0; color: inherit; font: inherit; width: calc(100% + 8px); text-align: left; }
.nt-bar.pickable:hover { background: rgba(230,189,103,0.12); }
.nt-text .gen.forced { background: rgba(132,227,122,0.25); color: #eaffe6; outline: 1px solid var(--lab-green); }

/* base vs chat */
.chat-compare { margin-bottom: 18px; padding: 16px; border-radius: 12px; border: 1px solid rgba(57,207,255,0.28); background: rgba(0,0,0,0.22); }
.cc-head { display: grid; gap: 10px; margin-bottom: 12px; }
.cc-head h3 { font-size: 1.1rem; }
.cc-head .preset-row { margin: 0; }
.cc-head .lab-button { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.cc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-col { display: grid; align-content: start; gap: 8px; padding: 12px; border-radius: 10px; background: #020812; border: 1px solid rgba(255,255,255,0.08); }
.cc-base { border-color: rgba(255,176,96,0.45); }
.cc-chat { border-color: rgba(132,227,122,0.45); }
.cc-label { font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.cc-base .cc-label { color: var(--lab-orange); }
.cc-chat .cc-label { color: var(--lab-green); }
.cc-text { min-height: 130px; color: #d8eaf2; font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.cc-text .q { color: #fff; font-weight: 800; }
.cc-text .typing::after { content: "▍"; color: var(--lab-gold); animation: blink 1s steps(2) infinite; }

/* tools: trap */
.trap-btn { border-color: rgba(255,127,156,0.5) !important; }
.trap-modes { align-items: center; margin-bottom: 10px; padding: 8px 10px; border-radius: 10px; border: 1px dashed rgba(255,127,156,0.5); background: rgba(255,127,156,0.06); }
.trap-modes span { color: #ffd0da; font-size: 12.5px; font-weight: 800; margin-right: 4px; }
.trap-modes .lab-button { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.tc-step pre .inject { display: block; margin-top: 6px; padding: 5px 7px; border-radius: 5px; color: #ffd0da; background: rgba(255,127,156,0.16); outline: 1px dashed rgba(255,127,156,0.7); }
.tc-step span.danger { color: #ffb3c3; font-weight: 700; }
.tc-step span.safe { color: #c8ffc2; }

/* systems race */
.race { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border-radius: 12px; background: #020812; border: 1px solid rgba(255,255,255,0.08); }
.race-title { display: flex; justify-content: space-between; gap: 10px; color: var(--lab-dim); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.lane { display: grid; grid-template-columns: 118px minmax(0, 1fr) 132px; gap: 10px; align-items: center; font-size: 13px; }
.lane > strong { color: #e2f8ff; font-size: 12.5px; }
.lane-track { position: relative; height: 18px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.lane-track i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--c); box-shadow: 0 0 12px var(--c); transition: width var(--dur) linear; }
.lane-track em { position: absolute; left: 8px; top: 0; line-height: 18px; color: #fff; font: 700 11px ui-monospace, monospace; font-style: normal; text-shadow: 0 1px 2px #000; }
.lane-out { color: var(--lab-muted); font-size: 12px; line-height: 1.3; }
.lane-out b { display: block; color: #fff; font-size: 12.5px; }
.lane.best .lane-out b { color: var(--lab-green); }
.lane.best > strong::after { content: " ★"; color: var(--lab-gold); }

/* video dialog */
.tour-video { width: min(960px, calc(100vw - 24px)); padding: 14px; border: 1px solid var(--lab-line-hot); border-radius: 14px; background: #030d1c; color: var(--lab-text); box-shadow: 0 30px 90px rgba(0,0,0,0.7); }
.tour-video::backdrop { background: rgba(1,5,12,0.78); backdrop-filter: blur(4px); }
.tv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tv-head strong { font: 800 1.1rem Georgia, serif; color: #f8ecd8; }
.tour-video video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }

@media (max-width: 680px) {
  .gist { flex-direction: column; gap: 3px; font-size: 14px; }
  .cc-cols { grid-template-columns: 1fr; }
  .maths-row { grid-template-columns: 1fr; gap: 4px; }
  .lane { grid-template-columns: 1fr; gap: 4px; }
}

/* =================== v3: readability pass =================== */
.hero-links { margin: 14px 0 0 !important; color: var(--lab-muted) !important; font-size: 14px !important; }
.hero-links a { color: #9be8ff; }
.tour-mode { margin-left: auto; padding: 4px 2px; border: 0; background: none; color: #9be8ff; font-size: 12.5px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.gl-stage em { display: block; margin-top: -4px; color: var(--lab-muted); font-size: 11px; font-style: normal; font-weight: 600; line-height: 1.3; }
.nt-raw { margin: 0 0 8px; padding: 8px 11px; border-radius: 8px; border: 1px dashed rgba(255,176,96,0.55); background: rgba(255,176,96,0.07); color: #ffe2c2; font-size: 13px; line-height: 1.45; }
.nt-raw b { color: var(--lab-orange); }
.ctx-hint { margin-left: 6px; color: var(--lab-muted); font-style: normal; font-weight: 700; letter-spacing: 0; text-transform: none; }
.attn-probe .probe-label { color: var(--lab-dim); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
