/* Study workspace: consistent reading measure, responsive shell, restrained chrome. */
:root {
  --font-display: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: var(--font-display);
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --sidebar-w: 276px;
  --measure: 72ch;
  --fs-0: .8125rem; --fs-1: .9375rem; --fs-2: 1rem;
  --fs-3: 1.125rem; --fs-4: 1.375rem; --fs-5: 1.8rem; --fs-6: 2.4rem;
  --radius: 5px; --radius-lg: 7px;
}
[hidden] { display: none !important; }
body { line-height: 1.7; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.035em; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .btn, .nav-link { transition: color .15s, background-color .15s, border-color .15s; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#main:focus { outline: none; }
.skip-link { position: fixed; top: -80px; left: 1rem; z-index: 100; background: var(--surface); padding: .75rem 1rem; }
.skip-link:focus { top: .5rem; }
.sidebar { padding: 1.35rem .95rem 1rem; gap: 1.2rem; height: 100dvh; scrollbar-width: thin; overscroll-behavior: contain; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 .4rem .4rem; }
.brand-mark { background: var(--accent); color: var(--accent-ink); width: 34px; height: 34px; border-radius: 8px; font-size: 1.3rem; }
.brand-name { display: block; font-size: 1.02rem; }
.brand-sub { display: block; margin-top: .3rem; font-size: .625rem; letter-spacing: .12em; }
.nav-label { padding: 0 .65rem .4rem; font-size: .625rem; letter-spacing: .08em; }
.nav-link { padding: .48rem .65rem; font-size: .79rem; line-height: 1.4; min-height: 36px; gap: .6rem; }
.nav-link > span:not(.nav-index):not(.dot):not(.badge) { min-width: 0; }
.nav-index { font-family: var(--font-mono); font-size: .65rem; color: var(--muted); flex: 0 0 1.15rem; }
.nav-link.active { font-weight: 600; }
.nav-link.active .nav-index { color: var(--accent); }
.nav-link .dot { margin-left: auto; width: 6px; height: 6px; }
.nav-symbol { width: 1.1rem; font-size: 1rem; }
.curriculum-nav .nav-group + .nav-group { margin-top: 1.2rem; border: 0; padding-top: 0; }
.practice-nav { border-top: 1px solid var(--line); padding-top: 1rem; }
.sidebar-bottom { margin-top: auto; padding-top: .6rem; }
.progress-wrap { gap: .65rem; }
.progress-meta { font-family: var(--font-display); font-size: .7rem; }
.progress-bar { height: 4px; }
.progress-bar > i { background: var(--accent); }
.sidebar-foot { margin-top: 1rem; justify-content: space-between; }
.icon-btn { min-height: 34px; font-family: var(--font-display); font-size: .72rem; background: transparent; }
.drawer-close { display: none; }
.page { max-width: 1440px; margin-inline: auto; padding: 2.5rem clamp(1.5rem, 4.2vw, 5rem) 3rem; }
.page.prose { max-width: 1000px; }
.page-kicker { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: .66rem; letter-spacing: .11em; }
.edition { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .07em; color: var(--muted); align-self: center; }
.accent { color: var(--accent); }
.course-intro { padding-block: clamp(2.5rem, 5vw, 4.5rem) 2.5rem; }
.course-intro h1 { font-size: clamp(2.35rem, 3.5vw, 4rem); line-height: 1.12; margin-top: 1rem; font-weight: 650; letter-spacing: -.05em; }
.course-intro h1 span { color: var(--muted); }
.course-intro > p { max-width: 62ch; margin-top: 1.35rem; font-size: 1.02rem; color: var(--ink-2); line-height: 1.8; }
.hero-actions { margin-top: 1.75rem; gap: 1rem; align-items: center; }
.btn { font-size: .82rem; min-height: 42px; padding: .65rem 1rem; gap: 1rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.text-btn { background: none; border-color: transparent; color: var(--ink-2); padding-inline: 0; }
.text-btn:hover { border-color: transparent; color: var(--accent); }
.course-facts { display: flex; flex-wrap: wrap; gap: 1rem 2.3rem; padding-block: 1.2rem; border-block: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.course-facts b { font-size: .95rem; color: var(--ink); margin-right: .3rem; font-weight: 600; }
.curriculum-section { margin-top: 3rem; }
.section-head { align-items: flex-end; margin-bottom: 2rem; }
.section-head h2 { margin-top: .4rem; }
.section-head p { font-size: .8rem; line-height: 1.6; }
.curriculum-stage + .curriculum-stage { margin-top: 2.5rem; }
.stage-heading { display: flex; gap: .85rem; margin-bottom: .8rem; align-items: baseline; }
.stage-number { color: var(--accent); font: .72rem var(--font-mono); }
.stage-heading h3 { font-size: 1rem; letter-spacing: -.02em; }
.stage-heading p { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.roadmap { gap: 0; border-top: 1px solid var(--line); }
.roadmap-node { grid-template-columns: 2rem minmax(0, 1fr) auto 1rem; gap: .75rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 1.15rem .7rem; background: transparent; }
.roadmap-node:hover { background: var(--surface); }
.roadmap-node h4 { font-size: .96rem; font-weight: 600; letter-spacing: -.015em; }
.roadmap-node .idx { font-size: .7rem; }
.roadmap-node .fires { display: block; font-family: var(--font-display); font-size: .76rem; margin-top: .35rem; }
.module-count { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.roadmap-arrow { color: var(--muted); transition: transform .15s; }
.roadmap-node:hover .roadmap-arrow { transform: translate(2px, -2px); color: var(--accent); }
.study-note { margin-top: 3.5rem; border-top: 2px solid var(--ink); padding-top: 1.6rem; display: grid; grid-template-columns: 1fr 1.25fr; gap: 2rem; }
.study-note h2 { font-size: 1.6rem; margin-top: .5rem; }
.study-note p { font-size: .87rem; color: var(--ink-2); }
.study-note a { display: inline-block; margin-top: 1rem; font-size: .85rem; }
.course-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .65rem; color: var(--muted); }
.breadcrumb { font-size: .76rem; color: var(--muted); text-decoration: none; }
.breadcrumb-separator { padding: 0 .5rem; color: var(--line-strong); }
.module-number { margin-top: 2rem; color: var(--accent); }
.module-head { padding-bottom: 1.75rem; scroll-margin-top: 1rem; }
.module-head h1 { font-size: clamp(1.9rem, 3vw, 2.9rem); margin-top: .7rem; }
.module-head .tagline { font-size: 1rem; font-style: normal; max-width: 70ch; color: var(--muted); line-height: 1.7; }
.tabs { margin-top: 0; gap: 1rem; }
.tab { font-size: .85rem; padding: .85rem .35rem; min-height: 48px; }
.tab.active { color: var(--accent); border-color: var(--accent); }
.tab .k { font-size: .6rem; border: 0; opacity: .7; }
.tab-panel { padding-top: 1.5rem; }
.tab-panel.active { animation: panel-in .18s ease-out; }
@keyframes panel-in { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.tab-intro { border: 0; padding: 0; font-size: .82rem; max-width: 90ch; margin-bottom: 2rem; }
.reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) 210px; column-gap: clamp(1.5rem, 3vw, 3rem); align-items: start; }
.lesson-content { grid-column: 1; grid-row: 1; min-width: 0; }
.lesson-toc { grid-column: 2; grid-row: 1; position: sticky; top: 80px; border-left: 1px solid var(--line); padding-left: 1rem; }
.lesson-toc .nav-label { padding: 0 0 .7rem; }
.lesson-toc a { display: flex; gap: .6rem; font-size: .75rem; line-height: 1.55; text-decoration: none; color: var(--muted); padding: .5rem 0; }
.lesson-toc a span { flex: none; color: var(--accent); font: .64rem var(--font-mono); padding-top: .15rem; }
.lesson-toc a:hover { color: var(--accent); }
.lesson { max-width: var(--measure); scroll-margin-top: 75px; padding-bottom: 2.5rem; }
.lesson + .lesson { border-top: 1px solid var(--line); padding-top: 2rem; }
.lesson-head { align-items: start; gap: .8rem; flex-wrap: wrap; }
.lesson-head h2 { font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.3; flex: 1 1 25ch; letter-spacing: -.025em; }
.lesson-done { min-height: 32px; font: .65rem var(--font-mono); }
.lesson-done input { width: 17px; height: 17px; }
.prose > * + * { margin-top: 1.2rem; }
.prose p, .prose li { font-size: .96rem; line-height: 1.85; }
.prose h3 { font-size: 1.2rem; }
.display-math { padding: 1.1rem .8rem; background: var(--surface); border-left: 2px solid var(--line-strong); border-radius: 0; font-size: 1.05rem; max-width: 100%; text-align: left; }
math[display="block"] { min-width: min-content; }
.callout { padding: 1rem 1.15rem; border: 0; border-left: 3px solid var(--line-strong); border-radius: 0; font-size: .88rem; gap: .8rem; }
.callout.rule { border-color: var(--accent); }
.callout.trap { border-color: var(--loss); }
.callout.trade { border-color: var(--note); }
.callout .ico { font-size: .58rem; }
.think { border-style: solid; border-color: var(--line); box-shadow: none; padding: 1.15rem; }
.think .q { font-size: .93rem; line-height: 1.65; }
.think input[type="text"], .think textarea { font-size: 1rem; }
.think .reveal { font-size: .88rem; }
.matrix { width: 100%; font-family: var(--font-display); font-size: .82rem; }
.matrix td, .matrix th { text-align: left; vertical-align: top; padding: .7rem .8rem; border: 0; border-bottom: 1px solid var(--line); min-width: 8rem; }
.matrix th { background: var(--surface-2); color: var(--ink-2); font-size: .72rem; font-weight: 600; }
.matrix td { line-height: 1.65; }
.table-wrap { max-width: 100%; }
.solve, .quiz-q, .deck { max-width: 880px; }
.solve-head { flex-wrap: wrap; gap: .8rem; }
.solve-head h3 { font-size: 1.15rem; }
.solve-head .given { line-height: 1.8; }
.lab { border-radius: 5px; }
.lab-body { grid-template-columns: 215px minmax(0, 1fr); }
.lab-head { padding: 1.2rem 1.4rem; }
.lab-head p { font-size: .85rem; }
.lab-stage { padding: 1.25rem; overflow-x: auto; }
.lab-stage .chart { min-width: 480px; }
.lab-stage .matrix { width: auto; font-family: var(--font-mono); }
.lab-stage .matrix td, .lab-stage .matrix th { min-width: 0; padding: .35rem .5rem; }
.ctl label { gap: .5rem; font-size: .68rem; }
.ctl input[type="range"] { min-height: 30px; }
.readout { border: 0; border-bottom: 1px solid var(--line); padding: .5rem 0; background: transparent; }
.readout .l { font-family: var(--font-display); font-size: .66rem; }
.readout .v { font-size: 1.2rem; overflow-wrap: anywhere; }
.quiz-q .qt { font-size: 1rem; line-height: 1.6; }
.opt { padding: .75rem; min-height: 44px; }
.card { box-shadow: none; }
.method-grid { grid-template-columns: 1fr 1fr; }
.method { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 1.25rem 0; }
.method p { font-size: .9rem; }
.next-prev { margin-top: 2.5rem; }
.next-prev a { font-size: .85rem; max-width: 45%; }
@media (min-width: 1600px) { .page { padding-inline: 4.5rem; } }
@media (max-width: 1400px) {
  .reading-layout { grid-template-columns: 1fr; }
  .lesson-toc { position: static; grid-column: 1; grid-row: 1; margin-bottom: 2rem; columns: 2; border-left: 0; border-bottom: 1px solid var(--line); padding: 0 0 1rem; }
  .lesson-toc .nav-label { column-span: all; }
  .lesson-toc a { break-inside: avoid; }
  .lesson-content { grid-row: 2; }
  .lesson { max-width: 100%; }
  .edition { display: none; }
  .module-count span { display: none; }
  .lab-body { grid-template-columns: 1fr; }
  .lab-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .sidebar { width: min(88vw, 310px); }
  .drawer-close { display: block; font-size: 1.4rem; border: 0; min-width: 36px; }
  .drawer-open { overflow: hidden; }
  .topbar { height: 60px; padding: .65rem 1.2rem; gap: .8rem; }
  .topbar .brand-name { font-size: .9rem; }
  .topbar .brand-mark { display: none; }
  .topbar #menu-btn { font-size: 1.1rem; min-width: 36px; }
  .topbar-caption { margin-left: auto; color: var(--muted); font-size: .67rem; }
  .page { padding: 1.75rem clamp(1.1rem, 4vw, 2.5rem) 3rem; }
  .tabs { top: 60px; gap: .75rem; }
  .lesson { scroll-margin-top: 130px; }
  .module-head { scroll-margin-top: 75px; }
  .course-intro h1 { font-size: clamp(2.2rem, 5.6vw, 3.5rem); }
  .course-intro { padding-top: 2.5rem; }
  .lesson-toc a { min-height: 44px; }
}
@media (max-width: 600px) {
  .page-kicker { padding-bottom: 1rem; }
  .eyebrow { font-size: .6rem; }
  .course-intro { padding-block: 2rem; }
  .course-intro h1 { font-size: clamp(2rem, 7.8vw, 2.8rem); }
  .course-intro > p { font-size: .91rem; }
  .hero-actions { align-items: flex-start; gap: .65rem; }
  .course-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; font-size: .72rem; }
  .curriculum-section { margin-top: 2rem; }
  .section-head { gap: .8rem; margin-bottom: 1.5rem; }
  .section-head h2 { font-size: 1.6rem; }
  .stage-heading p { font-size: .75rem; }
  .roadmap-node { grid-template-columns: 1.35rem minmax(0, 1fr) 1rem; padding: 1rem .2rem; gap: .55rem; }
  .roadmap-node h4 { font-size: .88rem; }
  .roadmap-node .fires { font-size: .7rem; }
  .module-count { display: none; }
  .study-note { grid-template-columns: 1fr; gap: 1rem; }
  .lesson-toc { columns: 1; }
  .callout { grid-template-columns: 1fr; gap: .5rem; }
  .lesson-head h2 { font-size: 1.4rem; }
  .tab { font-size: .8rem; padding-inline: .25rem; }
  .tab .k { display: none; }
  .tabs { justify-content: space-between; gap: 0; }
  .solve-head, .step { padding: 1rem; }
  .step { grid-template-columns: 1.3rem minmax(0, 1fr); gap: .5rem; }
  .card .side { padding: 1.2rem; }
  .card-actions { padding: .75rem; gap: .3rem; }
  .grade { min-width: 3.4rem; min-height: 48px; }
  .method-grid { grid-template-columns: 1fr; }
  .lab-controls { grid-template-columns: 1fr; }
  .lab-stage { padding: 1rem; }
  .lab-head { padding: 1rem; }
  .btn.small, .chip { min-height: 38px; }
  .think .row { align-items: stretch; }
  .think input { width: 100%; }
  .chips { flex-wrap: wrap; }
  .kbd-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .tab-panel.active { animation: none; } .roadmap-arrow { transition: none; } }
.lesson-toc summary { cursor: pointer; font-size: .72rem; font-weight: 600; color: var(--ink-2); padding: .25rem 0 .75rem; }
.lesson-toc summary span { font-weight: 400; color: var(--muted); margin-left: .5rem; }
@media (min-width: 1401px) { .lesson-toc summary { list-style: none; font-size: .65rem; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; } .lesson-toc summary span { display: none; } }
@media (max-width: 1400px) { .lesson-toc { columns: auto; padding: .8rem 0; margin-bottom: 1.5rem; border-block: 1px solid var(--line); } .lesson-toc summary { padding: .25rem 0; min-height: 32px; } .lesson-toc nav { columns: 2; padding-top: .7rem; } }
@media (max-width: 600px) { .lesson-toc nav { columns: 1; } }
@media (max-width: 900px) { .nav-link { min-height: 44px; } }
/* Reading support: consistent context, notation, and switchable working. */
.equation-toolbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 0; border-bottom:1px solid var(--line); }
.equation-toolbar[hidden] { display:none; }
.equation-toolbar strong { font-size:.8rem; display:block; }
.equation-toolbar > div > span { font-size:.72rem; color:var(--muted); }
.equation-switch { display:flex; padding:3px; gap:3px; border:1px solid var(--line); border-radius:8px; background:var(--surface); flex-shrink:0; }
.equation-switch button { font:inherit; font-size:.8rem; color:var(--ink-2); background:transparent; border:0; border-radius:5px; padding:.6rem .85rem; min-height:42px; cursor:pointer; }
.equation-switch button[aria-pressed="true"] { background:var(--ink); color:var(--paper); }
.equation-switch button span { opacity:.7; font-size:.72rem; }
.reading-foundation { margin:1.4rem 0; }
.reading-foundation p { margin:.6rem 0; }
.notation-key { margin:1.3rem 0; padding:1rem 1.15rem; border:1px solid var(--line); border-radius:6px; }
.notation-key summary { font-size:.85rem; font-weight:600; cursor:pointer; min-height:28px; }
.notation-key summary span { font-weight:400; color:var(--muted); padding-left:.5rem; font-size:.75rem; }
.notation-key dl { margin:.7rem 0 1rem; font-size:.84rem; line-height:1.65; }
.notation-row { display:grid; grid-template-columns:minmax(5rem, .8fr) minmax(0,3fr); gap:.8rem; align-items:baseline; padding:.65rem 0; border-top:1px solid var(--line); }
.notation-row dt, .notation-row dd { margin:0; min-width:0; }
.notation-symbol { color:var(--accent); font-size:1.15rem; font-weight:400; padding:.15rem .45rem; background:var(--accent-soft); border-radius:4px; width:fit-content; max-width:100%; overflow-x:auto; }
.notation-symbol math { white-space:nowrap; overflow-wrap:normal; }
.notation-label { font-family:var(--font-display); font-size:.8rem; font-weight:600; color:var(--ink); }
.notation-context { grid-template-columns:1fr; color:var(--muted); }
.notation-key summary:focus-visible { outline:2px solid var(--accent); outline-offset:5px; }
.lesson-statements { padding-left:1.2rem; }
.lesson-statements li { margin:.65rem 0; }
.lesson-statements li::marker { color:var(--accent); }
.notation-key > a { font-size:.75rem; }
.trading-purpose { border-left:2px solid var(--accent); padding:.25rem 0 .25rem 1rem; margin:1.5rem 0; }
.trading-purpose strong { font-size:.8rem; }
.trading-purpose p { font-size:.88rem; margin:.45rem 0; }
.equation-block { margin:1.7rem 0; min-width:0; border-block:1px solid var(--line); }
.equation-formula { padding:.25rem 0; min-width:0; }
.equation-algebra { padding:1rem 0; }
.derivation-kind { font-size:.64rem; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); margin-bottom:.45rem; }
.equation-algebra h4, .equation-python h4 { margin:.2rem 0 .8rem; font-size:.94rem; }
.derivation-steps { padding-left:1.3rem; font-size:.86rem; }
.derivation-steps li { padding-left:.25rem; margin:.75rem 0; line-height:1.8; }
.derivation-steps li::marker { color:var(--accent); font-weight:600; }
.worked-arithmetic { background:var(--surface); border-left:2px solid var(--line); padding:.8rem 1rem; margin-top:1rem; font-size:.85rem; }
.worked-arithmetic strong { font-size:.72rem; color:var(--muted); }
.worked-arithmetic p { margin:.4rem 0 0; }
.equation-python { padding:1.2rem 0; }
.python-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.code-note { font-size:.8rem; color:var(--muted); }
.equation-python pre { padding:1.2rem; border:1px solid var(--line); border-radius:6px; font-size:.76rem; line-height:1.7; overflow:auto; tab-size:4; }
.copy-status { font-size:.75rem; color:var(--muted); }
[data-equation-mode="algebra"] .equation-python, [data-equation-mode="python"] .equation-algebra { display:none; }
@media (max-width:600px) {
 .equation-toolbar { align-items:stretch; flex-direction:column; gap:.6rem; }
 .equation-toolbar > div > span { display:none; }
 .equation-switch button { flex:1; }
 .notation-key { padding:.8rem; }
 .python-head { align-items:flex-start; }
 .equation-python pre { padding:.8rem; }
}

.candle-chart-wrap { overflow:auto; }
.candle-chart { display:block; width:100%; min-width:480px; }
.candle-grid { stroke:var(--line); stroke-width:.7; }
.candle-axis { fill:var(--muted); font:11px var(--font-mono); }
.candle-wick { stroke:currentColor; stroke-width:1.5; }
.candle { cursor:pointer; color:var(--gain); }
.candle.falling { color:var(--loss); }
.candle-hit { fill:transparent; stroke:none; }
.candle-body { stroke:currentColor; fill:var(--surface); stroke-width:1.5; }
.candle.falling .candle-body { fill:currentColor; }
.candle.selected .candle-hit { fill:var(--accent); fill-opacity:.08; }
.candle:focus-visible { outline:2px solid var(--accent); }
.candle-match { fill:var(--accent); }
.pivot-marker { fill:var(--ink); font:600 10px var(--font-mono); }
.candle-legend { display:flex; gap:.5rem 1rem; flex-wrap:wrap; font-size:.65rem; color:var(--muted); margin:.7rem 0; }
.candle-legend span { display:inline-flex; align-items:center; gap:.35rem; }
.candle-legend i { display:inline-block; width:12px; height:5px; }
.rising-key { background:var(--surface); border:1px solid var(--gain); }
.falling-key { background:var(--loss); }
.candle-help { font-size:.72rem; color:var(--muted); }
.candle-inspector { display:block; min-height:3.5em; font: .75rem/1.7 var(--font-mono); padding:.6rem .8rem; background:var(--surface); border:1px solid var(--line); border-radius:4px; }

.notation-key, .worked-arithmetic, .derivation-steps { overflow-wrap:anywhere; }
.equation-toolbar { position:sticky; top:54px; z-index:16; background:var(--paper); }
.lesson-toc { top:160px; }
.lesson { scroll-margin-top:160px; }
@media(max-width:900px) { .equation-toolbar { top:112px; } .lesson { scroll-margin-top:215px; } }
@media(max-width:600px) { .lesson { scroll-margin-top:230px; } }

/* A compact curriculum index and an integrated, local practice workspace. */
.nav-search { padding:0 .45rem; }
.nav-search label { display:block; font-size:.7rem; color:var(--muted); margin-bottom:.35rem; }
.nav-search input { width:100%; min-width:0; background:var(--surface-2); border:1px solid transparent; border-radius:5px; padding:.6rem; font:inherit; font-size:.76rem; color:var(--ink); }
.nav-search input:focus { background:var(--surface); border-color:var(--accent); }
.nav-search [role=status] { display:block; font-size:.7rem; color:var(--muted); min-height:1.1em; }
.nav-stage { padding-block:.45rem; border-bottom:1px solid var(--line); }
.nav-stage > summary { display:flex; align-items:center; gap:.6rem; list-style:none; font:500 .64rem/1.65 var(--font-mono); text-transform:uppercase; letter-spacing:.02em; padding:.45rem .65rem; cursor:pointer; color:var(--ink-2); }
.nav-stage > summary::-webkit-details-marker { display:none; }
.nav-stage > summary::before { content:'›'; transition:transform .15s; font-size:1rem; }
.nav-stage[open] > summary::before { transform:rotate(90deg); }
.nav-stage > summary > span { margin-left:auto; color:var(--muted); }
.nav-stage .nav-group { padding-bottom:.35rem; }
.module-brief { margin:1.4rem 0 .5rem; border-block:1px solid var(--line); }
.module-brief > summary { padding:.85rem 0; font-size:.85rem; cursor:pointer; color:var(--accent); }
.module-brief > div { display:grid; grid-template-columns:1.5fr 1fr; gap:2rem; padding:.5rem 0 1.4rem; }
.module-brief h2 { font-size:.86rem; letter-spacing:0; margin:0 0 .8rem; }
.module-brief ul { padding-left:1.2rem; font-size:.85rem; margin:0; }
.module-brief nav { display:flex; flex-wrap:wrap; gap:.5rem 1rem; font-size:.8rem; }
.practice-entry { display:inline-block; margin-top:1rem; font-size:.82rem; font-weight:600; }
.practice-workbench { margin:1.7rem 0 3rem; }
.practice-heading { display:flex; justify-content:space-between; align-items:end; gap:2rem; padding-bottom:1.2rem; border-bottom:1px solid var(--line); }
.practice-heading h2 { margin:.5rem 0; font-size:1.5rem; }
.practice-heading p { font-size:.82rem; color:var(--muted); margin:0; }
.practice-progress { max-width:25ch; font: .7rem/1.6 var(--font-mono); color:var(--muted); }
.practice-picker { display:flex; gap:1rem; padding:1.2rem 0; }
.practice-picker label { display:flex; flex-direction:column; gap:.4rem; font-size:.73rem; color:var(--muted); min-width:0; }
.practice-picker select { min-width:0; width:100%; padding:.65rem; border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--ink); font:inherit; font-size:.8rem; }
.problem-picker { flex:1; }
.workbench-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(260px,.58fr); align-items:start; gap:clamp(1.2rem,3vw,3rem); }
.problem-panel { min-width:0; }
.problem-meta { display:flex; justify-content:space-between; gap:1rem; color:var(--accent); font: .66rem var(--font-mono); text-transform:uppercase; padding:.8rem 0; }
.problem-panel h3 { font-size:1.2rem; line-height:1.4; margin:.5rem 0 1rem; }
.problem-prompt { font-size:.95rem; line-height:1.85; }
.problem-context { margin:1rem 0; padding:.2rem 0 .2rem 1rem; border-left:2px solid var(--line-strong); font-size:.84rem; color:var(--ink-2); }
.problem-context strong { font-size:.72rem; text-transform:uppercase; color:var(--muted); }
.practice-formula { overflow:auto; max-width:100%; margin:1rem 0; font-size:.85rem; }
.answer-label,.working-label { display:block; font-size:.78rem; font-weight:600; margin:1.3rem 0 .7rem; }
.answer-label input,.working-label textarea,[data-calculator] textarea { display:block; width:100%; margin-top:.5rem; padding:.75rem; border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--ink); font: .84rem/1.65 var(--font-mono); resize:vertical; }
.answer-actions,.calculator-actions { display:flex; flex-wrap:wrap; gap:.6rem; }
.answer-feedback { min-height:1.6em; margin:.8rem 0; font-size:.8rem; color:var(--ink-2); }
.answer-feedback[data-correct=true] { color:var(--gain); }
.answer-feedback[data-correct=false] { color:var(--loss); }
.practice-options { display:grid; gap:.6rem; margin:1.2rem 0; }
.practice-options button { text-align:left; border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--ink); padding:.8rem 1rem; font: .86rem/1.6 var(--font-body); cursor:pointer; }
.practice-options button:hover,.practice-options button[aria-pressed=true] { border-color:var(--accent); background:var(--accent-soft); }
.practice-hint,.practice-solution { border-top:1px solid var(--line); padding:.8rem 0; font-size:.84rem; }
.practice-hint summary,.practice-solution summary,.calculator-help summary { cursor:pointer; min-height:30px; font-weight:600; }
.practice-solution > div { margin:.8rem 0; line-height:1.85; }
.self-review { margin:1rem 0; border:1px solid var(--line); padding:.8rem 1rem; border-radius:5px; }
.self-review legend { font-size:.75rem; padding:0 .4rem; }
.self-review label { display:flex; align-items:flex-start; gap:.6rem; font-size:.82rem; margin:.7rem 0; }
.self-review input { margin-top:.3rem; flex:none; }
.self-review p { font-size:.73rem; color:var(--muted); }
.problem-navigation { display:flex; justify-content:space-between; gap:.6rem; border-top:1px solid var(--line); padding-top:1rem; margin-top:1.5rem; }
.calculation-tools { position:sticky; top:76px; min-width:0; padding:1.2rem; background:var(--surface-2); border-radius:6px; max-height:calc(100dvh - 100px); overflow:auto; }
.calculation-tools h3 { margin:0; font-size:1rem; }
.calculation-tools > p { font-size:.77rem; color:var(--muted); line-height:1.7; }
[data-calculator] label { font-size:.73rem; font-weight:600; }
[data-calculator] textarea { min-height:85px; }
.calculator-actions { margin-top:.75rem; }
.calculator-result { display:block; margin:1rem 0; min-height:3rem; padding:.8rem; background:var(--surface); border-left:2px solid var(--accent); overflow-wrap:anywhere; font: .9rem/1.65 var(--font-mono); }
.calculator-result[data-error=true] { border-color:var(--loss); color:var(--loss); font-size:.78rem; }
.calculator-help { font-size:.73rem; border-top:1px solid var(--line); padding-top:.6rem; }
.calculator-help ul { padding-left:1.1rem; }
.calculator-help li { margin:.5rem 0; overflow-wrap:anywhere; }
.calculator-help code { white-space:normal; font-size:.7rem; }
.calculator-history { font: .68rem/1.7 var(--font-mono); color:var(--muted); overflow-wrap:anywhere; }
.calculator-history > div { border-top:1px solid var(--line); padding:.65rem 0; }
.guided-heading { margin-top:3rem; padding-top:2rem; border-top:1px solid var(--line); }
@media(max-width:1100px) { .workbench-grid { grid-template-columns:1fr; } .calculation-tools { position:static; max-height:none; grid-row:1; } .calculator-help:not([open]) { margin-bottom:0; } }
@media(max-width:600px) { .practice-heading { display:block; } .practice-progress { display:block; max-width:none; margin-top:.8rem; } .practice-picker { flex-direction:column; } .module-brief > div { grid-template-columns:1fr; gap:1rem; } .practice-heading h2 { font-size:1.3rem; } .answer-label input,.working-label textarea,[data-calculator] textarea,.practice-picker select,.nav-search input { font-size:16px; } .problem-navigation .btn { padding:.6rem; } }
@media(prefers-reduced-motion:reduce) { .nav-stage > summary::before { transition:none; } }
.calculation-tools > summary { cursor:pointer; font-weight:600; font-size:.92rem; min-height:28px; }
.calculation-tools > summary span { display:block; font-size:.69rem; font-weight:400; color:var(--muted); margin-left:1rem; }
.calculation-tools:not([open]) { overflow:visible; }
@media(max-width:1100px) { .calculation-tools { padding:.85rem 1rem; } }
.practice-workbench,.problem-panel { scroll-margin-top:76px; }
@media(max-width:900px) { .practice-workbench,.problem-panel { scroll-margin-top:130px; } }

