.math-explorers{margin:1.5rem 0 2rem;scroll-margin-top:6rem}
.math-explorers>p{max-width:65ch;color:var(--text-secondary,#4d6268)}
.math-explorer{margin:.7rem 0;border:1px solid var(--border,#c9d7d9);border-radius:12px;background:var(--surface,#fff);scroll-margin-top:6rem;overflow:clip}
.math-explorer summary{padding:1rem 1.15rem;cursor:pointer;line-height:1.5}
.math-explorer-title{font-weight:700;margin-inline-end:.7rem}
.math-explorer-skill{font-size:.85rem;color:var(--text-secondary,#4d6268)}
.math-explorer summary:hover{background:var(--surface-hover,#f1f7f7)}
.math-explorer-body{padding:1.15rem;border-top:1px solid var(--border,#d6e0e2)}
.math-explorer-assumption,.math-explorer-help{font-size:.88rem;color:var(--text-secondary,#4d6268)}
.math-explorer-controls{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:1rem;margin:0}
.math-explorer-controls[hidden],.math-explorer-visual[hidden]{display:none!important}
.math-explorer-control>label{display:block;font-weight:650;margin-bottom:.4rem}
.math-explorer-control input[type=range]{width:100%;min-height:44px;max-width:none;accent-color:#276b83;margin:0}
.math-explorer-number-controls{display:flex;gap:.45rem;align-items:center}
.math-explorer-number-controls input{width:5.5rem;min-width:0;min-height:44px;font:inherit;text-align:center;border:1px solid var(--border,#9eafb5);border-radius:6px;background:var(--surface,#fff);color:var(--text-primary,#243c46)}
.math-explorer-number-controls button{min-width:44px;min-height:44px;border:1px solid #7d989f;border-radius:6px;background:var(--surface,#fff);color:var(--text-primary,#243c46);font:inherit;font-size:1.2rem;cursor:pointer}
.math-explorer-number-controls button:disabled{opacity:.4;cursor:default}
.math-explorer-control select{max-width:100%;width:100%;min-height:44px;padding:.45rem;font:inherit;border:1px solid var(--border,#9eafb5);border-radius:6px;background:var(--surface,#fff);color:var(--text-primary,#243c46)}
.math-explorer :is(input,select,button,summary):focus-visible{outline:3px solid #a64b2c;outline-offset:3px}
.math-explorer input[aria-invalid=true]{border:2px solid #a53627}
.math-explorer-help{grid-column:1/-1;margin:0}
.math-explorer-result{background:var(--surface-alt,#f3f7f8);padding:1rem;border-radius:8px;margin:0}
.math-explorer-formula{font-size:1.05rem;font-weight:700;line-height:1.7;overflow-wrap:anywhere;margin-top:0}
.math-explorer-visual{max-width:360px;margin:.6rem auto 0;background:#fff;border:1px solid #d3e0e4;border-radius:6px;color:#243c46}
.math-explorer-visual svg{width:100%;height:auto;display:block}
.math-explorer-prompt,.math-explorer-note{max-width:75ch;line-height:1.65}
.math-explorer-note{font-size:.93rem}
.math-explorer-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:480px){.math-explorer summary{padding:.85rem}.math-explorer-body{padding:.9rem .8rem}.math-explorer-skill{display:block}.math-explorer-result{padding:.7rem}.math-explorer-number-controls input{flex:1;max-width:8rem}}
@media(prefers-reduced-motion:reduce){.math-explorers *{scroll-behavior:auto}}
@media print{.math-explorer-controls{display:none}.math-explorer{break-inside:avoid}.math-explorer-body{border:0}}

/* Keep the controls beside their model when the page has enough room. */
.math-explorers{line-height:1.6}
.math-explorers-heading h2{font-family:var(--disp);font-size:1.4rem;line-height:1.3;margin-bottom:.4rem}
.math-explorers>p{margin-bottom:1rem}
.math-explorer-print-shortcut{margin:1.25rem 0;line-height:1.6}
.math-explorer-print-shortcut a{color:var(--accent);text-underline-offset:3px}
.math-explorer-body>p{max-width:75ch}
.math-explorer-body>.math-explorer-assumption{margin-top:.4rem}
.math-explorer-workspace{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;margin:1rem 0 0;align-items:start}
.math-explorer-workspace>*{min-width:0}
.math-explorer-controls{align-content:start;gap:1.25rem}
.math-explorer-control{min-width:0}
.math-explorer-formula{margin:0 0 .5rem}
.math-explorer-result>[data-explorer-explanation]{line-height:1.6}
.math-explorer-visual{width:100%}
.math-explorer-sidebar>.math-explorer-prompt{margin-top:1rem}
.math-explorer-sidebar>.math-explorer-note{margin-top:.5rem;color:#465570}
@media(min-width:760px){
 .math-explorer-workspace:has(.math-explorer-controls:not([hidden])){grid-template-columns:minmax(240px,.9fr) minmax(0,1.1fr);gap:1.5rem}
 .math-explorer-controls{grid-template-columns:minmax(0,1fr)}
}
@media print{.math-explorer-workspace{display:block}.math-explorer-result{margin:.75rem 0}}

.math-explorer-sidebar{min-width:0}
.math-explorer-sidebar>.math-explorer-prompt{padding-top:1rem;border-top:1px solid var(--line,#d6e0e2)}
.math-explorer-number-controls{direction:ltr;justify-content:flex-start}
.math-explorer-control input[type=range]{direction:ltr}
.math-explorer-formula{unicode-bidi:plaintext}
html[dir=rtl] .math-explorer-workspace{direction:ltr}
html[dir=rtl] .math-explorer-sidebar,html[dir=rtl] .math-explorer-result{direction:rtl;text-align:start}
html[dir=rtl] .math-explorer :is(select,input[type=number]){text-align:center}
html[lang=ur] .math-explorers{line-height:1.85}
html[lang=ur] .math-explorer :is(.math-explorer-formula,.math-explorer-note,.math-explorer-help){line-height:1.85}

html[lang=ar] .math-explorers{line-height:1.85}
html[lang=ar] .math-explorer :is(.math-explorer-formula,.math-explorer-note,.math-explorer-help){line-height:1.85}
