/* One palette for mathematical figures. Preserve dimensions and mathematical geometry. */
:is(svg.sat-fig,svg.calc-graph,svg.ml-topic-art,svg[data-tb-sketch],.graph-example svg,.em-topic-diagram svg,.ml-art svg,.ml-math-figure){box-sizing:border-box;border:1px solid #2c405b!important;border-radius:10px!important;max-width:100%;background:#101e33!important;color:#4ce5d0}
.alg-poly-graph{background:#101e33!important;border-radius:10px}.alg-poly-axis-x,.alg-poly-axis-y{color:#eef5ff!important}
.ml-math-figure .ml-figure-label{fill:#eef5ff!important;stroke:none!important;font-style:normal!important;font-family:KaTeX_Main,"STIX Two Text",Cambria,Georgia,serif!important}
.ml-math-figure .ml-figure-variable{font-family:KaTeX_Math,"STIX Two Text",Cambria,Georgia,serif!important;font-style:italic!important}
.ml-math-figure .ml-figure-key{fill:#e7ff72!important}
.ml-math-figure .ml-figure-line{stroke:#4ce5d0!important}
.ml-math-figure .ml-figure-unfilled{fill:none!important}
.ml-math-figure .ml-figure-filled{fill:#4ce5d0!important}
.ml-math-figure .ml-figure-grid{stroke:#2c405b!important;fill:none!important}
.ml-math-figure .ml-figure-axis{stroke:#9fb3cf!important;fill:none!important}
.ml-math-figure .ml-figure-point{fill:#e7ff72!important;stroke:#e7ff72!important}
.ml-math-figure .ml-figure-hole{fill:#101e33!important;stroke:#e7ff72!important}
.ml-math-figure .ml-figure-background{fill:#101e33!important;stroke:none!important}
.ml-math-figure .ml-figure-angle{fill:none!important;stroke:#e7ff72!important}
.ml-math-figure .ml-figure-arrow-head{fill:#4ce5d0!important;stroke:none!important}
.ml-math-figure .ml-figure-muted{fill:#60718d!important;stroke:#60718d!important}
/* Initial paint before the shared decorator runs; do not flash a white/red figure. */
@media screen{
 /* SAT/PSAT must paint correctly before asynchronous SVG decoration. */
 svg.sat-fig{background:#101e33!important;color:#eef5ff!important}
 svg.sat-fig :is(path,line,polyline,polygon,ellipse):not(defs *,clipPath *,mask *,marker *){stroke:#4ce5d0!important}
 svg.sat-fig :is(path,polyline,polygon):not(defs *,clipPath *,mask *,marker *){fill:none!important}
 svg.sat-fig rect[fill="white"],svg.sat-fig rect[fill="#fff"],svg.sat-fig rect[fill="#ffffff"]{fill:#101e33!important}
 svg.sat-fig :is(.a,.axis){stroke:#9fb3cf!important}
 :is(.calc-graph,.sat-fig) :is(.curve,.f){stroke:#4ce5d0!important;fill:none!important}
 :is(.calc-graph,.sat-fig) :is(.major,.minor,.g){stroke:#2c405b!important}
 :is(.calc-graph,.sat-fig) :is(.point,.p){fill:#e7ff72!important}
 :is(.calc-graph,.sat-fig) .hole{fill:#101e33!important;stroke:#e7ff72!important}
 :is(.calc-graph,.sat-fig) text{fill:#eef5ff!important;font-family:KaTeX_Main,"STIX Two Text",Cambria,Georgia,serif!important}
}
@media print{
 svg.sat-fig :is(path,line,polyline,polygon,ellipse):not(defs *,clipPath *,mask *,marker *){stroke:#000!important}
 svg.sat-fig :is(path,polyline,polygon):not(defs *,clipPath *,mask *,marker *){fill:none!important}
 svg.sat-fig :is(.p,.point),svg.sat-fig text{fill:#000!important}
 svg.sat-fig :is(.g,.major,.minor){stroke:#ddd!important}
 svg.sat-fig rect[fill="white"],svg.sat-fig rect[fill="#fff"],svg.sat-fig rect[fill="#ffffff"]{fill:#fff!important}
 :is(svg.sat-fig,svg.calc-graph,svg.ml-topic-art,svg[data-tb-sketch],.graph-example svg,.em-topic-diagram svg,.ml-art svg,.ml-math-figure),.alg-poly-graph{background:#fff!important;color:#000!important;border-color:#777!important;box-shadow:none!important}
 .alg-poly-axis-x,.alg-poly-axis-y{color:#000!important}
 .ml-math-figure :is(.ml-figure-line,.ml-figure-axis,.ml-figure-angle,.ml-figure-hole){stroke:#000!important}
 .ml-math-figure :is(.ml-figure-label,.ml-figure-key,.ml-figure-point,.ml-figure-filled,.ml-figure-arrow-head){fill:#000!important}
 .ml-math-figure .ml-figure-point{stroke:#000!important}
 .ml-math-figure .ml-figure-muted{fill:#888!important;stroke:#888!important}
 .ml-math-figure :is(.ml-figure-hole,.ml-figure-background){fill:#fff!important}
 .ml-math-figure .ml-figure-grid{stroke:#ddd!important}
 .ml-math-figure .ml-figure-unfilled{fill:none!important}
}

/* Parallel-angle diagrams: legible labels clear of the lines and arc marks. */
svg.sat-fig.ml-parallel-figure{width:420px;max-width:100%;height:auto}
svg.sat-fig.ml-parallel-figure text.ml-figure-key{font-size:14px!important}
svg.sat-fig.ml-parallel-figure .ml-figure-caption{font-size:10px!important}
@media print{svg.sat-fig.ml-parallel-figure{width:280px;max-width:100%;break-inside:avoid}}
/* Coordinate figures share the existing Calculus palette and print treatment. */
.ml-coordinate-figure{margin:1rem 0;max-width:100%;break-inside:avoid}
.ml-coordinate-figure svg.ml-course-graph{display:block;width:440px;height:auto;max-width:100%;margin:0 auto}
.ml-coordinate-figure figcaption{font:400 .8rem/1.45 'DM Sans',sans-serif;color:#aebcd0;margin:.5rem 0;text-align:center;overflow-wrap:anywhere}
@media print{.ml-coordinate-figure svg.ml-course-graph{width:65mm;max-width:100%;height:auto}.ml-coordinate-figure figcaption{color:#222!important;font-size:8pt}.ml-course-region{fill:#000!important;fill-opacity:.08!important}}

@media print{.ml-course-graph marker path{stroke:#000!important}.ml-coordinate-figure{color:#000!important}}
.calc-sheet .ml-coordinate-figure figcaption,.worksheet .ml-coordinate-figure figcaption,#mlb-paper .ml-coordinate-figure figcaption{color:#41586c}

/* Bound mathematical figures even inside the higher-specificity question rules.
   Auto height preserves each SVG viewBox ratio, including true geometry. */
html body #app :is(svg.calc-graph,svg.sat-fig,svg.ml-course-graph,.graph-example svg,svg[data-tb-sketch],svg.ml-topic-art,.em-topic-diagram svg,.ml-art svg){display:block;width:360px;max-width:100%;height:auto;max-height:none;margin:16px auto}
html body #app .alg-poly-graph{width:360px;max-width:100%}
html body #app .alg-poly-graph>svg.calc-graph{width:100%;margin:0}
html body #app :is(.calc-sheet,.worksheet,#mlb-paper) :is(svg.calc-graph,svg.sat-fig,svg.ml-course-graph,.graph-example svg){width:240px;max-width:100%;height:auto;max-height:none}
@media print{
 html body #app :is(svg.calc-graph,svg.sat-fig,svg.ml-course-graph,.graph-example svg,svg[data-tb-sketch],svg.ml-topic-art,.em-topic-diagram svg,.ml-art svg){width:60mm;max-width:100%;height:auto;max-height:none;break-inside:avoid;margin:3mm auto}
 html body #app :is(.calc-sheet,.worksheet,#mlb-paper) :is(svg.calc-graph,svg.sat-fig,svg.ml-course-graph,.graph-example svg){width:45mm;max-width:100%;height:auto;max-height:none}
 html body #app .alg-poly-graph{width:45mm;max-width:100%}
 html body #app .alg-poly-graph>svg.calc-graph{width:100%;margin:0}
}

/* Desmos-inspired paper graph surface, shared by all mathematical channels. */
@media screen {
 html body :is(svg.sat-fig,svg.calc-graph,svg.ml-topic-art,svg[data-tb-sketch],.graph-example svg,.em-topic-diagram svg,.ml-art svg,.ml-math-figure),html body .alg-poly-graph{background:#fff!important;color:#17212e!important;border-color:#c7ced7!important;border-radius:8px}
 html body svg.ml-math-figure :is(.ml-figure-label,.ml-figure-key),html body :is(svg.calc-graph,svg.sat-fig) text{fill:#17212e!important;color:#17212e!important}
 html body svg.ml-math-figure :is(.ml-figure-grid,.major,.minor,.g){stroke:#dce1e7!important;fill:none!important}
 html body svg.ml-math-figure :is(.ml-figure-axis,.axis,.a){stroke:#536171!important;fill:none!important}
 html body svg.ml-math-figure :is(.ml-figure-line,.curve,.f,.ml-figure-angle,.ml-figure-hole){stroke:#c74440!important}
 html body svg.ml-math-figure :is(.ml-figure-point,.point,.p,.ml-figure-filled,.ml-figure-arrow-head){fill:#c74440!important}
 html body svg.ml-math-figure .ml-figure-point{stroke:#c74440!important}
 html body svg.ml-math-figure :is(.ml-figure-hole,.hole,.ml-figure-background){fill:#fff!important}
 html body svg.ml-math-figure .ml-figure-unfilled{fill:none!important}
 html body svg.ml-math-figure .fig-arrow{stroke:#536171!important;fill:none!important}
 html body svg.ml-math-figure :is(.fig-asym,.asym){stroke:#687787!important;stroke-dasharray:6 4}
 html body .alg-poly-axis-x,html body .alg-poly-axis-y{color:#17212e!important}
 html body .ml-coordinate-figure figcaption{color:#526177}
 html body #app .worksheet :is(svg.calc-graph,svg.sat-fig,svg.ml-course-graph,.graph-example svg){width:300px;max-width:100%;height:auto}
}

/* Decorative SAT/PSAT topic-card colors; academic graphs and paper stay unchanged. */
@media screen {
 html body #app .em-topic-diagram svg.ml-topic-art{background:#101e33!important;color:#4ce5d0!important;border-color:#2c405b!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-label{fill:#eef5ff!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-key{fill:#e7ff72!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-line{stroke:#4ce5d0!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-grid{stroke:#2c405b!important;fill:none!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-axis{stroke:#9fb3cf!important;fill:none!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-point{fill:#e7ff72!important;stroke:#e7ff72!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-hole{fill:#101e33!important;stroke:#e7ff72!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-background{fill:#101e33!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-angle{stroke:#e7ff72!important;fill:none!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-filled{fill:#4ce5d0!important}
 html body #app .em-topic-diagram svg.ml-topic-art .ml-figure-arrow-head{fill:#4ce5d0!important;stroke:none!important}
 html body #app .em-topic-diagram svg.ml-topic-art [data-topic-palette="authored"]{fill:var(--ml-topic-fill)!important;stroke:var(--ml-topic-stroke)!important}
}

/* Approved homepage-only restoration; academic graph styling is unchanged. */
@media screen {
html body #courses .ml-art svg{background:#101e33!important;color:#4ce5d0!important;border-color:#2c405b!important}
html body #courses .ml-art svg .ml-figure-label{fill:#eef5ff!important;color:#eef5ff!important}
html body #courses .ml-art svg .ml-figure-key{fill:#e7ff72!important}
html body #courses .ml-art svg .ml-figure-line{stroke:#4ce5d0!important}
html body #courses .ml-art svg .ml-figure-filled{fill:#4ce5d0!important}
html body #courses .ml-art svg .ml-figure-grid{stroke:#2c405b!important}
html body #courses .ml-art svg .ml-figure-axis{stroke:#9fb3cf!important}
html body #courses .ml-art svg .ml-figure-point{fill:#e7ff72!important;stroke:#e7ff72!important}
html body #courses .ml-art svg .ml-figure-hole{fill:#101e33!important;stroke:#e7ff72!important}
html body #courses .ml-art svg .ml-figure-background{fill:#101e33!important}
html body #courses .ml-art svg .ml-figure-angle{stroke:#e7ff72!important}
html body #courses .ml-art svg .ml-figure-arrow-head{fill:#4ce5d0!important}
html body #courses .ml-art svg .ml-figure-muted{fill:#60718d!important;stroke:#60718d!important}
}
