.math-learning,
.math-practice,
.math-fraction-explorer {
  --ml-ink: #233e4a;
  --ml-accent: #1c6573;
  --ml-soft: #edf7f5;
  --ml-border: #c1dbdb;
  color: var(--ml-ink);
}
.math-learning { margin: 2rem 0; }
.math-learning > h2 { margin: 0 0 .65rem; }
.math-learning > p { max-width: 75ch; line-height: 1.65; }
.math-learning h3 { font-size: 1.05rem; margin: 0 0 .8rem; }
.math-learning-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin: 1.3rem 0;
}
.math-worked-example {
  min-width: 0;
  margin: 0;
  padding: 1.25rem;
  background: var(--ml-soft);
  border: 1px solid var(--ml-border);
  border-radius: 1rem;
}
.math-worked-example figcaption { margin-top: 1rem; line-height: 1.65; }
.math-example-equation { display: block; margin-bottom: .4rem; font-size: 1.2rem; }
.math-fraction-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1rem 0; }
.math-fraction-part { display: grid; place-items: center; gap: .25rem; padding: .75rem .2rem; border: 1px solid var(--ml-accent); background: #fff; }
.math-fraction-part.is-used { color: #fff; background: var(--ml-accent); }
.math-fraction-part > span { font-size: 1.5rem; line-height: 1; }
.math-fraction-part > small { font-size: .95rem; }
.math-number-line { display: block; width: 100%; height: auto; overflow: visible; }
.math-number-line text { font-family: inherit; font-size: 20px; fill: var(--ml-ink); }
.math-number-axis,
.math-number-tick { fill: none; stroke: var(--ml-ink); stroke-width: 2; }
.math-number-jump { fill: none; stroke: var(--ml-accent); stroke-width: 3; }
.math-number-line .math-number-jump-label { fill: var(--ml-accent); font-size: 19px; font-weight: 700; }
.math-number-start { fill: #fff; stroke: var(--ml-ink); stroke-width: 3; }
.math-number-end { fill: var(--ml-accent); stroke: var(--ml-accent); stroke-width: 3; }
.math-number-line .math-number-endpoint-label { font-size: 20px; }
.math-counter-array { display: grid; gap: .5rem; margin: 1rem 0; }
.math-counter-group { display: flex; align-items: center; gap: 1rem; padding: .45rem .75rem; border: 1px solid var(--ml-border); border-radius: .5rem; background: #fff; }
.math-counter-label { font-size: .85rem; white-space: nowrap; }
.math-counter-dots { display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 13rem); gap: .35rem; color: var(--ml-accent); font-size: 1.6rem; line-height: 1.3; }
.math-practice { min-inline-size: 0; margin: 0; padding: 1rem 1.25rem 1.25rem; border: 1px solid var(--ml-border); border-radius: 1rem; background: #fff; }
.math-practice legend { padding: 0 .3rem; font-size: 1.05rem; font-weight: 800; }
.math-practice-question { margin: .25rem 0 1rem; line-height: 1.6; font-weight: 700; }
.math-practice-choices { display: flex; flex-wrap: wrap; gap: .6rem; }
.math-practice-choices button { min-width: 3.5rem; min-height: 44px; padding: .65rem 1rem; border: 2px solid var(--ml-accent); border-radius: .65rem; background: #fff; color: var(--ml-ink); font: inherit; font-weight: 750; cursor: pointer; }
.math-practice-choices button:hover { background: var(--ml-soft); }
.math-practice-choices button[aria-pressed="true"] { border-color: var(--ml-accent); background: var(--ml-accent); color: #fff; }
.math-practice button:focus-visible,
.math-practice summary:focus-visible,
.math-learning-next a:focus-visible { outline: 3px solid #773b95; outline-offset: 3px; }
.math-practice-feedback { margin: .9rem 0; line-height: 1.6; }
.math-practice-feedback[data-math-result="correct"] { color: #175c3a; }
.math-practice-feedback[data-math-result="retry"] { color: #75431a; }
.math-practice-solution summary { min-height: 44px; box-sizing: border-box; padding: .7rem 0; cursor: pointer; line-height: 1.5; }
.math-practice-solution p { margin: .4rem 0 0; line-height: 1.65; }
.math-common-mistake { margin: 1rem 0; padding: 1rem 1.25rem; border-left: 4px solid var(--ml-accent); background: var(--ml-soft); border-radius: 0 .6rem .6rem 0; }
.math-common-mistake p { margin: 0; line-height: 1.65; }
.math-learning-next { margin-top: 1.5rem; }
.math-learning-next ul { display: grid; gap: .8rem; margin: 0; padding-left: 1.25rem; }
.math-learning-next a { color: var(--ml-accent); font-weight: 750; text-underline-offset: .15em; }
.math-learning-next li > span { display: block; margin-top: .2rem; font-size: .93rem; line-height: 1.55; }
@media (max-width: 700px) { .math-learning-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .math-learning *, .math-practice * { scroll-behavior: auto; } }
@media print { .math-practice [data-math-choices] { display: none; } .math-practice-solution { display: block; } }
.math-reasoning-steps { margin: 1.2rem 0; padding-left: 1.4rem; max-width: 80ch; }
.math-reasoning-steps li { padding-left: .3rem; margin: .6rem 0; line-height: 1.65; }
.math-fraction-scope { font-size: .9rem; line-height: 1.5; }
.math-fraction-explorer > p { line-height: 1.6; }
.math-quarter-line { display: block; width: 100%; height: auto; max-width: 32rem; margin: 0 auto; }
.math-quarter-line text { font: 18px sans-serif; fill: var(--ml-ink); }
.math-fraction-value { font-size: 1.5rem; font-weight: 800; margin: .4rem 0; }
.math-fraction-controls label { display: block; font-weight: 750; line-height: 1.5; }
.math-fraction-controls input[type="range"] { width: 100%; min-height: 44px; margin: .5rem 0; accent-color: var(--ml-accent); }
.math-fraction-buttons { display: flex; flex-wrap: wrap; gap: .6rem; }
.math-fraction-buttons button { min-height: 44px; padding: .65rem .85rem; border: 2px solid var(--ml-accent); border-radius: .65rem; color: var(--ml-ink); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.math-fraction-buttons button:hover { background: var(--ml-soft); }
.math-fraction-controls input:focus-visible,
.math-fraction-buttons button:focus-visible { outline: 3px solid #773b95; outline-offset: 3px; }
.math-fraction-controls > p { font-size: .9rem; line-height: 1.6; }
.math-learning-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.math-related-paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.math-related-path { padding: 1.2rem; border: 1px solid #c1dbdb; border-radius: 1rem; background: #fff; }
.math-related-path h3 { margin: 0 0 .5rem; font-size: 1.1rem; }
.math-related-path > p { margin: .5rem 0; line-height: 1.6; }
.math-related-path ol, .math-related-path ul { padding-left: 1.4rem; }
.math-related-path li { padding: .55rem .4rem; line-height: 1.5; }
.math-related-path a { color: #1c6573; font-weight: 750; text-underline-offset: .15em; }
.math-related-path a:focus-visible { outline: 3px solid #773b95; outline-offset: 3px; }
.math-related-path li.is-current { background: #edf7f5; border-radius: .5rem; }
.math-related-current { display: inline-block; margin-left: .5rem; font-size: .8rem; font-weight: 750; }
.math-related-description { display: block; margin-top: .2rem; font-size: .92rem; }
.math-related-path .math-related-further { margin-top: 1rem; font-weight: 750; }
.math-printable-jump{margin:14px 0 24px;font-size:14px;font-weight:650}
.math-printable-jump a{color:#355781;text-underline-offset:4px;display:inline-block;padding:7px 0;min-height:32px}
#math-topic-printables{scroll-margin-top:24px}
