:root{
  --bg:#f4f6f8;--surface:#fff;--ink:#17202a;--muted:#667085;--line:#dfe4ea;
  --accent:#202a44;--accent-soft:#e9edf5;--danger:#a61b1b;--warn:#8a5a00;
  --ok:#1f6f43;font-family:Inter,Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);line-height:1.65}
a{color:inherit}button,input,textarea,select{font:inherit}
button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.55}
code{font-family:"SFMono-Regular",Consolas,monospace;font-size:.92em}
pre{overflow:auto;padding:16px;background:#111827;color:#fff;border-radius:12px;white-space:pre}
table{width:100%;border-collapse:collapse;background:#fff}.table-wrap{overflow:auto;margin:14px 0}
th,td{padding:10px 12px;border:1px solid var(--line);text-align:left;vertical-align:top}
.topbar{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;gap:14px;min-height:58px;padding:0 22px;background:#fffffff2;border-bottom:1px solid var(--line)}
.brand{font-weight:800;letter-spacing:.08em;text-decoration:none}.top-links{display:flex;gap:12px;flex-wrap:wrap}.top-link,.muted{color:var(--muted)}
.shell{width:min(1100px,calc(100% - 30px));margin:auto;padding:32px 0 72px}
.hero,.card,.planner,.flow,.daily-summary,.index-card,.material-card,.activity,.runtime-panel,.writer{background:var(--surface);border:1px solid var(--line);border-radius:18px}
.hero{padding:30px;margin-bottom:20px;box-shadow:0 10px 30px #17202a12}.hero h1{margin:4px 0 8px;font-size:clamp(2rem,5vw,3rem);line-height:1.15}
.eyebrow{margin:0;color:var(--muted);font-size:.78rem;font-weight:800;letter-spacing:.12em}.lead{color:var(--muted)}
.primary,.secondary,.danger{display:inline-flex;justify-content:center;align-items:center;min-height:42px;padding:0 14px;border-radius:11px;text-decoration:none;font-weight:700;border:1px solid var(--line);background:#fff}
.primary{background:var(--accent);color:#fff;border-color:var(--accent)}.danger{color:var(--danger);border-color:#e2b6b6}
.disabled,[aria-disabled="true"]{opacity:.45;pointer-events:none}.hidden{display:none!important}
.actions,.meta,.answer-actions,.timer-actions,.queue-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:14px}.meta{color:var(--muted)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}.card,.runtime-panel,.writer{padding:20px}
.notice,.status-box{margin:16px 0;padding:13px 15px;border-radius:12px;background:var(--accent-soft);color:#39445c;font-size:.92rem}
.status-box[data-tone="error"]{background:#fff0f0;color:var(--danger)}
.status-box[data-tone="warn"]{background:#fff6df;color:var(--warn)}
.status-box[data-tone="ok"]{background:#edf8f1;color:var(--ok)}
.flow-stack{display:grid;gap:14px}.flow{padding:22px}.flow-head{display:flex;gap:8px;align-items:center;margin-bottom:10px}
.pill{display:inline-flex;padding:3px 9px;border-radius:999px;background:var(--accent-soft);font-size:.76rem;font-weight:800}.flow-kind{font-size:.82rem;color:var(--muted)}
.choice{display:flex;gap:9px;padding:10px;margin-top:7px;background:var(--bg);border-radius:10px}
.response,.writer textarea,.writer input,.planner input,.planner select{width:100%;margin-top:8px;padding:10px;border:1px solid var(--line);border-radius:10px;background:#fff}
.answer-fields{border:0;padding:0;margin:14px 0}.answer-fields legend{font-weight:700}.save-state{font-size:.9rem;color:var(--muted)}
.save-state[data-state="committed"]{color:var(--ok)}.save-state[data-state="error"],.save-state[data-state="unknown"]{color:var(--danger)}
.submission-result{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#fafbfc}
.scope-nav{display:flex;justify-content:space-between;gap:10px;margin-top:22px}
.planner{display:grid;grid-template-columns:310px 1fr;overflow:hidden}.controls{padding:24px;background:var(--accent-soft)}
.pool{padding:22px}.scope-row{display:grid;grid-template-columns:22px 1fr auto;gap:10px;align-items:center;padding:12px 0;border-top:1px solid var(--line)}
.scope-row span span{display:block;color:var(--muted);font-size:.85rem}.section-head{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.section-head h2{font-size:1.08rem}.section-head span{color:var(--muted);font-size:.85rem}
.catalog-toolbar{display:grid;grid-template-columns:1fr 220px;gap:10px;margin-bottom:12px}.catalog-scroll{max-height:62vh;overflow:auto}
.queue-list,.reference-list{display:grid;gap:10px;padding:0;list-style:none}.queue-item{display:grid;grid-template-columns:46px 1fr auto;gap:12px;align-items:center;padding:13px;background:#fff;border:1px solid var(--line);border-radius:12px}
.queue-order{display:grid;place-items:center;min-height:42px;border-radius:10px;background:var(--accent-soft);font-weight:800}
.locked{border-left:4px solid #b26b00}.admitted{border-left:4px solid #2d7c50}
.daily-summary{display:grid;grid-template-columns:repeat(3,1fr);margin-bottom:18px}.daily-summary div{padding:18px}.daily-summary strong{font-size:1.7rem;margin-right:7px}
.index-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.index-card{display:grid;gap:7px;padding:18px;text-decoration:none}
.breadcrumb{color:var(--muted);font-size:.9rem;margin-bottom:10px}.local-ref{border-bottom:1px dotted var(--muted)}
.material-card{padding:18px}.resource-range{margin:.4rem 0}.resource-open{display:inline-flex;margin-top:8px;font-weight:700}
.references{margin-top:22px}.reference-list .material-card{border-radius:12px}.completion-help{margin-top:10px}
.timer{display:flex;align-items:center;justify-content:space-between;gap:15px}.timer-value{font-variant-numeric:tabular-nums;font-size:1.35rem;font-weight:800}
.note-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.note-grid label{font-weight:700}.note-grid textarea{min-height:110px}
.source-dialog{width:min(900px,calc(100% - 24px));max-height:88vh;border:1px solid var(--line);border-radius:16px;padding:0}
.source-dialog::backdrop{background:#11182777}.dialog-head{position:sticky;top:0;display:flex;justify-content:space-between;gap:10px;align-items:center;padding:14px 18px;background:#fff;border-bottom:1px solid var(--line)}
.dialog-body{padding:18px;overflow:auto}.source-meta{font-size:.85rem;color:var(--muted);word-break:break-all}
.writer{display:grid;gap:12px}.writer label{font-weight:700}.writer-actions{display:flex;gap:8px;flex-wrap:wrap}
.warning-inline{color:var(--warn);font-weight:700}.error-inline{color:var(--danger);font-weight:700}
@media(max-width:760px){
 .shell{width:min(100% - 18px,1100px);padding-top:18px}.topbar{padding:0 12px;align-items:flex-start;padding-top:10px;padding-bottom:10px}
 .planner,.grid2,.index-grid,.catalog-toolbar,.note-grid,.reference-grid{grid-template-columns:1fr}.scope-nav{flex-direction:column}.scope-nav>*{width:100%}
 .daily-summary{grid-template-columns:1fr}.queue-item{grid-template-columns:40px 1fr}.queue-item>.queue-actions{grid-column:2}
}

.reference-section{margin-top:22px}.reference-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.catalog-list{max-height:64vh;overflow:auto;padding-right:4px}
.admission{display:inline-flex;padding:2px 8px;border-radius:999px;font-size:.82rem;font-weight:800}
.admission.allowed{background:#edf8f1;color:var(--ok)}.admission.blocked{background:#fff6df;color:var(--warn)}
.timer-panel .section-head strong{font-variant-numeric:tabular-nums;font-size:1.35rem}
#source-dialog{width:min(900px,calc(100% - 24px));max-height:88vh;border:1px solid var(--line);border-radius:16px;padding:18px}
#source-dialog::backdrop{background:#11182777}.dialog-close{float:right}
#workspace-checksum{overflow-wrap:anywhere}

:focus-visible{outline:3px solid #2458be;outline-offset:3px}
.grid2>* , .planner>* , .flow-stack>* , .flow>* , .queue-item>*{min-width:0}
.card,.hero,.flow,.runtime-panel,.material-card,.meta,.breadcrumb{overflow-wrap:anywhere}
pre,.table-wrap{max-width:100%;min-width:0}
.activity{padding:14px}.evaluation-form{display:grid;gap:12px}.evaluation-form label{display:grid;gap:6px}
.evaluation-form textarea,.evaluation-form select{width:100%;min-width:0}
#bound-session-list{display:grid;gap:12px}.count{display:flex;gap:6px}.count input{min-width:0}
@media(max-width:760px){.reference-grid{grid-template-columns:1fr}.section-head{flex-wrap:wrap}.flow{padding:12px}}

.inline-reference {border-inline-start: .25rem solid currentColor; padding: .75rem 1rem; margin: 1rem 0;}
.preparation-advice details {margin: 1rem 0;}
.preparation-advice summary {cursor: pointer; font-weight: 600;}
.priority-controls select {display: block; width: 100%; margin-block: .5rem;}
.catalog-proposal {border-style: dashed;}

/* Learner Session Shell v2 — presentation only. */
.session-shell-v2{margin-block:1.25rem 2rem}
.session-layout-v2{display:grid;grid-template-columns:minmax(10rem,12rem) minmax(0,1fr) minmax(12rem,15rem);gap:1rem;align-items:start}
.session-rail-v2,.session-evidence-v2{position:sticky;top:5.25rem;max-height:calc(100vh - 6.5rem);overflow:auto}
.session-rail-v2{display:grid;gap:.35rem;padding:.5rem;border:1px solid var(--line,#d8dde0);border-radius:.8rem;background:var(--surface,#fff)}
.session-rail-item-v2{display:grid;grid-template-columns:2.1rem minmax(0,1fr);gap:.6rem;align-items:start;width:100%;text-align:left;border:1px solid transparent;border-radius:.65rem;padding:.65rem;background:transparent;color:inherit}
.session-rail-item-v2:hover{background:color-mix(in srgb,currentColor 5%,transparent)}
.session-rail-item-v2[aria-current="step"]{border-color:currentColor;background:color-mix(in srgb,currentColor 8%,transparent)}
.session-rail-number-v2{display:grid;place-items:center;min-height:2rem;border:1px solid currentColor;border-radius:999px;font-size:.75rem}
.session-rail-item-v2 strong,.session-rail-item-v2 small{display:block}
.session-rail-item-v2 small{margin-top:.1rem;opacity:.68;font-size:.75rem;line-height:1.35;overflow-wrap:anywhere}
.session-active-v2{min-width:0}
.session-active-v2 .flow-stack{display:block}
.session-step-v2[hidden]{display:none!important}
.session-step-v2>.inline-reference{margin-top:0}
.session-active-v2 .flow{margin:0;min-height:28rem}
.session-active-v2 .flow>div:not(.flow-head),.session-active-v2 .flow>.material-card,.session-active-v2 .flow>.activity{max-width:72ch;margin-inline:auto}
.session-evidence-v2{padding:1rem;border:1px solid var(--line,#d8dde0);border-radius:.8rem;background:var(--surface,#fff)}
.session-evidence-v2 h2{font-size:1rem;margin-top:0}
.session-state-list-v2{margin:0}
.session-state-list-v2>div{display:grid;grid-template-columns:minmax(4.4rem,.7fr) minmax(0,1.3fr);gap:.6rem;padding:.55rem 0;border-bottom:1px solid color-mix(in srgb,currentColor 14%,transparent)}
.session-state-list-v2 dt{opacity:.68}
.session-state-list-v2 dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.session-next-v2{margin-top:1rem;padding:.8rem;border-radius:.65rem;background:color-mix(in srgb,currentColor 6%,transparent)}
.session-next-v2 span,.session-next-v2 strong{display:block}
.session-next-v2 span{font-size:.75rem;opacity:.68}
.session-next-v2 strong{margin-top:.25rem}
.session-boundary-v2{font-size:.78rem;opacity:.68;margin-bottom:0}
.session-resume-v2{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:1rem 0;padding:.8rem 1rem;border:1px solid var(--line,#d8dde0);border-radius:.8rem;background:var(--surface,#fff)}
.session-resume-v2>div{display:grid;min-width:0}
.session-resume-v2 strong,.session-resume-v2 [data-session-resume-detail]{overflow-wrap:anywhere}
.session-kicker-v2{font-size:.72rem;opacity:.68}
.session-resume-v2 [data-session-resume-detail]{font-size:.78rem;opacity:.68}
.session-controls-v2{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;margin-top:1rem}
.session-controls-v2 [data-session-nav-state]{text-align:center;font-size:.8rem;opacity:.68}
.session-shell-v2.focus-lens-on .focus-lens-candidate{opacity:.28;transition:opacity .12s ease,background-color .12s ease}
.session-shell-v2.focus-lens-on .focus-lens-candidate.focus-lens-active,.session-shell-v2.focus-lens-on .focus-lens-candidate:focus{opacity:1;background:color-mix(in srgb,currentColor 5%,transparent);border-radius:.35rem}
.catalog-browser-v2{margin-top:1rem;border:1px solid var(--line,#d8dde0);border-radius:.8rem;background:var(--surface,#fff)}
.catalog-browser-v2>summary{cursor:pointer;padding:1rem;font-weight:700}
.catalog-browser-v2>.index-grid{padding:0 1rem 1rem}
.home-action-grid-v2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem;margin-top:1rem}
.home-action-v2{display:block;padding:1rem;border:1px solid var(--line,#d8dde0);border-radius:.8rem;text-decoration:none;color:inherit;background:var(--surface,#fff)}
.home-action-v2 strong,.home-action-v2 span{display:block}
.home-action-v2 span{margin-top:.25rem;opacity:.68}
@media(max-width:1050px){
 .session-layout-v2{grid-template-columns:minmax(9.5rem,11rem) minmax(0,1fr)}
 .session-evidence-v2{position:static;max-height:none;grid-column:1/-1}
}
@media(max-width:760px){
 .session-layout-v2{display:block}
 .session-rail-v2{position:static;display:flex;max-height:none;overflow-x:auto;margin-bottom:.75rem;scroll-snap-type:x proximity}
 .session-rail-item-v2{min-width:8.5rem;scroll-snap-align:start}
 .session-active-v2 .flow{min-height:0}
 .session-evidence-v2{margin-top:.75rem}
 .session-resume-v2{align-items:flex-start}
 .session-controls-v2{grid-template-columns:1fr 1fr}
 .session-controls-v2 [data-session-nav-state]{grid-column:1/-1;grid-row:1}
 .session-controls-v2 button{width:100%}
 .home-action-grid-v2{grid-template-columns:1fr}
}
@media(max-width:420px){
 .session-resume-v2{display:grid}
 .session-resume-v2 button{width:100%}
}
@media(prefers-reduced-motion:reduce){
 .session-shell-v2.focus-lens-on .focus-lens-candidate{transition:none}
}
/* Keep page actions together; adjacent-topic links appear only at boundaries. */
.session-shell-v2 .session-controls-v2 {display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:.8rem;margin-inline:auto;width:max-content;max-width:100%}
.session-shell-v2 .session-controls-v2 [data-session-nav-state] {flex:0 0 auto;white-space:nowrap}
.session-shell-v2 .session-controls-v2 button {width:auto;min-width:8rem}
.scope-nav.session-scope-nav-v2 {display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:1rem;margin:1rem auto;width:max-content;max-width:100%}
.scope-nav.session-scope-nav-v2[hidden],.scope-nav.session-scope-nav-v2 [hidden] {display:none!important}
@media(max-width:500px){
 .session-shell-v2 .session-controls-v2 {column-gap:.6rem;row-gap:.5rem}
 .session-shell-v2 .session-controls-v2 button {min-width:7rem;flex:0 1 auto}
 .session-shell-v2 .session-controls-v2 [data-session-nav-state] {order:-1;flex-basis:100%;text-align:center}
}

/* Empty evidence is omitted rather than repeated as unconnected backend state. */
.session-state-list-v2>div[hidden],.session-boundary-v2[hidden]{display:none!important}
.session-next-v2 [data-session-action]{margin-top:.65rem;max-width:100%;white-space:normal}


/* Continuous Scope layout pilot: opt-in presentation only, no new save/score logic. */
body.scope-continuous-pilot .scope-frame-v3 {
  grid-template-columns:minmax(185px,225px) minmax(0,1fr);
  gap:clamp(16px,2.7vw,34px);
}
body.scope-continuous-pilot .scope-course-nav-v3 {
  background:var(--surface,#fff);padding:14px;box-shadow:none;
}
body.scope-continuous-pilot .scope-reading-column-v3 {min-width:0}
body.scope-continuous-pilot .scope-reading-column-v3 > .hero {
  padding:clamp(17px,3vw,30px);
  border-radius:12px;
  box-shadow:none;
}
body.scope-continuous-pilot .scope-reading-column-v3 > .hero h1 {
  font-size:clamp(1.65rem,3vw,2.35rem);
  line-height:1.3;
}
body.scope-continuous-pilot .continuous-outline,
body.scope-continuous-pilot .continuous-utility {margin:12px 0;border-bottom:1px solid var(--line,#d8dde0)}
body.scope-continuous-pilot .continuous-outline > summary,
body.scope-continuous-pilot .continuous-utility > summary {
  cursor:pointer;min-height:44px;padding:10px 7px;font-size:.87rem;
  font-weight:730;color:var(--ink,inherit);
}
body.scope-continuous-pilot .continuous-outline nav {padding:2px 0 12px}
body.scope-continuous-pilot .continuous-outline :is(ol,ul) {
  list-style:none;margin:0;padding:0;counter-reset:scope-section;
}
body.scope-continuous-pilot .continuous-outline li {min-width:0}
body.scope-continuous-pilot .continuous-outline a {
  display:block;text-decoration:none;border-radius:7px;min-height:38px;
  font-size:.82rem;line-height:1.5;padding:8px 9px;overflow-wrap:anywhere;
  color:var(--ink,inherit);
}
body.scope-continuous-pilot .continuous-outline a:hover,
body.scope-continuous-pilot .continuous-outline a:focus-visible {background:var(--accent-faint,#edf3ed)}
body.scope-continuous-pilot .continuous-outline-more {margin:6px 0;border-top:1px solid var(--line,#d8dde0)}
body.scope-continuous-pilot .continuous-outline-more > summary {
  cursor:pointer;font-size:.8rem;padding:9px 8px;
}
body.scope-continuous-pilot .continuous-utility > .scope-course-actions-v3 {
  border:0;padding:0 0 9px;
}
body.scope-continuous-pilot .continuous-reader-tools {
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-top:16px;
}
body.scope-continuous-pilot .continuous-reader-tools button,
body.scope-continuous-pilot .continuous-compare {
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;border-radius:8px;padding:7px 12px;font-size:.84rem;
}
body.scope-continuous-pilot .continuous-compare {
  color:var(--muted,#60716d);text-decoration:underline;text-underline-offset:3px;
}
body.scope-continuous-pilot .scope-context-v3 {margin-bottom:12px}
body.scope-continuous-pilot .continuous-flow-stack {
  display:block;max-width:100%;min-width:0;
  overflow:visible;background:var(--surface,#fff);
  border:1px solid var(--line,#d8dde0);border-radius:12px;
}
body.scope-continuous-pilot .continuous-flow-stack > .flow,
body.scope-continuous-pilot .first-week-shell .continuous-flow-stack > .flow {
  display:block;min-height:0;margin:0!important;
  padding:clamp(18px,2.8vw,32px)!important;
  border:0!important;border-bottom:1px solid var(--line,#d8dde0)!important;
  border-radius:0!important;box-shadow:none!important;
  background:transparent!important;scroll-margin-top:100px;
}
body.scope-continuous-pilot .continuous-flow-stack > .flow:last-child {border-bottom:0!important}
body.scope-continuous-pilot .continuous-flow-stack > .flow > * {max-width:100%}
body.scope-continuous-pilot .continuous-flow-stack > .flow[data-flow-kind="material"] {
  background:var(--surface-soft,#fafbf9)!important;
}
body.scope-continuous-pilot .continuous-flow-stack > .comprehension-check {
  margin:16px clamp(12px,2.4vw,24px);
  padding:clamp(16px,2.5vw,24px);
  border-radius:10px;box-shadow:none;
  scroll-margin-top:95px;
}
body.scope-continuous-pilot .continuous-flow-stack pre {
  max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;
}
body.scope-continuous-pilot .continuous-flow-stack .flow h2,
body.scope-continuous-pilot .continuous-flow-stack .flow h3 {
  scroll-margin-top:100px;line-height:1.5;
}
body.scope-continuous-pilot .continuous-reading-current {
  background:var(--accent-faint,#edf3ed)!important;
  box-shadow:0 0 0 7px var(--accent-faint,#edf3ed);
  border-radius:3px;
}
body.scope-continuous-pilot .continuous-record-extra,
body.scope-continuous-pilot .continuous-history {
  margin:16px 0 22px;padding:0 16px;
  border:1px solid var(--line,#d8dde0);border-radius:9px;
  background:var(--surface,#fff);
}
body.scope-continuous-pilot .continuous-record-extra > summary,
body.scope-continuous-pilot .continuous-history > summary {
  cursor:pointer;min-height:44px;padding:11px 0;
  font-size:.88rem;font-weight:650;
}
body.scope-continuous-pilot .continuous-history > .answer-actions,
body.scope-continuous-pilot .continuous-history > details,
body.scope-continuous-pilot .continuous-history > aside {
  margin:0 0 14px;
}
body.scope-continuous-pilot .continuous-cloud-record {
  margin-top:22px;box-shadow:none;border-radius:12px;
}
body.scope-continuous-pilot .continuous-cloud-record > label {
  display:block;max-width:70ch;margin:10px 0;
}
body.scope-continuous-pilot .continuous-cloud-record textarea {display:block;width:100%;margin-top:9px}
body.scope-continuous-pilot #personal-record {
  box-shadow:none;border-radius:12px;max-width:100%;
}
body.scope-continuous-pilot .memory-lab-disclosure {margin:22px 0;scroll-margin-top:100px}
body.scope-continuous-pilot .scope-reading-column-v3 .scope-nav {margin:22px auto}
body.scope-continuous-pilot :is(.continuous-outline,.continuous-utility,.continuous-history,.continuous-record-extra) > summary:focus-visible,
body.scope-continuous-pilot .continuous-reader-tools :focus-visible {
  outline:3px solid var(--focus,#23634c);outline-offset:3px;
}
@media(max-width:850px) {
  body.scope-continuous-pilot .scope-frame-v3 {display:block}
  body.scope-continuous-pilot .scope-course-nav-v3 {
    position:static;max-height:none;margin-bottom:12px;padding:12px;
  }
  body.scope-continuous-pilot .continuous-flow-stack > .flow,
  body.scope-continuous-pilot .first-week-shell .continuous-flow-stack > .flow {
    padding:18px 16px!important;
  }
}
@media(max-width:500px) {
  body.scope-continuous-pilot .scope-reading-column-v3 > .hero {padding:18px 16px}
  body.scope-continuous-pilot .continuous-flow-stack > .comprehension-check {margin:12px 8px;padding:16px 12px}
  body.scope-continuous-pilot .continuous-reader-tools > * {max-width:100%}
}
@media(prefers-reduced-motion:reduce) {
  body.scope-continuous-pilot .continuous-reading-current {transition:none!important}
}

/* Continuous is the default. An explicit legacy view keeps a visible way back. */
body:is([data-page="scope"],[data-page="first-week"]) .continuous-legacy-return {
  display:inline-flex;min-height:44px;align-items:center;
  margin-top:12px;padding:8px 13px;
  color:var(--accent-strong,#345746);
  background:var(--accent-faint,#f0f4ef);
  border:1px solid var(--line,#d8d8cf);
  border-radius:8px;font-size:.86rem;
  text-decoration:underline;text-underline-offset:3px;
}
body:is([data-page="scope"],[data-page="first-week"]) .continuous-legacy-return:focus-visible {
  outline:3px solid var(--focus,#2458be);outline-offset:3px;
}

/* Unnumbered authored headings do not need an empty numeral gutter. */
body.scope-continuous-pilot .continuous-outline .textbook-toc-index:empty {display:none}

/* Reading-centered academic visual system.
 * Warm paper surfaces + low-chroma sage accents for long text/formula sessions.
 * Presentation only: no data/record semantics live in this file.
 */
:root{
  --bg:#f3f0e9;
  --surface:#fbfaf6;
  --surface-raised:#fdfcf8;
  --surface-soft:#f0f1eb;
  --ink:#26332e;
  --muted:#616b65;
  --line:#d8d8cf;
  --line-strong:#c4c9c2;
  --accent:#456b5b;
  --accent-strong:#345746;
  --accent-soft:#e4ebe5;
  --accent-faint:#f0f4ef;
  --danger:#8f3e38;
  --warn:#806229;
  --ok:#3f6955;
  --reading-measure:70ch;
  --reader-width:42rem;
  --reader-scale:1;
  --type-body:1.0625rem;
  --type-meta:.875rem;
  --space-paragraph:.8em;
  --space-block:1.25rem;
  --space-section:2rem;
  --focus:#2458be;
  --ui-radius:12px;
  --ui-shadow:0 5px 18px rgb(38 51 46 / .045);
  font-family:-apple-system,BlinkMacSystemFont,"Pretendard","Noto Sans KR","Apple SD Gothic Neo","Segoe UI",sans-serif;
}
html{background:var(--bg)}
body{background:var(--bg);color:var(--ink);font-size:16px;line-height:1.68}
body::before{content:none!important}
h1,h2,h3,h4{color:#203029;letter-spacing:-.018em;text-wrap:balance}
p,li,dd{word-break:keep-all}
a{text-underline-offset:.18em}
code{color:#34443d}
pre code{color:inherit}
pre{background:#202b27;color:#f3f5f2;border:1px solid #34423c;border-radius:9px;line-height:1.62}
table{background:var(--surface-raised)}
th,td{border-color:var(--line);line-height:1.6}
input,textarea,select{color:var(--ink)!important;background:#fdfcf8!important;border-color:var(--line-strong)!important}
textarea{line-height:1.72}
::selection{background:#cddbd1;color:#1f2d27}

.topbar{
  min-height:62px;
  padding-inline:clamp(14px,3vw,32px);
  background:rgb(251 250 246 / .96);
  border-bottom-color:var(--line);
  box-shadow:0 1px 7px rgb(38 51 46 / .035);
  backdrop-filter:none;
}
.brand{
  font-family:Georgia,"Times New Roman","Noto Serif KR",serif;
  font-size:1.16rem;
  color:#223831;
  letter-spacing:.055em;
}
.top-link{font-weight:650;text-decoration:none}
.top-link:hover{color:var(--accent-strong)}

.shell{width:min(1240px,calc(100% - 32px));padding:26px 0 68px}
body[data-page="scope"] .shell{width:min(1480px,calc(100% - 32px));padding-top:20px}
.hero,.card,.planner,.flow,.daily-summary,.index-card,.material-card,.activity,.runtime-panel,.writer{
  background:var(--surface-raised);
  border-color:var(--line);
  border-radius:var(--ui-radius);
}
.hero{padding:26px;box-shadow:none}
.hero h1{font-size:clamp(1.9rem,4vw,2.65rem)}
.lead{color:var(--muted);max-width:72ch}
.primary,.secondary,.danger{
  min-height:44px;border-radius:9px;
  background:var(--surface-raised);border-color:var(--line-strong)
}
.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.primary:hover{background:var(--accent-strong);border-color:var(--accent-strong)}
.secondary:hover{border-color:#9fa9a2;background:var(--accent-faint)}
.pill{background:var(--accent-soft);color:#355244}
.notice,.status-box{background:var(--accent-faint);color:#45544d}
.status-box[data-tone="warn"]{background:#f6f0df;color:var(--warn)}
.status-box[data-tone="error"]{background:#f7e9e6;color:var(--danger)}
.status-box[data-tone="ok"]{background:#e8f0ea;color:var(--ok)}
.save-state[data-state="committed"]{color:var(--ok)}
.save-state[data-state="error"],.save-state[data-state="unknown"]{color:var(--danger)}
.choice{background:#f3f2ec}
.submission-result{background:#f7f6f1}
.queue-item{background:var(--surface-raised);border-color:var(--line)}
.queue-order{background:var(--accent-soft)}
.admission.allowed{background:#e5efe8;color:var(--ok)}
.admission.blocked{background:#f3ecd8;color:var(--warn)}
.material-card{box-shadow:none}
.resource-open{color:var(--accent-strong)}
.inline-reference{border-inline-start-color:#8aa091!important;background:#f4f5ef;border-radius:8px}
.completion-help{border-top:1px solid var(--line);padding-top:.7rem}
.completion-help summary{color:#3f594d;font-weight:650}

/* Scope frame: canonical unit navigation / reading surface / evidence. */
.scope-frame-v3{display:grid;grid-template-columns:minmax(190px,220px) minmax(0,1fr);gap:24px;align-items:start}
.scope-course-nav-v3{
  position:sticky;top:82px;max-height:calc(100vh - 102px);overflow:auto;
  padding:16px 12px;background:#f8f6f0;border:1px solid var(--line);
  border-radius:var(--ui-radius)
}
.scope-course-nav-v3 .scope-nav-title-v3{padding:4px 8px 12px;border-bottom:1px solid var(--line)}
.scope-course-nav-v3 .scope-nav-title-v3 small{display:block;color:var(--muted);font-size:.78rem}
.scope-course-nav-v3 .scope-nav-title-v3 strong{display:block;margin-top:2px;font-size:.96rem}
.scope-course-actions-v3{display:grid;gap:4px;padding:10px 0;border-bottom:1px solid var(--line)}
.scope-course-actions-v3 a{
  display:flex;align-items:center;min-height:38px;padding:6px 9px;border-radius:7px;
  color:#425048;text-decoration:none;font-size:.88rem;font-weight:600
}
.scope-course-actions-v3 a:hover{background:var(--accent-faint)}
.scope-unit-heading-v3{margin:14px 8px 7px;color:var(--muted);font-size:.74rem;font-weight:750;letter-spacing:.04em}
.scope-unit-list-v3{display:grid;gap:3px}
.scope-unit-link-v3{
  display:grid;grid-template-columns:1.8rem minmax(0,1fr);gap:.5rem;align-items:start;
  min-height:40px;padding:7px 8px;border-radius:7px;color:#4e5a54;text-decoration:none
}
.scope-unit-link-v3:hover{background:#eeefe9}
.scope-unit-link-v3[aria-current="page"]{background:#e3e9e3;color:#264a3a}
.scope-unit-link-v3 span{color:#7b857f;font-size:.73rem;font-variant-numeric:tabular-nums}
.scope-unit-link-v3 strong{font-size:.84rem;font-weight:620;line-height:1.42}
.scope-nav-foot-v3{margin:12px 8px 2px;color:var(--muted);font-size:.72rem;line-height:1.5}
.scope-reading-column-v3{min-width:0}
.scope-reading-column-v3>.breadcrumb{margin:2px 2px 8px}
.scope-reading-column-v3>.hero{margin-bottom:12px}
.scope-reading-column-v3>.hero .meta{font-size:.84rem}

/* Context is available but no longer competes with the reading flow. */
.scope-context-v3{
  margin:10px 0 12px;border:1px solid var(--line);border-radius:9px;background:#f8f7f2
}
.scope-context-v3>summary{cursor:pointer;padding:11px 14px;font-weight:650;color:#49574f}
.scope-context-v3>.grid2{padding:0 12px 12px}
.scope-context-v3 .card{padding:14px;background:transparent;border-color:#e4e1d8}
.scope-context-v3 .card h2{font-size:.94rem;margin-top:0}
#runtime-status{margin:10px 0 12px;font-size:.82rem}
.timer-panel{box-shadow:none}

/* Reading-dominant Session Shell: horizontal flow rail + right evidence column. */
.session-shell-v2{margin-block:.75rem 1.6rem}
.session-layout-v2{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(230px,270px)!important;
  grid-template-areas:"rail rail" "active evidence";
  gap:12px 18px!important;align-items:start
}
.session-rail-v2{
  grid-area:rail;position:static!important;max-height:none!important;overflow-x:auto!important;
  display:flex!important;gap:2px!important;padding:4px!important;
  border:1px solid var(--line)!important;border-radius:9px!important;
  background:#f8f7f2!important;scrollbar-width:thin
}
.session-rail-item-v2{
  min-width:118px!important;display:flex!important;grid-template-columns:none!important;
  align-items:center!important;gap:7px!important;padding:8px 10px!important;border-radius:7px!important
}
.session-rail-item-v2[aria-current="step"]{
  border-color:transparent!important;background:#e1e8e2!important;color:#294c3d
}
.session-rail-number-v2{
  min-width:1.7rem;width:1.7rem;min-height:1.7rem!important;border-color:#aab6af!important;
  color:#52635a;font-size:.69rem
}
.session-rail-item-v2 strong{font-size:.82rem!important}
.session-rail-item-v2 small{display:block!important;max-width:15rem;color:var(--muted);font-size:.78rem!important;opacity:1;line-height:1.45}
.session-active-v2{grid-area:active}
.session-evidence-v2{
  grid-area:evidence;position:sticky!important;top:82px!important;max-height:calc(100vh - 102px)!important;
  padding:15px!important;border-color:var(--line)!important;border-radius:9px!important;
  background:#f8f7f2!important;box-shadow:none
}
.session-evidence-v2 h2{font-size:.92rem!important}
.session-state-list-v2>div{padding:.48rem 0!important;border-color:#deddd5!important}
.session-state-list-v2 dt,.session-state-list-v2 dd{font-size:.76rem}
.session-state-list-v2 dd{font-weight:600!important}
.session-next-v2{background:#ebefe9!important;border:1px solid #d7ded8}
.session-boundary-v2{font-size:.71rem!important}
.session-resume-v2{
  margin:.65rem 0!important;padding:.68rem .85rem!important;border-color:var(--line)!important;
  border-radius:9px!important;background:#f8f7f2!important;box-shadow:none
}
.session-active-v2 .flow{
  min-height:0!important;padding:clamp(22px,3.3vw,38px)!important;
  border-color:var(--line)!important;border-radius:10px!important;background:var(--surface-raised)!important;
  box-shadow:var(--ui-shadow)
}

.session-active-v2 .flow>div:not(.flow-head),
.session-active-v2 .flow>.material-card,
.session-active-v2 .flow>.activity{max-width:min(var(--reading-measure),var(--reader-width))!important}
.session-active-v2 .flow p,
.session-active-v2 .flow li,
.source-body p,.source-body li{
  font-size:1.06rem;line-height:1.78;color:#303c36
}
.session-active-v2 .flow h2,.session-active-v2 .flow h3,.session-active-v2 .flow h4{
  margin-top:1.75em;margin-bottom:.65em;color:#24362e
}
.session-active-v2 .flow h2{font-size:1.34rem}
.session-active-v2 .flow h3{font-size:1.13rem}
.session-active-v2 .flow .activity-prompt{max-width:var(--reading-measure);margin-inline:auto}
.session-active-v2 .flow pre{margin-block:1.2rem}
.session-active-v2 .flow .table-wrap{margin-block:1.2rem}
.session-controls-v2{margin-top:10px!important}
.session-controls-v2 [data-session-nav-state]{color:var(--muted)}
.session-shell-v2.focus-lens-on .focus-lens-candidate{opacity:1!important}
.session-shell-v2.focus-lens-on .focus-lens-candidate.focus-lens-active,
.session-shell-v2.focus-lens-on .focus-lens-candidate:focus{
  opacity:1!important;background:#eef1eb!important
}

/* Practical/assessment surfaces use mild semantic distinction, never saturated banners. */
.activity[data-activity-stage="diagnostic"],
.activity[data-activity-stage="review"],
.activity[data-activity-stage="delayed-retrieval"]{border-top:3px solid #8c9e95}
.activity[data-activity-stage="guided"]{border-top:3px solid #718f80}
.activity[data-activity-stage="independent"],
.activity[data-activity-stage="transfer"]{border-top:3px solid #4e6f60}

/* Long-form local sources are reading pages, not product dashboards. */
body[data-page="source"] .shell{width:min(980px,calc(100% - 30px))}
body[data-page="source"] .hero{background:transparent;border:0;padding:12px 0 18px}
body[data-page="source"] .source-body{max-width:var(--reading-measure);margin-inline:auto;padding:clamp(24px,4vw,44px)}
body[data-page="source"] .source-body p,
body[data-page="source"] .source-body li{font-size:1.06rem;line-height:1.8}

/* Home/Daily retain structure but share the calmer visual system. */
.home-action-v2,.catalog-browser-v2{background:var(--surface-raised)!important;border-color:var(--line)!important}
.home-action-v2:hover{background:#f4f5ef!important;border-color:#b9c2bc!important}
.planner{box-shadow:none}
.controls{background:#e9eee8}
.index-card{box-shadow:none}
.index-card:hover{border-color:#aeb9b2;background:#f7f7f2}

/* No decorative imagery, gradients, quote cards, or ornamental pseudo-elements. */
.hero,.card,.flow,.writer,.runtime-panel,.material-card,.index-card,.planner,
.session-resume-v2,.session-evidence-v2,.scope-course-nav-v3{background-image:none!important}
blockquote{border-left:3px solid #a7b4ac;margin-inline:0;padding:.5rem 0 .5rem 1rem;color:#526159;background:transparent}

@media(max-width:1180px){
  body[data-page="scope"] .shell{width:min(1180px,calc(100% - 24px))}
  .scope-frame-v3{grid-template-columns:190px minmax(0,1fr);gap:16px}
  .session-layout-v2{grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"rail" "active" "evidence"!important}
  .session-evidence-v2{position:static!important;max-height:none!important}
}
@media(max-width:860px){
  .scope-frame-v3{display:block}
  .scope-course-nav-v3{position:static;max-height:none;margin-bottom:12px}
  .scope-unit-list-v3{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  body{font-size:15.5px}
  .shell,body[data-page="scope"] .shell{width:min(100% - 18px,1480px);padding-top:14px}
  .topbar{min-height:56px}
  .scope-unit-list-v3{grid-template-columns:1fr}
  .session-rail-v2{scroll-snap-type:x proximity}
  .session-rail-item-v2{min-width:108px!important;scroll-snap-align:start}
  .session-active-v2 .flow{padding:20px 16px!important}
  .session-active-v2 .flow p,.session-active-v2 .flow li,.source-body p,.source-body li{font-size:1rem;line-height:1.72}
  .scope-context-v3>.grid2{grid-template-columns:1fr}
}
@media(max-width:420px){
  .brand{font-size:1rem}
  .scope-course-nav-v3{padding:12px 9px}
  .session-rail-number-v2{display:none}
}
@media(prefers-reduced-motion:reduce){
  *{scroll-behavior:auto!important;transition-duration:.001ms!important;animation-duration:.001ms!important}
}


/* iPad-first refinements.
 * Apple HIG recommends adapting layout across orientation/multitasking and
 * at least 44x44pt button hit regions. These rules favor reading width over
 * persistent dashboards on touch-first tablet viewports.
 */
html{
  scroll-padding-bottom:max(24px,env(safe-area-inset-bottom));
  -webkit-text-size-adjust:100%;
}
body{
  padding-left:env(safe-area-inset-left);
  padding-right:env(safe-area-inset-right);
  padding-bottom:env(safe-area-inset-bottom);
}
textarea:focus,input:focus,select:focus,
.primary:focus,.secondary:focus,button:focus{
  scroll-margin-bottom:38vh;
}

/* Keep evidence below the reading surface on common iPad landscape widths,
 * including 13-inch class displays. True three-column reading begins only on
 * wide desktop-class viewports.
 */
@media(max-width:1399px){
  body[data-page="scope"] .shell{width:min(1260px,calc(100% - 24px))}
  .session-layout-v2{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:"rail" "active" "evidence"!important
  }
  .session-evidence-v2{
    position:static!important;max-height:none!important;
    display:grid;grid-template-columns:minmax(0,1.2fr) minmax(220px,.8fr);
    gap:12px 18px
  }
  .session-evidence-v2>h2,.session-boundary-v2{grid-column:1/-1}
}

/* iPad portrait: do not spend a persistent column on navigation. Present Unit
 * hierarchy as a compact horizontally scrollable strip above the reading pane.
 */
@media(orientation:portrait) and (max-width:1100px){
  .scope-frame-v3{display:block}
  .scope-course-nav-v3{
    position:static;max-height:none;margin-bottom:12px;padding:10px 10px 8px
  }
  .scope-course-nav-v3 .scope-nav-title-v3{
    display:flex;align-items:baseline;gap:8px;padding:2px 6px 8px
  }
  .scope-course-actions-v3{display:flex;gap:4px;overflow-x:auto;padding:7px 0}
  .scope-course-actions-v3 a{white-space:nowrap}
  .scope-unit-heading-v3{margin:8px 6px 5px}
  .scope-unit-list-v3{
    display:flex;gap:5px;overflow-x:auto;padding-bottom:3px;
    scroll-snap-type:x proximity;overscroll-behavior-inline:contain
  }
  .scope-unit-link-v3{
    min-width:190px;scroll-snap-align:start
  }
  .scope-nav-foot-v3{margin-top:8px}
}

/* iPad Split View and narrow tablet windows: reading is the only persistent
 * column. Navigation and evidence remain in normal document flow.
 */
@media(max-width:900px){
  .scope-frame-v3{display:block}
  .scope-course-nav-v3{position:static;max-height:none;margin-bottom:10px}
  .scope-unit-list-v3{
    display:flex;grid-template-columns:none;gap:5px;overflow-x:auto;
    scroll-snap-type:x proximity
  }
  .scope-unit-link-v3{min-width:178px;scroll-snap-align:start}
  .session-evidence-v2{display:block}
  .session-active-v2 .flow{
    min-height:0!important;
    padding-inline:clamp(16px,4vw,28px)!important
  }
}

/* Touch-first controls: Apple HIG uses a 44pt hit-region rule; use 48 CSS px
 * for frequent controls so fingers and Pencil both have comfortable targets.
 */
@media(hover:none),(pointer:coarse){
  button,
  .primary,.secondary,.danger,
  .top-link,.resource-open,
  .scope-course-actions-v3 a,
  .scope-unit-link-v3,
  .session-rail-item-v2{
    min-height:48px!important;
  }
  input:not([type="checkbox"]):not([type="radio"]),select{min-height:48px}
  input[type="checkbox"],input[type="radio"]{min-width:22px;min-height:22px}
  button,.primary,.secondary,.danger,.top-link,.scope-unit-link-v3,.session-rail-item-v2{
    touch-action:manipulation;
    -webkit-tap-highlight-color:rgb(69 107 91 / .14);
  }
  .session-rail-v2,.scope-unit-list-v3,.scope-course-actions-v3{
    -webkit-overflow-scrolling:touch;
  }
  .session-rail-item-v2:hover,.scope-unit-link-v3:hover,.scope-course-actions-v3 a:hover{
    background:inherit;
  }
}

/* Safari virtual keyboard: JS toggles this class from visualViewport. We avoid
 * sticky action bars and give focused editors enough scroll room above the
 * software keyboard.
 */
body.virtual-keyboard-open{
  scroll-padding-bottom:42vh;
}
body.virtual-keyboard-open .session-controls-v2{
  position:static!important;
}
body.virtual-keyboard-open textarea:focus,
body.virtual-keyboard-open input:focus{
  scroll-margin-bottom:44vh;
}

/* Audit fixes: readable code, visible focus, and document bypass. */
.skip-link{position:fixed;inset:8px auto auto 8px;z-index:20;padding:10px 16px;background:var(--surface-raised);color:var(--ink);transform:translateY(-180%)}
.skip-link:focus{transform:none}
.top-link{display:inline-flex;align-items:center;min-height:44px;min-width:44px}
.session-view-actions-v2{display:flex;flex-wrap:wrap;gap:8px}
.session-overview-v2 .session-step-v2{margin-bottom:16px}
.session-shell-v2 .session-kicker-v2,
.session-shell-v2 [data-session-resume-detail],
.session-shell-v2 [data-session-nav-state],
.session-shell-v2 .session-state-list-v2 dt,
.session-shell-v2 .session-boundary-v2{opacity:1}

/* Compact Split View. */
@media(max-width:700px){
  .scope-course-nav-v3 .scope-nav-title-v3{display:block}
  .scope-course-actions-v3{display:grid;grid-template-columns:1fr 1fr}
  .scope-course-actions-v3 a:last-child{grid-column:1/-1}
  .scope-unit-link-v3{min-width:160px}
  .session-resume-v2{display:grid}
  .session-resume-v2 button{width:100%}
  .session-controls-v2{
    grid-template-columns:1fr 1fr!important;
    padding-bottom:max(4px,env(safe-area-inset-bottom))
  }
  .session-controls-v2 [data-session-nav-state]{grid-column:1/-1;grid-row:1}
}

/* Coarse-pointer large iPad landscape still keeps evidence out of the side
 * column even when the CSS viewport exceeds the generic desktop threshold. */
@media(hover:none) and (pointer:coarse) and (max-width:1499px){
  .session-layout-v2{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:"rail" "active" "evidence"!important
  }
  .session-evidence-v2{position:static!important;max-height:none!important}
}

/* Long-study refinements shared by static preview and runtime presentation. */
[hidden]{display:none!important}
.catalog-filter{
  display:grid;grid-template-columns:minmax(10rem,1fr) minmax(12rem,2fr) auto;
  gap:12px;align-items:end;padding:16px;border-bottom:1px solid var(--line)
}
.catalog-filter label{display:grid;gap:6px;font-weight:600}
.catalog-filter input,.catalog-filter select{width:100%;min-width:0;min-height:48px;padding:9px 12px;border:1px solid var(--line-strong);border-radius:8px}
.catalog-filter p{grid-column:1/-1;margin:0;font-size:var(--type-meta)}
.catalog-filter>*{min-width:0}
.reading-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:var(--space-block);font-size:var(--type-meta)}
.reading-controls button{min-height:44px;font-weight:600}
.reading-controls [aria-pressed="true"]{background:var(--accent-soft);border:2px solid var(--accent);color:var(--accent-strong)}
.flow-stack,.flow,.source-body,.writer,.pool{min-width:0}
.scope-reading-column-v3 .flow-stack{max-width:100%}
.scope-reading-column-v3 .flow>*,.session-active-v2 .flow>*,body[data-page="source"] .source-body{
  max-width:min(var(--reading-measure),var(--reader-width));margin-inline:auto
}
.session-active-v2 .flow p,.session-active-v2 .flow li,
.scope-reading-column-v3 .flow p,.scope-reading-column-v3 .flow li,
.source-body p,.source-body li,body[data-page="source"] .source-body p,
body[data-page="source"] .source-body li,.writer textarea{
  font-size:calc(var(--type-body) * var(--reader-scale));line-height:1.8;
  word-break:keep-all;overflow-wrap:anywhere
}
.flow p,.source-body p{margin-block:var(--space-paragraph)}
.session-active-v2 .flow h2,.session-active-v2 .flow h3,.session-active-v2 .flow h4,
.flow h2,.flow h3,.flow h4,.flow h5,.flow h6,.source-body h2,.source-body h3,.source-body h4,.source-body h5,.source-body h6{
  line-height:1.4;margin-block:var(--space-section) .65em;scroll-margin-top:6rem
}
.session-active-v2 .flow h2,.flow h2,.source-body h2{font-size:calc(1.375rem * var(--reader-scale))}
.session-active-v2 .flow h3,.flow h3,.source-body h3{font-size:calc(1.2rem * var(--reader-scale))}
.session-active-v2 .flow h4,.flow h4,.flow h5,.flow h6,.source-body h4,.source-body h5,.source-body h6{font-size:calc(1.0625rem * var(--reader-scale))}
.flow>.activity,.flow>.material-card,.inline-reference>.material-card{
  border:0;border-radius:0;background:transparent;box-shadow:none;padding:0
}
.scope-context-v3 .card{border:0;border-radius:0}
.scope-context-v3 .card+.card{border-inline-start:1px solid var(--line)}
.scope-context-v3 ul{padding-inline-start:1.25rem}
.flow pre,.source-body pre{font-size:calc(.9375rem * var(--reader-scale));line-height:1.65;margin-block:var(--space-block)}
.flow pre code,.source-body pre code{font-size:inherit;white-space:pre;word-break:normal;overflow-wrap:normal}
.flow code:not(pre code),.source-body code:not(pre code){overflow-wrap:anywhere;white-space:normal}
.table-wrap{max-width:100%;overflow:auto;overscroll-behavior-inline:contain;margin-block:var(--space-block)}
.table-wrap table{min-width:100%;width:max-content;max-width:none}
.table-wrap th,.table-wrap td{min-width:7rem;max-width:24rem;overflow-wrap:anywhere;word-break:normal}
.table-wrap th{background:var(--surface-soft);font-weight:700}
.reading-overflow{border:1px solid var(--line-strong);border-radius:8px}
math,.math-display{max-width:100%;overflow-x:auto;font-family:"STIX Two Math","Cambria Math",serif}
.session-rail-item-v2{flex:0 0 auto;width:auto!important;max-width:20rem;text-align:left}
.scope-unit-link-v3[aria-current="page"]{font-weight:700}
.session-rail-item-v2[aria-current="step"]{box-shadow:inset 0 -3px 0 var(--accent)}
.scope-unit-link-v3[aria-current="page"]{border-inline-start:3px solid var(--accent)}
.scope-nav-foot-v3,.session-boundary-v2,.session-state-list-v2 dt,.session-state-list-v2 dd,
.session-resume-v2 [data-session-resume-detail],.session-kicker-v2{font-size:var(--type-meta)!important;line-height:1.55}
.status-box,.save-state{overflow-wrap:anywhere}
.status-box[data-tone="error"],.save-state[data-state="error"],.save-state[data-state="unknown"]{border-inline-start:3px solid var(--danger);padding-inline-start:.75rem}
.status-box[data-tone="warn"],.save-state[data-tone="warn"]{border-inline-start:3px solid var(--warn);padding-inline-start:.75rem}
.save-state[data-state="committed"],.save-state[data-tone="ok"]{border-inline-start:3px solid var(--ok);padding-inline-start:.75rem}
.save-state[data-state="dirty"],.save-state[data-state="pending"]{border-inline-start:3px dashed var(--muted);padding-inline-start:.75rem}
button:disabled,.disabled,[aria-disabled="true"]{opacity:1;background:var(--surface-soft);color:var(--muted);border-style:dashed}
:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
.session-step-v2 :focus-visible{scroll-margin-top:6rem}
.choice{min-height:48px;align-items:center}
.resource-open,summary{min-height:44px}
.resource-open{align-items:center}
.writer{max-width:60rem;margin:0 auto var(--space-section)}
.writer textarea{resize:vertical;min-height:8rem}
#timer-value{font-variant-numeric:tabular-nums}
@media(max-width:900px){
  .planner{grid-template-columns:minmax(0,1fr)}
  .catalog-filter{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .catalog-filter button{grid-column:1/-1}
}
@media(max-width:600px){
  .catalog-filter{grid-template-columns:minmax(0,1fr)}
  .scope-context-v3 .grid2{grid-template-columns:minmax(0,1fr)}
  .scope-context-v3 .card+.card{border-inline-start:0;border-top:1px solid var(--line)}
  .reading-controls button{flex:1;min-height:48px}
  .reading-controls>span{flex-basis:100%}
  .session-rail-item-v2{max-width:17rem}
}
@media(forced-colors:active){
  :focus-visible{outline-color:Highlight}
  .session-rail-item-v2[aria-current="step"],.scope-unit-link-v3[aria-current="page"],.reading-controls [aria-pressed="true"]{border:2px solid Highlight}
  .primary,.secondary,.danger{border:1px solid ButtonText}
}

@media(max-width:760px){.scope-context-v3 .card+.card{border-inline-start:0;border-top:1px solid var(--line)}}

.session-rail-item-v2 small{font-size:var(--type-meta)!important}

.daily-habit{margin:24px 0;padding:28px;border:1px solid #c8d9d1;border-radius:20px;background:#f4f8f5;color:#182d26}
.daily-habit h2{font-size:clamp(1.35rem,3vw,1.8rem);margin:0 0 12px}.daily-habit p{line-height:1.65}
.habit-actions{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}.habit-actions button,.habit-actions a{min-height:44px}
.habit-calendar{display:grid;grid-template-columns:repeat(14,minmax(0,1fr));gap:5px;margin:18px 0}.habit-day{display:grid;place-items:center;border-radius:7px;min-height:42px;background:#e2e8e4;font-size:12px}.habit-day[data-state=learned]{background:#245a43;color:white}.habit-day[data-state=rest]{border:2px solid #8b9b92;background:transparent}
.habit-summary{display:flex;flex-wrap:wrap;gap:16px;font-size:14px}.habit-cue{border-left:3px solid #245a43;padding-left:14px}.habit-review{margin-top:20px;padding:20px;background:white;border:1px solid #d9e1dc;border-radius:12px}.habit-review textarea,.habit-dialog input,.habit-dialog textarea,.habit-dialog select,.study-checkpoint textarea{width:100%;min-width:0}
.habit-dialog{width:min(580px,calc(100vw - 24px));max-height:90dvh;overflow:auto;border:1px solid #b9c9bf;border-radius:16px;padding:24px}.habit-dialog::backdrop{background:#14291b80}.habit-dialog label{display:grid;gap:6px;margin:14px 0}.habit-dialog .choice{display:flex;align-items:center}.habit-dialog .choice input{width:auto}.habit-dialog form{display:block}
.study-pacing{position:sticky;top:0;z-index:8;margin-bottom:16px;background:#f4f8f5;border:1px solid #cadbd0;border-radius:12px;padding:14px}.study-pacing .habit-actions{margin:8px 0}.study-checkpoint{border:1px solid #cadbd0;border-radius:12px;padding:20px;margin-top:20px;background:white}.study-checkpoint label{display:grid;gap:6px;margin:14px 0}.study-focused .scope-course-nav-v3,.study-focused .session-evidence-v2{display:none}.study-focused .scope-frame-v3{grid-template-columns:minmax(0,1fr)}.study-focused .session-layout-v2{grid-template-columns:90px minmax(0,1fr)}
.habit-review [hidden],.daily-habit [hidden]{display:none!important}.habit-reference{white-space:pre-wrap;overflow-wrap:anywhere;border-left:3px solid #72967f;padding:12px}
@media(max-width:760px){.daily-habit{padding:20px 16px}.habit-calendar{grid-template-columns:repeat(7,minmax(0,1fr))}.study-focused .session-layout-v2{grid-template-columns:minmax(0,1fr)}.study-pacing{position:static}.habit-dialog{padding:18px}.habit-actions>*{flex:1 1 140px}}

/* iPad/keyboard accessibility overlay. Presentation only; loaded last. */
html{font-size:100%;scroll-padding-top:6rem}
body{font-size:1rem}
.shell,.scope-frame-v3,.scope-reading-column-v3,.session-layout-v2,
.session-active-v2,.session-step-v2,.writer,.pool,.catalog-list{min-width:0}
.planner{grid-template-columns:minmax(16rem,19.375rem) minmax(0,1fr)}
.grid2,.note-grid,.reference-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.index-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.scope-row{grid-template-columns:22px minmax(0,1fr) auto}
.queue-item{grid-template-columns:46px minmax(0,1fr) auto}
.writer,.activity,.source-body,.scope-course-nav-v3,.session-resume-v2,
.scope-row,.queue-item,.session-evidence-v2{overflow-wrap:anywhere}
.response,textarea,input,select{min-width:0;max-width:100%;font-size:1rem}
textarea{resize:vertical;min-height:7rem;line-height:1.75}
input[type="file"]{width:100%}
.answer-fields{min-inline-size:0}
.choice{align-items:flex-start;min-height:48px}
.choice input{flex:none;margin-top:.35rem}
.choice span{min-width:0;overflow-wrap:anywhere}
button,.primary,.secondary,.danger{min-height:44px;min-width:44px;white-space:normal}
summary{min-height:44px;padding-block:.6rem;cursor:pointer}
.resource-open{align-items:center;min-height:44px}
:focus-visible{outline:3px solid #2458be;outline-offset:3px}
/* Fallback for engines without :focus-visible support. */
@supports not selector(:focus-visible){:focus{outline:3px solid #2458be;outline-offset:3px}}
pre,.table-wrap{max-inline-size:100%;overflow:auto;overscroll-behavior-x:contain;scroll-padding:1rem}
pre{white-space:pre;word-break:normal;overflow-wrap:normal;-webkit-user-select:text;user-select:text}
pre code{white-space:inherit;overflow-wrap:normal;word-break:normal}
p code,li code,td code{overflow-wrap:anywhere;white-space:normal}
th,td{overflow-wrap:anywhere}
.session-active-v2 .flow p,.session-active-v2 .flow li{line-height:1.8}
.session-active-v2 .flow p{margin-block:.85em 1.1em}
.code-tools{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;margin-block:.5rem}
.code-copy-status{font-size:.875rem;color:var(--muted)}
.scope-unit-link-v3 span{color:var(--muted)}
.session-rail-v2,.scope-unit-list-v3{scroll-padding-inline:.5rem}
#source-dialog{max-height:88vh;max-height:calc(var(--visual-viewport-height,100dvh) - 2rem);overflow:auto}
/* Keep one scroll owner inside the dialog. */
#source-dialog .dialog-body{overflow:visible;padding:.75rem 0}
body.virtual-keyboard-open{padding-bottom:calc(var(--virtual-keyboard-overlap,0px) + max(24px,env(safe-area-inset-bottom)))}
body.virtual-keyboard-open .topbar{position:static}
body.virtual-keyboard-open .scope-course-nav-v3,
body.virtual-keyboard-open .session-evidence-v2{position:static!important;max-height:none!important}
/* Narrow tablet windows are a stacked flow, independent of orientation. */
@media(max-width:900px){
 .planner,.grid2,.note-grid,.reference-grid,.catalog-toolbar{grid-template-columns:minmax(0,1fr)}
 .index-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .catalog-list,.catalog-scroll{max-height:none;overflow:visible}
 .topbar{position:static;flex-wrap:wrap;padding-block:.5rem}
 html{scroll-padding-top:1rem}
 .session-active-v2 .flow{min-height:0!important}
 .scope-course-nav-v3 .scope-nav-title-v3{flex-wrap:wrap}
 .scope-unit-link-v3{flex:0 0 11rem;min-width:0}
 .scope-course-actions-v3{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}
 .scope-course-actions-v3 a{white-space:normal;min-width:0}
 .scope-course-actions-v3 a:last-child{grid-column:1/-1}
}
@media(max-width:600px){
 .index-grid,.daily-summary{grid-template-columns:minmax(0,1fr)}
 .queue-item{grid-template-columns:40px minmax(0,1fr)}
 .queue-item>.queue-actions{grid-column:2;min-width:0}
 .scope-row{grid-template-columns:22px minmax(0,1fr)}
 .scope-row>span:last-child{grid-column:2}
 .hero,.controls,.pool,.writer,.runtime-panel{padding:1rem}
 .session-controls-v2{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .session-controls-v2 button{overflow-wrap:anywhere}
 .section-head,.timer{flex-wrap:wrap}
 .session-active-v2 .flow p,.session-active-v2 .flow li,.source-body p,.source-body li{font-size:1rem}
}
@media(max-height:600px){
 .topbar{position:static}
 .scope-course-nav-v3,.session-evidence-v2{position:static!important;max-height:none!important}
}
@media(hover:none),(pointer:coarse){
 summary,.choice,.resource-open,.scope-row{min-height:48px}
 .code-tools button{min-height:48px}
}
@media(forced-colors:active){
 :focus-visible{outline-color:Highlight}
 button:disabled,[aria-disabled="true"]{color:GrayText;opacity:1}
 .session-rail-item-v2[aria-current="step"],.scope-unit-link-v3[aria-current="page"]{outline:2px solid Highlight}
}

/* Continuous Scope pilot refinements: use the EXISTING paper/sage theme tokens.
 * No second color system and no styling for unrelated/non-opted-in pages.
 */
body.scope-continuous-pilot .scope-frame-v3 {
  grid-template-columns:var(--continuous-sidebar-width,220px) minmax(0,1fr)!important;
}
body.scope-continuous-pilot.scope-toc-collapsed .scope-frame-v3 {
  display:block!important;
}
body.scope-continuous-pilot.scope-toc-collapsed .scope-course-nav-v3 {display:none!important}
body.scope-continuous-pilot .scope-course-nav-v3 {
  border-color:var(--line);
  background:var(--surface);
  box-shadow:none;
}
body.scope-continuous-pilot .scope-reading-column-v3>.hero {
  border-color:var(--line);
  background:var(--surface);
}
body.scope-continuous-pilot .continuous-toc-settings {
  display:grid;grid-template-columns:1fr auto;align-items:center;gap:6px 8px;
  margin:8px 4px 12px;padding:10px 4px 12px;border-bottom:1px solid var(--line);
  font-size:.8rem;color:var(--muted);
}
body.scope-continuous-pilot .continuous-toc-settings label {font-weight:650}
body.scope-continuous-pilot .continuous-toc-settings input[type=range] {
  grid-column:1;min-width:0;width:100%;accent-color:var(--accent);
}
body.scope-continuous-pilot .continuous-toc-settings output {font-variant-numeric:tabular-nums;font-size:.75rem}
body.scope-continuous-pilot .continuous-toc-settings button {grid-column:1/-1}
body.scope-continuous-pilot .continuous-unit-list {
  padding-top:8px;border-top:1px solid var(--line);margin-top:8px;
}
body.scope-continuous-pilot .continuous-unit-list>summary {
  cursor:pointer;padding:11px 8px;min-height:44px;color:var(--muted);font-size:.82rem;font-weight:650;
}
body.scope-continuous-pilot .continuous-unit-list .scope-unit-list-v3 {
  padding:3px 0 12px;
}
body.scope-continuous-pilot .continuous-toc-toggle {
  border:1px solid var(--line-strong);
  background:var(--surface-raised);
  color:var(--accent-strong);
}
body.scope-continuous-pilot .continuous-reader-tools button:focus-visible,
body.scope-continuous-pilot .continuous-toc-settings :focus-visible {
  outline:3px solid var(--focus);outline-offset:3px;
}
body.scope-continuous-pilot .continuous-lesson-recap {
  margin:28px 0 22px;padding:clamp(20px,3vw,38px);
  border:1px solid var(--line);border-top:4px solid var(--accent);
  border-radius:var(--ui-radius);background:var(--surface-raised);
  scroll-margin-top:110px;box-shadow:none;
}
body.scope-continuous-pilot .continuous-recap-kicker {
  color:var(--accent-strong);font-size:.76rem;font-weight:800;letter-spacing:.03em;
  margin:0 0 8px;
}
body.scope-continuous-pilot .continuous-lesson-recap h2 {
  margin:0 0 10px;font-size:clamp(1.35rem,2.6vw,1.8rem);
}
body.scope-continuous-pilot .continuous-recap-intro {
  font-size:.91rem;color:var(--muted);margin:0 0 22px;
}
body.scope-continuous-pilot .continuous-recap-list {
  list-style:decimal;list-style-position:outside;
  padding-left:1.65rem;margin:0 0 22px;
}
body.scope-continuous-pilot .continuous-recap-item {
  padding:0 0 17px;margin:0 0 17px;border-bottom:1px solid var(--line);
  line-height:1.7;
}
body.scope-continuous-pilot .continuous-recap-item::marker {
  color:var(--accent);font-weight:750;font-variant-numeric:tabular-nums;
}
body.scope-continuous-pilot .continuous-recap-item h3 {
  font-size:1.08rem;line-height:1.5;color:var(--accent-strong);margin:0 0 6px;
}
body.scope-continuous-pilot .continuous-recap-item h3 strong {font-weight:800}
body.scope-continuous-pilot .continuous-recap-item p {margin:.3rem 0;line-height:1.8}
body.scope-continuous-pilot .continuous-recap-item .continuous-recap-detail {
  color:var(--muted);font-size:.93rem;
}
body.scope-continuous-pilot .continuous-recap-warning,
body.scope-continuous-pilot .continuous-recap-question {
  margin:11px 0 0;padding:12px 16px;border-left:3px solid var(--accent);
  background:var(--accent-faint);border-radius:0 7px 7px 0;line-height:1.85;
}
body.scope-continuous-pilot .continuous-recap-warning strong,
body.scope-continuous-pilot .continuous-recap-question strong {
  color:var(--accent-strong);
}
body.scope-continuous-pilot .continuous-recap-question {
  background:var(--surface-soft);border-left-color:var(--line-strong);
}
body.scope-continuous-pilot .continuous-blog {
  margin:24px 0 30px;padding:0 clamp(16px,3vw,28px);
  border:1px solid var(--line);border-radius:var(--ui-radius);
  background:var(--surface);scroll-margin-top:100px;
}
body.scope-continuous-pilot .continuous-blog>summary {
  cursor:pointer;min-height:60px;display:list-item;padding:17px 0 14px;
  font-size:1.02rem;font-weight:750;color:var(--accent-strong);
}
body.scope-continuous-pilot .continuous-blog-inner {padding:0 0 23px}
body.scope-continuous-pilot .continuous-blog-inner>p {
  max-width:75ch;line-height:1.85;font-size:.92rem;margin:8px 0 16px;
}
body.scope-continuous-pilot .continuous-blog-help {color:var(--muted)}
body.scope-continuous-pilot .continuous-blog-inner>label {
  display:block;margin:16px 0 8px;font-weight:650;font-size:.92rem;
}
body.scope-continuous-pilot #continuous-blog-editor {
  display:block;box-sizing:border-box;width:100%;min-height:250px;max-width:100%;
  padding:15px;border:1px solid var(--line-strong);border-radius:9px;
  background:var(--surface-raised);color:var(--ink);
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:.87rem;line-height:1.7;resize:vertical;
}
body.scope-continuous-pilot .continuous-blog-privacy {
  display:flex!important;align-items:flex-start;gap:10px;
  font-weight:500!important;font-size:.89rem!important;
}
body.scope-continuous-pilot .continuous-blog-privacy input {
  flex:none;margin-top:4px;accent-color:var(--accent);width:18px;height:18px;
}
body.scope-continuous-pilot .continuous-blog-actions {
  display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:12px 0;
}
body.scope-continuous-pilot .continuous-blog-actions button,
body.scope-continuous-pilot .continuous-blog-actions a,
body.scope-continuous-pilot .continuous-blog-inner>[data-blog-refresh] {
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;padding:9px 13px;border-radius:8px;
  font-size:.86rem;text-decoration:none;
}
body.scope-continuous-pilot .continuous-blog-actions button {
  background:var(--accent);color:var(--surface);
  border:1px solid var(--accent);cursor:pointer;
}
body.scope-continuous-pilot .continuous-blog-actions button:disabled {
  background:var(--surface-soft);color:var(--muted);border-color:var(--line);
}
body.scope-continuous-pilot .continuous-blog-actions a {
  border:1px solid var(--line);color:var(--accent-strong);
}
body.scope-continuous-pilot [data-blog-status] {
  font-size:.83rem;color:var(--muted);line-height:1.7;margin-top:13px;
}
body.scope-continuous-pilot #continuous-blog-editor:focus-visible,
body.scope-continuous-pilot .continuous-blog :focus-visible {
  outline:3px solid var(--focus);outline-offset:2px;
}
/* Only the read area is dimmed. Controls remain accessible and usable. */
body.scope-continuous-pilot .continuous-focus-highlight {
  position:fixed;z-index:52;pointer-events:none;
  border:2px solid var(--accent);border-left:5px solid var(--accent-strong);
  background:rgba(228,235,229,.08);border-radius:6px;
  box-shadow:0 0 0 140vmax rgba(10,22,15,.46);
}
body.scope-continuous-pilot .continuous-focus-highlight[hidden],
body.scope-continuous-pilot .continuous-focus-dock[hidden]{display:none!important}
body.scope-continuous-pilot .continuous-focus-dock {
  position:fixed;z-index:110;
  right:max(14px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));
  width:min(560px,calc(100vw - 28px));padding:11px;
  border:1px solid var(--line-strong);border-radius:13px;
  background:var(--surface-raised);color:var(--ink);
  box-shadow:0 12px 40px rgba(28,40,33,.24);
  display:grid;gap:9px;
}
body.scope-continuous-pilot .continuous-focus-modes,
body.scope-continuous-pilot .continuous-focus-controls {
  display:flex;gap:6px;align-items:center;justify-content:flex-end;flex-wrap:wrap;
}
body.scope-continuous-pilot .continuous-focus-modes {justify-content:flex-start}
body.scope-continuous-pilot .continuous-focus-dock button {
  min-height:44px;min-width:44px;padding:8px 12px;
  border:1px solid var(--line-strong);background:var(--surface);
  color:var(--ink);border-radius:8px;font-size:.85rem;
}
body.scope-continuous-pilot .continuous-focus-modes button[aria-pressed="true"] {
  background:var(--accent);border-color:var(--accent);
  color:var(--surface-raised);font-weight:750;
}
body.scope-continuous-pilot [data-focus-position] {
  flex:1 1 auto;text-align:center;white-space:nowrap;
  color:var(--muted);font-size:.8rem;font-variant-numeric:tabular-nums;
}
body.scope-continuous-pilot .continuous-focus-dock button:focus-visible {
  outline:3px solid var(--focus);outline-offset:2px;
}
body.scope-continuous-pilot .topbar {z-index:85}
@media(max-width:850px){
  body.scope-continuous-pilot .scope-frame-v3 {display:block!important}
  body.scope-continuous-pilot .continuous-toc-settings>label,
  body.scope-continuous-pilot .continuous-toc-settings>input,
  body.scope-continuous-pilot .continuous-toc-settings>output{display:none}
  body.scope-continuous-pilot .continuous-toc-settings {display:block}
}
@media(max-width:600px){
  body.scope-continuous-pilot .continuous-focus-dock {
    left:max(8px,env(safe-area-inset-left));
    right:max(8px,env(safe-area-inset-right));
    bottom:max(8px,env(safe-area-inset-bottom));
    width:auto;padding:9px;
  }
  body.scope-continuous-pilot .continuous-focus-controls button {
    flex:0 0 auto;min-width:42px;padding:8px;
  }
  body.scope-continuous-pilot .continuous-lesson-recap {padding:19px 17px}
  body.scope-continuous-pilot .continuous-recap-list {padding-left:1.4rem}
  body.scope-continuous-pilot .continuous-blog {padding-inline:15px}
  body.scope-continuous-pilot .continuous-blog-actions>* {flex:1 1 130px}
}
@media(prefers-reduced-motion:reduce){
  body.scope-continuous-pilot .continuous-focus-highlight{transition:none!important}
}

/* Continuous Textbook v2: actual editorial redesign based on the supplied
 * computer-systems HTML textbook. A reader-scoped neutral paper/sage palette
 * keeps body text and light syntax blocks on coordinated surfaces. Applies ONLY to Scope pages using the
 * continuous reader; does not touch plans, auth, saved-record semantics.
 */
body.textbook-reader-ready {
  /* Matte neutral paper, with low-chroma sage reserved for emphasis. */
  --bg:#f1f3f1;
  --surface:#f7f8f6;
  --surface-raised:#fbfcfa;
  --surface-soft:#eef1ed;
  --ink:#28332d;
  --ink-soft:#425248;
  --muted:#58655c;
  --line:#d3dad2;
  --line-strong:#b5c0b5;
  --accent:#3f6753;
  --accent-strong:#2f5842;
  --accent-soft:#e5ede5;
  --accent-faint:#f0f4ee;
  --focus:#2b5e47;
  --textbook-code-bg:#f2f4f0;
  --textbook-code-ink:#263b31;
  --textbook-code-border:#c8d2c6;
  --textbook-code-inline-bg:#eaf0e8;
  --textbook-code-inline-ink:#294a37;
  --textbook-code-comment:#536357;
  --textbook-code-keyword:#6b3f7c;
  --textbook-code-string:#276343;
  --textbook-code-number:#804d20;
  --textbook-code-function:#245c80;
  --textbook-code-type:#725325;
  --textbook-code-operator:#455b50;
  --textbook-hairline:var(--line,#dadfd6);
  --textbook-reading-progress:0%;
  --textbook-reading-width:780px;
  --textbook-body-size:1.0625rem;
  --textbook-reading-gutter:clamp(24px,3vw,48px);
  /* Reference TOC: 17px × .74 = 12.58px; rem preserves browser text zoom. */
  --textbook-toc-size:.78625rem;
  --textbook-toc-label-size:.711875rem;
  --textbook-toc-number-width:max(26px,5.5ch);
}
body.textbook-reader-ready .topbar {
  background:var(--surface-raised);
}
/* Keep the keyboard bypass visible above the sticky reader controls. */
body.textbook-reader-ready .skip-link {z-index:140}
body.textbook-reader-ready ::selection {
  background:#d9e6d8;
  color:#21372b;
}
body.textbook-reader-ready .shell,
body.textbook-reader-ready .first-week-shell {
  width:min(1450px,calc(100% - 42px))!important;
  max-width:none!important;
  padding:0 0 90px!important;
}
body.textbook-reader-ready .scope-frame-v3 {
  display:grid!important;
  grid-template-columns:var(--continuous-sidebar-width,300px) minmax(0,1fr)!important;
  gap:0!important;
  align-items:stretch!important;
  background:var(--surface-raised,#fdfcf8);
  border:1px solid var(--textbook-hairline);
  border-radius:0 0 14px 14px;
  min-height:calc(100vh - var(--textbook-topbar-height,58px));
}
body.textbook-reader-ready.scope-toc-collapsed .scope-frame-v3 {
  display:block!important;
  grid-template-columns:minmax(0,1fr)!important;
}
body.textbook-reader-ready .scope-course-nav-v3 {
  position:sticky!important;
  top:var(--textbook-topbar-height,58px)!important;
  align-self:start;
  max-height:calc(100dvh - var(--textbook-topbar-height,58px))!important;
  height:calc(100dvh - var(--textbook-topbar-height,58px));
  overflow-y:auto;
  border:0!important;
  border-right:1px solid var(--textbook-hairline)!important;
  border-radius:0!important;
  padding:26px 19px 35px!important;
  font-size:1.0625rem;
  background:var(--surface-raised,#fdfcf8)!important;
  box-shadow:none!important;
  scrollbar-width:thin;
}
body.textbook-reader-ready .scope-course-nav-v3 .scope-nav-title-v3 {
  padding:8px 10px 20px!important;
  border-bottom:1px solid var(--textbook-hairline)!important;
}
body.textbook-reader-ready .scope-course-nav-v3 .scope-nav-title-v3 strong {
  font-size:1.04rem;
  letter-spacing:-.02em;
  line-height:1.5;
}
body.textbook-reader-ready .scope-course-nav-v3 .scope-nav-title-v3 small {
  margin-bottom:4px;
  font-weight:650;
  color:var(--accent-strong,#345746);
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline {
  margin:14px 0 18px;
  border-bottom:1px solid var(--textbook-hairline);
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline>summary {
  padding:.5em .85em;
  min-height:0;
  letter-spacing:.1em;
  font-size:var(--textbook-toc-label-size);
  font-weight:850;
  color:var(--muted);
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline nav {
  padding-bottom:16px;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline a {
  position:relative;
  letter-spacing:normal;
  display:flex;
  gap:8px;
  align-items:flex-start;
  line-height:1.48;
  min-height:0;
  padding:8px 24px 8px 9px;
  border-radius:8px;
  font-size:var(--textbook-toc-size);
  word-break:keep-all;
  overflow-wrap:anywhere;
  transition:background .15s ease;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-index {
  flex:0 0 var(--textbook-toc-number-width);
  width:var(--textbook-toc-number-width);
  min-width:26px;
  white-space:nowrap;
  font-size:.9em;
  font-variant-numeric:tabular-nums;
  font-weight:780;
  color:var(--muted);
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-text {
  flex:1;
  min-width:0;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline a.textbook-toc-current {
  background:var(--accent-soft,#e4ebe5);
  color:var(--accent-strong,#345746);
  font-weight:760;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline a.textbook-toc-current:before {
  content:"";
  position:absolute;
  left:0;top:9px;bottom:9px;
  width:3px;border-radius:4px;
  background:var(--accent,#456b5b);
}
/* DOM-order hierarchy: equal-depth rows share one number and title column.
 * Disclosure markers occupy the right gutter, never a second left indent. */
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group {
  margin:0;
  border:0;
  border-radius:0;
  background:transparent;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group>summary {
  position:relative;
  display:block;
  list-style:none;
  padding:0;
  min-height:0;
  font-size:var(--textbook-toc-label-size);
  font-weight:850;
  line-height:1.48;
  letter-spacing:normal;
  color:var(--muted);
  cursor:pointer;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-children {
  margin:0;
  padding:0 0 0 12px;
  list-style:none;
  border-left:0;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-children a {
  font-size:var(--textbook-toc-size);
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-toc-settings {
  padding:8px 10px 17px;
  margin:0 0 10px;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-toc-settings button {
  font-size:.8rem;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-utility {
  margin-top:24px;
  border-top:1px solid var(--textbook-hairline);
}
body.textbook-reader-ready .scope-course-nav-v3 .scope-unit-link-v3 {
  padding:9px 10px;
  font-size:.8rem;
}
body.textbook-reader-ready .scope-reading-column-v3 {
  position:relative;
  min-width:0;
  /* Replace inherited 70ch / 42rem limits only inside this reader. */
  --reading-measure:var(--textbook-reading-width);
  --reader-width:100%;
  padding:0 var(--textbook-reading-gutter) 88px!important;
  font-size:calc(var(--textbook-body-size) * var(--reader-scale,1));
  line-height:1.8;
  letter-spacing:normal;
  background:var(--surface-raised,#fdfcf8);
  box-shadow:none;
}
body.textbook-reader-ready .scope-reading-column-v3 > .breadcrumb {
  padding-top:16px;
  margin:0 0 9px;
  font-size:.76rem;
  color:var(--muted);
  letter-spacing:.01em;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero {
  border:0!important;
  border-bottom:1px solid var(--textbook-hairline)!important;
  border-radius:0!important;
  background:transparent!important;
  padding:clamp(28px,4vw,58px) 0 35px!important;
  margin:0 0 14px!important;
  box-shadow:none!important;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero .eyebrow {
  color:var(--accent-strong,#345746);
  font-size:.75rem;
  font-weight:830;
  letter-spacing:.15em;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero h1 {
  font-size:clamp(2.5rem,3.5vw,3rem)!important;
  font-weight:750;
  letter-spacing:-.035em;
  line-height:1.27!important;
  margin:13px 0 18px!important;
  max-width:100%;
  text-wrap:balance;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero .lead {
  color:var(--muted);
  font-size:1.08rem;
  line-height:1.8;
  max-width:100%;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero .meta {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:21px 0 0;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero .meta>span,
body.textbook-reader-ready .scope-reading-column-v3>.hero .learning-time {
  background:var(--surface-soft,#f0f1eb);
  color:var(--accent-strong,#345746);
  border:1px solid var(--textbook-hairline);
  padding:6px 12px;
  font-size:.83rem;
  border-radius:99px;
}
body.textbook-reader-ready .scope-reading-column-v3>.hero .answer-save-help {
  color:var(--muted);
  line-height:1.7;
  font-size:.84rem;
}
body.textbook-reader-ready .textbook-toolbar {
  position:sticky;
  top:var(--textbook-topbar-height,58px);
  z-index:82;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding:11px 14px;
  min-height:65px;
  margin:0 calc(-1 * var(--textbook-reading-gutter));
  border-bottom:1px solid var(--textbook-hairline);
  background:var(--surface-raised,#fdfcf8);
  box-shadow:0 4px 20px rgba(36,52,40,.06);
}
body.textbook-reader-ready .textbook-toolbar:after {
  content:"";
  position:absolute;
  left:0;bottom:-1px;
  width:var(--textbook-reading-progress);
  height:2px;
  background:var(--accent,#456b5b);
  pointer-events:none;
}
body.textbook-reader-ready .textbook-toolbar-left {
  display:grid;
  gap:3px;
  min-width:0;
  max-width:230px;
}
body.textbook-reader-ready .textbook-toolbar-brand {
  font-size:.69rem;
  font-weight:790;
  letter-spacing:.12em;
  color:var(--accent-strong,#345746);
}
body.textbook-reader-ready .textbook-toolbar-location {
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:.78rem;
  color:var(--muted);
}
body.textbook-reader-ready .textbook-toolbar-right {
  min-width:0;
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools {
  min-width:0;
  max-width:100%;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:5px;
  margin:0;
}
body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools > :is(button,a) {
  min-height:40px!important;
  padding:7px 10px!important;
  border-radius:7px!important;
  font-size:.81rem!important;
  line-height:1.4;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
}
body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools .continuous-compare {
  color:var(--muted);
  border:1px solid var(--textbook-hairline);
  text-decoration:none;
}
body.textbook-reader-ready .textbook-font-controls {
  display:inline-flex;
  flex-wrap:wrap;
  max-width:100%;
  border:1px solid var(--textbook-hairline);
  border-radius:7px;
  padding:2px;
  background:var(--surface-soft,#f0f1eb);
}
body.textbook-reader-ready .textbook-font-button {
  min-width:33px;
  min-height:36px;
  height:auto;
  line-height:1.4;
  padding:4px 8px;
  border:0;
  color:var(--ink);
  background:transparent;
  border-radius:6px;
  font-size:.83rem;
  font-weight:700;
}
body.textbook-reader-ready .textbook-font-button[aria-pressed="true"] {
  background:var(--accent-soft,#e4ebe5);
  color:var(--accent-strong,#345746);
  box-shadow:0 0 0 1px var(--textbook-hairline);
}
body.textbook-reader-ready .textbook-search {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  min-width:0;
  max-width:100%;
}
body.textbook-reader-ready .textbook-search input {
  width:clamp(90px,13vw,170px);
  flex:1 1 8rem;
  min-width:0;
  max-width:100%;
  min-height:40px;
  height:auto;
  line-height:1.5;
  border:1px solid var(--textbook-hairline);
  background:var(--surface-raised);
  padding:6px 9px;
  border-radius:7px;
  font-size:.8rem;
  color:var(--ink);
}
body.textbook-reader-ready .textbook-search-result {
  min-width:0;
  color:var(--muted);
  font-size:.72rem;
  white-space:normal;
  overflow-wrap:anywhere;
}
body.textbook-reader-ready .textbook-search-next {
  border:1px solid var(--textbook-hairline);
  padding:5px 9px;
  min-height:36px;
  border-radius:7px;
  background:var(--surface-soft);
  font-size:.8rem;
}
body.textbook-reader-ready .textbook-search-match {
  outline:2px solid var(--accent);
  outline-offset:6px;
  border-radius:4px;
  scroll-margin-top:var(--textbook-anchor-offset,calc(var(--textbook-topbar-height,58px) + 90px));
}
body.textbook-reader-ready .textbook-sr-only {
  position:absolute!important;
  width:1px;height:1px;
  padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}
body.textbook-reader-ready .textbook-primer {
  margin:26px 0 36px;
  padding:clamp(20px,3vw,30px) clamp(20px,3vw,34px);
  background:var(--accent-faint,#f0f4ef);
  border:1px solid var(--line,#d8ddd5);
  border-left:4px solid var(--accent,#456b5b);
  border-radius:0 10px 10px 0;
}
body.textbook-reader-ready .textbook-eyebrow {
  color:var(--accent-strong,#345746);
  font-size:.76rem;
  font-weight:800;
  letter-spacing:.1em;
  margin:0 0 7px;
}
body.textbook-reader-ready .textbook-primer h2 {
  margin:0 0 17px;
  font-size:clamp(1.15rem,2vw,1.4rem);
  letter-spacing:-.03em;
}
body.textbook-reader-ready .textbook-primer-list {
  list-style:decimal;
  padding-left:1.45rem;
  margin:0;
}
body.textbook-reader-ready .textbook-primer-list>li {
  margin:0 0 13px;
  padding-left:5px;
  font-size:calc(var(--textbook-body-size) * var(--reader-scale,1));
  line-height:1.8;
  letter-spacing:normal;
}
body.textbook-reader-ready .textbook-primer-list li::marker {
  font-weight:750;color:var(--accent-strong,#345746);
}
body.textbook-reader-ready .textbook-primer-list strong {
  display:block;
  color:var(--ink);
  font-weight:750;
  letter-spacing:normal;
}
body.textbook-reader-ready .textbook-primer-list span {
  display:block;
  margin-top:3px;
  color:var(--ink-soft,#45574d);
}
body.textbook-reader-ready .textbook-primer-jump {
  display:inline-flex;
  margin-top:9px;
  font-size:.86rem;
  color:var(--accent-strong,#345746);
  font-weight:720;
  text-decoration:underline;
  text-underline-offset:3px;
}
/* Learning objectives are supplementary navigation, not another heavy card. */
body.textbook-reader-ready .textbook-goals {
  border:0!important;
  border-bottom:1px solid var(--textbook-hairline)!important;
  border-radius:0!important;
  background:transparent!important;
  padding:12px 0 24px!important;
  margin:0 0 20px!important;
  box-shadow:none!important;
}
body.textbook-reader-ready .textbook-goals>summary {
  color:var(--accent-strong);
  font-weight:720;
  padding:9px 0;
}
body.textbook-reader-ready .textbook-goals>.grid2,
body.textbook-reader-ready .textbook-goals ul {
  padding-left:0;
}
body.textbook-reader-ready .textbook-goals .card {
  background:transparent!important;
  border:0!important;
  padding:10px 0!important;
  box-shadow:none!important;
}
body.textbook-reader-ready #runtime-status {
  padding:9px 12px;
  border-radius:6px;
  background:var(--surface-soft);
  color:var(--muted);
  font-size:.8rem;
  margin:6px auto 12px!important;
}
/* The major change: remove the nested-card appearance from lesson text.
 * Only questions, code and intentional asides retain separate surfaces.
 */
body.textbook-reader-ready .continuous-flow-stack {
  display:block!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  overflow:visible!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow,
body.textbook-reader-ready .first-week-shell .continuous-flow-stack>.flow {
  display:block!important;
  margin:0!important;
  border:0!important;
  border-bottom:1px solid var(--textbook-hairline)!important;
  border-radius:0!important;
  padding:clamp(36px,4vw,48px) 0!important;
  background:transparent!important;
  box-shadow:none!important;
  min-height:0!important;
  scroll-margin-top:var(--textbook-anchor-offset,calc(var(--textbook-topbar-height,58px) + 90px))!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow:first-child {
  padding-top:17px!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="material"] {
  padding:22px 24px!important;
  background:var(--surface-soft,#f1f1eb)!important;
  border:1px solid var(--textbook-hairline)!important;
  border-radius:9px!important;
  margin:25px 0!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="activity"] {
  padding:24px clamp(18px,2.8vw,32px)!important;
  background:var(--accent-faint,#f0f4ef)!important;
  border:1px solid var(--textbook-hairline)!important;
  border-left:4px solid var(--accent)!important;
  border-radius:0 10px 10px 0!important;
  margin:27px 0!important;
  scroll-margin-top:var(--textbook-anchor-offset,calc(var(--textbook-topbar-height,58px) + 90px))!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="activity"] .activity {
  border:0!important;
  box-shadow:none!important;
  background:transparent!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow .textbook-flow-kicker {
  margin:0 0 23px!important;
  color:var(--accent-strong,#345746);
  font-weight:780;
  font-size:.75rem!important;
  letter-spacing:.1em;
}
body.textbook-reader-ready .continuous-flow-stack>.flow .flow-head {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:9px;
  padding:0 0 9px;
  margin-bottom:15px;
  border-bottom:1px solid var(--textbook-hairline);
}
body.textbook-reader-ready .continuous-flow-stack>.flow .flow-head .pill {
  background:var(--accent-soft);
  color:var(--accent-strong);
}
body.textbook-reader-ready .continuous-flow-stack>.flow p,
body.textbook-reader-ready .continuous-flow-stack>.flow li {
  max-width:100%;
  margin:0 0 1.12em;
  font-size:calc(var(--textbook-body-size) * var(--reader-scale,1))!important;
  line-height:1.8!important;
  font-weight:400;
  letter-spacing:normal;
  word-break:keep-all;
  overflow-wrap:anywhere;
  text-wrap:pretty;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4) {
  line-height:1.43!important;
  font-weight:750;
  letter-spacing:-.02em;
  overflow-wrap:anywhere;
  color:var(--ink);
  margin-top:2em!important;
  margin-bottom:.72em!important;
  scroll-margin-top:var(--textbook-anchor-offset,calc(var(--textbook-topbar-height,58px) + 90px))!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow h2 {font-size:calc(1.375rem * var(--reader-scale,1))!important}
body.textbook-reader-ready .continuous-flow-stack>.flow h3 {font-size:calc(1.1875rem * var(--reader-scale,1))!important}
body.textbook-reader-ready .continuous-flow-stack>.flow h4 {font-size:calc(1.0625rem * var(--reader-scale,1))!important}
body.textbook-reader-ready .continuous-flow-stack>.flow>:is(h2,h3,h4):first-child,
body.textbook-reader-ready .continuous-flow-stack>.flow>.textbook-flow-kicker+:is(h2,h3,h4),
body.textbook-reader-ready .continuous-flow-stack>.flow .flow-head>:is(h2,h3,h4) {
  margin-top:0!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow strong {
  font-weight:750;
  color:var(--ink);
}
body.textbook-reader-ready .continuous-flow-stack>.flow ul,
body.textbook-reader-ready .continuous-flow-stack>.flow ol {
  padding-left:1.58rem;
  margin:1em 0 1.55em;
  max-width:100%;
}
body.textbook-reader-ready .continuous-flow-stack>.flow li {
  padding-left:3px;
  margin-bottom:.84em;
}
body.textbook-reader-ready .continuous-flow-stack>.flow li::marker {
  color:var(--accent,#456b5b);
}
body.textbook-reader-ready .scope-reading-column-v3 code:not(pre code),
body.textbook-reader-ready .continuous-flow-stack>.flow :is(code:not(pre code)) {
  background:var(--textbook-code-inline-bg);
  border:1px solid var(--textbook-code-border);
  border-radius:4px;
  padding:.07em .27em;
  font-size:.88em;
  color:var(--textbook-code-inline-ink);
}
body.textbook-reader-ready .scope-reading-column-v3 pre,
body.textbook-reader-ready .continuous-flow-stack>.flow pre {
  background:var(--textbook-code-bg);
  color:var(--textbook-code-ink);
  border:1px solid var(--textbook-code-border);
  border-radius:9px;
  padding:19px 20px;
  line-height:1.7;
  font-size:calc(.9375rem * var(--reader-scale,1));
  margin:1.4em 0 1.6em;
  overflow-x:auto;
  max-width:100%;
}
/* Actual generated classes come from code_highlight.py. These scoped rules
 * outrank both the older dark pre rules and the later global syntax sheet. */
body.textbook-reader-ready .scope-reading-column-v3 pre code {
  color:inherit;
  background:transparent;
  border:0;
  padding:0;
  font-size:inherit;
  line-height:inherit;
  white-space:pre;
  word-break:normal;
  overflow-wrap:normal;
  text-shadow:none;
}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-comment {color:var(--textbook-code-comment);font-style:normal}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-keyword {color:var(--textbook-code-keyword);font-weight:650}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-string {color:var(--textbook-code-string)}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-number {color:var(--textbook-code-number)}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-function,
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-builtin {color:var(--textbook-code-function)}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-type {color:var(--textbook-code-type)}
body.textbook-reader-ready .scope-reading-column-v3 pre .syn-operator {color:var(--textbook-code-operator)}
body.textbook-reader-ready .scope-reading-column-v3 pre a {
  color:var(--textbook-code-function);
  text-decoration:underline;
}
body.textbook-reader-ready .continuous-flow-stack a:not(.primary,.secondary),
body.textbook-reader-ready .continuous-flow-stack a:not(.primary,.secondary):visited {
  color:var(--accent-strong);
  text-decoration:underline;
  text-underline-offset:.18em;
}
body.textbook-reader-ready .scope-reading-column-v3 mark {
  color:var(--ink);
  background:var(--accent-soft);
}
body.textbook-reader-ready .scope-reading-column-v3 .code-tools button {
  color:var(--accent-strong);
  background:var(--surface-raised);
  border:1px solid var(--line-strong);
}
body.textbook-reader-ready .scope-reading-column-v3 .code-tools button:hover {
  color:var(--accent-strong);
  background:var(--accent-soft);
  border-color:var(--accent);
}
body.textbook-reader-ready .scope-reading-column-v3 .code-tools button:disabled {
  color:var(--muted);
  background:var(--surface-soft);
  opacity:1;
}
body.textbook-reader-ready .scope-reading-column-v3 .code-copy-status {
  color:var(--muted);
}
body.textbook-reader-ready .scope-reading-column-v3 :is(pre,.code-tools button):focus-visible {
  outline:3px solid var(--focus);
  outline-offset:3px;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(figure,img,svg) {
  max-width:100%;
}
body.textbook-reader-ready .continuous-flow-stack>.flow figure {
  margin:1.8em 0;
  padding:12px 12px 8px;
  border:1px solid var(--textbook-hairline);
  border-radius:10px;
  background:var(--surface);
}
body.textbook-reader-ready .continuous-flow-stack>.flow figcaption {
  color:var(--muted);
  line-height:1.65;
  text-align:center;
  font-size:.83rem;
  padding:8px 3px;
}
body.textbook-reader-ready .continuous-flow-stack>.flow blockquote {
  padding:18px 20px;
  background:var(--accent-faint);
  border-left:4px solid var(--accent);
  border-radius:0 8px 8px 0;
  margin:1.5em 0;
}
body.textbook-reader-ready .continuous-flow-stack>.flow table {
  border:1px solid var(--textbook-hairline);
  background:transparent;
  font-size:calc(.9375rem * var(--reader-scale,1));
  line-height:1.56;
}
/* Keep wide tables inside their own scroll area, not the page viewport. */
body.textbook-reader-ready .continuous-flow-stack>.flow table:not(.table-wrap table) {
  display:block;
  max-width:100%;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
}
body.textbook-reader-ready .scope-reading-column-v3 th,
body.textbook-reader-ready .continuous-flow-stack>.flow th {
  background:var(--accent-soft);
  color:var(--accent-strong);
  font-weight:700;
}
body.textbook-reader-ready .continuous-flow-stack>.flow th,
body.textbook-reader-ready .continuous-flow-stack>.flow td {
  padding:12px 14px;
  border-color:var(--textbook-hairline);
}
body.textbook-reader-ready .continuous-flow-stack>.flow tr:nth-child(even) td {
  background:var(--surface-soft,#f0f1eb);
}
body.textbook-reader-ready .continuous-flow-stack>.comprehension-check {
  margin:25px 0!important;
  padding:clamp(18px,3vw,29px)!important;
  background:var(--accent-faint)!important;
  border:1px solid var(--textbook-hairline)!important;
  border-left:4px solid var(--accent)!important;
  box-shadow:none!important;
  border-radius:0 10px 10px 0!important;
}
body.textbook-reader-ready .continuous-flow-stack .answer-fields {
  margin-top:14px;
}
body.textbook-reader-ready .continuous-flow-stack .answer-fields :is(textarea,input,select) {
  background:var(--surface-raised);
  border:1px solid var(--line-strong);
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-lesson-recap {
  background:var(--accent-faint);
  border:0;
  border-top:4px solid var(--accent);
  border-radius:0 0 10px 10px;
  box-shadow:none;
  margin:48px 0 25px;
  padding:clamp(24px,4vw,38px);
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-lesson-recap h2 {
  font-size:calc(1.375rem * var(--reader-scale,1));
  line-height:1.43;
  font-weight:750;
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-recap-item h3 {
  font-size:calc(1.1875rem * var(--reader-scale,1));
  line-height:1.43;
  font-weight:750;
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-recap-list :is(li,p){
  font-size:calc(var(--textbook-body-size) * var(--reader-scale,1));
  line-height:1.8;
  letter-spacing:normal;
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-blog,
body.textbook-reader-ready .scope-reading-column-v3 .textbook-record {
  background:var(--surface-raised);
  border:1px solid var(--textbook-hairline);
  border-radius:10px;
  margin-top:25px;
  padding:clamp(16px,2vw,25px);
  box-shadow:none;
}
body.textbook-reader-ready .scope-reading-column-v3 .continuous-history {
  box-shadow:none;
  background:var(--surface-soft);
}
body.textbook-reader-ready .scope-reading-column-v3 .memory-lab-disclosure {
  padding:12px;
  border:1px solid var(--textbook-hairline);
  border-radius:10px;
  background:var(--surface-soft);
}
body.textbook-reader-ready .scope-reading-column-v3 .scope-nav {
  padding:23px 0;
  border-top:1px solid var(--textbook-hairline);
}
body.textbook-reader-ready .textbook-nav-backdrop[hidden]{display:none!important}
body.textbook-reader-ready .textbook-nav-backdrop{
  display:none;
}
body.textbook-reader-ready .textbook-toolbar :is(button,input,a):focus-visible,
body.textbook-reader-ready .textbook-primer a:focus-visible {
  outline:3px solid var(--accent);
  outline-offset:2px;
}
/* A single 780px reading axis, using existing nodes rather than wrappers.
 * Applying the measure to each reading-column child also covers #static-preview
 * and the first-week stack without moving any answer fields or runtime nodes. */
body.textbook-reader-ready .scope-reading-column-v3>:not(.textbook-toolbar) {
  box-sizing:border-box;
  width:100%;
  max-width:var(--textbook-reading-width);
  margin-inline:auto!important;
  min-width:0;
}
body.textbook-reader-ready .continuous-flow-stack>.flow>* {
  max-width:100%;
}
body.textbook-reader-ready .scope-reading-column-v3 [id] {
  scroll-margin-top:var(--textbook-anchor-offset,calc(var(--textbook-topbar-height,58px) + 90px))!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(p,li,dd),
body.textbook-reader-ready .scope-reading-column-v3>.hero,
body.textbook-reader-ready .textbook-primer {
  overflow-wrap:anywhere;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline :is(a,summary):focus-visible {
  outline:3px solid var(--accent);
  outline-offset:2px;
}
/* Tablet and mobile: table of contents becomes a drawer, never a second
 * whole-page flow above the lesson. The existing semantic nav is reused.
 */
@media(max-width:1100px){
  body.textbook-reader-ready .textbook-toolbar-left{display:none}
  body.textbook-reader-ready .textbook-toolbar{padding:9px 11px}
  body.textbook-reader-ready .textbook-toolbar-right{width:100%;justify-content:space-between}
}
@media(max-width:920px){
  body.textbook-reader-ready .shell,body.textbook-reader-ready .first-week-shell {
    width:100%!important;
    padding:0 0 70px!important;
  }
  body.textbook-reader-ready .scope-frame-v3,
  body.textbook-reader-ready.scope-toc-collapsed .scope-frame-v3 {
    display:block!important;
    border-radius:0;
    border-left:0;border-right:0;
  }
  body.textbook-reader-ready .scope-course-nav-v3 {
    position:fixed!important;
    z-index:120!important;
    left:0;top:0!important;
    height:100dvh!important;
    max-height:100dvh!important;
    width:min(325px,85vw)!important;
    padding:18px 10px!important;
    border:0!important;
    border-right:1px solid var(--textbook-hairline)!important;
    box-shadow:12px 0 45px rgba(26,40,29,.19)!important;
    transform:translateX(-107%);
    transition:transform .2s ease;
    visibility:hidden;
  }
  body.textbook-reader-ready.textbook-mobile-nav-open .scope-course-nav-v3 {
    display:block!important;
    visibility:visible;
    transform:translateX(0);
  }
  body.textbook-reader-ready.textbook-mobile-nav-open .textbook-nav-backdrop {
    display:block;
    position:fixed;
    inset:0;
    width:100%;
    border:0;
    padding:0;
    border-radius:0;
    z-index:110;
    background:rgba(22,39,27,.47);
  }
  body.textbook-reader-ready .scope-reading-column-v3 {
    --textbook-reading-gutter:24px;
    padding:0 var(--textbook-reading-gutter) 75px!important;
  }
  body.textbook-reader-ready .textbook-toolbar {
    margin:0 calc(-1 * var(--textbook-reading-gutter));
  }
  body.textbook-reader-ready .scope-course-nav-v3 .continuous-toc-settings>button {
    display:block;
    width:100%;
    margin-top:10px;
  }
}
@media(max-width:640px){
  body.textbook-reader-ready .scope-reading-column-v3 {--textbook-reading-gutter:20px;padding:0 var(--textbook-reading-gutter) 75px!important}
  body.textbook-reader-ready .textbook-toolbar {
    margin:0 calc(-1 * var(--textbook-reading-gutter));
    padding:7px 9px;
    top:var(--textbook-topbar-height,58px);
    gap:6px;
  }
  body.textbook-reader-ready .textbook-toolbar-right {
    gap:5px;
    justify-content:flex-start;
  }
  body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools {
    width:auto;
    margin-left:0;
  }
  body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools .continuous-compare {
    display:none;
  }
  body.textbook-reader-ready .textbook-toolbar .continuous-reader-tools > :is(button,a) {
    min-height:40px;
    padding:6px 8px!important;
    font-size:.73rem!important;
  }
  /* Search remains available at narrow widths and 200% text zoom. */
  body.textbook-reader-ready .textbook-search {flex:1 1 100%;width:100%}
  body.textbook-reader-ready .textbook-search input {width:95px}
  body.textbook-reader-ready .textbook-font-button {min-width:29px;padding:3px 5px}
  body.textbook-reader-ready .scope-reading-column-v3>.hero h1 {
    font-size:clamp(1.875rem,6vw,2.125rem)!important;
  }
  body.textbook-reader-ready .textbook-primer {padding:19px 17px;margin:18px 0 29px}
  body.textbook-reader-ready .continuous-flow-stack>.flow {
    padding:32px 0!important;
  }
  body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="activity"] {
    padding:19px 14px!important;
    margin:24px 0!important;
  }
  body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="material"] {
    padding:19px 14px!important;
    margin:24px 0!important;
  }
  body.textbook-reader-ready .continuous-flow-stack>.comprehension-check {
    margin:24px 0!important;
    padding:20px 16px!important;
  }
}
@media(max-width:400px){
  body.textbook-reader-ready .textbook-toolbar {flex-wrap:wrap}
}
@media(prefers-reduced-motion:reduce){
  body.textbook-reader-ready .scope-course-nav-v3 {transition:none}
}
@media(forced-colors:active){
  body.textbook-reader-ready .scope-reading-column-v3 :is(pre,code:not(pre code),.code-tools button) {
    background:Canvas;
    color:CanvasText;
    border-color:CanvasText;
  }
  body.textbook-reader-ready .continuous-flow-stack>.flow :is(pre,code:not(pre code)) {
    background:Canvas;
    color:CanvasText;
    border-color:CanvasText;
  }
  body.textbook-reader-ready .scope-reading-column-v3 pre [class^="syn-"] {color:CanvasText}
  body.textbook-reader-ready .scope-reading-column-v3 :is(pre,.code-tools button):focus-visible {outline-color:Highlight}
}
@media print{
  body.textbook-reader-ready .scope-reading-column-v3 pre,
  body.textbook-reader-ready .continuous-flow-stack>.flow pre {
    background:#fff;
    color:#000;
    border-color:#777;
  }
  body.textbook-reader-ready .scope-reading-column-v3 pre [class^="syn-"] {color:#000}
  body.textbook-reader-ready .textbook-toolbar,
  body.textbook-reader-ready .scope-course-nav-v3,
  body.textbook-reader-ready .textbook-nav-backdrop,
  body.textbook-reader-ready .continuous-focus-dock,
  body.textbook-reader-ready .continuous-focus-highlight {display:none!important}
  body.textbook-reader-ready .scope-frame-v3 {display:block!important;border:0!important}
  body.textbook-reader-ready .scope-reading-column-v3 {padding:0!important}
}

/* The same row box applies to summaries, leaf topics, activities and materials. */
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-roots>li {margin:1.2em 0;padding:0;list-style:none;}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group>summary::-webkit-details-marker {display:none;}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group>summary::marker {content:"";}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group>summary::after {
  content:"▸";
  position:absolute;
  right:7px;
  top:8px;
  width:10px;
  line-height:1.48;
  font-size:var(--textbook-toc-size);
  pointer-events:none;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group[open]>summary::after {content:"▾";}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-group>summary>a {
  display:flex;
  width:100%;
  box-sizing:border-box;
}
body.textbook-reader-ready .scope-course-nav-v3 .continuous-outline .textbook-toc-children>li {margin:0;padding:0;list-style:none;}

/* Root list has the same zero browser-list padding as nested lists. */
body.textbook-reader-ready .continuous-outline .textbook-toc-roots {list-style:none;margin:0;padding:0;}

/* A modal drawer is not the legacy horizontally scrolling Unit strip. */
@media(max-width:920px){
  body.textbook-reader-ready .scope-course-nav-v3 .scope-unit-list-v3,
  body.textbook-reader-ready .scope-course-nav-v3 .scope-course-actions-v3 {
    display:grid;grid-template-columns:minmax(0,1fr);overflow-x:visible;
    width:100%;min-width:0;scroll-snap-type:none;
  }
  body.textbook-reader-ready .scope-course-nav-v3 .scope-unit-link-v3,
  body.textbook-reader-ready .scope-course-nav-v3 .scope-course-actions-v3 a {
    min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;
  }
}

/* New reference typography: source body 17px; role mapping is presentation-only.
 * Keep authored headings/anchors/order and the existing paper/sage palette.
 * Semantic roles override legacy tag-only 22/19/17px heading fallbacks. */
body.textbook-reader-ready .scope-reading-column-v3>.hero h1 {
  font-size:clamp(calc(var(--textbook-body-size) * 2.15 * var(--reader-scale,1)),5vw,calc(var(--textbook-body-size) * 3.35 * var(--reader-scale,1)))!important;
  line-height:1.27!important;
  letter-spacing:-.058em;
  overflow-wrap:anywhere;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="chapter"] {
  font-size:calc(var(--textbook-body-size) * 2 * var(--reader-scale,1))!important;
  line-height:1.36!important;
  letter-spacing:-.045em;
  margin-top:1.5em!important;
  margin-bottom:.97em!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="section"],
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="support-group"] {
  font-size:calc(var(--textbook-body-size) * 1.28 * var(--reader-scale,1))!important;
  line-height:1.44!important;
  letter-spacing:-.02em;
  margin-top:2.4em!important;
  margin-bottom:.75em!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="subsection"],
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="support"] {
  font-size:calc(var(--textbook-body-size) * 1.1 * var(--reader-scale,1))!important;
  line-height:1.44!important;
  letter-spacing:normal;
  margin-top:2em!important;
  margin-bottom:.55em!important;
}
/* A flow boundary already supplies vertical separation. Avoid double spacing. */
body.textbook-reader-ready .continuous-flow-stack>.flow>:is(h2,h3,h4)[data-reader-heading]:first-child,
body.textbook-reader-ready .continuous-flow-stack>.flow>.textbook-flow-kicker+:is(h2,h3,h4)[data-reader-heading],
body.textbook-reader-ready .continuous-flow-stack>.flow .flow-head>:is(h2,h3,h4)[data-reader-heading] {
  margin-top:0!important;
}
/* Preview existing goals in one vertical list, never infer new learning content. */
body.textbook-reader-ready .textbook-primer {
  display:block;
  min-width:0;
}
body.textbook-reader-ready .textbook-primer-list {
  display:block;
  columns:auto;
  list-style:disc outside;
  padding-left:1.5em;
  margin:.2em 0 .7em;
}
body.textbook-reader-ready .textbook-primer-list>li {
  display:list-item;
  min-width:0;
  margin:.1em 0 .65em;
  padding-left:.15em;
  line-height:1.69;
  overflow-wrap:anywhere;
}
body.textbook-reader-ready .textbook-primer-list>li>strong {
  display:block;
  font-weight:750;
  line-height:1.5;
}
body.textbook-reader-ready .textbook-primer-list>li>span {
  display:block;
  margin-top:.25em;
  line-height:1.69;
  overflow-wrap:anywhere;
}
/* Spacing only: one existing li remains one existing concept, in source order.
 * Do not restyle activity options, answer lists, material menus or recap records. */
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="block"] :is(ul,ol) {
  margin:1em 0 1.65em;
  padding-left:1.48em;
}
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="block"] :is(ul,ol)>li {
  padding-left:.15em;
  margin-bottom:.82em;
  line-height:1.82!important;
}
body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="block"] :is(ul,ol)>li:last-child {
  margin-bottom:0;
}
@media(max-width:1020px) {
  body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="chapter"] {
    font-size:calc(var(--textbook-body-size) * 1.65 * var(--reader-scale,1))!important;
  }
}
@media(max-width:650px) {
  body.textbook-reader-ready .textbook-primer {padding:1.05em 1em;}
  body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="block"] :is(ul,ol) {padding-left:1.28em;}
  body.textbook-reader-ready .continuous-flow-stack>.flow[data-flow-kind="block"] :is(ul,ol)>li {margin-bottom:.95em;}
}
@media(max-width:420px) {
  body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="chapter"] {
    font-size:calc(var(--textbook-body-size) * 1.5 * var(--reader-scale,1))!important;
  }
  body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="section"],
body.textbook-reader-ready .continuous-flow-stack>.flow :is(h2,h3,h4)[data-reader-heading="support-group"] {
    font-size:calc(var(--textbook-body-size) * 1.21 * var(--reader-scale,1))!important;
  }
}
body.textbook-reader-ready .textbook-primer[hidden] {display:none!important}

/* Original inline sources and model-answer document headings live outside .flow.
 * Their explicit support role is visual only: keep text, tags and record IDs. */
body.textbook-reader-ready .continuous-flow-stack :is(h2,h3,h4)[data-reader-heading="support"] {
  font-size:calc(var(--textbook-body-size) * 1.1 * var(--reader-scale,1))!important;
  line-height:1.44!important;font-weight:750;letter-spacing:normal;
  overflow-wrap:anywhere;color:var(--ink);
}

/* One compact account disclosure shares the navigation row on every page. */
.topbar {flex-wrap: wrap; column-gap: 1rem; row-gap: .25rem;}
.topbar > .top-links {margin-inline-start: auto; align-items: center;}
.site-account {position: relative; flex: 0 1 auto; min-width: 0; margin: 0; padding: 0; font-size: .9rem;}
.site-account > .record-account {margin: 0; padding: 0; border: 0;}
.site-account > .record-account > summary {display: block; line-height: 2rem; max-width: min(18rem, 42vw); padding: .35rem .65rem; border: 1px solid var(--line, #c6cbd0); border-radius: .6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box;}
.site-account > .record-account > summary::-webkit-details-marker {display: none;}
.site-account > .record-account > summary:focus-visible {outline: 2px solid var(--accent, #23634c); outline-offset: 3px;}
.site-account .account-panel {position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); z-index: 20; width: min(22rem, calc(100vw - 2rem)); max-height: min(32rem, 75dvh); overflow-y: auto; overscroll-behavior: contain; padding: 1rem; box-sizing: border-box; background: var(--surface, #fff); border: 1px solid var(--line, #c6cbd0); border-radius: .75rem; box-shadow: 0 8px 24px #0002;}
.site-account .account-help {font-size: .85rem; margin-block: .5rem;}
@media (max-width: 600px) {
  .topbar {padding-inline: 1rem; column-gap: .5rem;}
  .topbar > .brand {font-size: .95rem;}
  .topbar > .top-links {gap: .5rem; font-size: .8rem;}
  .topbar > .site-account {margin-inline-start: auto;}
}
.site-account p {margin-block: .5rem; overflow-wrap: anywhere;}
.site-account [data-account-status] {font-weight: 650;}
.site-account summary {cursor: pointer; font-weight: 600;}
.site-account form {display: flex; align-items: end; flex-wrap: wrap; gap: .5rem;}
.site-account label {flex: 1 1 16rem; min-width: 0;}
.site-account input {display: block; width: 100%; max-width: 30rem; min-width: 0; box-sizing: border-box;}
.site-account button, .site-account summary {min-height: 44px;}
.site-account [hidden] {display: none !important;}
.site-account [data-account-feedback]:empty {display: none;}

/* Quiet light palette: every token exceeds WCAG AA 4.5:1 on #f4f6f3. */
pre{background:#f4f6f3;color:#283b32;border:1px solid #c9d2cb;max-width:100%;min-width:0;overflow:auto;tab-size:4}
pre code{color:inherit;white-space:pre;word-break:normal;overflow-wrap:normal}
pre .syn-comment{color:#59665d}
pre .syn-keyword{color:#744282}
pre .syn-string{color:#296344}
pre .syn-number{color:#875024}
pre .syn-function,pre .syn-builtin{color:#245c80}
pre .syn-type{color:#735227}
pre .syn-operator{color:#485d54}
@media(forced-colors:active){pre{background:Canvas;color:CanvasText;border-color:CanvasText}pre [class^="syn-"]{color:CanvasText}}
@media print{pre{background:#fff;color:#000}pre [class^="syn-"]{color:#000}}

/* PRG-01 workbench. All styles are scoped; the learner shell owns page layout. */
.memory-lab-disclosure{margin:1.2rem 0 1.8rem;border:1px solid var(--line,#cbd5df);border-radius:14px;background:var(--surface,#fff);overflow:hidden}
.memory-lab-disclosure>summary{padding:.8rem 1.1rem;min-height:48px;cursor:pointer;font-weight:750}
.memory-lab{--ml-bg:#101d2a;--ml-panel:#162635;--ml-ink:#ebf3f8;--ml-muted:#adbfcd;--ml-line:#405668;--ml-accent:#8ce4d3;--ml-warning:#ffd18f;--ml-danger:#ffb1ad;--ml-code:#0d1823;color:var(--ml-ink);background:var(--ml-bg);padding:clamp(.8rem,2vw,1.5rem);font:400 14px/1.65 system-ui,-apple-system,"Apple SD Gothic Neo",sans-serif;text-align:left;color-scheme:dark}
.memory-lab *{box-sizing:border-box}.memory-lab [hidden]{display:none!important}
.memory-lab h2,.memory-lab h3,.memory-lab h4,.memory-lab p{color:inherit}.memory-lab h2{margin:0;font-size:clamp(1.5rem,3vw,2.1rem);line-height:1.25;letter-spacing:-.04em}.memory-lab h3{font:700 .74rem/1.4 ui-monospace,monospace;letter-spacing:.09em;margin:0}.memory-lab h4{margin:.6rem 0;font-size:1rem}
.memory-lab p{margin:.6rem 0}.memory-lab a{color:var(--ml-accent)}.memory-lab code{background:transparent;color:inherit;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;padding:0}
.memory-lab button,.memory-lab select,.memory-lab input,.memory-lab textarea{font:inherit;color:var(--ml-ink);background:var(--ml-panel);border:1px solid var(--ml-line);border-radius:6px;max-width:100%}
.memory-lab button,.memory-lab select{min-height:44px;padding:.45rem .65rem}.memory-lab button{cursor:pointer;font-size:.82rem;font-weight:650}.memory-lab button:hover{border-color:var(--ml-accent);background:#263e4d}.memory-lab button:disabled{opacity:.42;cursor:default}.memory-lab input[type=number]{width:6.5rem;min-height:44px;padding:.45rem}.memory-lab input[type=checkbox]{width:18px;height:18px;accent-color:var(--ml-accent)}.memory-lab textarea{width:100%;padding:.6rem;resize:vertical;min-height:70px}
.memory-lab :is(button,input,select,textarea,summary,a,[tabindex]):focus-visible,.memory-lab-disclosure>summary:focus-visible{outline:3px solid var(--ml-accent,#25827a);outline-offset:3px}.memory-lab summary{min-height:44px;cursor:pointer;padding:.5rem 0}.memory-lab label{display:flex;flex-direction:column;gap:.25rem;color:var(--ml-muted);font-size:.8rem}.memory-lab label:has(input[type=checkbox]){flex-direction:row;align-items:center;gap:.5rem;min-height:44px}
.ml-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;border-bottom:1px solid var(--ml-line);padding-bottom:1rem}.memory-lab .memory-lab-eyebrow{font:650 .72rem ui-monospace,monospace;letter-spacing:.13em;color:var(--ml-accent);margin:0 0 .7rem}.ml-heading p:last-child{color:var(--ml-muted);font-size:.8rem;letter-spacing:.05em}.ml-badge{padding:.4rem .65rem;border:1px solid var(--ml-line);border-radius:20px;color:var(--ml-accent);font-size:.72rem}.memory-lab .memory-lab-intro{color:var(--ml-muted);max-width:85ch;font-size:.88rem;margin:1rem 0}
.ml-journey{display:flex;gap:1.3rem;flex-wrap:wrap;font-size:.75rem;color:var(--ml-muted);margin:1rem 0}.ml-journey span+span:before{content:'→';margin-right:.9rem;color:var(--ml-accent)}.ml-setup{display:flex;align-items:end;flex-wrap:wrap;gap:.6rem 1rem;padding:1rem 0;border-top:1px solid var(--ml-line)}.ml-setup>label:first-child{flex:1 1 18rem}.ml-goal{border-left:3px solid var(--ml-accent);padding:.55rem .8rem;background:var(--ml-panel);font-size:.86rem}.ml-concepts{color:var(--ml-muted);font-size:.85rem;margin:.5rem 0}
.ml-prediction{display:grid;grid-template-columns:minmax(13rem,1fr) minmax(13rem,1.6fr) auto;align-items:end;gap:.6rem 1rem;border:1px solid var(--ml-line);border-radius:9px;padding:.75rem 1rem;margin:1rem 0 1.25rem}.ml-prediction legend{color:var(--ml-accent);font-size:.85rem;padding:0 .35rem;font-weight:650}.ml-prediction p{grid-column:1/-1;font-size:.8rem;color:var(--ml-muted);margin:0}
.ml-workspace{display:grid;grid-template-columns:minmax(210px,.95fr) minmax(300px,1.65fr) minmax(180px,.8fr);border:1px solid var(--ml-line);border-radius:10px;overflow:hidden}.ml-workspace>section,.ml-workspace>aside{min-width:0;padding:.85rem}.ml-code-panel,.ml-inspector{background:var(--ml-panel)}.ml-code-panel{border-right:1px solid var(--ml-line)}.ml-inspector{border-left:1px solid var(--ml-line)}.ml-panel-title{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap;padding:0 0 .75rem;color:var(--ml-muted)}.ml-panel-title>span{font:600 .65rem ui-monospace,monospace}.ml-code{background:var(--ml-code);font:.76rem/1.95 ui-monospace,SFMono-Regular,Consolas,monospace;padding:.7rem .25rem .7rem 2.8rem;margin:0 0 .7rem;border-radius:7px;min-height:280px;max-height:510px;overflow:auto;list-style:decimal}.ml-code li{padding-left:.45rem;white-space:pre;min-width:max-content;border-left:2px solid transparent;color:#d6e1e9}.ml-code li::marker{color:#859aaa;font-size:.68rem}.ml-code .ml-related{color:var(--ml-accent)}.ml-code .ml-current{background:#22453f;border-left-color:var(--ml-accent);color:#eafff6}.ml-code .ml-current::marker{color:var(--ml-accent)}.ml-controls{display:grid;grid-template-columns:1fr 1fr;gap:.4rem}.ml-controls label{grid-column:1/-1;margin-top:.5rem}.memory-lab .ml-primary{background:var(--ml-accent);border-color:var(--ml-accent);color:#102c2c}.memory-lab .ml-caption{font-size:.73rem;color:var(--ml-muted);margin:.7rem 0}
.ml-scene-toolbar{display:flex;gap:.3rem;flex-wrap:wrap;margin-bottom:.6rem}.ml-scene-toolbar button{min-width:44px;padding:.3rem .5rem}.memory-lab-board{border:1px solid #304859;border-radius:8px;overflow:hidden;background-color:#0d1925;background-image:radial-gradient(#35506488 .8px,transparent .8px);background-size:20px 20px}.memory-lab-board svg{display:block;width:100%;height:auto;aspect-ratio:700/460;touch-action:pan-y;user-select:none}.memory-lab-board svg:active{cursor:grabbing}.memory-lab-board svg text{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;fill:var(--ml-ink)}.ml-stack-zone,.ml-heap-zone{fill:#132330cc;stroke:var(--ml-line);stroke-width:1}.ml-svg-heading{font-size:14px;letter-spacing:1px;fill:var(--ml-muted)!important}.ml-slot rect{fill:#203547;stroke:#7292a5;stroke-width:1.5}.ml-object rect{fill:#173b36;stroke:#6db9a9;stroke-width:1.3}.ml-object.ml-freed rect{fill:#332a35;stroke:var(--ml-danger);stroke-dasharray:5 4}.ml-object.ml-lost rect{fill:#3d3424;stroke:var(--ml-warning)}.ml-svg-name{font-size:18px;font-weight:700}.ml-svg-value{font-size:17px;fill:var(--ml-accent)!important}.ml-svg-small{font-size:12px;fill:var(--ml-muted)!important}.ml-svg-object-value{font-size:13px;font-weight:600}.ml-svg-placeholder{font-size:15px;fill:var(--ml-muted)!important}.ml-selected rect{stroke:var(--ml-accent)!important;stroke-width:3!important}.ml-changed rect{filter:drop-shadow(0 0 5px #8ce4d340)}.ml-edge{fill:none;stroke:var(--ml-accent);stroke-width:2}.ml-expired{stroke:var(--ml-danger);stroke-dasharray:5 5;opacity:.7}.ml-active-edge.ml-live{stroke-width:3;filter:drop-shadow(0 0 4px #8ce4d370)}.ml-arrow-tip{fill:var(--ml-accent)}.ml-slot,.ml-object{cursor:pointer}.ml-slot:focus-visible rect,.ml-object:focus-visible rect{stroke:var(--ml-accent);stroke-width:4}
.ml-selectors{display:flex;gap:.35rem;flex-wrap:wrap;padding-top:.65rem}.ml-selectors button[aria-pressed=true]{border-color:var(--ml-accent);color:var(--ml-accent);background:#1d3936}.ml-legend{display:flex;flex-wrap:wrap;gap:.25rem .8rem;margin:.65rem 0;color:var(--ml-muted);font-size:.68rem}.memory-lab-feedback{border-left:3px solid var(--ml-accent);background:var(--ml-panel);padding:.7rem .8rem;font-size:.82rem;min-height:5rem}.memory-lab-feedback[data-tone=danger]{border-color:var(--ml-danger);background:#382b34}.memory-lab-feedback[data-tone=warning]{border-color:var(--ml-warning);background:#353125}.ml-output{border:1px solid var(--ml-line);border-radius:7px;background:var(--ml-code);padding:.65rem;font-size:.68rem;color:var(--ml-muted)}.ml-output output{display:block;white-space:pre-wrap;font:400 .95rem/1.5 ui-monospace,monospace;color:var(--ml-accent);margin-top:.4rem}
.ml-inspector dl{margin:.7rem 0}.ml-inspector dt{font-size:.7rem;color:var(--ml-muted);margin-top:.65rem}.ml-inspector dd{margin:.1rem 0;font-size:.82rem;overflow-wrap:anywhere;padding-bottom:.5rem;border-bottom:1px solid #354c5b}.ml-inspector>p,.ml-analysis p,.ml-inspector details p{font-size:.78rem;color:var(--ml-muted)}.ml-analysis{margin-top:1.2rem;padding-top:.6rem;border-top:1px solid var(--ml-line)}.ml-manual{display:grid;grid-template-columns:1fr;gap:.4rem;margin-top:.6rem}.ml-manual button{text-align:left}
.ml-history{padding-top:1.3rem}.ml-scrub{display:flex;align-items:center;gap:1rem!important;flex-direction:row!important}.ml-scrub input{width:100%;accent-color:var(--ml-accent);min-height:44px}.ml-log{margin:.5rem 0 1rem;padding:0;max-height:210px;overflow:auto;list-style:none;border-top:1px solid var(--ml-line)}.ml-log li{display:grid;grid-template-columns:minmax(150px,.7fr) 2fr;gap:.8rem;align-items:start;padding:.5rem 0;border-bottom:1px solid #354c5b;font-size:.78rem;color:var(--ml-muted)}.ml-log button{text-align:left;font-family:ui-monospace,monospace}.ml-log button[aria-current=step]{color:var(--ml-accent);border-color:var(--ml-accent)}.memory-lab [data-ml-comparison]{font-size:.85rem;border-left:3px solid var(--ml-accent);padding:.6rem .8rem;background:var(--ml-panel)}.ml-history>button{margin-top:.7rem}.memory-lab-details{border-top:1px solid var(--ml-line);margin-top:1.3rem;font-size:.78rem;color:var(--ml-muted)}
@media(max-width:1050px){.ml-workspace{grid-template-columns:minmax(230px,.9fr) minmax(300px,1.5fr)}.ml-inspector{grid-column:1/-1;border-left:0;border-top:1px solid var(--ml-line);display:grid;grid-template-columns:1fr 1fr;gap:.5rem 1.2rem}.ml-inspector .ml-panel-title{grid-column:1/-1}.ml-inspector h4{grid-column:1/-1}.ml-inspector .ml-analysis{margin:0}.ml-inspector details{grid-column:1/-1}.ml-manual{grid-template-columns:repeat(4,1fr)}.ml-prediction{grid-template-columns:1fr 1fr}.ml-prediction>button{grid-column:1/-1;justify-self:start}}
@media(max-width:780px){.ml-workspace{grid-template-columns:minmax(0,1fr)}.ml-code-panel{border-right:0;border-bottom:1px solid var(--ml-line)}.ml-code{min-height:0;max-height:370px;font-size:.8rem}.ml-inspector{display:block}.ml-inspector .ml-analysis{margin-top:1rem}.ml-controls{grid-template-columns:repeat(3,1fr)}.ml-controls label{grid-column:auto}.memory-lab-board svg{min-height:270px}.ml-prediction{grid-template-columns:1fr}.ml-prediction>button{width:100%}.ml-log li{grid-template-columns:1fr}.ml-manual{grid-template-columns:1fr 1fr}.ml-journey{gap:.35rem .8rem}.ml-journey span+span:before{display:none}.ml-heading{align-items:start}.ml-scrub{flex-direction:column!important;align-items:stretch}.ml-panel-title button{width:100%}}
@media(max-width:430px){.memory-lab{padding:.7rem}.ml-workspace>section,.ml-workspace>aside{padding:.65rem}.ml-controls{grid-template-columns:1fr 1fr}.ml-controls label{grid-column:1/-1}.ml-setup>label{flex:1 1 8rem}.ml-code{font-size:.73rem}.ml-scene-toolbar{gap:.2rem}.memory-lab-board svg{min-height:215px}.ml-legend{font-size:.66rem}}
@media(prefers-reduced-motion:reduce){.memory-lab *,.memory-lab *::before,.memory-lab *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.ml-changed rect,.ml-active-edge.ml-live{filter:none}}
/* The shared reading theme uses important declarations for form controls. */
.memory-lab :is(input,textarea,select){color:var(--ml-ink)!important;background:var(--ml-panel)!important;border-color:var(--ml-line)!important}

.memory-lab .ml-expired-arrow-tip{fill:var(--ml-danger)}
@media(max-width:430px){.memory-lab-board{overflow:auto}.memory-lab-board svg{min-width:640px;min-height:420px;touch-action:auto}}


/* PRG-01 v3 · interactive source workbench and readable compact memory diagram. */
.memory-lab-disclosure{scroll-margin-top:5.5rem}
.memory-lab{--ml-accent:#8fe9d5;--ml-warning:#f5cf92;--ml-danger:#ffaca7;background:radial-gradient(ellipse at 100% -5%,#244b4c88,transparent 34%),linear-gradient(165deg,#102030 0%,#101c29 65%);font-size:14px}
.ml-heading{background:radial-gradient(ellipse at 0 0,#2849519c,transparent 65%);padding:.65rem .6rem 1.15rem;margin:-.2rem -.15rem 0}
.memory-lab .memory-lab-eyebrow{font-size:.74rem;color:#a1f3df}
.memory-lab h2{font-size:clamp(1.7rem,3vw,2.4rem);letter-spacing:-.055em}
.ml-badge{font-weight:650;letter-spacing:.02em;background:#12352f99;border-color:#34786c;color:#b8f1e3}
.ml-journey{gap:.45rem 1rem;color:#d0e1e9}.ml-journey span{background:#183344;border:1px solid #2f5061;border-radius:40px;padding:.26rem .65rem}
.ml-journey span+span:before{display:none}
.memory-lab :is(.ml-setup,.ml-missions) :is(select,input){border-color:#587285}
.memory-lab .ml-section-kicker{font:750 .69rem/1.5 ui-monospace,monospace;letter-spacing:.1em;color:#94e5d5}
.ml-missions{border:1px solid #3b6164;background:linear-gradient(125deg,#1a3c45,#162836 66%);border-radius:12px;padding:1rem;display:grid;grid-template-columns:minmax(0,1fr) minmax(170px,.65fr) auto auto;gap:.7rem 1rem;align-items:end;margin:1.1rem 0}
.ml-mission-intro h3{font:750 1.05rem/1.45 system-ui,sans-serif;letter-spacing:0;margin:.1rem 0 .25rem}
.ml-mission-intro p{font-size:.79rem;color:#c1d5dd;margin:0}.ml-missions button{white-space:nowrap}
.ml-mission-status{grid-column:1/-1;margin:0!important;padding:.6rem .7rem;background:#102634;border-left:3px solid #5a938b;border-radius:3px;font-size:.84rem;color:#d6edf0!important}
.ml-mission-status[data-tone=success],.ml-source-status[data-tone=success]{border-color:var(--ml-accent);color:#b9efce!important}
.ml-mission-status[data-tone=warning]{border-color:var(--ml-warning)}
.ml-workspace{background:#112433;box-shadow:0 12px 35px #0002;grid-template-columns:minmax(240px,1.05fr) minmax(320px,1.85fr) minmax(190px,.95fr)}
.ml-workspace>section,.ml-workspace>aside{padding:1rem}
.memory-lab .ml-code{font-size:.82rem;line-height:1.88;background:#0b1722;border:1px solid #273c4b}
.ml-code .ml-current{background:#244d43;color:#f1fff7;font-weight:700}
.ml-source-panel{margin:.6rem 0 .85rem;border:1px solid #446479;border-radius:10px;padding:.35rem .75rem .7rem;background:#102331}
.ml-source-panel>summary{font-weight:750;color:#a3f6e2;display:flex;align-items:center;gap:.5rem}
.ml-source-flag{margin-left:auto;padding:.15rem .48rem;border:1px solid #467c72;border-radius:20px;font-size:.69rem;color:#c1eadd}
.ml-source-panel textarea{font:500 .84rem/1.65 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:4;min-height:290px;background:#0a1722!important;color:#e7f1f3!important;border:1px solid #4a6879!important;white-space:pre;overflow:auto}
.ml-source-panel label{font-weight:650}
.ml-source-actions{display:grid;grid-template-columns:1fr 1fr;gap:.35rem;margin-top:.5rem}
.ml-source-status{border-left:3px solid #557284;background:#192f3d;border-radius:3px;padding:.5rem .6rem;font-size:.8rem;color:#d7e5e9!important}
.ml-source-status[data-tone=danger]{border-color:var(--ml-danger);color:#ffe0de!important}
.ml-grammar{margin-top:.55rem;border-top:1px solid #456071}.ml-grammar p{font-size:.78rem;line-height:1.9}
.ml-execution-focus{background:linear-gradient(110deg,#213d4a,#182c3a);border:1px solid #416876;border-left:4px solid var(--ml-accent);border-radius:9px;padding:.65rem .85rem;margin:.05rem 0 .55rem;min-height:94px}
.ml-execution-focus[data-tone=danger]{border-left-color:var(--ml-danger);background:linear-gradient(110deg,#422e39,#222b39)}
.ml-execution-focus[data-tone=warning]{border-left-color:var(--ml-warning)}
.ml-execution-focus strong{display:block;overflow-wrap:anywhere;font:750 .93rem/1.45 ui-monospace,SFMono-Regular,monospace;color:#f3fff9;padding:.15rem 0}
.ml-execution-focus p{font-size:.8rem;line-height:1.5;color:#cadce4;margin:.2rem 0 0;max-height:4.5em;overflow:auto}
.ml-state-strip{font:700 .77rem/1.55 ui-monospace,monospace;background:#0b2029;border:1px solid #365b64;border-radius:8px;margin:.4rem 0 .65rem!important;padding:.6rem .75rem;overflow-wrap:anywhere;color:#b0efdb!important}
.memory-lab-board{background-color:#0b1c2a;border-color:#4b6e78;box-shadow:inset 0 0 40px #0003}
.memory-lab-board svg{aspect-ratio:auto;min-width:0}
.ml-slot rect{fill:#244255;stroke:#86a9bb;stroke-width:1.8}
.ml-object rect{fill:#155043;stroke:#8dddc8}
.ml-object.ml-freed rect{fill:#46323c;stroke:#ffa5aa}
.ml-object.ml-lost rect{fill:#59472e;stroke:#f5cf92}
.ml-svg-heading{font-size:15px;fill:#c6e7ed!important;font-weight:650}
.ml-svg-value{fill:#aef9e4!important}.ml-svg-object-value{font-size:14px;fill:#eafff4!important}
.ml-selected rect{stroke:#b3fff0!important;stroke-width:3!important;filter:drop-shadow(0 0 7px #8ce4d375)}
.ml-changed rect{filter:drop-shadow(0 0 7px #8ce4d38a)}
.ml-active-edge.ml-live{stroke-width:3.5;stroke-dasharray:8 6;animation:ml-flow 1.25s linear infinite;filter:drop-shadow(0 0 5px #8ce4d38f)}
@keyframes ml-flow{to{stroke-dashoffset:-28}}
.ml-selectors button[aria-pressed=true]{box-shadow:inset 0 0 0 1px var(--ml-accent)}
.ml-inspector dt{font-size:.8rem}.ml-inspector dd{font-size:.9rem}
.ml-history{border-top:1px solid #36515d;margin-top:1rem}
@media(max-width:1220px){.ml-workspace{grid-template-columns:minmax(230px,.92fr) minmax(310px,1.6fr)}.ml-inspector{grid-column:1/-1;border-left:0;border-top:1px solid var(--ml-line);display:grid;grid-template-columns:1fr 1fr;gap:.5rem 1.2rem}.ml-inspector .ml-panel-title{grid-column:1/-1}.ml-inspector .ml-analysis{margin:0}.ml-inspector details{grid-column:1/-1}}
@media(max-width:1000px){.ml-missions{grid-template-columns:1fr 1fr}.ml-mission-intro,.ml-mission-status{grid-column:1/-1}}
@media(max-width:780px){
 .ml-workspace{grid-template-columns:minmax(0,1fr)}
 .ml-code-panel{border-right:0;border-bottom:1px solid var(--ml-line)}
 .ml-inspector{display:block}
 .ml-missions{grid-template-columns:1fr 1fr}
 .ml-code{max-height:340px}
 .ml-execution-focus{min-height:0}
 .ml-scene-panel{padding-top:.8rem!important}
 .memory-lab-board svg{min-height:0}
}
@media(max-width:560px){
 .ml-missions{grid-template-columns:1fr}
 .ml-missions>*,.ml-mission-intro,.ml-mission-status{grid-column:1/-1}
 .ml-missions button{width:100%}
 .ml-source-actions{grid-template-columns:1fr}
 .ml-controls{grid-template-columns:1fr 1fr}
 .ml-scene-toolbar button{min-width:42px}
 .memory-lab-board,.memory-lab-board svg{overflow:hidden;min-width:0!important;min-height:0!important;touch-action:pan-y}
 .ml-panel-title{gap:.25rem}
 .memory-lab .ml-code{font-size:.78rem}
 .ml-state-strip{font-size:.72rem}
 .ml-execution-focus strong{font-size:.83rem}
}
@media(prefers-reduced-motion:reduce){.ml-active-edge.ml-live{animation:none}}
/* A solid sticky header prevents transparency bleed over the lab's controls. */
body:has(.memory-lab-disclosure[open]) .topbar{background:#fbfaf6!important;backdrop-filter:none}


/* PRG-02: isolated advanced memory workbench; the existing PRG-01 remains untouched. */
.ml-advanced-disclosure{margin:1.8rem 0 1.15rem;border:1px solid #47717c;border-radius:14px;background:#0d1e2d;color:#e7f3f7;overflow:hidden}
.ml-advanced-disclosure>summary{display:flex;align-items:center;gap:.75rem;background:linear-gradient(110deg,#193d48,#122534);color:#e8faf6;padding:.95rem 1.2rem;font-size:1rem;font-weight:800;min-height:48px;cursor:pointer;line-height:1.5}
.ml-advanced-disclosure>summary:focus-visible{outline:3px solid #9df0e3;outline-offset:-3px}
.adv-summary-index{font:700 .8rem/1 ui-monospace,monospace;color:#97ecdc;letter-spacing:.08em;border:1px solid #50998d;border-radius:6px;padding:.42rem .52rem}
.ml-advanced{--adv-paper:#101e2a;--adv-panel:#182b39;--adv-line:#416272;--adv-accent:#9eecda;--adv-warning:#ffd392;--adv-danger:#ffbbb4;--adv-ink:#ebf6f9;background:radial-gradient(ellipse at 87% 0,#244c4a88,transparent 32%),var(--adv-paper);color:var(--adv-ink);padding:clamp(.75rem,2vw,1.45rem);font:400 14px/1.6 system-ui,-apple-system,"Apple SD Gothic Neo",sans-serif}
.ml-advanced *{box-sizing:border-box}.ml-advanced [hidden]{display:none!important}
.ml-advanced :is(h3,h4,p){color:inherit}.ml-advanced code{color:#a9eee1;background:transparent;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.ml-advanced :is(button,textarea,select,input){color:var(--adv-ink);background:#112433;border:1px solid var(--adv-line);border-radius:7px;font:inherit;max-width:100%}
.ml-advanced :is(button,select){min-height:44px;padding:.55rem .7rem}.ml-advanced button{cursor:pointer;font-size:.82rem;font-weight:700}
.ml-advanced button:hover:not(:disabled){border-color:var(--adv-accent);background:#264657}.ml-advanced button:disabled{opacity:.4;cursor:default}
.ml-advanced :is(button,select,textarea,input,summary):focus-visible{outline:3px solid var(--adv-accent);outline-offset:3px}
.ml-advanced .adv-primary{background:var(--adv-accent);border-color:var(--adv-accent);color:#0b292b}
.adv-head{display:flex;align-items:start;justify-content:space-between;flex-wrap:wrap;gap:1.2rem;margin:.15rem 0 1.1rem;padding:.35rem .2rem 1.15rem;border-bottom:1px solid var(--adv-line)}
.adv-head h3{font-size:clamp(1.3rem,2.2vw,1.8rem);line-height:1.35;letter-spacing:-.05em;margin:.2rem 0 .5rem}
.adv-head p:not(.adv-eyebrow){max-width:65ch;font-size:.86rem;color:#b9d2db;margin:0}
.adv-eyebrow{font:700 .71rem/1.5 ui-monospace,monospace;letter-spacing:.09em;color:var(--adv-accent)!important;margin:0}
.adv-model-note{font-size:.73rem;color:#bcecdc;border:1px solid #426d6c;padding:.5rem .7rem;border-radius:30px;white-space:normal}
.adv-scenarios{display:grid;grid-template-columns:minmax(210px,1fr) minmax(0,1.8fr);align-items:end;gap:.7rem 1rem;margin:.7rem 0 1.1rem}
.adv-scenarios label,.adv-code label,.adv-timeline-wrap label{display:flex;flex-direction:column;gap:.35rem;font-size:.8rem;color:#c5e1e4}
.adv-scenarios select{width:100%!important;color:var(--adv-ink)!important;background:#152f40!important}
.adv-scenarios>p{margin:0;background:#183642;border-left:3px solid #7ddbc8;padding:.7rem .85rem;min-height:44px;font-size:.86rem}
.adv-workspace{display:grid;grid-template-columns:minmax(210px,1.15fr) minmax(320px,1.9fr) minmax(190px,.88fr);gap:0;border:1px solid var(--adv-line);border-radius:12px;overflow:hidden}
.adv-workspace>section,.adv-workspace>aside{min-width:0;padding:1rem}
.adv-code,.adv-inspect{background:var(--adv-panel)}.adv-code{border-right:1px solid var(--adv-line)}.adv-inspect{border-left:1px solid var(--adv-line)}
.adv-panel-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.4rem;margin:0 0 .65rem}
.adv-panel-header h4{font:800 .75rem/1.4 ui-monospace,monospace;letter-spacing:.1em;margin:0;color:#cce6e9}
.adv-panel-header>span{font:.68rem ui-monospace,monospace;color:#a1becc}
.adv-section-hint{font-size:.77rem;color:#b9ced6!important;margin:0 0 .65rem}
.adv-code textarea{display:block;min-height:310px;width:100%;padding:.8rem .85rem;background:#0b1723!important;color:#e9f4f6!important;border:1px solid #4e697c!important;border-radius:9px;resize:vertical;font:500 .78rem/1.7 ui-monospace,SFMono-Regular,Consolas,monospace!important;white-space:pre;overflow:auto;tab-size:4}
.adv-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem;margin:.8rem 0}.adv-actions button{white-space:normal}
.adv-compile-status{border-left:3px solid #698a9d;padding:.7rem .8rem;background:#213545;border-radius:3px;font-size:.78rem;min-height:3.25rem;margin:.7rem 0}
.adv-compile-status[data-tone="success"]{border-color:var(--adv-accent)}.adv-compile-status[data-tone="warning"]{border-color:var(--adv-warning)}.adv-compile-status[data-tone="danger"]{border-color:var(--adv-danger);background:#3b2e3a}
.adv-source-view{border-top:1px solid var(--adv-line);margin-top:.8rem}
.adv-source-view>summary{min-height:44px;padding:.6rem 0;cursor:pointer;font-size:.8rem;font-weight:700}
.adv-source-lines{list-style:decimal;padding:.5rem 0 .5rem 2.5rem;overflow:auto;max-height:280px;background:#081721;border-radius:7px;font:.74rem/1.9 ui-monospace,monospace}
.adv-source-lines li{white-space:pre;padding:0 .5rem;border-left:2px solid transparent}
.adv-source-lines li::marker{color:#94b6c7}
.adv-source-lines .adv-executed{background:#225445;border-color:#91ebd7;color:#dffff4}
.adv-memory{background:radial-gradient(ellipse at 10% 0,#163847,transparent 45%),#102330}
.adv-current{border:1px solid #416b73;border-left:4px solid var(--adv-accent);border-radius:9px;padding:.65rem .85rem;background:#1c3947;margin-bottom:.75rem}
.adv-current>span{font:700 .7rem ui-monospace,monospace;letter-spacing:.06em;color:#aee8dd}
.adv-current strong{display:block;font:.87rem/1.55 ui-monospace,SFMono-Regular,monospace;color:#f1fff9;white-space:normal;overflow-wrap:anywhere;margin:.2rem 0}
.adv-current>p{margin:.25rem 0 0;font-size:.84rem;color:#d2e3e8!important;line-height:1.6}
.adv-current>p[data-tone="danger"]{color:#ffcecb!important}
.adv-svg-box{border:1px solid #426571;border-radius:10px;background-color:#0c1d2a;background-image:radial-gradient(#35556891 .8px,transparent .8px);background-size:18px 18px;overflow:hidden}
.adv-svg-box svg{display:block;width:100%;height:auto;aspect-ratio:700/225}
.adv-svg-frame{fill:#122735bb;stroke:#496a7a;stroke-width:1}
.adv-svg-top{font:700 13px ui-monospace,monospace;fill:#b3dee0}
.adv-svg-item rect{fill:#274456;stroke:#8db0bb;stroke-width:2}
.adv-svg-item.adv-heap rect{fill:#1d4d42;stroke:#75dfc1}
.adv-svg-item.adv-buffer rect{fill:#264a40;stroke:#77caab}
.adv-svg-title{font:700 17px ui-monospace,monospace;fill:#e7fcf8}
.adv-svg-value{font:700 16px ui-monospace,monospace;fill:#9af4d9}
.adv-svg-address{font:500 13px ui-monospace,monospace;fill:#b8d3db}
.adv-arrow{stroke:#8fe9d5;stroke-width:3;fill:none;stroke-linecap:round}
.adv-svg-path{font:700 15px ui-monospace,monospace;fill:#afdfd5}
.adv-connections{font:.75rem/1.6 ui-monospace,monospace;color:#b2dcd5!important;background:#0b1d29;padding:.55rem .7rem;border-radius:7px;overflow-wrap:anywhere}
.adv-buffer-regions{display:grid;gap:.75rem;margin:.85rem 0}
.adv-memory-region{border:1px solid #47616f;background:#142c38;border-radius:9px;padding:.6rem .65rem}
.adv-memory-region h4{font:750 .79rem/1.5 ui-monospace,monospace;margin:0 0 .55rem;color:#cce9ef}
.adv-byte-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:.35rem}
.adv-byte-cell{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:56px;background:#2b3d4b;border:1px solid #6b8696;border-radius:7px}
.adv-byte-cell small{font:.69rem ui-monospace,monospace;color:#bdd2da}
.adv-byte-cell strong{font:700 .83rem ui-monospace,monospace;color:#f5ffff}
.adv-byte-written{background:#164d42;border-color:#7bcbb0}.adv-byte-expired{opacity:.45}
.adv-byte-overflow{background:#63363c;border:2px dashed #ffc0b8;animation:adv-pulse 1.6s ease-in-out infinite}
.adv-byte-overflow strong{color:#ffe9e5}
@keyframes adv-pulse{50%{border-color:#fa747a}}
.adv-empty{font-size:.8rem;color:#b8cbd7!important}
.adv-model-explanation{font-size:.75rem;color:#bdd7dd!important;line-height:1.7;margin:1rem 0 0}
.adv-inspect>h4{font:750 .83rem/1.5 system-ui,sans-serif;margin:1.1rem 0 .25rem;color:#e0f6f2}
.adv-inspect>p{font-size:.81rem;color:#c0d3de!important;margin:0 0 .4rem}
.adv-outcome{display:block;font-size:.91rem;background:#123e3c;color:#abf4db;padding:.75rem;border-radius:7px}
.adv-check{width:100%;margin:.75rem 0 .5rem;border-color:#70b8a9!important}
.adv-check-status{min-height:2rem;font-size:.8rem;color:#c5dce3!important;margin:0 0 .8rem!important}
.adv-check-status[data-tone="success"]{color:#a9eed0!important}.adv-check-status[data-tone="warning"]{color:#ffd69f!important}
.adv-terminal{background:#091923;border:1px solid #436577;border-radius:9px;padding:.6rem}
.adv-terminal span{display:block;font:.7rem ui-monospace,monospace;color:#a9cbd3}
.adv-terminal output{display:block;white-space:pre-wrap;font:.95rem/1.6 ui-monospace,monospace;color:#9deed5;padding-top:.35rem}
.adv-timeline-wrap{margin:1.2rem 0;padding:.85rem;background:#132a39;border:1px solid #416272;border-radius:10px}
.adv-timeline-wrap label{margin:.65rem 0}
.adv-timeline-wrap input[type=range]{display:block;width:100%;min-height:44px;accent-color:#9de6d3}
.adv-events{display:flex;flex-wrap:wrap;gap:.4rem}
.adv-events button{min-height:40px;max-width:100%;text-align:left;font:600 .73rem ui-monospace,monospace}
.adv-events button[aria-current="step"]{background:#26594d;border-color:#8ae8d1}
.adv-footer-note{border-top:1px solid #3d5d6b;padding:1rem 0 0;margin:1.1rem 0 0;font-size:.75rem;color:#b4cbd5!important}
@media(max-width:1200px){.adv-workspace{grid-template-columns:minmax(220px,1fr) minmax(290px,1.55fr)}.adv-inspect{grid-column:1/-1;border-left:0;border-top:1px solid var(--adv-line)}.adv-inspect{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:1rem}.adv-inspect .adv-panel-header,.adv-inspect .adv-outcome,.adv-inspect .adv-terminal{grid-column:1/-1}}
@media(max-width:750px){.adv-scenarios{grid-template-columns:1fr}.adv-workspace{grid-template-columns:minmax(0,1fr)}.adv-code{border-right:0;border-bottom:1px solid var(--adv-line)}.adv-inspect{display:block}.adv-svg-box svg{min-width:0;aspect-ratio:700/225}.adv-memory,.adv-workspace>section,.adv-workspace>aside{padding:.8rem}.adv-actions{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:460px){.adv-actions{grid-template-columns:repeat(2,minmax(0,1fr))}.adv-code textarea{font-size:.73rem!important;min-height:270px}.adv-byte-row{grid-template-columns:repeat(4,minmax(0,1fr))}.adv-svg-title{font-size:15px}.adv-svg-value{font-size:14px}.adv-svg-address{font-size:12px}}
@media(prefers-reduced-motion:reduce){.adv-byte-overflow{animation:none}}

/* A freed object is a historical relation, never a live reference. */
.adv-arrow-historical{stroke:#f7a39b;stroke-dasharray:7 6}

.source-license-notices{margin-block:1.5rem;padding-block:1rem;border-top:1px solid var(--line);color:var(--ink);font-size:.9rem}
.license-notice+.license-notice{margin-block-start:1rem}
.license-notice summary{cursor:pointer;font-weight:600}
.license-notice summary:focus-visible,.license-notice a:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.license-notice-text{white-space:pre-wrap;overflow-wrap:anywhere;overflow:visible;background:transparent;color:inherit;border-radius:0;padding:0;font:inherit}
.license-notice-print{display:none}
/* A separate print copy avoids relying on browser handling of closed details. */
@media print{
 .source-license-notices,.license-notice{display:block!important;overflow:visible!important}
 .license-notice-details{display:none!important}
 .license-notice-print{display:block!important}
 .license-notice-text{white-space:pre-wrap!important;overflow:visible!important;color:#000!important}
 .license-attribution a::after{content:" (" attr(href) ")"}
}
@media print{
 #source-dialog[open]{position:static!important;max-height:none!important;height:auto!important;overflow:visible!important}
 #source-dialog[open] .dialog-body{overflow:visible!important;max-height:none!important}
}

[data-content-reader] {margin-block: 1rem; padding: 1rem; border: 1px solid var(--line, #8893a3); border-radius: .75rem; overflow-wrap: anywhere;}
[data-content-reader] button, [data-content-reader] > a {min-height:44px; margin:.25rem; display:inline-flex; align-items:center;}
[data-content-reader] article {margin-block:1rem; padding-block:1rem; border-top:1px solid var(--line, #8893a3);}
[data-content-reader] [hidden], [data-content-reader][hidden], [data-cms-original-study][hidden] {display:none !important;}
[data-content-reader] :focus-visible {outline:3px solid var(--accent, #2579d7); outline-offset:3px;}
[data-content-reader] pre {max-width:100%; overflow:auto;}

/* Original generated outline/recap/search never masquerade as CMS content. */
body[data-cms-reading="latest"] .scope-course-nav-v3,
body[data-cms-reading="latest"] .textbook-toolbar,
body[data-cms-reading="latest"] .textbook-primer,
body[data-cms-reading="latest"] .continuous-focus-dock,
body[data-cms-reading="latest"] .continuous-reader-tools,
body[data-cms-reading="latest"] .continuous-focus-highlight {display:none !important;}
body[data-cms-reading="latest"] .scope-frame-v3 {display:block;}
