:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #07101c;
    color: #edf5ff;
    font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 85% 0%, #163452 0, transparent 30%), #07101c; }
a { color: inherit; }
.site-header, .cover, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.site-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #213249; }
.brand { font-size: 1.6rem; font-weight: 850; letter-spacing: -.06em; text-decoration: none; }
.brand span, h1 span { color: #61d6c5; }
.project-nav { display: flex; gap: 1.5rem; }
.project-nav a { color: #a9bad0; font-size: .86rem; text-decoration: none; }
.project-nav a:hover { color: #fff; }
.cover-intro { display: grid; grid-template-columns: 1.25fr 1fr; gap: 4rem; padding: 5rem 0 3rem; align-items: end; }
.eyebrow { margin: 0 0 .8rem; color: #61d6c5; font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: 1.02; letter-spacing: -.055em; }
.lede { margin: 0; color: #a9bad0; font-size: 1.02rem; line-height: 1.75; }
.chapter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 0 0 4rem; padding: 0; list-style: none; counter-reset: chapters; }
.chapter-grid li { counter-increment: chapters; }
.chapter-grid a { display: grid; grid-template-columns: 48px 1fr; gap: 1rem; min-height: 150px; padding: 1.6rem; border: 1px solid #263b53; border-radius: .85rem; background: #0b1726; text-decoration: none; }
.chapter-grid a:hover { border-color: #61d6c5; background: #0e1e31; }
.chapter-grid a::before { content: counter(chapters, decimal-leading-zero); color: #61d6c5; font: .75rem ui-monospace, monospace; }
.chapter-grid h2 { margin: 0 0 .55rem; font-size: 1.15rem; }
.chapter-grid p { margin: 0; color: #91a5bd; font-size: .85rem; line-height: 1.65; }
.book-layout { display: grid; grid-template-columns: 225px minmax(0, 960px); gap: 2.2rem; width: min(1230px, calc(100% - 40px)); margin: 2.4rem auto 4rem; align-items: start; }
.book-nav { position: sticky; top: 1.5rem; padding: 1.1rem; border: 1px solid #213249; border-radius: .75rem; background: #0b1726; }
.book-nav p { margin: .2rem .5rem .8rem; color: #7187a0; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.book-nav ol { margin: 0; padding: 0; list-style: none; }
.book-nav a { display: block; padding: .55rem .6rem; border-radius: .4rem; color: #91a5bd; font-size: .77rem; text-decoration: none; }
.book-nav a:hover { color: #fff; background: #14243a; }
.book-nav a[aria-current="page"] { color: #61d6c5; background: #12312f; }
.chapter { min-width: 0; }
.chapter-heading { margin-bottom: 1.6rem; }
.chapter-heading h1 { font-size: clamp(2.2rem, 4vw, 3.5rem); }
.chapter-heading .lede { max-width: 760px; margin-top: 1rem; font-size: .94rem; }
.demo-shell { overflow: hidden; border: 1px solid #2b405c; border-radius: .9rem; background: #0b1726; box-shadow: 0 1.5rem 5rem #0005; }
.scene { min-height: 200px; background: #0b1726; }
.scene svg, canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
canvas { touch-action: none; }
.controls { display: flex; align-items: center; gap: .7rem; padding: 1rem; border-top: 1px solid #2b405c; }
button { min-height: 40px; padding: .65rem .9rem; border: 1px solid #61d6c5; border-radius: .5rem; background: #61d6c5; color: #06231e; font: 700 .78rem inherit; cursor: pointer; }
button:hover { background: #8ae5d7; }
button.secondary { border-color: #354c69; background: transparent; color: #dce8f8; }
button.secondary:hover { background: #162a42; }
.status { flex: 1; margin: 0; color: #a9bad0; font-size: .76rem; line-height: 1.5; }
.chapter-notes { display: grid; grid-template-columns: .8fr 1.2fr; gap: 2rem; margin-top: 2.2rem; align-items: start; }
.chapter-notes h2 { margin: 0 0 .7rem; font-size: 1.25rem; }
.chapter-notes p { margin: 0; color: #91a5bd; font-size: .85rem; line-height: 1.7; }
pre { margin: 0; padding: 1.2rem; overflow: auto; border: 1px solid #263b53; border-radius: .65rem; background: #08111e; color: #c4f4e9; font: .7rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; font-size: .8rem; }
.pager a { color: #61d6c5; text-decoration: none; }
footer { display: flex; justify-content: space-between; gap: 2rem; padding: 1.6rem 0 2.5rem; border-top: 1px solid #213249; color: #7e92aa; font-size: .7rem; }
footer p { margin: 0; }
a:focus-visible, button:focus-visible { outline: 3px solid #ffcb6b; outline-offset: 3px; }
noscript { display: block; padding: 1rem; text-align: center; color: #ffcb6b; }
@media (max-width: 900px) {
    .cover-intro { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 3rem; }
    .book-layout { grid-template-columns: 1fr; }
    .book-nav { position: static; overflow-x: auto; padding: .6rem; }
    .book-nav p { display: none; }
    .book-nav ol { display: flex; gap: .25rem; }
    .book-nav a { white-space: nowrap; }
    .chapter-notes { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .site-header, .cover, footer, .book-layout { width: calc(100% - 24px); }
    .site-header { min-height: 68px; }
    .project-nav a:first-child { display: none; }
    .chapter-grid { grid-template-columns: 1fr; }
    .chapter-grid a { min-height: 0; padding: 1.2rem; }
    .controls { flex-wrap: wrap; }
    .status { flex-basis: 100%; order: 5; }
    .chapter-notes { gap: 1.3rem; }
    footer { display: grid; gap: .7rem; }
}
