/* Scoped classroom styles. The system controls where the module is mounted. */
.math-lab {
  --ml-ink:var(--ink);--ml-accent:var(--green);--ml-soft:var(--soft);--ml-line:var(--line);
  --ml-wash:var(--paper);--ml-strong:var(--light);
  min-width:0;
  color:var(--ml-ink);
}
.math-lab:fullscreen { overflow:auto;padding:1.2rem clamp(1rem,3vw,2rem);background:var(--paper); }
.ml-heading {display:flex;justify-content:space-between;align-items:center;gap:.75rem;padding:.15rem 0 .75rem}
.ml-heading .ml-title {margin:.1rem 0 0;font-size:clamp(1.14rem,1.8vw,1.45rem);font-weight:650;line-height:1.35;letter-spacing:-.01em}
.ml-kicker {font-size:.73em;line-height:1.4;letter-spacing:.03em;font-weight:550;color:var(--ml-soft)}
.ml-present {flex:none;font-size:.85em}
.ml-body {padding:0}
.ml-tabs {display:flex;flex-wrap:wrap;gap:.3rem;margin-bottom:.85rem;border-bottom:1px solid var(--ml-line)}
.math-lab .ml-tab {text-align:left;line-height:1.3;background:transparent;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ml-soft);padding:.42rem .58rem;font-weight:550;}
.ml-tab small {display:block;margin-top:.16rem;font-size:.72em;letter-spacing:.01em;font-weight:550}
.math-lab .ml-tab:hover {background:var(--ml-strong)}
.math-lab .ml-tab[aria-selected=true] {color:var(--green-dark);border-bottom-color:var(--ml-accent);font-weight:650}
.ml-panel {min-width:0}
.ml-activity h3 {margin:.25rem 0;font-size:clamp(1.05rem,1.8vw,1.3rem);font-weight:650;line-height:1.3}
.ml-instruction {color:var(--ml-soft);margin:0 0 .75rem}
.ml-goal {display:block;font-size:1.07em;margin:.55rem 0 0}
.ml-diagram {display:block;width:100%;height:auto;max-width:740px;background:var(--ml-wash);user-select:none}
.ml-number-line {cursor:crosshair;touch-action:pan-y;margin:.4rem 0 .7rem}
.ml-triangle {cursor:grab;touch-action:none;margin:.7rem 0}
.ml-triangle:active {cursor:grabbing}
.ml-axis,.ml-axis-arrow {fill:none;stroke:var(--ml-ink);stroke-width:1.15;stroke-linecap:round;stroke-linejoin:round}
.ml-tick,.ml-marker-label {fill:var(--ml-ink);font:650 9px/1 system-ui,sans-serif}
.ml-marker-label {font-size:12px;fill:#075a4a}
.ml-marker {fill:#138268;stroke:white;stroke-width:1.6}
.ml-guide {stroke:#a6bbb1;stroke-width:1;stroke-dasharray:3.5 3.5}
.ml-geometry-shape {fill:#daefe6;stroke:#176b59;stroke-width:1.5;stroke-linejoin:round}
.ml-range {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.2rem .55rem;align-items:center;width:min(100%,620px);padding:.3rem 0;font-weight:650;cursor:pointer}
.ml-range input[type=range] {display:block;width:100%;grid-column:1/-1;min-height:36px;margin:0;padding:0;border:0;background:transparent;accent-color:var(--ml-accent);cursor:pointer}
.ml-range-value {font-variant-numeric:tabular-nums;min-width:3ch;text-align:right;color:var(--ml-accent)}
.ml-geometry-controls {display:grid;gap:.6rem 1rem;grid-template-columns:1fr 1fr;max-width:740px}
.ml-actions {display:flex;align-items:center;flex-wrap:wrap;gap:.45rem;margin:.5rem 0}
.math-lab .ml-main {background:var(--ml-accent);border-color:var(--ml-accent);color:#fff}
.math-lab .ml-main:hover {background:var(--green-dark);color:#fff}
.ml-live {display:block;min-height:2em;margin:.35rem 0;color:var(--ml-accent);font-weight:650}
.ml-explain {border-top:1px solid var(--ml-line);padding-top:.65rem;margin-top:.75rem}
.ml-explain summary {cursor:pointer;font-weight:600;color:var(--ml-soft)}
.ml-explain p {margin:.45rem 0 0;color:var(--ml-soft)}
.ml-metrics {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.5rem;margin:.55rem 0 .75rem;max-width:740px}
.ml-angles {grid-template-columns:repeat(4,minmax(0,1fr))}
.ml-metric {border-inline-start:1px solid var(--ml-line);padding:.18rem .45rem .18rem .65rem}
.ml-equation {font:650 .9em/1.45 system-ui,sans-serif;display:block;overflow-wrap:anywhere}
.ml-metric-value {display:block;color:var(--ml-ink);font-size:1.25em;font-variant-numeric:tabular-nums}
.math-lab.ml-presenting .ml-body {font-size:1.14em}
.math-lab.ml-presenting:fullscreen .ml-body,.math-lab.ml-presenting:fullscreen .ml-heading{max-width:1100px;margin-inline:auto}
.math-lab.ml-presenting:fullscreen .ml-diagram {max-height:48vh}
.math-lab button:focus-visible,.math-lab input:focus-visible,.math-lab summary:focus-visible {outline:2px solid var(--ml-accent);outline-offset:2px}
@media(max-width:520px) {
  .ml-heading {align-items:flex-start}
  .ml-geometry-controls {grid-template-columns:1fr;gap:0}
  .ml-angles {grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media print { .math-lab {display:none!important} }