/* Foundations stay visible before notation; no prerequisite gate or extra mode. */
.module-start {border:1px solid var(--line);border-top:3px solid var(--accent);border-radius:12px;padding:clamp(1.1rem,2.8vw,2rem);margin-bottom:2rem;background:var(--surface);scroll-margin-top:160px;}
.module-start h2 {margin:.45rem 0 1rem;padding:0;border:0;}
.learning-sequence {padding-left:1.35rem;margin:1.2rem 0;}
.learning-sequence li {padding:.25rem 0 .25rem .3rem;}
.learning-sequence li::marker {color:var(--accent);font-weight:700;}
.concept-key {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1.4rem 0;}
.concept-key div {padding-top:.75rem;border-top:1px solid var(--line);}
.concept-key dt {font-weight:700;}
.concept-key dd {margin:.3rem 0 0;line-height:1.65;}
.readiness-check {padding:1rem;border:1px solid var(--line);border-radius:8px;}
.readiness-check summary {cursor:pointer;font-weight:600;line-height:1.6;}
.readiness-check p {margin:.8rem 0 0;}
.foundation-next {display:inline-block;margin-top:1.25rem;line-height:1.6;}
.lesson-primer {border-left:3px solid var(--accent);padding:.1rem 0 .5rem 1.1rem;margin:1.25rem 0;}
.lesson-primer h3 {font-size:1.05rem;margin:.5rem 0;}
.lesson-primer p,.lesson-primer li {line-height:1.75;}
@media(max-width:900px){.module-start{scroll-margin-top:215px;}}
@media(max-width:600px){.concept-key{grid-template-columns:1fr;gap:.6rem;}.module-start{scroll-margin-top:230px;}.lesson-primer{padding-left:.85rem;}}

