:root{color-scheme:light;--paper:#FAF9F5;--ink:#1E293B;--muted:#66635e;--line:#dad7ce;--query:#B5396B;--key:#3E6D8E;--value:#3F7A6B;--soft:#efeee8}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:17px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.app{max-width:1640px;padding:22px 28px;margin:auto}button,input,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;background:transparent;border:1px solid var(--line);border-radius:8px;padding:8px 14px;cursor:pointer}button:hover:not(:disabled){background:#e9e7df}button:disabled{opacity:.4;cursor:default}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--key);outline-offset:3px}header{display:flex;justify-content:space-between;align-items:center;gap:14px;padding-bottom:16px;border-bottom:1px solid var(--line)}.brand{font-weight:700;font-size:23px;letter-spacing:-.6px}.brand-mark{display:inline-grid;place-items:center;color:var(--query);border:1px solid var(--query);width:30px;height:30px;border-radius:50%;margin-right:8px}.course{font-size:12px;letter-spacing:1.1px;font-weight:500;color:var(--muted);margin-left:10px}.views{display:flex;gap:4px;padding:4px;background:var(--soft);border-radius:10px}.views button{border:0;font-size:15px}.views button[aria-pressed=true]{background:var(--ink);color:var(--paper)}.steps{display:flex;gap:3px;padding:14px 0 4px}.steps button{flex:1;border:0;border-bottom:2px solid var(--line);border-radius:0;padding:6px 3px 9px;white-space:nowrap;font-size:14px;text-align:left;color:var(--muted)}.steps button[aria-current=step]{border-color:var(--query);color:var(--query);font-weight:700}.step-index{display:inline-block;font-size:12px;border:1px solid currentColor;border-radius:50%;width:21px;height:21px;text-align:center;margin-right:6px;line-height:19px}.stage-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:15px 0 12px}.eyebrow{font-size:11px;letter-spacing:1.5px;text-transform:uppercase;color:var(--muted)}h1{font-family:Georgia,serif;font-size:33px;line-height:1.15;font-weight:500;margin:4px 0 0;letter-spacing:-.4px}.legend{display:flex;gap:17px;font-size:14px}.q{color:var(--query)}.k{color:var(--key)}.v{color:var(--value)}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:28px;min-height:430px}.visual{min-width:0;border-top:1px solid var(--line);padding-top:13px;display:flex;flex-direction:column}.tokens{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:0 35px}.tokens button{border-color:transparent;border-radius:8px;text-align:center;font-size:22px;font-family:Georgia,serif;padding:5px 12px}.tokens button[aria-pressed=true]{color:var(--query);background:#b5396b0b;border-color:#b5396b55}.tokens small{font:11px system-ui;display:block;color:var(--muted);margin-top:2px}.tokens button[aria-pressed=true] small{color:var(--query)}svg{display:block;width:100%;flex:1;min-height:0;overflow:visible}svg text{fill:var(--ink);font:21px system-ui,sans-serif}svg .small{font-size:16px;fill:var(--muted)}svg .tiny{font-size:14px;fill:var(--muted)}svg .label{font-size:18px}svg .large{font-size:26px;font-weight:600}svg .math{font-family:"DejaVu Sans Mono",ui-monospace,monospace;font-size:20px}svg .qtext{fill:var(--query)}svg .ktext{fill:var(--key)}svg .vtext{fill:var(--value)}svg .faded{opacity:.26}svg .vector{font-weight:700;font-style:italic}.visual-note{font-size:14px;color:var(--muted);margin:8px 0 0;min-height:20px;text-align:center}.explanation{border-left:1px solid var(--line);padding:10px 0 0 24px;font-size:17px;display:flex;flex-direction:column;gap:14px}.explanation p{margin:0 0 12px}.explanation h2{font-size:18px;margin:0 0 8px;font-weight:650}.formula{background:var(--soft);padding:12px 14px;border-radius:8px;font:18px/1.65 ui-monospace,monospace;overflow-wrap:anywhere}.formula b{color:var(--query)}.formula .mathline{display:block}.insight{border-left:3px solid var(--value);padding-left:12px;font-size:16px}.explanation .subtle{font-size:14px;color:var(--muted)}fieldset{border:0;border-top:1px solid var(--line);padding:12px 0 0;margin:0}legend{padding:0 8px 0 0;font-size:12px;letter-spacing:.8px;text-transform:uppercase;color:var(--muted)}fieldset label{display:grid;grid-template-columns:22px 1fr;align-items:center;font-size:15px;line-height:1.25;margin:0 0 8px;cursor:pointer}fieldset input{margin:0;accent-color:var(--query);width:16px;height:16px}fieldset label span{grid-column:2;font-size:11px;color:var(--muted);margin-top:2px}.text-button{border:0;padding:0;text-align:left;color:var(--key);font-size:14px;margin-top:auto;width:max-content}.explanation button.jump{font-size:17px;border-color:var(--query);color:var(--query);margin:3px 0 10px}.transport{display:flex;gap:7px}footer{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}footer p{font-size:11px;color:var(--muted);max-width:340px}footer a{font-size:12px;color:var(--key)}button.primary{background:var(--ink);color:var(--paper);border-color:var(--ink)}button.primary:hover:not(:disabled){background:#35445a}button.quiet{border-color:transparent;color:var(--muted)}dialog{max-width:1000px;width:90vw;max-height:88vh;overflow:auto;border:1px solid var(--line);border-radius:12px;background:var(--paper);color:var(--ink);padding:28px}dialog::backdrop{background:#1e293b66}.dialog-top{display:flex;align-items:center;justify-content:space-between;gap:20px}.dialog-top h2{font:28px Georgia,serif;margin:0}.matrices{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin:24px 0}.matrix-card{border-top:1px solid var(--line);padding-top:12px}.matrix-card h3{font-size:16px;margin:0 0 10px}table{border-collapse:collapse;font:15px ui-monospace,monospace}th,td{padding:7px 10px;text-align:right}th{font-weight:500;color:var(--muted)}.matrix-card table{border-left:2px solid var(--muted);border-right:2px solid var(--muted)}.table-scroll{overflow-x:auto}.details-copy{font-size:15px}.matrix-row{cursor:pointer}.matrix-row:focus{outline:none}.matrix-row:focus rect.row-focus{stroke:var(--query);stroke-width:3}.scene-entry{animation:appear .4s ease-out}.flow-line{stroke-dasharray:6 7;animation:flow 1.5s linear infinite}.bar-grow{animation:appear .6s ease-out}@keyframes appear{from{opacity:.1}to{opacity:1}}@keyframes flow{to{stroke-dashoffset:-26}}[hidden]{display:none!important}
body.embed .app{padding:10px 18px}body.embed header{padding-bottom:8px}body.embed .brand{font-size:20px}body.embed .steps{padding-top:7px}body.embed .stage-heading{margin:8px 0}body.embed h1{font-size:29px}body.embed .workspace{min-height:0;height:379px}body.embed .visual{padding-top:5px}body.embed .tokens button{font-size:20px;padding:2px 8px}body.embed .explanation{font-size:16px;gap:8px;padding-top:4px}body.embed .explanation p{margin-bottom:8px}body.embed .formula{font-size:17px;padding:7px 11px}body.embed fieldset{padding-top:6px}body.embed fieldset label{margin-bottom:5px}body.embed footer{margin-top:8px;padding-top:7px}body.embed .transport button{padding:6px 12px}body.embed .visual-note{font-size:12px;margin:2px 0 0}
.workspace{grid-template-rows:minmax(0,1fr)}.visual,.explanation{min-height:0}.visual svg{height:0;flex:1 1 0}
.tokens{padding-left:0;padding-right:0;max-width:100%;align-self:center;width:100%}body.embed footer p{margin:0}body.embed .transport button{white-space:nowrap}
body.embed .workspace{height:360px;grid-template-columns:minmax(0,1fr) 370px}body.embed fieldset label span{display:none}body.embed fieldset label{font-size:14px;margin-bottom:6px}body.embed .explanation{gap:7px}body.embed .explanation .subtle{font-size:13px}body.embed .explanation .insight{font-size:14px}body.embed .explanation button.jump{padding:5px 10px;font-size:15px;margin:0}body.embed .explanation h2{font-size:17px}body.embed .explanation .formula{line-height:1.45}
@media(min-width:1600px){body.embed .app{max-width:none}}
@media(max-width:1050px){.workspace{grid-template-columns:minmax(0,1fr) 270px;gap:15px}.explanation{padding-left:15px;font-size:15px}.course{display:none}.steps button{font-size:12px}.step-index{margin-right:3px}.app{padding:16px}.legend{font-size:12px;gap:8px}h1{font-size:29px}footer p{max-width:220px}.tokens{padding:0 15px}.visual svg{min-height:260px}}
@media(max-width:760px){header{flex-wrap:wrap}.views{width:100%}.views button{flex:1;font-size:13px}.steps{overflow-x:auto}.steps button{min-width:112px}.workspace,body.embed .workspace{display:flex;flex-direction:column;height:auto}.explanation{border-left:0;border-top:1px solid var(--line);padding:16px 0 0}.stage-heading{align-items:flex-start}.legend{display:none}h1,body.embed h1{font-size:26px}.tokens{padding:0}.tokens button{font-size:20px}.visual svg{min-height:210px}.visual-note{font-size:12px}.explanation{font-size:16px}.explanation fieldset{display:grid;grid-template-columns:1fr 1fr;gap:8px}.transport{flex-wrap:wrap}footer{flex-wrap:wrap}footer p{max-width:none;width:100%;order:3;margin:0}.matrices{grid-template-columns:1fr}dialog{padding:18px}.dialog-top h2{font-size:23px}.steps button{flex-shrink:0}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media(max-width:760px){.visual{overflow-x:auto}.visual svg{min-width:780px;height:270px;flex:none}.tokens{min-width:780px;align-self:flex-start}.visual-note{min-width:780px}.visual::before{content:"Swipe the diagram to explore all positions →";font-size:12px;color:var(--muted);margin-bottom:8px}}
@media(min-width:761px){body.embed .workspace{height:calc(100vh - 260px);min-height:360px}}
@media(min-width:1060px) and (min-height:700px){body.embed .explanation{font-size:18px}body.embed .explanation h2{font-size:20px}body.embed .explanation .subtle{font-size:15px}body.embed .explanation .insight{font-size:16px}body.embed .explanation .formula{font-size:19px}body.embed fieldset label{font-size:16px}body.embed .text-button{font-size:16px}}
/* embed mode (projected in a lecture slide): larger type, cream panels. Added 2026-11-12. */
@media(min-width:1060px){
body.embed .app{padding:8px 18px}
body.embed .brand{font-size:24px}body.embed .course{font-size:16px}
body.embed .views button{font-size:19px;padding:5px 12px}
body.embed .steps button{font-size:18px;padding:4px 3px 6px}
body.embed .eyebrow{font-size:16px;letter-spacing:1px}
body.embed h1{font-size:32px}
body.embed .stage-heading{margin:4px 0}
body.embed .legend{font-size:18px}
body.embed .tokens button{font-size:22px}
body.embed .visual-note{font-size:16px}body.embed .tokens small{font-size:16px;line-height:1.2}
body.embed .workspace{height:calc(100vh - 262px);min-height:360px;grid-template-columns:minmax(0,1fr) 480px}
body.embed .explanation{font-size:22px;line-height:1.35}
body.embed .explanation h2{font-size:24px}
body.embed .explanation .formula{font-size:20px;background:transparent;border:1px solid var(--line)}
body.embed .explanation .subtle{font-size:18px}
body.embed .explanation .insight{font-size:20px}
body.embed .explanation button.jump{font-size:18px}
body.embed fieldset label{font-size:20px}
body.embed .text-button{font-size:18px}
body.embed .transport button{font-size:20px;padding:5px 12px}
body.embed footer p{font-size:16px;max-width:520px}
body.embed footer a{font-size:16px}
body.embed svg text.tiny{font-size:17px}
body.embed svg text.small{font-size:18px}
body.embed svg text.label{font-size:20px}
}
