/* Legacy surfaces are mapped explicitly; gradients never sit behind reading copy. */
html[data-library] .cover::before,html[data-library] .cover::after,html[data-library] .checkpoint::before,html[data-library] .atomic::after{display:none!important}
html[data-library] .cover-subtitle{font:400 1.2rem/1.6 'IBM Plex Sans',sans-serif;font-style:normal;max-width:52ch}
html[data-library] svg text{font-family:'IBM Plex Sans',sans-serif!important}
html[data-library=cuda] :is(.interactive,.interactive-card,.chart-container,.chart-wrap){--text-primary:#111214;--text-secondary:#52545a;--text-tertiary:#52545a;--ink:#111214;--muted:#52545a;--accent-cyan:#111214;--accent-amber:#111214;--accent-purple:#52545a;background:#f5f5ef;color:#111214}
html[data-library] .library-data-table{width:100%;border-collapse:collapse;font:16px/1.5 'IBM Plex Sans',sans-serif;color:#111214;background:#f5f5ef}
html[data-library] .library-data-table :is(th,td){padding:12px 16px;border-bottom:1px solid #c6c7bf;text-align:left;color:#111214;white-space:normal}
html[data-library] .library-data-table caption{padding:16px;text-align:left;font-weight:600;color:#111214}
html[data-library] .library-data-table small{color:#52545a;display:block;font-weight:400;margin-top:8px}
html[data-library] .library-data-table th{font-weight:600;background:#e9e9e2}
html[data-library] .library-data-table .compared{font-weight:600;border-left:4px solid #111214}
html[data-library=ib27] .book-prose>h1:first-child{max-width:17ch}
html[data-library] .katex-display{overflow-x:auto;overflow-y:hidden;max-width:100%;padding-block:6px}
html[data-library] .formula{max-width:100%;overflow-x:auto}
html[data-library] .formula-line{max-width:100%;overflow-x:auto}
html[data-library] .chart-wrap:has(.library-data-table){height:auto!important;min-height:0!important}
html[data-library] #tc-fig .chart-wrap,html[data-library] #opt-progress-fig .chart-wrap{height:auto!important}
html[data-library] .katex{display:inline-block;max-width:100%;overflow-x:auto;overflow-y:hidden;vertical-align:middle;padding-block:3px}
html[data-library=cuda] .checkpoint,html[data-library=cuda] .atomic{overflow:hidden}
html[data-library=cuda] .chapter-num-bg{display:none}
html[data-library] canvas{max-width:100%!important}
html[data-library=cuda] .chart-container{position:relative;min-width:0;max-width:100%}
html[data-library=rwa-regression] #eventLog{overflow-x:auto;max-width:100%}
@media(max-width:680px){html[data-library=rwa-regression] [style*="grid-template-columns:24px 60px"]{grid-template-columns:24px 50px minmax(0,1fr)!important}html[data-library=rwa-regression] [style*="grid-template-columns:24px 60px"]>span:last-child{grid-column:2 / -1;width:auto!important}}
html[data-library] .scroll-region.has-overflow:before{content:'Wide figure · swipe or use arrow keys to explore';display:block;position:sticky;left:0;padding:4px 0 12px;max-width:100%;font:14px/1.4 'IBM Plex Sans',sans-serif;color:#52545a;background:#f5f5ef}
/* Light figure panels keep their own ink roles rather than inheriting the page's light text. */
html[data-library] :is(figure,.figure,.interactive){--ink:#111214;--ink-soft:#111214;--ink-muted:#52545a;--muted:#52545a;--secondary:#52545a;--bg-card:#f5f5ef;--bg:#f5f5ef;--rule:#c6c7bf;--rule-soft:#c6c7bf;--accent:#111214;--accent-soft:#e9e9e2;--highlight:#111214;--color-canvas:#f5f5ef;--color-surface:#e9e9e2;--color-ink:#111214;--color-secondary:#52545a;--color-accent:#111214;--color-accent-dark:#111214}
html[data-library] .interactive{background:#f5f5ef;color:#111214;border-color:#c6c7bf;border-radius:8px;padding:24px;box-shadow:none}
html[data-library] .interactive :is(.value,.readout,.interactive-caption,.interactive-header,h3,h4,strong,small,label){color:#111214;font-family:'IBM Plex Sans',sans-serif}
html[data-library] .interactive .interactive-header .tag{background:#e9e9e2;color:#52545a;white-space:normal}
html[data-library] .interactive .readout{font-size:16px;line-height:1.6}
html[data-library] :is(figure,.figure,.interactive) :is(th,td){background:#f5f5ef;color:#111214;border-color:#c6c7bf}
html[data-library] :is(figure,.figure,.interactive) th{background:#e9e9e2}
html[data-library] :is(figure,.figure,.interactive) :is(button,input,select){color:#111214;background:#f5f5ef;border-color:#52545a}
html[data-library] :is(figure,.figure,.interactive) button:hover{background:#e9e9e2;color:#111214}
html[data-library=cuda] figcaption{font:400 16px/1.6 'IBM Plex Sans',sans-serif!important;color:#52545a!important}
html[data-library=cuda] :is(.figure-label,.fig-label){color:#52545a!important}
html[data-library] .interactive .readout{background:#e9e9e2!important;color:#111214!important}
html[data-library] .interactive .readout *{color:#111214!important}
html[data-library=cuda] :is(.figure-caption,.chapter-goal){font:400 18px/1.65 'IBM Plex Sans',sans-serif!important;color:inherit;font-style:normal}
html[data-library=cuda] .figure-caption{font-size:16px!important;color:#52545a}
html[data-library=cuda] .figure{--text-primary:#111214;--text-secondary:#52545a;--text-tertiary:#52545a;--muted:#52545a;--ink:#111214}
html[data-library=cuda] .figure [class*="controls"]{background:#e9e9e2!important;color:#111214!important}
html[data-library=cuda] .figure [class*="controls"] *{color:#111214!important}
html[data-library] a{color:#142E28}
html[data-library] small,html[data-library] .eyebrow,html[data-library] .foot{color:#466357}
html[data-library] :is(figure,.figure,.interactive){--canvas:#f5f5ef;--surface:#e9e9e2;--paper:#f5f5ef;--paper-ink:#111214;--paper-muted:#52545a}
html[data-library] :is(figure,.figure,.interactive) :is(a,small,.eyebrow){color:#111214}
html[data-library] table{background:#f5f5ef;color:#111214}
html[data-library] :is(td,th){background:#f5f5ef!important;color:#111214!important;border-color:#c6c7bf}
html[data-library] th{background:#e9e9e2!important}
html[data-library] td a{color:#111214}
html[data-library] .machine-frame{background:#f5f5ef;--canvas:#f5f5ef;--surface:#e9e9e2;--ink:#111214;--secondary:#52545a;--paper:#f5f5ef;color:#111214}
html[data-library] .machine-note{color:#52545a}
html[data-library] .chip-s.shared{background:#e9e9e2!important;color:#111214!important}
html[data-library=rwa-regression] .token-chip{color:#111214!important;background:#e9e9e2!important;border:1px solid #52545a}
html[data-library=rwa-regression] .callout{background:#142E28;color:#F4F5EF}
html[data-library=rwa-regression] .callout :is(a,.label){color:#F4F5EF}
html[data-library=rwa-regression] .interactive [style*="color:var(--good)"]{color:#111214!important}
html[data-library=cuda] .rel-chip{color:#b7b8b1!important;background:#202124!important;border-color:#424348!important}
html[data-library=cuda] :is(.num,.var){color:var(--ink)!important}
html[data-library=cuda] .formula{background:#202124;color:#f5f5ef}
html[data-library=cuda] .formula *{color:inherit!important}
html[data-library=strategy-bitcoin] #result{background:#202124;color:#f5f5ef}
html[data-library] :is(a.primary,.skip,.cover-cta){background:#DFFF5E!important;color:#142E28!important}
html[data-library] :is(a.primary,.cover-cta) *{color:#111214!important}
html[data-library] :is(figure,.figure){--color-accent:#ffe500;--color-accent-dark:#111214}
html[data-library] .node.dark :is(small,.v,.s,b,a){color:#f5f5ef!important}
html[data-library] .node.hot{background:#ffe500!important;color:#111214!important}
html[data-library] .node.hot :is(small,.v,.s,b,a){color:#111214!important}
html[data-library] .figure .col-h{background:#f5f5ef;color:#52545a}
html[data-library] .study-tools{background:#f5f5ef;color:#111214;--paper:#f5f5ef;--paper-ink:#111214}
html[data-library=cuda] td.num{color:#111214!important}
html[data-library=cuda] .figure .legend span{color:#111214!important}
html[data-library] .xref{background:#e9e9e2;color:#111214!important}
html[data-library=cuda] #ncu-mock{--bg-elev-2:#f5f5ef;--text-primary:#111214;--text-secondary:#52545a;--accent-cyan:#111214;--accent-amber:#111214}
html[data-library=cuda] #ncu-mock span{color:#111214!important}
html[data-library=cuda] .figure [style*="color:var(--accent"]{color:#111214!important}
html[data-library=cuda] .figure [style*="color: var(--accent"]{color:#111214!important}
html[data-library=ssrd] .start-link,html[data-library=ssrd] .start-link *{color:#111214!important}

html[data-library=ssrd] .start-reading,html[data-library=ssrd] .start-reading *{color:#111214!important}
html[data-library] :is(figure,.figure,.interactive) :is(small,.meta,.src,.source,.tag,.fig-label,td,th){font-size:14px}
@media print{html[data-library] :is(article[hidden],section[hidden]){display:block!important}html[data-library] .scroll-region.has-overflow:before{display:none}}

/* Cortex-M retains dark cover/footer bands; inherited paper-page roles stop here. */
html[data-library=cortex-m] .top :is(a,small,.eyebrow),html[data-library=cortex-m] footer:not(.library-footnote) a{color:#F4F5EF}
html[data-library=cortex-m] pre code{color:inherit}
html[data-library=cortex-m] .library-footnote{background:#F4F5EF;color:#466357}

/* Paper reading roles for the remaining imported-book aliases. */
html[data-library=tokenization]{--sub:#466357;--yellow:#142E28}
html[data-library=strategy] .pill{background:#DFFF5E;color:#142E28}
html[data-library=strategy] .node b{color:inherit}
html[data-library=ssrd] .start-reading,html[data-library=ssrd] .start-reading:hover{background:#DFFF5E;color:#142E28!important}
html[data-library=ssrd] .start-reading *{color:#142E28!important}
html[data-library=cuda] .learning-path-arrow{color:#466357}
html[data-library=cuda] .bitlayout .bit.sign{color:#6e153d}
html[data-library=cuda] .code-block pre{color:#F4F5EF}
html[data-library=cuda] .code-block pre [style*="color: var(--"],html[data-library=cuda] .code-block pre [style*="color:var(--"]{color:inherit!important}
html[data-library=cuda] .code-linenums{color:#b6c2b5}
html[data-library=cuda] pre[style]{background:#e6eadf!important;color:#142E28!important}
html[data-library=cuda] .code-block pre [style*="color:var(--text"],html[data-library=cuda] .code-block pre [style*="color: var(--text"]{color:#F4F5EF!important}
html[data-library=strategy] .warn b{color:#9b2c2c}
html[data-library=cuda] .figure [style*="background:var(--bg-code)"]{color:#F4F5EF!important}
/* Keep complete display words on phones instead of splitting the kit's heavy face. */
@media(max-width:680px){
 html[data-library] :is(h1,.cover h1,.book-hero h1){font-size:clamp(1.875rem,7.7vw,3.25rem);overflow-wrap:normal;word-break:normal;hyphens:none}
}
