/* Mathematical Induction is the canonical AA HL UI. These measured shared
 * widths and existing primitives must remain identical across lesson topics. */
.lesson_container:has(.math-experience) {
 --aa-reading-width:780px; --aa-interaction-width:820px; --aa-workspace-width:1160px;
 --aa-example-width:920px; --aa-response-width:740px; --aa-checkpoint-width:720px;
 --aa-section-gap:clamp(48px,5vw,72px); --aa-subsection-gap:40px;
 --aa-paragraph-gap:18px; --aa-content-gap:24px; --aa-card-padding:24px; --aa-radius:12px; --aa-control-radius:8px;
 --aa-workspace-surface:color-mix(in srgb,var(--aa-surface-accent) 24%,var(--aa-surface));
 --aa-quiet-border:color-mix(in srgb,var(--aa-border) 60%,transparent);
 max-width:calc(var(--aa-workspace-width) + 48px); margin-inline:auto; min-width:0;
 color:var(--aa-text);
}
body:has(.math-experience) { --aa-header-offset:calc(var(--nav_height,70px) + 76px); }
body.admin-bar:has(.math-experience) { --aa-admin-height:32px; --aa-header-offset:calc(var(--nav_height,70px) + 108px); }
@media(max-width:782px) { body.admin-bar:has(.math-experience) { --aa-admin-height:46px; --aa-header-offset:calc(var(--nav_height,70px) + 122px); } }
.main:has(.math-experience) { padding-top:24px; }
.main:has(.math-experience)>.outer { min-width:0; margin-top:16px; overflow-x:visible; }
.main:has(.math-experience):not(:has(>.sidebar))>.outer { max-width:100%; width:100%; }
body:has(.math-experience) .navbar { top:var(--aa-admin-height,0px); }
body:has(.math-experience) .student-primary-nav { top:calc(var(--nav_height,70px) + var(--aa-admin-height,0px)); }
.lesson_container:has(.math-experience) :is(h1,h2,h3,[id],.math-checkpoint,.math-prediction,[data-quick-check],.math-concept-flow,.math-interactive-guide,.math-reference-section,.math-example-grid,.math-note-grid,.math-learning-path,figure) { scroll-margin-top:var(--aa-header-offset,146px); }
.lesson_container:has(.math-experience) .lesson_header h1 { font-size:clamp(32px,3.2vw,46px); line-height:1.12; margin:12px 0 16px; max-width:960px; letter-spacing:-.025em; }
.lesson_container:has(.math-experience) .top_bar { padding-top:8px; margin-bottom:16px; }
.lesson_content:has(.math-experience) { display:block; font-size:18px; line-height:1.6; }
.lesson_container:has(.math-experience) .contents { position:static; width:fit-content; max-width:100%; padding:0; margin:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
.lesson_container:has(.math-experience) .top_bar { flex-wrap:wrap; gap:8px; }
.lesson_container:has(.math-experience) .top_bar>.contents:has(details[open]) { flex-basis:100%; order:3; }
.math-contents-disclosure>summary { min-height:44px; padding:8px 0; font-size:14px; color:var(--aa-text-muted); cursor:pointer; }
.math-contents-disclosure[open] { max-width:var(--aa-reading-width); padding-bottom:8px; }
.lesson_container:has(.math-experience) .contents__list { display:flex; flex-wrap:wrap; gap:4px 18px; margin:0!important; }
.lesson_container:has(.math-experience) .contents__link { min-height:44px; padding:8px 0; font-size:14px; }
.math-experience { container:math-lesson / inline-size; min-width:0; }
.math-experience *, .math-experience *::before, .math-experience *::after { box-sizing:border-box; }
.math-experience [hidden] { display:none!important; }
.lesson_content .math-experience h2 { margin:var(--aa-section-gap) 0 22px; font-size:clamp(26px,2.6vw,34px); line-height:1.2; }
.lesson_content .math-experience h3 { margin:var(--aa-subsection-gap) 0 16px; font-size:clamp(22px,2vw,25px); line-height:1.25; }
.lesson_content .math-experience p { max-width:var(--aa-reading-width); line-height:1.6; margin:var(--aa-paragraph-gap) 0; }
.math-experience :is(.math-intuitive-intro,.math-learning-goals,.math-summary) { max-width:var(--aa-reading-width); }
.math-experience > :is(p,ul,ol), .math-experience .step_section > :is(p,ul,ol) { max-width:var(--aa-reading-width); }
.math-experience .math-lesson-intro { max-width:var(--aa-reading-width); background:none; border:0; padding:0; margin:0 0 16px; }
.lesson_content .math-experience .math-lesson-intro__lead { font-size:18px; font-weight:400; margin:0 0 10px; }
.math-experience .math-lesson-meta { display:flex; flex-wrap:wrap; gap:6px 0; margin:0!important; }
.lesson_content .math-experience .math-lesson-meta li { padding:0; font-size:12px; line-height:1.6; border:0; background:none; border-radius:0; color:var(--aa-text-muted); font-weight:400; }
.math-experience .math-learning-goals { margin:16px 0 40px; padding:0; border:0; background:none; }
.lesson_content .math-experience .math-learning-goals__title { margin:0 0 8px; font-size:18px; }
.math-experience .math-learning-goals ul { margin:8px 0!important; }
.math-intuitive-intro__lead { font-size:20px; font-weight:600; }
.math-idea-link { width:fit-content; padding:16px 0; background:none; border:0; font-size:21px; }
.math-interactive-guide { margin:var(--aa-subsection-gap) 0; padding:0; border:0; }
.math-experience .math-prediction { max-width:var(--aa-workspace-width); margin:0; }
.math-interactive-guide>.math-prediction { max-width:var(--aa-workspace-width); }
.math-experience .math-prediction-prompt { max-width:var(--aa-response-width); font-weight:var(--main_bolder_weight); line-height:1.5; margin:0 0 13px; }
.math-experience .math-prediction fieldset { max-width:var(--aa-response-width); border:0; padding:0; margin:0; display:block; min-width:0; }
.math-experience .math-prediction label { display:flex; gap:8px; align-items:center; min-height:44px; max-width:100%; }
.math-experience .math-prediction input[type=text],.math-experience .math-prediction select { max-width:180px; min-width:0; min-height:44px; border:1px solid var(--aa-border); border-radius:var(--aa-control-radius); padding:6px; color:var(--aa-text); background:var(--aa-surface); }
.math-experience .math-guide-task { font-size:15px; }
.math-guide-layout { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:var(--aa-content-gap); align-items:center; }
.math-guide-drawing,.math-guide-panel { min-width:0; }
.math-guide-drawing svg { min-width:0; display:block; width:100%; max-width:480px; margin:auto; overflow:hidden; }
.math-guide-drawing svg text { fill:var(--aa-text); font:15px system-ui,sans-serif; }
.math-guide-control { display:grid; grid-template-columns:minmax(90px,.8fr) minmax(0,1.6fr); gap:8px; align-items:center; margin:0 0 8px; }
.math-guide-control label { font-size:14px; font-weight:600; }
.math-guide-control>div { display:flex; gap:8px; align-items:center; min-width:0; }
.math-guide-control input[type=range] { min-width:0; width:100%; min-height:44px; accent-color:var(--aa-accent); }
.math-guide-control input[type=number] { width:64px; min-height:44px; flex-shrink:0; padding:6px; border:1px solid var(--aa-border); border-radius:var(--aa-control-radius); color:var(--aa-text); background:var(--aa-surface); }
.math-guide-summary { padding:12px 0 0; margin-top:8px; border-top:1px solid var(--aa-border); font-size:14px; }
.math-guide-summary dl { display:grid; grid-template-columns:minmax(85px,.9fr) minmax(0,1.2fr); gap:6px 12px; margin:0; }
.math-guide-summary dt { color:var(--aa-text-muted); }
.math-guide-summary dd { margin:0; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.lesson_content .math-experience .math-guide-summary p { margin:12px 0 0; font-size:14px; }
.math-guide-summary:empty { display:none; }
.math-experience :is(.math-equation,.katex-display) { min-width:0; max-width:100%; overflow-x:auto; overflow-y:hidden; }
.math-experience .math-equation { padding:8px 0; margin:16px 0; }
.math-experience .katex { white-space:nowrap; max-width:100%; }
.math-experience :not(.katex-display)>.katex { display:inline-block; overflow-x:auto; overflow-y:hidden; padding:2px 3px; vertical-align:middle; }
.math-formula-reference { max-width:var(--aa-example-width); }
.math-formula-reference>.math-formula-wide { grid-column:1/-1; }
.math-example-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:var(--aa-subsection-gap); max-width:var(--aa-example-width); align-items:start; }
.math-example-unit { min-width:0; }
.math-example-unit:nth-child(n+3) { grid-column:1/-1; max-width:var(--aa-example-width); width:100%; }
.lesson_content .math-experience .math-worked-example { max-width:var(--aa-example-width); padding:18px 0; margin:12px 0 0; border:0; border-top:1px solid var(--aa-border); border-radius:0; background:transparent; box-shadow:none; min-height:0; }
.lesson_content .math-experience .math-worked-example__header { padding:0; margin:0; border:0; background:transparent; }
.lesson_content .math-experience .math-worked-example__header p { margin:0; }
.lesson_content .math-experience .math-worked-example>:last-child { margin-bottom:0; }
.lesson_content .math-experience .math-section-kicker { margin:0 0 6px; font-size:12px; }
.lesson_content .math-experience .math-section-kicker+:is(h2,h3) { margin:0 0 12px; font-size:24px; }
.lesson_content .math-experience .math-reveal { margin:16px 0 0; border:0; border-left:2px solid var(--aa-border); border-radius:0; background:transparent; }
.math-experience .math-reveal summary { min-height:44px; padding:10px 12px; font-size:14px; }
.math-note-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:28px; align-items:start; margin-block:var(--aa-subsection-gap); }
.lesson_content .math-experience :is(.math-misconception,.math-warning) { max-width:var(--aa-reading-width); padding:4px 0 4px 18px; margin:16px 0; background:transparent; border:0; border-left:2px solid var(--aa-warning); border-radius:0; box-shadow:none; }
.lesson_content .math-experience .math-exam-awareness { max-width:var(--aa-reading-width); padding:4px 0 4px 18px; margin:16px 0; background:transparent; border:0; border-left:2px solid var(--aa-border); border-radius:0; box-shadow:none; }
.lesson_content .math-experience :is(.math-misconception,.math-exam-awareness)>:first-child { margin-top:0; }
.lesson_content .math-experience :is(.math-misconception,.math-exam-awareness)>:last-child { margin-bottom:0; }
.lesson_content .math-experience .math-checkpoint { max-width:var(--aa-checkpoint-width); padding:var(--aa-card-padding); margin:24px 0; border-radius:var(--aa-radius); border:1px solid var(--aa-quiet-border); background:var(--aa-workspace-surface); }
.lesson_content .math-experience .math-checkpoint--compact { max-width:var(--aa-checkpoint-width); }
.lesson_content .math-experience .math-checkpoint--wide { max-width:var(--aa-workspace-width); }
.lesson_content .math-experience .math-quick-check { max-width:760px; padding:24px; background:var(--aa-workspace-surface); border:1px solid var(--aa-quiet-border); margin:24px 0; border-radius:var(--aa-radius); }
.lesson_content .math-experience :is(.math-choice-grid label,.math-quick-check fieldset label) { min-height:50px; padding:8px 12px; border-radius:var(--aa-radius); }
.lesson_content .math-experience .math-quick-check__question { padding:8px 0!important; }
.lesson_content .math-experience .math-quick-check--progressive .math-quick-check__question { list-style:none; border:0; border-radius:0; background:transparent; }
.lesson_content .math-experience .math-quick-check__questions { margin:6px 0!important; }
.lesson_content .math-experience .math-quick-check__note { margin:4px 0 12px!important; }
.math-experience .math-quick-progress { display:block; font-size:13px; color:var(--aa-text-muted); }
.math-quick-navigation { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin-top:8px; font-size:14px; }
.math-experience button { min-height:44px; }
.math-experience :is(input,button,summary,legend,select):focus-visible { outline:3px solid var(--aa-accent); outline-offset:3px; }
.math-experience [data-quick-input] { min-height:44px; max-width:180px; width:100%; padding:8px; color:var(--aa-text); background:var(--aa-surface); border:1px solid var(--aa-border); border-radius:var(--aa-radius); }
.math-experience .math-lesson-visual { max-width:var(--aa-workspace-width); padding:20px; margin:28px 0; }
.math-movement-result { display:block; width:100%; max-width:400px; }
.math-movement-result text { fill:var(--aa-text); font:14px system-ui,sans-serif; }
.math-guide-addition { stroke:var(--aa-text); stroke-width:2; stroke-dasharray:2 3; fill:none; }
.math-guide-changed { stroke:var(--aa-diagram-accent); stroke-width:3; stroke-dasharray:none; animation:math-dimension-emphasis 1.2s ease-out; }
@keyframes math-dimension-emphasis { from { stroke-width:6; } to { stroke-width:3; } }
/* Existing slider visuals share the workspace composition without changing their controls. */
.math-experience .math-prediction:has([data-teaching-drawing] input[type=range]) { max-width:var(--aa-workspace-width); }
.math-teaching-visual:has(input[type=range]) [data-teaching-drawing] { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:16px 24px; align-items:center; }
.math-teaching-visual:has(input[type=range]) .math-feedback-example { grid-column:1/-1; }
.math-teaching-visual:has(input[type=range]) .math-feedback-drawing { grid-column:1; grid-row:2/span 2; min-width:0; width:100%; }
.math-teaching-visual:has(input[type=range]) .math-feedback-controls { grid-column:2; grid-row:2; min-width:0; }
.math-teaching-visual:has(input[type=range]) .math-feedback-reading { grid-column:2; grid-row:3; margin:0; font-size:14px; }
.math-experience .math-feedback-control { grid-template-columns:minmax(90px,.8fr) minmax(0,1.4fr) 36px; gap:8px; }
.math-experience .math-feedback-control label { grid-column:auto; font-size:14px; }
.math-experience .math-feedback-control input[type=range] { min-height:44px; }
@container math-lesson (max-width:850px) {
 .math-teaching-visual:has(input[type=range]) [data-teaching-drawing] { display:block; }
 .math-guide-layout,.math-example-grid,.math-note-grid,.math-formula-reference { grid-template-columns:1fr; }
 .math-example-unit:nth-child(n+3),.math-formula-reference>.math-formula-wide { grid-column:auto; }
 .math-guide-drawing svg { max-width:400px; }
 .math-guide-panel { max-width:600px; width:100%; margin-inline:auto; }
}
@media(max-width:768px) {
 .lesson_container:has(.math-experience) { --aa-section-gap:48px; --aa-subsection-gap:32px; --aa-card-padding:20px; }
 .math-guide-layout,.math-example-grid,.math-note-grid,.math-formula-reference { grid-template-columns:1fr; }
 .math-guide-drawing svg { max-width:360px; }
 .math-quick-navigation { flex-wrap:wrap; }
 .lesson_content .math-experience :is(.math-choice-grid label,.math-quick-check fieldset label) { min-height:44px; }
 .lesson_content .math-experience .math-quick-check { padding:16px; }
}
@media(prefers-reduced-motion:reduce) { .math-experience * { scroll-behavior:auto!important; transition:none!important; animation:none!important; } }

