.math-lab{margin:30px 0;padding:25px;border:1px solid #cadbc2;border-radius:16px;background:#f5f8ef;min-width:0;color:#40593b}.math-lab>header{margin-bottom:22px}.math-lab-kicker{display:block;font-size:14px;letter-spacing:1px;color:#587849;font-weight:600;margin-bottom:9px}.math-lab>header h3{font-size:22px;line-height:1.65;color:#2e563c;margin:0 0 10px}.math-lab p{font-size:16px;line-height:1.95;margin:0;overflow-wrap:anywhere}.math-lab-controls{margin:20px 0;min-width:0}.math-lab-control-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}.math-lab fieldset{margin:0;padding:16px;border:1px solid #d7e3cb;border-radius:10px;min-width:0;background:#fffef9}.math-lab legend{font-size:16px;color:#4f6c3e;line-height:1.8;padding:0 5px;font-weight:600}.math-lab-select{display:block;min-width:0}.math-lab-select>span{display:block;font-size:16px;font-weight:600;margin-bottom:8px;line-height:1.7}.math-lab select{display:block;width:100%;max-width:100%;min-height:50px;padding:10px 34px 10px 12px;border:1px solid #afc49d;border-radius:9px;background:#fffefa;color:#3e6036;font-size:16px;line-height:1.6}.math-lab-slider{display:block;margin:9px 0 11px;min-width:0}.math-lab-slider>span{display:flex;gap:10px;justify-content:space-between;align-items:flex-start;font-size:16px;line-height:1.8;color:#537143}.math-lab-slider output{font-size:18px;font-weight:650;color:#285b3c;min-width:30px;text-align:right}.math-lab input[type=range]{width:100%;height:48px;min-height:48px;display:block;margin:5px 0;accent-color:#327455;touch-action:pan-y}.math-lab .math-lab-note{font-size:14px;color:#647a56;margin-top:14px}.math-lab .math-lab-choice{display:flex;flex-wrap:wrap;gap:9px;padding:13px 14px 15px;margin-top:18px}.math-lab button{min-height:48px;font-size:16px;line-height:1.6;border:1px solid #baccab;border-radius:9px;background:#fffef8;padding:11px 16px;color:#426639;cursor:pointer;touch-action:manipulation;max-width:100%}.math-lab button[aria-pressed=true]{background:#e0ecd6;border-color:#6f9358;color:#2f5c2c;font-weight:600}.math-lab button:active{background:#e6eddc}.math-lab button:focus-visible,.math-lab select:focus-visible,.math-lab input:focus-visible{outline:3px solid #c39754;outline-offset:3px}.math-lab .math-lab-mistake-button{margin-top:16px;border-color:#d0b493;color:#825727}.math-lab .math-lab-mistake-button[aria-pressed=true]{background:#f4e5d0;border-color:#b98246;color:#7c4c1e}.math-lab-figure{margin:24px 0 20px;padding:12px 7px;background:#fffef9;border:1px solid #dce5d1;border-radius:12px;min-width:0}.math-lab-figure svg{width:100%;height:auto;display:block;max-width:680px;margin:0 auto}.math-lab-figure text{font-family:inherit;font-size:16px;fill:#4f6b44}.math-lab-figure .lab-svg-value{font-size:20px;font-weight:600}.math-lab-figure .lab-group-label{font-size:14px;fill:#fffdf5}.math-lab-results{min-width:0}.math-lab-equation{font-size:18px;line-height:2;overflow-wrap:anywhere;padding:18px 20px;border-radius:10px;background:#e8f0df;color:#2c5735;margin:16px 0;font-weight:550;font-variant-numeric:tabular-nums}.math-lab-readings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:#dce5d1;border:1px solid #dce5d1;border-radius:10px;overflow:hidden;margin:19px 0;min-width:0}.math-lab-readings>div{padding:15px 17px;background:#fffef9;min-width:0}.math-lab-readings dt{font-size:14px;line-height:1.8;color:#687d58;margin:0 0 6px}.math-lab-readings dd{font-size:17px;color:#315c3b;font-weight:600;line-height:1.9;margin:0;overflow-wrap:anywhere}.math-lab .math-lab-meaning{margin:19px 0;color:#46643c}.math-lab .math-lab-observation{padding:17px 19px;border-left:3px solid #85a56f;border-radius:0 9px 9px 0;background:#edf2e5;margin:18px 0;color:#486b38}.math-lab-legend{display:flex;gap:10px 18px;flex-wrap:wrap;margin:8px 0 16px}.math-lab-legend>span{display:flex;gap:8px;align-items:center;font-size:14px;line-height:1.8;color:#5e7552}.math-lab-legend i{display:inline-block;width:18px;height:18px;flex-shrink:0;border-radius:4px;border:1px solid #8da180}.math-lab-legend .first{background:#b2c9a7}.math-lab-legend .overlap{background:#3d7864}.math-lab-legend .remainder{background:#d69a63;border-color:#b07d4b}.math-lab-error-comparison{background:#fbefdd;border:1px solid #dfbd91;border-radius:10px;padding:19px 20px;margin-top:18px}.math-lab-error-comparison strong{display:block;font-size:17px;line-height:1.9;color:#865b2d;margin-bottom:10px}.math-lab-error-comparison p{font-size:16px;color:#795b36;margin-top:10px}.math-lab-footer{border-top:1px solid #d6e1c9;padding-top:20px;margin-top:24px;display:flex;align-items:center;justify-content:space-between;gap:15px;flex-wrap:wrap}.math-lab-footer>span{font-size:14px;line-height:1.8;color:#6a7c59}.math-lab-footer .button{flex-shrink:0}
@media(max-width:1050px){.math-lab{padding:21px}.math-lab>header h3{font-size:21px}.math-lab-control-columns{gap:13px}.math-lab fieldset{padding:13px}.math-lab-figure{padding:8px 2px}.math-lab-equation{padding:16px 17px;font-size:17px}.math-lab-readings>div{padding:14px}.math-lab-readings dd{font-size:16px}}
@media(max-width:760px){.math-lab{padding:20px 17px}.math-lab-control-columns{grid-template-columns:minmax(0,1fr)}.math-lab-readings{grid-template-columns:minmax(0,1fr)}.math-lab-figure{margin:20px 0}.math-lab-equation{font-size:17px;padding:15px}.math-lab-footer{align-items:stretch}.math-lab-footer>span{width:100%}.math-lab-footer .button{width:100%}.math-lab-legend{gap:10px}.math-lab>header h3{font-size:21px}.math-lab .math-lab-choice{flex-direction:column}.math-lab .math-lab-choice button{width:100%}.math-lab .math-lab-mistake-button{width:100%;font-size:16px}}
@media(max-width:520px){.math-lab{padding:19px 14px;margin:25px -3px}.math-lab>header h3{font-size:20px}.math-lab-figure{padding:8px 0}.math-lab-equation{font-size:16px;padding:14px}.math-lab-readings>div{padding:14px 15px}.math-lab-error-comparison{padding:16px}.math-lab .math-lab-observation{padding:15px}.math-lab button{padding:11px 13px}}
/* The reading controls stay within the lesson paper and occupy normal flow. */
.chapter-reading-nav{position:sticky;top:8px;z-index:14;display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 11px;margin:-6px -8px 24px;border:1px solid #d2dfc5;border-radius:11px;background:#fbfdf6;box-shadow:0 5px 15px #4a653116}.chapter-reading-nav button{min-height:48px;padding:10px 13px;border:1px solid #b6c9a3;border-radius:8px;background:#fffef9;color:#426839;font-size:16px;line-height:1.6;cursor:pointer}.chapter-reading-nav button:disabled{opacity:.5;cursor:default}.chapter-reading-nav>span{flex:1;text-align:center;font-size:15px;line-height:1.6;color:#59764b;min-width:89px}.chapter-reading-nav button:focus-visible{outline:3px solid #c39754;outline-offset:2px}.deep-lesson-layout .lesson-paper{scroll-margin-top:16px}.chapter-directory{scroll-margin-top:16px}
@media(max-width:1050px){.chapter-reading-nav{gap:7px;padding:9px}.chapter-reading-nav button{padding:10px 11px}.chapter-reading-nav>span{font-size:14px;min-width:80px}}
@media(max-width:520px){.chapter-reading-nav{margin:-4px -7px 22px;gap:7px}.chapter-reading-nav>span{order:-1;width:100%;flex-basis:100%;text-align:left;padding-left:3px}.chapter-reading-nav button{flex:1;padding:9px 8px;font-size:16px;white-space:nowrap}}
/* Keep the mathematical feedback next to the controls when there is room.
   Flex bases apply to the actual lesson width, including a narrowed AI layout. */
.math-lab-workbench{min-width:0}.math-lab-visual-column{min-width:0}.math-lab-live-equation{display:none}
.math-lab input[type=range]{appearance:none;-webkit-appearance:none;background:transparent;height:48px;min-height:48px;cursor:pointer}
.math-lab input[type=range]::-webkit-slider-runnable-track{height:8px;border-radius:8px;background:#c7d8bb;border:1px solid #a6bf96}
.math-lab input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;box-sizing:border-box;width:28px;height:28px;border:3px solid #fffef8;border-radius:50%;background:#2d7454;box-shadow:0 1px 5px #365c3733;margin-top:-10px}
.math-lab input[type=range]::-moz-range-track{height:8px;border-radius:8px;background:#c7d8bb;border:1px solid #a6bf96}
.math-lab input[type=range]::-moz-range-thumb{box-sizing:border-box;width:28px;height:28px;border:3px solid #fffef8;border-radius:50%;background:#2d7454;box-shadow:0 1px 5px #365c3733}
@media(min-width:760px){
  .math-lab-workbench{display:flex;flex-wrap:wrap;align-items:flex-start;gap:18px;margin:20px 0}
  .math-lab-workbench>.math-lab-controls{flex:1 1 240px;min-width:min(100%,240px);max-width:100%;margin:0}
  .math-lab-workbench>.math-lab-visual-column{flex:2 1 350px;min-width:min(100%,350px);max-width:100%;align-self:flex-start;position:sticky;top:96px}
  .math-lab-workbench .math-lab-control-columns{grid-template-columns:minmax(0,1fr);gap:14px}
  .math-lab-workbench .math-lab-figure{margin:0;padding:10px 3px}
  .math-lab-workbench .math-lab-figure svg{max-width:680px}
  .math-lab-live-equation{display:block;margin-top:12px}
  .math-lab .math-lab-live-caption{font-size:16px;line-height:1.85;color:#365c3b;padding:13px 16px;border:1px solid #d4e2c7;border-radius:9px;background:#fffef9}
  .math-lab-live-equation .math-lab-equation{font-size:16px;line-height:1.95;padding:14px 16px;margin:12px 0 0}
  .math-lab-results>.math-lab-equation{display:none}
  .math-lab-workbench .math-lab-choice{flex-direction:column;margin-top:14px}
  .math-lab-workbench .math-lab-choice button{width:100%;font-size:16px}
  .math-lab-workbench .math-lab-slider{margin-top:6px;margin-bottom:8px}
}
@media(max-width:759px){.math-lab-visual-column{position:static}.math-lab-workbench .math-lab-figure{margin-top:20px}}
