/* All additions are scoped; shared headers and unselected lessons are untouched. */
body[data-bw-basal-ganglia] .bwcr{font-size:1.125rem;line-height:1.65;max-width:58rem;padding-inline:clamp(.75rem,3vw,2rem)}
body[data-bw-basal-ganglia] .bwcr p,body[data-bw-basal-ganglia] .bwcr li,body[data-bw-basal-ganglia] .bwcr label,body[data-bw-basal-ganglia] .bwcr summary{font-size:1em}
body[data-bw-basal-ganglia] .bwcr-intro{padding-block:1.1rem .25rem;margin-bottom:.5rem}
body[data-bw-basal-ganglia] .bwcr-intro h1{font-size:clamp(2rem,5vw,3rem);line-height:1.1}
body[data-bw-basal-ganglia] .bwcr section[data-lesson-section]{margin-block:3rem;scroll-margin-top:7rem}
body[data-bw-basal-ganglia] .bwcr h2{line-height:1.25;margin-bottom:1.2rem}
body[data-bw-basal-ganglia] .bwcr h3{line-height:1.35}
body[data-bw-basal-ganglia] .bwcr :is(button,select){font:inherit;line-height:1.35;min-height:44px;max-width:100%;white-space:normal;overflow-wrap:anywhere;padding:.65rem .8rem;border:1px solid #607488;border-radius:.5rem;background:#fff;color:#172d44;cursor:pointer}
body[data-bw-basal-ganglia] .bwcr button:hover{background:#e5f3f3}
body[data-bw-basal-ganglia] .bwcr :focus-visible,.bg-image-dialog :focus-visible{outline:3px solid #a7530a;outline-offset:4px}
body[data-bw-basal-ganglia] .bwcr [hidden]{display:none!important}
.bg-start{max-width:43rem;margin-block:.5rem 1.5rem}
body[data-bw-basal-ganglia] #contents{margin-block:1rem 2rem}
.bg-figure{margin:1.5rem 0 2rem!important;padding:1rem;background:#f8fafc;border:1px solid #d2dee7;border-radius:.8rem;color:#172d44}
.bg-figure>a{display:block;color:#064e66;text-decoration:none}
.bg-figure img{display:block;width:auto;max-width:100%;height:auto;margin:0 auto;border-radius:.35rem;object-fit:contain}
.bg-figure>a>span{display:flex;align-items:center;justify-content:center;min-height:44px;padding-top:.5rem;text-decoration:underline;font-weight:650}
.bg-figure figcaption p{margin:.7rem 0 0}
.bg-figure [data-bg-attribution]{color:#3d5265;overflow-wrap:anywhere}
.bg-kicker{font-weight:700;color:#235e65;margin:0 0 .5rem;text-transform:none}
.bg-reasoning,.bg-model,.bg-dopamine{background:#f1f8f7;border:1px solid #b9d5d3;border-left:5px solid #087f8c;border-radius:.6rem;padding:1.1rem;margin:1.5rem 0;color:#172d44}
.bg-reasoning .bg-question{font-weight:650;margin-top:0}
.bg-steps{padding-left:1.25rem;margin-block:.6rem}
.bg-steps>li{padding-left:.25rem;margin-block:1.2rem}
.bg-steps>li::marker{font-weight:700;color:#235e65}
.bg-controls,[data-bg-predictions]{display:flex;flex-wrap:wrap;gap:.6rem;margin-block:.65rem}
[data-bg-fact]{border-left:3px solid #087f8c;padding-left:.8rem;margin-top:.8rem}
[data-bg-fact] p{margin:.4rem 0}
.bg-small:empty{display:none}
.bg-reasoning details{margin-top:.8rem}
.bg-reasoning summary,.bg-model summary{cursor:pointer;min-height:44px;padding-block:.5rem}
.bg-model h3{margin:.3rem 0 .7rem}
.bg-model-grid{display:grid;grid-template-columns:minmax(16rem,1fr) minmax(15rem,1.1fr);gap:1.25rem;align-items:start}
.bg-stage{background:#fff;border-radius:.6rem;min-width:0}
.bg-stage svg{display:block;width:100%;height:auto;max-height:40rem;font-family:Arial,sans-serif;font-size:24px;overflow:visible}
.bg-stage rect{fill:#f1f5f9;stroke:#607488;stroke-width:1.5}
.bg-stage text{fill:#172d44;font-size:24px}
.bg-stage [data-bg-node-state]{font-size:24px;font-weight:700}
.bg-stage .bg-up rect{fill:#bceade;stroke:#14674f;stroke-width:3}
.bg-stage .bg-down rect{fill:#fee2dc;stroke:#a83225;stroke-width:3}
.bg-edge{fill:none;stroke-width:3;opacity:.3}
.bg-excite{stroke:#087f8c}.bg-inhibit{stroke:#a83225}
.bg-current{opacity:1;stroke-width:4;stroke-dasharray:8 5}
.bg-traced{opacity:1;stroke-width:6;stroke-dasharray:none}
.bg-model-work{min-width:0}.bg-model-work select{display:block;width:100%}
.bg-legend{background:#fff;padding:.7rem;border-radius:.5rem}
[data-bg-history]{padding-left:1.3rem}
[data-bg-history] li{margin-bottom:.7rem}
.bg-limit{border-top:1px solid #b9d5d3;padding-top:1rem}
.bg-dopamine svg{width:min(100%,28rem);display:block;margin:auto;font:24px Arial,sans-serif}
body[data-bw-basal-ganglia] [aria-pressed=true],body[data-bw-basal-ganglia] button[data-selected]{background:#d2ece6;border-color:#14674f;box-shadow:inset 0 0 0 1px #14674f}
body[data-bw-basal-ganglia] .bwcr-options{display:grid;grid-template-columns:1fr;gap:.6rem}
body[data-bw-basal-ganglia] .bwcr-options label{min-height:44px;padding:.85rem;align-items:flex-start}
body[data-bw-basal-ganglia] .bwcr-options input{min-width:20px;min-height:20px;margin-top:.25rem}
body[data-bw-basal-ganglia] .bwcr-rationales{padding-left:1.5rem}
body[data-bw-basal-ganglia] article[data-case]{padding:1.1rem;margin-block:2rem;background:#fff;border:1px solid #ccd9e2;border-radius:.7rem;color:#172d44}
body[data-bw-basal-ganglia] article[data-case] legend{font-size:1.125rem;font-weight:550;line-height:1.65;max-width:100%}
body[data-bw-basal-ganglia] article[data-case] fieldset{min-width:0}
body[data-bw-basal-ganglia] .bwcr-rationale{margin-bottom:1.4rem}
.bg-image-dialog{padding:1rem;width:min(94vw,64rem);max-width:94vw;max-height:94vh;overflow:auto;background:#fff;color:#172d44;border:2px solid #506879;border-radius:.7rem;font:1.125rem/1.6 system-ui,sans-serif}
.bg-image-dialog::backdrop{background:#102233cc}
.bg-dialog-tools{display:flex;gap:.7rem;flex-wrap:wrap;align-items:center;background:#fff;position:sticky;top:-1rem;padding:.5rem 0;z-index:1}
.bg-dialog-tools h2{font-size:1.35rem;margin:0 auto 0 0}
.bg-dialog-tools button{font:inherit;min-height:44px;padding:.5rem .8rem;background:#fff;color:#172d44;border:1px solid #607488;border-radius:.4rem}
.bg-image-viewport{overflow:auto;max-width:100%;max-height:68vh;background:#f1f5f9;padding:.5rem}
.bg-image-viewport img{display:block;max-width:none;width:auto;height:auto;margin:auto}
.bg-image-viewport img:not([style*="width: "]){max-width:100%}
.bg-image-dialog [data-bg-dialog-attribution]{overflow-wrap:anywhere}
@media(max-width:650px){.bg-model-grid{grid-template-columns:1fr}.bg-model,.bg-dopamine,.bg-reasoning{padding:.8rem;border-left-width:3px}.bg-figure{padding:.65rem}body[data-bw-basal-ganglia] article[data-case]{padding:.65rem}.bg-steps{padding-left:1rem}body[data-bw-basal-ganglia] .bwcr-rationales{padding-left:1rem}.bg-stage{max-width:25rem;margin:auto;width:100%}.bg-model-work{display:flex;flex-direction:column}.bg-model-work>[data-bg-model-controls]{order:0}.bg-model-work>.bg-legend{order:1}.bg-model-work>[data-bg-history]{order:2}}
@media(prefers-reduced-motion:reduce){body[data-bw-basal-ganglia] .bwcr *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
/* Large-text wrapping must not inherit a grid track's automatic minimum. */
body[data-bw-basal-ganglia] main.bwcr{width:100%;box-sizing:border-box;margin-inline:auto}
body[data-bw-basal-ganglia] .bwcr-options{grid-template-columns:minmax(0,1fr)}
body[data-bw-basal-ganglia] .bwcr-options :is(li,label,span){min-width:0;max-width:100%;overflow-wrap:anywhere}
body[data-bw-basal-ganglia] .bwcr-options label{grid-template-columns:20px minmax(0,1fr);gap:.65rem}
body[data-bw-basal-ganglia] .bwcr-compare{grid-template-columns:repeat(auto-fit,minmax(min(100%,16rem),1fr))}
body[data-bw-basal-ganglia] .bwcr .bwcr-options label{display:grid;grid-template-columns:20px minmax(0,1fr);gap:.65rem}

.bg-current-link{display:none;background:#fff;border-radius:.5rem;margin:.8rem 0}
.bg-current-link svg{display:block;width:100%;height:auto;font:24px Arial,sans-serif;fill:#172d44}
@media(max-width:650px){.bg-current-link{display:block}}