.math-guide-primary { stroke:var(--aa-diagram-accent); stroke-width:2.5; fill:none; }
.math-guide-secondary { stroke:var(--aa-text-muted); stroke-width:1.6; fill:none; stroke-dasharray:4 5; }
.math-guide-axis { stroke:var(--aa-text-muted); stroke-width:1; fill:none; opacity:.55; }
.math-guide-point { fill:var(--aa-diagram-accent); stroke:var(--aa-diagram-accent); stroke-width:2; }
.math-guide-point--open { fill:var(--aa-surface); stroke:var(--aa-text); stroke-width:2; }
.math-guide-area { fill:var(--aa-accent-soft); stroke:var(--aa-diagram-accent); stroke-width:1.5; }
.math-guide-population { fill:var(--aa-border); }
/* Function-machine chips style their direct labels, never KaTeX's internal spans. */
.math-experience .math-function-machine>span span { padding:0; border-radius:0; background:transparent; flex:initial; }
.math-experience .math-function-machine { max-width:var(--aa-reading-width); }

/* Editorial surfaces: information stays quiet; controls carry the accent. */
body:has(.math-experience), body:has(.math-experience) .main { background:color-mix(in srgb,var(--secondary_background) 45%,var(--white)); }
.darkmode body:has(.math-experience), .darkmode body:has(.math-experience) .main { background:var(--secondary_background); }
.math-experience .math-lesson-meta li+li::before { content:"·"; margin-inline:10px; color:var(--aa-text-muted); }
.math-experience .math-worked-example ol>li::marker { color:var(--aa-text-muted); font-size:14px; font-weight:600; }
.math-experience .math-worked-example__header { font-weight:500; }
.math-experience .math-quick-progress { margin-bottom:8px; }
.math-quick-meter { display:block; appearance:none; width:100%; height:3px; margin:0 0 14px; border:0; background:var(--aa-border); color:var(--aa-accent); border-radius:2px; }
.math-quick-meter::-webkit-progress-bar { background:var(--aa-border); border-radius:2px; }
.math-quick-meter::-webkit-progress-value { background:var(--aa-accent); border-radius:2px; }
.math-quick-meter::-moz-progress-bar { background:var(--aa-accent); border-radius:2px; }
@media(min-width:769px) {
 .lesson_container:has(.math-experience) .top_bar { position:relative; }
 .lesson_container:has(.math-experience) .top_bar>.contents:has(details[open]) { flex-basis:auto; order:initial; }
 .lesson_container:has(.math-experience) .contents__list { position:absolute; right:0; top:100%; z-index:20; display:grid; gap:0; width:260px; max-height:60vh; overflow:auto; padding:12px 18px; background:var(--aa-surface); border:1px solid var(--aa-border); border-radius:var(--aa-radius); box-shadow:0 8px 24px color-mix(in srgb,var(--aa-text) 8%,transparent); }
}

.math-experience .math-worked-example [data-prediction-reveal]>ol { padding-block:8px; border-block:1px solid var(--aa-quiet-border); }
.math-experience .math-reveal summary { color:var(--aa-text-muted); }

/* Prediction mathematics is topic-specific; its shell is Induction's checkpoint. */
.math-prediction-responses:not(.math-choice-grid) { display:flex; flex-wrap:wrap; gap:12px; }
.math-experience .math-prediction .math-choice-grid label { gap:10px; }
.math-experience .math-prediction>.math-reveal { max-width:var(--aa-workspace-width); }
.math-prediction legend.math-lesson-visually-hidden { width:1px; }