/* Trading Dev Academy: local vocabulary and readable, copy-safe Python. */
.reading-graph[data-graph="fractions"] .graph-stage > .chart { min-width: 0; }
.reading-graph[data-graph="fractions"] .graph-results math { font-size: 1.15rem; }
@media (max-width: 600px) {
  .reading-graph[data-graph="fractions"] .graph-stage > .chart text { font-size: 20px; }
}
.key-definitions { margin: 1.3rem 0; padding: 1rem 1.2rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 7px; background: var(--surface); }
.key-definitions summary { cursor: pointer; font-weight: 650; font-size: .93rem; }
.key-definitions summary span { color: var(--muted); font-size: .75rem; font-weight: 400; margin-left: .5rem; }
.key-definitions dl { margin: 1rem 0 0; }
.key-definitions dl > div { padding: .7rem 0; border-top: 1px solid var(--line); }
.key-definitions dt { color: var(--ink); font-size: .92rem; }
.key-definitions dd { margin: .25rem 0 0; font-size: .87rem; line-height: 1.65; color: var(--ink-2); }
.definition-example { display: block; margin-top: .35rem; color: var(--muted); }
.key-term { font-weight: 650; color: var(--ink); }
.equation-python pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; max-width: 100%; font-size: .85rem; line-height: 1.8; background: var(--surface); color: var(--ink); }
.equation-python pre code { white-space: inherit; overflow-wrap: inherit; font: inherit; padding: 0; background: none; }
.py-keyword { color: #7132a8; font-weight: 600; }
.py-function { color: #154bb7; font-weight: 600; }
.py-builtin { color: #795414; }
.py-string { color: #21623c; }
.py-number { color: #a43820; }
.py-comment { color: #687282; font-style: italic; }
.py-operator { color: #30485d; }
[data-theme="dark"] .py-keyword { color: #d8acff; }
[data-theme="dark"] .py-function { color: #a1c3ff; }
[data-theme="dark"] .py-builtin { color: #e9c889; }
[data-theme="dark"] .py-string { color: #9cddb6; }
[data-theme="dark"] .py-number { color: #ffb099; }
[data-theme="dark"] .py-comment { color: #a4adbb; }
[data-theme="dark"] .py-operator { color: #c2d0df; }
@media (prefers-color-scheme:dark) {
 :root:not([data-theme="light"]) .py-keyword { color:#d8acff; }
 :root:not([data-theme="light"]) .py-function { color:#a1c3ff; }
 :root:not([data-theme="light"]) .py-builtin { color:#e9c889; }
 :root:not([data-theme="light"]) .py-string { color:#9cddb6; }
 :root:not([data-theme="light"]) .py-number { color:#ffb099; }
 :root:not([data-theme="light"]) .py-comment { color:#a4adbb; }
 :root:not([data-theme="light"]) .py-operator { color:#c2d0df; }
}
@media(max-width:600px) { .key-definitions {padding:.85rem;} .key-definitions summary span {display:block;margin-left:1rem;} .equation-python pre {font-size:.8rem;} .brand-sub,.topbar-caption {font-size:.62rem;} }

/* Optional local checkpoints. */
.workspace-local-storage {border-block:1px solid var(--line);padding-block:1rem;margin-block:1.5rem;}
.workspace-local-storage ul {padding-left:1.3rem;}
.workspace-local-storage li {margin-block:.9rem;overflow-wrap:anywhere;}
.workspace-local-storage li .btn {margin:.3rem .4rem .3rem 0;}
