.nivo-nav {
  display:flex; gap:1rem; align-items:center; justify-content:space-between;
  flex-wrap:wrap; margin-bottom:1.25rem;
}
.nivo-nav nav { display:flex; gap:.45rem; flex-wrap:wrap; }
.nivo-nav a { color:#233b50; text-decoration:none; font-weight:850; }
.nivo-nav nav a { padding:.45rem .7rem; border:2px solid white; border-radius:.8rem; background:#d0e6fa; }
.nivo-nav nav a:hover, .nivo-nav nav a[aria-current="page"] { background:#ffeab0; }
.nivo-brand {
  display:inline-flex; align-items:center; gap:.38rem; font-size:clamp(1.4rem,4vw,2.1rem);
  white-space:nowrap; line-height:1; letter-spacing:-.065em; font-weight:950;
}
.nivo-brand .nivo-up { margin-left:-.38rem; color:#833654; }
.nivo-mark { display:inline-block; position:relative; width:2.45rem; height:2.25rem; margin-right:.15rem; }
.nivo-mark i {
  position:absolute; width:1.23rem; height:.73rem; border-radius:.28rem;
  border:1px solid #fff; box-shadow:0 2px 0 #315568;
}
.nivo-mark i::before { content:""; position:absolute; top:-.2rem; left:.16rem; width:.32rem; height:.23rem; border-radius:.11rem .11rem 0 0; background:inherit; }
.nivo-mark i:first-child { left:0; bottom:.36rem; background:#a9dfcf; transform:rotate(-10deg); }
.nivo-mark i:nth-child(2) { right:0; bottom:.72rem; background:#efb5cf; transform:rotate(8deg); }
.nivo-mark b { position:absolute; right:.08rem; top:0; color:#a1650e; font-size:1rem; }
.nivo-hero {
  position:relative; overflow:hidden; display:grid; grid-template-columns:minmax(0,1.8fr) minmax(15rem,1fr);
  align-items:center; min-height:14rem; padding:clamp(1.2rem,5vw,3.2rem);
  background:#ffeab0; border:2px solid #fff; border-radius:1.6rem; box-shadow:0 6px 0 #e2c581;
}
.nivo-hero h1, .module-header h1 {
  margin:0; color:#233b50; font-size:clamp(2.2rem,6vw,4rem);
  line-height:1.04; letter-spacing:-.055em; font-weight:950;
}
.nivo-hero p, .module-header p { margin:.65rem 0 0; max-width:45ch; }
.block-stack { position:relative; justify-self:center; width:14rem; height:10rem; }
.block-stack i {
  display:block; position:absolute; width:8.4rem; height:2.75rem; border:2px solid #fff;
  border-radius:.65rem; box-shadow:0 .45rem 0 #3b5367; transform:rotate(var(--angle)); background:var(--piece);
}
.block-stack i::before, .block-stack i::after {
  content:""; position:absolute; height:.7rem; width:1.4rem; border:2px solid #fff;
  border-bottom:0; border-radius:.35rem .35rem 0 0; background:var(--piece); top:-.75rem;
}
.block-stack i::before { left:1rem; }.block-stack i::after { right:1rem; }
.block-stack i:first-child { --piece:#bce7d4; --angle:-10deg; left:0; bottom:1rem; }
.block-stack i:nth-child(2) { --piece:#f5bfd7; --angle:7deg; left:3.1rem; bottom:3.9rem; }
.block-stack i:nth-child(3) { --piece:#b8daf6; --angle:-7deg; left:5rem; bottom:6.5rem; width:6.6rem; }
.tool-bricks, .nivo-records { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; }
.tool-bricks { margin-top:1.8rem; }
.tool-brick, .record-card { border:2px solid #fff; border-radius:1.35rem; padding:1.15rem; box-shadow:0 5px 0 #4c6b7b42; }
.tool-brick { position:relative; display:block; text-decoration:none; color:#233b50; transition:transform .15s, box-shadow .15s; }
.tool-brick::before { content:""; position:absolute; top:-.55rem; left:1.2rem; width:1.3rem; height:.55rem; background:inherit; border:2px solid #fff; border-bottom:0; border-radius:.32rem .32rem 0 0; }
.tool-brick:hover { transform:translateY(-3px); box-shadow:0 8px 0 #4c6b7b42; }
.brick-blue, [data-tone="blue"] { background:#cde6fb; }
.brick-mint, [data-tone="mint"] { background:#cceedd; }
.brick-rose, [data-tone="rose"] { background:#f7d4e5; }
.brick-icon { display:grid; place-items:center; height:2.3rem; width:2.55rem; margin-bottom:.65rem; font-size:1.25rem; font-weight:950; border-radius:.6rem; background:#ffeab0; border:1px solid #fff; }
.tool-brick h2, .record-card h2 { margin:0; line-height:1.2; font-size:1.28rem; }
.tool-brick p { margin:.35rem 0 .65rem; }
.brick-progress { font-weight:800; color:#374f61; font-size:.9rem; }
.module-header { margin-bottom:1.1rem; }
.topic-bricks { display:flex; flex-wrap:wrap; gap:.6rem; margin-bottom:1rem; }
.topic-bricks button { border:2px solid #fff; color:#233b50; font-weight:800; }
.topic-bricks [aria-pressed="true"] { outline:2px solid #3b607c; }
.math-card { max-width:55rem; border:2px solid #fff; margin:0; }
#mathModule {
  display:grid; grid-template-columns:minmax(0, 1fr) minmax(14rem, 17rem);
  align-items:start; gap:clamp(1rem, 2.5vw, 2rem);
}
.math-workspace { grid-area:1 / 1; min-width:0; }
.math-calculator { grid-area:1 / 2; position:sticky; top:1rem; z-index:2; min-width:0; }
.math-calculator-panel {
  background:var(--yellow); border:2px solid #fff; border-radius:1.15rem;
  padding:.8rem; box-shadow:0 4px 0 #dcc17d;
  max-height:calc(100dvh - 2rem); overflow:auto;
}
.math-calculator-panel h2 { margin:0 0 .45rem; font-size:1.2rem; }
.math-calculator-label { font-size:.9rem; font-weight:700; }
.math-calculator-panel input { background:#fffaf0; margin:.2rem 0 0; }
.math-calculator-panel output {
  display:block; background:#fffaf0; margin:.4rem 0 .6rem; padding:.3rem .5rem;
  min-height:2.2rem; border-radius:.6rem; text-align:right; font-weight:800; overflow-wrap:anywhere;
}
.math-calculator-panel output[data-error] { color:#87401d; text-align:left; font-size:.9rem; }
.math-calculator-keys { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.3rem; }
.math-calculator-keys button { padding:.25rem; background:#fffaf0; border-color:#d2bc82; font-weight:800; }
.math-calculator-keys button:is([data-key="÷"], [data-key="×"], [data-key="−"], [data-key="+"]) { background:var(--blue); }
.math-calculator-keys .primary { background:#b4d5ee; border-color:#315568; }
.math-calculator-toggle { display:none; }
@media(max-width:56rem) {
  #mathModule { display:block; }
  .math-calculator { width:max-content; margin:0 0 .65rem auto; top:.5rem; }
  .math-calculator-toggle { display:block; font-weight:800; border:2px solid #fff; background:var(--yellow); }
  .math-calculator-panel {
    position:absolute; top:calc(100% + .35rem); right:0; width:min(17rem, calc(100vw - 2rem));
    max-height:calc(100dvh - 4.5rem);
  }
  .math-calculator-toggle[aria-expanded="false"] + .math-calculator-panel { display:none; }
}
.math-card #mathChallenge { font-size:clamp(1.45rem,4vw,2.15rem); margin:.3rem 0 .7rem; }
.math-card #mathFeedback[data-tone="win"] { color:#185b41; }
.math-card #mathFeedback[data-tone="retry"] { color:#774700; }
.math-card #mathFeedback:empty { display:none; }
.math-card audio { display:block; width:min(100%,26rem); margin:.6rem 0; }
.math-card #mathForm { padding:.25rem 0 0; }
.nivo-input { width:100%; border:2px solid #fff; border-radius:.65rem; padding:.55rem .65rem; background:#fff1c6; color:#233b50; font:inherit; }
#mathAnswer { width:min(100%, 18rem); }
.record-form { display:grid; gap:.45rem; margin-top:.8rem; }
.record-form button { justify-self:start; }
.record-card progress { margin-top:.3rem; }
.record-card > label { margin-top:.65rem; font-weight:800; }
.record-list { margin:.8rem 0 0; padding-left:1.15rem; }
.record-list li { margin:.35rem 0; overflow-wrap:anywhere; }
.record-list label { display:flex; align-items:baseline; gap:.45rem; }
@media(max-width:780px) {
  .tool-bricks, .nivo-records { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .nivo-hero { grid-template-columns:1fr; min-height:auto; }
  .block-stack { display:none; }
}
@media(max-width:520px) {
  .tool-bricks, .nivo-records { grid-template-columns:1fr; }
  .nivo-nav { gap:.7rem; }
  .nivo-nav nav { font-size:.9rem; }
}
#mathLevels { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); max-width:40rem; }
#mathLevels button { min-width:0; text-align:center; background:var(--blue); }
#mathLevels button:nth-child(-n+6) { background:var(--mint); }
#mathLevels button:last-child { background:var(--yellow); }
#mathLevels [aria-pressed="true"] { background:var(--yellow); }
.math-level-label { margin:.55rem 0 .4rem; font-weight:850; }
#mathGuide { background:#f8fbfb; }
#mathExample { font-weight:700; }
#mathExampleSolution { font-weight:750; }
.challenge-steps.math-course-steps { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media(max-width:560px) {
  .challenge-steps.math-course-steps { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.math-course-block {
  margin:.85rem 0; padding:clamp(.85rem, 3vw, 1.25rem);
  border:2px solid #fff; border-radius:1rem; background:#fafdfd;
}
.math-course-block h3 { margin:0 0 .55rem; }
.math-course-block p { margin:.45rem 0; }
.math-objective { font-weight:800; }
.math-course-tips {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap:.55rem; margin-top:.85rem;
}
.math-course-tips > p { background:#e8f3ed; padding:.6rem .75rem; border-radius:.6rem; margin:0; }
.math-course-tips strong { display:block; margin-bottom:.15rem; }
.math-guided-choices { display:grid; gap:.45rem; margin:.8rem 0; }
.math-guided-choices button { text-align:left; background:#edf6fb; border-color:#c0d2d7; }
.math-guided-choices button[data-answer="correct"] { background:#cceedd; border-color:#40826b; font-weight:800; }
.math-guided-choices button[aria-disabled="true"] { cursor:default; }
.math-guided-feedback:not(:empty) { border-left:.25rem solid #40826b; padding:.45rem .7rem; background:#e8f3ed; }
.math-guided-feedback[data-tone="retry"]:not(:empty) { border-color:#ae781e; background:#fff3cf; }
#mathQuizBack { margin-top:.7rem; }
#mathSkill { margin:.55rem 0 0; }
@media(max-width:460px) { #mathLevels { grid-template-columns:repeat(4,minmax(0,1fr)); } }
.fraction-lab { background:var(--yellow); margin-bottom:1rem; }
.fraction-tiles { display:grid; grid-template-columns:repeat(var(--parts,4),minmax(0,1fr)); gap:2px; margin:.65rem 0; }
.fraction-tile { display:block; min-height:1.65rem; padding:0; border:1px solid #71919e; border-radius:.2rem; background:#f9e2a5; }
.fraction-tile[data-filled="true"] { background:#257b69; border-color:#185848; }
#fractionTiles button { min-height:2.75rem; }
#fractionParts { width:min(100%,18rem); accent-color:#257b69; vertical-align:middle; }
#fractionPartsCount { padding:.25rem; font-weight:800; }
#fractionFeedback, #fractionReadout { font-weight:750; }
.math-fraction-review { margin:.75rem 0; padding:.65rem .85rem; border:2px solid var(--line); border-radius:.85rem; background:var(--mint); }
.math-fraction-review h3 { margin:.2rem 0; }
.fraction-equation { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; font-weight:800; font-size:1.25rem; }
.stacked-fraction { display:inline-grid; text-align:center; min-width:1.6rem; line-height:1.15; }
.stacked-fraction span:first-child { border-bottom:2px solid currentColor; }
.math-steps li { padding:.2rem 0; }
#mathReviewCheck { font-weight:750; }
.math-problem {
  margin:.85rem 0; padding:.8rem .95rem; border:2px solid var(--line);
  border-radius:1rem; background:var(--blue);
}
.math-problem p { margin:0 0 .45rem; }
.math-problem h3 { margin:.15rem 0 .6rem; font-size:1.15rem; }

.math-visual {
  background:#fffaf0; border:2px solid #c0d2d7; border-radius:1rem;
  padding:clamp(.75rem, 3vw, 1.2rem); margin:.75rem 0; min-width:0;
}
.math-visual h3 { margin:0 0 .45rem; }
.math-visual-figure { margin:.75rem 0; padding:.75rem; background:#edf6fb; border-radius:.65rem; }
.math-visual-figure figcaption { margin-top:.65rem; }
.math-visual-diagram { display:grid; gap:.6rem; justify-items:start; }
.math-visual-group { width:100%; }
.math-visual-label { font-weight:700; margin-bottom:.25rem; }
.math-visual-tiles {
  width:min(100%, calc(var(--columns) * 1.55rem)); display:grid;
  grid-template-columns:repeat(var(--columns), minmax(0, 1fr)); gap:2px;
}
.math-visual-tiles > span { aspect-ratio:1; border:1px solid #56758a; border-radius:.15rem; background:#fff; }
.math-visual-tiles .math-visual-filled {
  background:repeating-linear-gradient(135deg,#28736a 0 5px,#599087 5px 8px);
}
.math-visual-strip { width:min(100%, 12rem); gap:0; }
.math-visual-strip > span { aspect-ratio:auto; height:1.5rem; border-radius:0; }
.math-visual-strip > span + span { border-left:0; }
.math-visual-ticks {
  display:flex; justify-content:space-between; max-width:27rem; width:100%; list-style:none;
  border-top:2px solid #526d81; padding:0; margin:.5rem 0 0;
}
.math-visual-ticks > li { min-width:1.3em; text-align:center; font-variant-numeric:tabular-nums; }
.math-visual-ticks > li::before { content:""; display:block; width:2px; height:.4rem; margin:0 auto; background:#526d81; }
.math-visual-marked { font-weight:800; text-decoration:underline; text-underline-offset:.2em; }
.math-visual-perimeter {
  display:grid; align-items:center; justify-items:center; gap:.25rem; width:min(100%, 17rem);
  grid-template:" . top . " auto " left shape right " auto " . bottom . " auto / max-content minmax(0,1fr) max-content;
}
.math-visual-perimeter::before { content:""; grid-area:shape; width:100%; aspect-ratio:5/2; border:3px solid #28736a; }
.math-visual-perimeter span:nth-child(1) { grid-area:top; }
.math-visual-perimeter span:nth-child(2) { grid-area:left; }
.math-visual-perimeter span:nth-child(3) { grid-area:right; }
.math-visual-perimeter span:nth-child(4) { grid-area:bottom; }
.math-visual-decimal { border-collapse:collapse; width:min(100%, 23rem); text-align:center; }
.math-visual-decimal th, .math-visual-decimal td { border:1px solid #8fa4b3; padding:.25rem; }
.math-visual-decimal th { font-size:clamp(.72rem, 2.4vw, .9rem); }
.math-visual-decimal td:nth-child(2) { background:#ffeab0; font-weight:800; }
.math-visual-flow { display:grid; gap:.35rem; list-style:none; margin:0; padding:0; }
.math-visual-flow > li { background:white; border-left:.25rem solid #28736a; border-radius:.35rem; padding:.3rem .55rem; }
.math-visual-plot { display:block; width:min(100%, 32.5rem); height:auto; }
.math-visual-solution { padding-left:1.4em; margin:.55rem 0; }
.math-visual-solution:empty { display:none; }
.math-visual-solution > li + li { margin-top:.4rem; }
.math-visual-transfer { margin:.85rem 0 .5rem; }
.math-visual-transfer strong { display:block; }
#mathVisualReveal[aria-disabled="true"] { cursor:default; background:#e8f4eb; }
.nivo-tutor {
  margin:.75rem 0; padding:clamp(.75rem, 2.5vw, 1.15rem); min-width:0;
  border:2px solid #b8cfd5; border-radius:.9rem; background:#f2faf8; color:#243c4f;
}
.nivo-tutor > h3 { margin:0 0 .45rem; }
.nivo-tutor p { margin:.5rem 0; }
.nivo-tutor-options { display:flex; flex-wrap:wrap; gap:.4rem; }
.nivo-tutor-options [aria-pressed="true"], .nivo-tutor .actions [aria-pressed="true"] {
  background:#cbeadf; border-color:#487e71; font-weight:750;
}
.nivo-tutor-text { line-height:1.6; }
.nivo-tutor-reference {
  white-space:pre-line; margin:.6rem 0; padding:.5rem .7rem; border-left:.2rem solid #437e72;
  background:#e0f0ec; font-weight:750;
}
.nivo-tutor-guidance { padding:.45rem .65rem; border-radius:.5rem; background:#fff2cd; }
.nivo-tutor-status:empty { display:none; }
.nivo-tutor audio { display:block; max-width:100%; }
.nivo-tutor-extra { background:#e4f1f5; }
.nivo-tutor-suggestion {
  margin:.65rem 0; padding:.5rem .8rem .75rem;
  border-radius:.7rem; background:#fff2cd;
}
.nivo-tutor-suggestion p { margin:.2rem 0 .55rem; }
.nivo-personal { background:#f2faf8; margin:.4rem 0 1rem; }
.nivo-personal form { max-width:29rem; margin-top:.65rem; }
#nameAudioStatus { margin:.4rem 0 0; }
.nivo-coach-line {
  margin:.45rem 0 .65rem; padding:.45rem .7rem; border-radius:.6rem;
  background:#f4faf8; color:#243c4f;
}
.nivo-coach-exchange { margin-top:.75rem; border-top:1px solid #bad5cd; padding-top:.45rem; }
.nivo-coach-prompt { font-weight:750; }
.nivo-coach-reply:not(:empty) {
  padding:.55rem .7rem; border-radius:.55rem; background:#e0f0ec; color:#243c4f;
}
.nivo-coach-reply:empty { display:none; }
.nivo-tutor-ai { margin:.85rem 0 0; background:#fffdf7; border-color:#b8cfd5; }
.nivo-tutor-ai form, .nivo-tutor-ai label { display:grid; gap:.4rem; }
.nivo-tutor-ai form button { justify-self:start; }
.nivo-tutor-ai textarea { width:100%; resize:vertical; }
.nivo-tutor-thread { list-style:none; padding:0; margin:.5rem 0; }
.nivo-tutor-thread:empty { display:none; }
.nivo-tutor-thread > li { margin:.5rem 0 .75rem; }
.nivo-tutor-question, .nivo-tutor-answer { padding:.5rem .7rem; border-radius:.65rem; overflow-wrap:anywhere; }
.nivo-tutor-question { background:#e4f1fa; font-weight:700; }
.nivo-tutor-answer { background:#e8f4ee; white-space:pre-wrap; }
