:root{--docs-header-height:124px;--accent:#174283;--paper:#fff;--panel:#f5f6f8;--ink:#1c1f24;--muted:#585d64;--line:#e5e7eb}.dark{--paper:#181c21;--panel:#23272d;--ink:#e8eaed;--muted:#acb1b8;--line:#383e48;--accent:#8da7ce}.doc-header{height:auto;display:block;padding:0 30px;background:var(--paper);border-bottom:1px solid var(--line)}.doc-row{display:flex;align-items:center;gap:24px;min-height:72px}.doc-row .brand{font-size:12px;line-height:1.35;letter-spacing:0;max-width:300px;white-space:normal;flex:1}.doc-search{position:relative;flex:1;max-width:420px;min-width:140px}.doc-search input{width:100%;border:1px solid var(--line);border-radius:10px;padding:9px 13px;font:14px system-ui;background:var(--paper);color:var(--ink)}.doc-search .search-results{position:absolute;top:100%;left:0;right:0;background:var(--paper);max-height:350px;overflow:auto;box-shadow:0 8px 20px #0001;z-index:50;border-radius:8px}.doc-search .search-results a{display:block;padding:9px 14px;font-size:13px}.doc-row .tools{display:flex;gap:7px;white-space:nowrap}.doc-row .tools>*{font-size:12px;padding:7px 10px}.stage-tabs{display:flex;gap:27px;overflow-x:auto;min-height:48px;align-items:stretch;scrollbar-width:thin}.stage-tabs a{display:flex;align-items:center;font-size:13px;text-decoration:none;color:var(--muted);white-space:nowrap;border-bottom:2px solid transparent;padding:10px 0}.stage-tabs a.selected{color:var(--ink);border-bottom-color:var(--accent);font-weight:650}.doc-sidebar{top:var(--docs-header-height);left:20px;width:240px;padding:24px 12px 30px;border-right:0;background:var(--paper);height:calc(100vh - var(--docs-header-height));bottom:0}.doc-sidebar .group{font-size:12px;letter-spacing:0;text-transform:none;margin:30px 10px 10px;color:var(--ink);font-weight:650}.doc-sidebar nav a{font-size:13px;line-height:1.5;border-radius:8px;padding:8px 12px;margin:2px 0;display:block}.doc-sidebar nav a.active{background:#e7edf5;color:#133d7c}.dark .doc-sidebar nav a.active{background:#2b333f;color:#a3b8d7}.all-books{font-size:12px;color:var(--muted);display:block;margin:0 10px 25px;text-decoration:none}.layout,body.has-chapter-outline .layout{margin-left:270px;padding:calc(var(--docs-header-height) + 40px) 265px 60px 45px}.layout main,body.has-chapter-outline main{max-width:800px;margin:0 auto}.eyebrow{font-size:11px;letter-spacing:.06em;color:var(--accent)}article h1{font-size:36px;line-height:1.2;margin-bottom:26px}article h2{font-size:25px;margin-top:35px}article h3{font-size:20px}article p,article li{font-size:var(--size,18px);line-height:1.75}.chapter-toc,.has-chapter-outline .chapter-toc{position:fixed;top:calc(var(--docs-header-height) + 36px);right:20px;bottom:24px;width:210px;overflow:auto;margin:0;padding:0 10px 20px;border:0;border-radius:0;background:var(--paper);z-index:4}.chapter-toc summary,.has-chapter-outline .chapter-toc summary{font-size:12px;letter-spacing:0;text-transform:none;list-style:none;background:var(--paper);position:sticky;top:0;padding:0 5px 14px;pointer-events:none}.chapter-outline-links a,.chapter-toc>a{font-size:12px!important;line-height:1.55;color:var(--muted)}.reading-mode-bar{font-size:11px;margin:24px 0}.page-nav{margin-top:40px}.web-reading-section h2{scroll-margin-top:calc(var(--docs-header-height) + 20px)}[id]{scroll-margin-top:calc(var(--docs-header-height) + 25px)}.reader-demo{padding:14px}pre{border-radius:10px;font-size:14px}.menu{display:none}.doc-row .tools select{display:inline-block}.format-pending{opacity:.65}@media(max-width:1150px){.layout,body.has-chapter-outline .layout{padding-right:35px}.chapter-toc,.has-chapter-outline .chapter-toc{position:static;width:auto;max-height:230px;border:1px solid var(--line);border-radius:8px;padding:16px;margin:25px 0}.chapter-toc summary,.has-chapter-outline .chapter-toc summary{pointer-events:auto}.doc-search{max-width:320px}.doc-row{gap:14px}}@media(max-width:800px){.doc-header{padding:0 18px}.doc-row{display:grid;grid-template-columns:26px 1fr;gap:10px;padding:12px 0}.doc-row .menu{display:block;grid-column:1;grid-row:1}.doc-row .brand{grid-column:2;grid-row:1;max-width:none;font-size:12px}.doc-search{grid-column:1/3;grid-row:2;max-width:none;width:100%}.doc-row .tools{grid-column:1/3;grid-row:3;justify-content:flex-end;width:auto}.doc-row .tools>*{font-size:12px}.stage-tabs{gap:23px;min-height:42px}.doc-sidebar{left:0;width:270px;transform:translateX(-105%);z-index:25;border-right:1px solid var(--line)}.doc-sidebar.open{transform:translateX(0)}.layout,body.has-chapter-outline .layout{margin-left:0;padding:calc(var(--docs-header-height) + 26px) 22px 45px}.layout main{max-width:760px}article h1{font-size:31px}article p,article li{font-size:var(--size,17px)}.chapter-toc{max-height:200px}}@media print{.doc-header,.doc-sidebar,.chapter-toc,.reading-mode-bar,.section-pager{display:none!important}.layout,body.has-chapter-outline .layout{margin:0;padding:0}article p,article li{font-size:10.5pt}article h1{font-size:26pt}}

html{scroll-padding-top:0}

/* KCSLAB shared book design: compact rails, readable prose, early practice. */
:root{--ink:#172440;--muted:#657186;--paper:#fff;--panel:#f5f8fb;--line:#d9e2ec;--accent:#0d397a;--gold:#f6b914;--green:#1959b9;--size:17px;--reader-origin:max(0px,calc((100vw - 1460px)/2));--reader-left:calc(var(--reader-origin) + 242px);--reader-width:min(660px,calc(100vw - 490px))}
.dark{--ink:#e8eef8;--muted:#afbed3;--paper:#101b2d;--panel:#192942;--line:#33465e;--accent:#9bc4ff;--code:#192942}
.doc-header{padding:0 max(22px,calc((100vw - 1460px)/2 + 16px))}.doc-row{min-height:66px;gap:20px}.doc-row .brand{display:flex;gap:10px;align-items:center;flex:0 1 340px;max-width:340px;font-weight:700}.kcs-mark{display:inline-grid;place-items:center;width:29px;height:31px;flex:0 0 29px;border-radius:7px 7px 7px 0;background:#0d397a;color:#fff;border-bottom:3px solid var(--gold);font-size:19px}.stage-tabs{min-height:42px;gap:24px}.stage-tabs a.selected{color:var(--accent);border-bottom-color:var(--gold)}.doc-search{max-width:420px}.doc-row .tools{margin-left:auto}
.doc-sidebar{left:calc(var(--reader-origin) + 12px);width:218px;padding:22px 6px}.doc-sidebar .group{margin:24px 10px 8px;font-size:11px}.doc-sidebar nav a{display:flex;align-items:flex-start;gap:9px;padding:7px 10px;font-size:13px}.nav-icon{width:16px;height:16px;flex:0 0 16px;margin-top:2px;color:var(--muted)}.doc-sidebar nav a.active{background:#eaf1fa;color:#0d397a}.doc-sidebar nav a.active .nav-icon{color:#0d397a}.dark .doc-sidebar nav a.active{background:#233d61;color:#b9d6ff}.dark .doc-sidebar nav a.active .nav-icon{color:#b9d6ff}
.layout,body.has-chapter-outline .layout{margin-left:var(--reader-left);width:var(--reader-width);padding:calc(var(--docs-header-height) + 28px) 0 60px}.layout main,body.has-chapter-outline main{max-width:none;margin:0;width:100%}.chapter-toc,.has-chapter-outline .chapter-toc{left:calc(var(--reader-left) + var(--reader-width) + 30px);right:auto;width:184px;top:calc(var(--docs-header-height) + 32px);padding:0 6px 20px}.chapter-outline-links a[aria-current="location"]{border-left-color:var(--accent)}
article h1{font-size:34px;line-height:1.2;margin:0 0 18px}article h2{font-size:24px;margin:30px 0 12px;padding-top:0;border-top:0}article h3{font-size:19px;margin:24px 0 10px}article p,article li{font-size:var(--size);line-height:1.65}article p{margin-bottom:15px}article ul,article ol{margin:14px 0 20px}.lead{font-size:20px;color:var(--muted);line-height:1.5}.eyebrow{margin-bottom:12px}.reading-mode-bar{margin:14px 0;padding:8px 0;border:0}.reading-mode-bar button{padding:5px 9px}pre{padding:17px 19px;margin:18px 0;background:var(--panel);border-radius:9px;line-height:1.65}.practice-start{margin:24px 0 28px;padding:20px 22px;border:1px solid var(--line);border-left:3px solid var(--gold);border-radius:10px;background:var(--panel)}.practice-start h2{margin:9px 0 12px;font-size:22px}.practice-start pre{background:var(--paper);margin:12px 0}.practice-start details{font-size:14px}.practice-note{font-size:12px!important;color:var(--muted);margin:12px 0!important}.mini-label{font-size:10px;letter-spacing:.1em;font-weight:700;color:var(--accent)}.primary-action{display:inline-flex;align-items:center;background:#0d397a;color:#fff;padding:9px 15px;border-radius:6px;font-size:14px;font-weight:650;text-decoration:none}.primary-action:hover{background:#092857}.teaser-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:20px 0}.teaser-grid>a,.teaser-grid>section{padding:17px;border:1px solid var(--line);border-radius:9px;text-decoration:none;color:var(--ink);font-size:14px;line-height:1.55}.teaser-grid>a:hover{border-color:var(--accent);background:var(--panel)}.teaser-grid strong,.teaser-grid span:not(.mini-label){display:block}.teaser-grid strong{margin:9px 0 6px}.teaser-grid span{color:var(--muted)}.teaser-grid p{font-size:14px;margin-bottom:12px}.teaser-grid h3{font-size:18px;margin:0 0 8px}.teaser-grid a{font-size:13px}.prompt-pair{display:grid;grid-template-columns:1fr 1.5fr;gap:12px;margin:20px 0}.prompt-pair section{border:1px solid var(--line);border-radius:9px;padding:17px}.prompt-pair p{font-size:15px;margin:8px 0 0}.catalogue-main{max-width:1380px}.book-card .card-links a.primary{background:#0d397a;color:white}.dark .cover,.dark blockquote,.dark figure{background:var(--panel)}
@media(max-width:1150px){:root{--reader-left:242px;--reader-width:calc(100vw - 275px)}.chapter-toc,.has-chapter-outline .chapter-toc{position:static;left:auto;right:auto;width:100%;max-height:230px;margin:18px 0 24px;padding:12px 15px;border:1px solid var(--line);border-radius:8px}.chapter-toc summary{pointer-events:auto}.doc-sidebar{left:10px}.doc-row .brand{flex:0 1 290px}.doc-row .tools>*{padding:5px 7px}}
@media(max-width:800px){:root{--reader-left:0px;--reader-width:100%}.doc-header{padding:0 18px}.doc-row .brand{max-width:none;display:flex}.doc-search{max-width:none}.doc-sidebar{left:0;width:260px}.layout,body.has-chapter-outline .layout{margin-left:0;width:100%;padding:calc(var(--docs-header-height) + 22px) 20px 45px}.teaser-grid{grid-template-columns:1fr}.prompt-pair{grid-template-columns:1fr}.stage-tabs{gap:22px}.practice-start{padding:17px}article h1{font-size:30px}article p,article li{font-size:var(--size)}.doc-row .tools{margin-left:0}}
@media print{.layout,body.has-chapter-outline .layout{width:auto;margin:0;padding:0}.practice-start{break-inside:avoid}.nav-icon,.kcs-mark{display:none}}
.compact-guide .reading-mode-bar,.compact-guide .section-pager{display:none}.compact-guide .practice-start{margin-top:20px}.doc-sidebar .all-books .nav-icon{display:none}

/* Navigation has the same compact rhythm across the series. */
.doc-sidebar .sidebar-video{display:flex;align-items:center;gap:10px;margin:0 10px 24px;text-decoration:none;color:var(--muted);font-size:13px;line-height:1.5}.doc-sidebar .sidebar-video .nav-icon{width:20px;height:20px;flex-basis:20px;margin:0}.doc-sidebar nav .group{margin:26px 10px 9px;font-size:12px;letter-spacing:0;text-transform:none;font-weight:650;color:var(--ink)}.doc-sidebar nav a{padding:7px 11px;gap:10px;line-height:1.45;border-radius:9px}.doc-sidebar .nav-icon{width:16px;height:16px}.doc-sidebar nav a.active{font-weight:650}.doc-sidebar nav a:hover:not(.active){background:var(--panel);color:var(--ink)}
/* Overflow remains fully scrollable; tracks and thumbs stay quiet at rest. */
.doc-sidebar,.chapter-toc{overflow-y:auto;overflow-x:hidden}.doc-sidebar,.chapter-toc,.stage-tabs,html{scrollbar-width:thin;scrollbar-color:transparent transparent}
.doc-sidebar::-webkit-scrollbar,.chapter-toc::-webkit-scrollbar,.stage-tabs::-webkit-scrollbar,html::-webkit-scrollbar{width:6px;height:5px}
.doc-sidebar::-webkit-scrollbar-track,.chapter-toc::-webkit-scrollbar-track,.stage-tabs::-webkit-scrollbar-track,html::-webkit-scrollbar-track{background:transparent}
.doc-sidebar::-webkit-scrollbar-thumb,.chapter-toc::-webkit-scrollbar-thumb,.stage-tabs::-webkit-scrollbar-thumb,html::-webkit-scrollbar-thumb{background:transparent;border-radius:6px}
.doc-sidebar.is-scrolling,.chapter-toc.is-scrolling,.stage-tabs.is-scrolling,html.is-page-scrolling{scrollbar-color:#a3b1c4 transparent}
.doc-sidebar.is-scrolling::-webkit-scrollbar-thumb,.chapter-toc.is-scrolling::-webkit-scrollbar-thumb,.stage-tabs.is-scrolling::-webkit-scrollbar-thumb,html.is-page-scrolling::-webkit-scrollbar-thumb{background:#a3b1c4}
.dark .doc-sidebar.is-scrolling,.dark .chapter-toc.is-scrolling,.dark .stage-tabs.is-scrolling{scrollbar-color:#637b9a transparent}
@media(forced-colors:active){.doc-sidebar,.chapter-toc,.stage-tabs,html{scrollbar-color:auto}}

/* Captioned imported content and accessible horizontal table scrolling. */
.table-scroll{overflow-x:auto;margin:28px 0 36px;border:1px solid var(--line);border-radius:10px;background:var(--paper)}
.table-scroll table{margin:0;min-width:440px;width:100%;font-size:15px;line-height:1.6}
article table>caption,.table-scroll caption{text-align:left;caption-side:bottom;padding:10px 0 0;font-size:14px;line-height:1.6;font-weight:400;color:var(--muted);background:transparent;border:0}
.table-scroll th,.table-scroll td{padding:12px 18px;vertical-align:top}.table-scroll th{font-weight:650}.table-scroll tbody tr:nth-child(even){background:var(--panel)}
.table-scroll td:first-child{min-width:105px}.table-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
figure.code-listing{padding:0;border:0;background:transparent;margin:28px 0 36px}figure.code-listing pre{margin:0}figure.code-listing figcaption{margin-top:10px}
figure figcaption{font-size:14px;line-height:1.6;color:var(--muted)}
@media print{.table-scroll{overflow:visible}.table-scroll table{min-width:0}article table>caption,.table-scroll caption{caption-side:bottom;break-before:avoid}}

/* Keep complete code and terminal output within the reading column. */
article figure.code-listing,article figure.code-listing div.sourceCode{min-width:0;max-width:100%}
article pre,article pre.sourceCode,article pre code,article pre code.sourceCode{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;max-width:100%;box-sizing:border-box}
article div.sourceCode{overflow:visible;min-width:0;max-width:100%}
article pre{overflow:visible;padding-right:28px}
article pre code>span{white-space:inherit;overflow-wrap:inherit}
article pre:has(.copy){padding-top:48px}

article pre>button.no-print{float:none!important;display:block;margin:0 0 14px auto}

/* Inline code must read as a separate token in headings and prose. */
article :is(h1,h2,h3,h4,h5,h6,p,li,td,th) code{font-size:.88em;letter-spacing:normal;font-weight:inherit;padding:.08em .24em;border-radius:4px;background:var(--panel);box-decoration-break:clone;-webkit-box-decoration-break:clone;overflow-wrap:anywhere}
article pre code{padding:0;background:none}
.table-scroll table{min-width:0;table-layout:auto}.table-scroll td:first-child{min-width:0}.table-scroll td,.table-scroll th{overflow-wrap:anywhere}
article a{overflow-wrap:anywhere}article figure{max-width:100%;box-sizing:border-box}

.code-frame{position:relative;min-width:0;max-width:100%}
article .code-frame pre{padding:17px 96px 17px 19px;margin-top:0}
.copy-code{position:absolute;top:17px;right:14px;display:inline-flex;align-items:center;gap:5px;border:0;background:transparent;color:var(--muted);font:12px system-ui;line-height:20px;padding:2px 4px;cursor:pointer;border-radius:4px}
.copy-code:hover{color:var(--ink);background:var(--panel)}.copy-code:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media print{article .code-frame pre{padding:11pt!important}}

.doc-sidebar .intro-legacy{margin:24px 8px 10px;padding-top:16px;border-top:1px solid var(--line)}.doc-sidebar .intro-legacy summary{font-size:12px;color:var(--muted);cursor:pointer}.doc-sidebar .intro-legacy a{font-size:12px}

/* Introduction content components use the same reader shell as every lesson. */
.intro-hero{position:relative;border:1px solid #d8dfe9;background:linear-gradient(125deg,#eff3f8,#dce4ef);border-radius:18px;padding:28px;margin:0 0 28px;overflow:hidden;color:#1e3860}
.intro-hero>span{font:650 12px system-ui;letter-spacing:.18em}.intro-hero small{display:block;margin-top:18px;font-size:12px;line-height:1.7}.intro-hero-path{display:flex;align-items:center;max-width:330px;margin:22px 0}.intro-hero-path b{display:grid;place-items:center;border:1px solid #98abc8;background:#ffffffa0;width:42px;height:42px;border-radius:12px;font:500 17px system-ui}.intro-hero-path i{height:1px;background:#98abc8;flex:1;max-width:70px}
.intro-card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0 26px}
.intro-card{display:flex;flex-direction:column;gap:10px;padding:18px;border:1px solid var(--line);border-radius:12px;background:var(--paper);color:var(--ink);text-decoration:none;transition:border-color .15s,background .15s}
.intro-card:hover{border-color:var(--accent);background:var(--panel)}.intro-card-title{display:flex;align-items:center;justify-content:space-between;gap:12px;font:600 14px system-ui;color:var(--ink)}.intro-card-title>span{color:var(--accent)}.intro-card>span:last-child{font-size:13px;line-height:1.6;color:var(--muted)}
.intro-outcomes{padding-left:23px}.intro-outcomes li{margin:12px 0;padding-left:6px}.intro-sequence{margin-top:42px}
.dark .intro-hero{background:linear-gradient(125deg,#202835,#26303f);border-color:#3c4859;color:#b6c6dd}.dark .intro-hero-path b{background:#242e3c;border-color:#5f6d82}
@media(max-width:500px){.intro-card-grid{grid-template-columns:1fr}.intro-hero{padding:22px}}
@media print{.intro-hero{display:none}.intro-card{break-inside:avoid}}

/* Navigation symbols stay local to the web reader; selection has a shape as well as colour. */
.doc-sidebar nav a{position:relative}
.doc-sidebar nav a::before{content:"";position:absolute;left:0;top:7px;bottom:7px;width:3px;border-radius:3px;background:transparent}
.doc-sidebar nav a.active::before{background:var(--accent)}
.doc-sidebar nav a.active .nav-icon{color:var(--accent)}
.optional-ipython{margin:30px 0;padding:18px;border:1px solid var(--line);border-radius:10px;background:var(--panel)}
.optional-ipython>summary{cursor:pointer;font-weight:600;line-height:1.6}
.optional-ipython[open]>summary{margin-bottom:18px}
@media print{.doc-sidebar,.doc-header,.nav-icon,.doc-sidebar nav a::before{display:none!important}.optional-ipython{border:0;padding:0;background:transparent}}

/* Book references use accessible numbered endnotes. */
.footnotes{font-size:.85em;line-height:1.6;margin-top:2.5rem;color:var(--muted,#526176)}
.footnotes li{padding-left:.25rem;margin-bottom:.65rem}.footnote-ref{font-size:.75em;vertical-align:super;line-height:0}.footnote-back{margin-left:.25em}

/* Previous/next reading links and position in the online edition. */
.book-pagination{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:16px;padding-top:20px}
.book-pagination a{max-width:none;display:flex;flex-direction:column;gap:5px;line-height:1.45;text-decoration:none}
.book-pagination .page-next{text-align:right;grid-column:3}.book-pagination .page-prev{grid-column:1}.page-direction,.page-position,.page-end{font-size:12px;color:var(--muted)}.page-position{white-space:nowrap;text-align:center}.page-end{font-style:italic}.narrative-transition{margin-bottom:18px}
@media(max-width:600px){.book-pagination{grid-template-columns:1fr 1fr;gap:18px}.book-pagination .page-next{grid-column:2;grid-row:1}.book-pagination .page-position{grid-row:2;grid-column:1/-1}.book-pagination .page-end{grid-row:1}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Captions are siblings of the bordered table region, never inside its border. */
article figure.table-figure{padding:0;border:0;background:transparent;border-radius:0;margin:28px 0 36px}
article figure.table-figure>.table-scroll{margin:0}
article figure.table-figure>figcaption{margin:10px 0 0;padding:0;border:0;background:transparent;text-align:left;font-size:14px;font-weight:400;line-height:1.6;color:var(--muted)}
@media print{article figure.table-figure>figcaption{break-before:avoid}}

/* KCS company palette: blue primary, gold supporting accent. */
:root{--accent:#0d397a;--gold:#f6b914;--ink:#172440;--muted:#657186;--panel:#f5f8fb;--line:#dfe6ec}.dark{--accent:#9bc4ff;--paper:#101b2d;--panel:#192942;--ink:#e8eef8;--muted:#afbed3;--line:#33465e}a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible{outline-color:var(--accent)}

/* The frame encloses only the visual; its caption remains below the box. */
article figure.media-figure{padding:0;border:0;background:transparent;border-radius:0}
article figure.media-figure>.figure-media{padding:20px;border:1px solid var(--line);border-radius:14px;background:#fdfdfe}
article figure.media-figure>figcaption{margin:10px 0 0;padding:0;border:0;background:transparent}
.dark article figure.media-figure{background:transparent}
.dark article figure.media-figure>.figure-media{background:var(--panel)}
@media print{article figure.media-figure>.figure-media{padding:10pt}article figure.media-figure>figcaption{break-before:avoid}}

/* Shared component for explicitly grouped page outlines. */
.chapter-toc .toc-group-label{display:block;font-size:12px;line-height:1.45;letter-spacing:.02em;margin:16px 0 6px;color:var(--ink)}
.chapter-toc .toc-group:first-of-type .toc-group-label{margin-top:4px}

/* Prediction controls belong to the screen edition, not the printed book. */
@media print{details.prediction-check{display:block}details.prediction-check>summary{display:none!important}details.prediction-check::details-content{content-visibility:visible;height:auto}}
