:root {
  --navy: #153a63;
  --blue: #1789dd;
  --sky: #eaf7ff;
  --line: #cfe2ef;
  --yellow: #ffd34e;
  --pink: #ff7da7;
  --green: #62bf75;
  --orange: #ffad33;
  --ink: #173755;
  --paper: #fff;
  --bg: #f4f9fc;
  --shadow: 0 12px 34px rgba(21, 58, 99, 0.1);
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: Inter, "Noto Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
}
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.icon-button,
.spec-toggle,
.small-button,
.spec-head button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.icon-button {
  width: 42px;
  height: 42px;
  font-size: 20px;
}
.brand {
  font-size: 25px;
  font-weight: 950;
  color: var(--blue);
  white-space: nowrap;
}
.brand span {
  color: var(--orange);
}
.stage-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.stage-title strong {
  background: var(--blue);
  color: #fff;
  padding: 9px 13px;
  border-radius: 11px;
}
.stage-title span {
  font-weight: 800;
}
.progress-wrap {
  width: 130px;
  text-align: right;
  font-weight: 900;
}
.progress {
  height: 7px;
  background: #e3eef5;
  border-radius: 9px;
  margin-top: 5px;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 12.5%;
  background: var(--green);
  transition: 0.35s;
}
.sync-status {
  display: block;
  margin-top: 4px;
  color: #587083;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.spec-toggle {
  padding: 10px 13px;
}
.account-actions {
  display: flex;
  gap: 8px;
}
.account-actions button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}
.account-actions button:last-child {
  border-color: #f0c8bd;
  color: #a9412f;
}
.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}
.step-rail {
  padding: 24px 16px;
  background: #edf8ff;
  border-right: 1px solid var(--line);
}
.step-rail h2 {
  font-size: 16px;
  margin: 0 8px 14px;
}
.step-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 11px 12px;
  margin: 6px 0;
  border-radius: 13px;
  font-weight: 750;
  line-height: 1.3;
}
.step-button.active {
  background: #ccecff;
  border-color: #65bcec;
}
.step-button.done {
  background: #effaf1;
  border-color: #bce1c3;
}
.rail-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border-radius: 17px;
  padding: 13px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}
.rail-note p {
  margin: 1px 0;
  font-size: 14px;
  line-height: 1.45;
}
.mapi-dot {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 950;
}
.lesson {
  padding: 24px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}
.mobile-stage {
  display: none;
}
.question-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px 24px;
  border-left: 7px solid var(--orange);
  box-shadow: var(--shadow);
}
.book-label {
  font-size: 13px;
  font-weight: 900;
  color: #9a6500;
  letter-spacing: 0.04em;
}
.question-card h1 {
  font-size: 24px;
  margin: 8px 0;
}
.question-card p {
  margin: 0;
  line-height: 1.55;
}
.workspace {
  display: block;
  margin-top: 18px;
}
.visual-card,
.guide-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.visual-head {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}
.small-button {
  padding: 7px 11px;
}
.visual {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.guide-card {
  margin-top: 18px;
  padding: 19px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 88px minmax(0, 1fr);
  gap: 11px 10px;
  align-content: start;
}
.guide-card p {
  font-size: 14px;
  line-height: 1.5;
  margin: 4px 0 16px;
}
.character {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 950;
}
.character.mapi {
  background: var(--yellow);
}
.character.paha {
  background: #ffd4e1;
}
.equation {
  margin-top: 18px;
  background: var(--navy);
  color: #fff;
  border-radius: 18px;
  padding: 19px;
  text-align: center;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 900;
  letter-spacing: 0.02em;
}
.equation .accent {
  color: #ffd45c;
}
.blank {
  display: inline-grid;
  place-items: center;
  min-width: 55px;
  border-bottom: 3px solid #fff;
}
.controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}
.controls button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.primary {
  border: 0;
  background: var(--blue);
  color: #fff;
}
.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.spec-panel {
  position: fixed;
  z-index: 40;
  right: 0;
  top: 0;
  width: min(420px, 92vw);
  height: 100vh;
  background: #fff;
  box-shadow: -18px 0 50px rgba(21, 58, 99, 0.2);
  padding: 22px;
  transform: translateX(105%);
  transition: 0.3s;
  overflow: auto;
}
.spec-panel.open {
  transform: none;
}
.spec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
}
.spec-head button {
  width: 38px;
  height: 38px;
  font-size: 23px;
}
.spec-panel section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 13px;
}
.spec-panel h2 {
  font-size: 16px;
  margin: 0 0 9px;
}
.spec-panel li,
.spec-panel p {
  line-height: 1.55;
  font-size: 14px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chips span {
  background: #e9f5ff;
  color: #075e9e;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}
.book-work {
  width: min(520px, 92%);
  border: 3px dashed #f1b43a;
  border-radius: 22px;
  padding: 28px;
  text-align: center;
  background: #fffaf0;
}
.book-icon {
  font-size: 70px;
}
.book-work h3 {
  font-size: 25px;
  margin: 12px;
}
.answer {
  font-size: 54px;
  font-weight: 950;
  color: var(--blue);
}
.decompose {
  display: flex;
  gap: 34px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.bond {
  width: 190px;
  text-align: center;
}
.bond .top {
  font-size: 32px;
  font-weight: 950;
}
.bond .branches {
  display: flex;
  justify-content: space-around;
  margin-top: 30px;
  position: relative;
}
.bond .branches:before,
.bond .branches:after {
  content: "";
  position: absolute;
  top: -23px;
  width: 55px;
  border-top: 3px solid var(--navy);
}
.bond .branches:before {
  left: 31px;
  transform: rotate(-24deg);
}
.bond .branches:after {
  right: 31px;
  transform: rotate(24deg);
}
.bond .branches span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--sky);
  font-size: 23px;
  font-weight: 950;
}
.area-wrap {
  position: relative;
  width: min(520px, 88vw);
  padding: 54px 0 0 54px;
}
.area-label-x {
  position: absolute;
  left: 54px;
  right: 0;
  top: 13px;
  display: grid;
  grid-template-columns: 5fr 1fr;
  text-align: center;
  font-weight: 900;
}
.area-label-y {
  position: absolute;
  left: 8px;
  top: 54px;
  bottom: 0;
  display: grid;
  grid-template-rows: 10fr 3fr;
  align-items: center;
  font-weight: 900;
}
.area-model {
  height: 300px;
  display: grid;
  grid-template-columns: 5fr 1fr;
  grid-template-rows: 10fr 3fr;
  position: relative;
  overflow: visible;
}
.area-model > div {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  font-weight: 950;
  font-size: 19px;
}
.area-a {
  background: #cdeeff;
  border-color: #368ac8 !important;
}
.area-b {
  background: #ffccdc;
  border-color: #df4c78 !important;
}
.area-c {
  background: #d9f3d7;
  border-color: #62a95e !important;
}
.area-d {
  background: #ffe9ac;
  border-color: #d19d22 !important;
}
.area-b.focus {
  box-shadow: 0 0 0 7px rgba(255, 125, 167, 0.25);
  animation: pulse 1s infinite alternate;
}
.area-b.moving {
  position: relative;
  z-index: 4;
  animation: movePiece 1.2s forwards;
}
.area-model.moved .area-b {
  opacity: 0;
}
.moved-piece {
  position: absolute;
  left: 0;
  top: calc(100% + 16px);
  height: 56px;
  width: 83.333%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffccdc;
  border: 2px solid #df4c78;
  font-weight: 950;
  opacity: 0;
  transform: translateY(-12px);
}
.area-model.moved .moved-piece {
  animation: arrive 0.4s 1s forwards;
}
.width-brace {
  position: absolute;
  left: 54px;
  right: 16.667%;
  bottom: -100px;
  text-align: center;
  font-weight: 950;
  color: #b94f00;
  opacity: 0;
}
.area-model.moved ~ .width-brace {
  animation: arrive 0.4s 1.2s forwards;
}
.groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 560px;
}
.calc-box {
  background: var(--sky);
  border-radius: 20px;
  padding: 24px 30px;
  font-size: 28px;
  font-weight: 950;
  line-height: 1.8;
  text-align: center;
}
.finish {
  display: grid;
  gap: 14px;
  text-align: center;
}
.finish .seal {
  width: 92px;
  height: 92px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 7px double #e75050;
  border-radius: 50%;
  color: #e75050;
  font-size: 34px;
  font-weight: 950;
  transform: rotate(-8deg);
}
@keyframes pulse {
  to {
    transform: scale(1.025);
  }
}
@keyframes movePiece {
  0% {
    transform: none;
  }
  65% {
    transform: translate(-260px, 340px) rotate(90deg);
  }
  100% {
    transform: translate(-245px, 355px) rotate(90deg);
    opacity: 0;
  }
}
@keyframes arrive {
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .step-rail {
    display: none;
  }
  .lesson {
    padding: 18px;
  }
  .mobile-stage {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .guide-card {
    grid-template-columns: 42px 1fr;
  }
  .stage-title span {
    display: none;
  }
  .visual {
    min-height: 400px;
  }
  .progress-wrap {
    width: 90px;
  }
  .spec-toggle {
    font-size: 0;
  }
  .spec-toggle:after {
    content: "仕様";
    font-size: 14px;
  }
}
@media (max-width: 580px) {
  .topbar {
    height: 62px;
    padding: 0 12px;
    gap: 9px;
  }
  .brand {
    font-size: 19px;
  }
  .stage-title {
    display: none;
  }
  .progress-wrap {
    flex: 1;
  }
  .account-actions {
    gap: 5px;
  }
  .account-actions button {
    min-height: 38px;
    padding: 0 9px;
    font-size: 12px;
  }
  .lesson {
    padding: 12px;
  }
  .question-card {
    padding: 16px 17px;
  }
  .question-card h1 {
    font-size: 20px;
  }
  .visual {
    min-height: 360px;
    padding: 17px;
  }
  .area-wrap {
    transform: scale(0.78);
    width: 480px;
  }
  .guide-card {
    padding: 15px;
  }
  .controls button {
    padding: 0 13px;
    font-size: 14px;
  }
  .equation {
    padding: 15px;
  }
  .book-icon {
    font-size: 55px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.area-wrap.move-stage {
  padding-bottom: 120px;
}
.move-stage .area-label-y {
  bottom: 120px;
}
.moved-side-label {
  position: absolute;
  left: 8px;
  top: 370px;
  height: 56px;
  display: flex;
  align-items: center;
  font-weight: 950;
  opacity: 0;
}
.area-model.moved .area-b {
  opacity: 1;
}
.moving-clone {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffccdc;
  border: 2px solid #df4c78;
  font-weight: 950;
  font-size: 19px;
  box-sizing: border-box;
  box-shadow: 0 12px 30px rgba(223, 76, 120, 0.28);
  pointer-events: none;
}
.model-frame {
  width: min(430px, 78vw);
  height: 270px;
  border: 3px solid var(--navy);
  position: relative;
  background: #fff;
}
.frame-top,
.frame-side,
.dimension-box {
  display: grid;
  place-items: center;
  background: #fff;
  border: 3px solid var(--navy);
  font-size: 26px;
  font-weight: 950;
}
.frame-top {
  position: absolute;
  width: 74px;
  height: 58px;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
}
.frame-side {
  position: absolute;
  width: 74px;
  height: 58px;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
}
.frame-top.filled,
.frame-side.filled,
.dimension-box.filled {
  color: #f05c32;
}
.dimension-box {
  width: 58px;
  height: 44px;
  margin: auto;
}
.area-label-x {
  align-items: center;
}
.area-label-y {
  justify-items: center;
}
.calc-question {
  text-align: center;
  font-size: 34px;
}
.calc-question p {
  font-size: 17px;
  font-weight: 600;
}
.calc-box strong {
  color: #e74f2c;
}
.guide-card { column-gap: 14px; }
.character-image {
  width: 88px;
  height: 100px;
  object-fit: contain;
  align-self: start;
}
.rail-note {
  align-items: center;
}
.rail-character {
  width: 56px;
  height: 64px;
  object-fit: contain;
  flex: 0 0 auto;
}
.guide-card b {
  display: block;
  margin-top: 5px;
}
.character-image,
.rail-character {
  filter: drop-shadow(0 5px 8px rgba(21, 58, 99, 0.12));
}
@media (max-width: 580px) {
  .guide-card {
    grid-template-columns: 72px 1fr;
  }
  .character-image {
    width: 72px;
    height: 84px;
  }
  .rail-character {
    width: 48px;
    height: 54px;
  }
}
.quiz-prompt,
.quiz-result {
  width: min(520px, 92%);
  min-height: 220px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px;
}
.quiz-prompt {
  background: #fff8dc;
  border: 3px dashed #efba34;
  font-size: 22px;
}
.quiz-prompt img {
  width: 130px;
  height: 130px;
  object-fit: contain;
}
.quiz-result {
  font-size: 22px;
}
.quiz-result.correct {
  background: #eaf8ec;
  border: 3px solid #78c987;
}
.quiz-result.try-again {
  background: #fff4df;
  border: 3px solid #f1bd58;
}
.quiz-result p {
  font-size: 16px;
  margin: 10px 0 0;
}
.quiz-input {
  width: 120px;
  height: 58px;
  border: 3px solid #fff;
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 950;
  text-align: center;
  vertical-align: middle;
}
.quiz-input:focus {
  outline: 4px solid #ffd45c;
  outline-offset: 3px;
}
.quiz-input.needs-answer {
  border-color: #ff8a65;
  animation: pulse 0.25s 2 alternate;
}
.quiz-input::-webkit-inner-spin-button {
  appearance: none;
}
.brand-logo {
  display: block;
  width: auto;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}
@media (max-width: 580px) {
  .brand-logo {
    height: 43px;
  }
}
.stm-book-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
  padding: 11px 18px;
  border: 3px solid #f2b52d;
  border-radius: 15px;
  background: #fff5c9;
  color: var(--navy);
  font-size: clamp(19px, 2.2vw, 26px);
  font-weight: 950;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 5px 0 #f2b52d;
}
.stm-book-prompt img {
  width: 104px;
  height: 74px;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 7px;
  box-shadow: 0 4px 10px rgba(21, 58, 99, 0.22);
  transform: rotate(-2deg);
  flex: 0 0 auto;
}
.stm-book-prompt[hidden] {
  display: none;
}
@media (max-width: 580px) {
  .stm-book-prompt {
    gap: 11px;
    margin-top: 13px;
    padding: 9px 10px;
    font-size: 18px;
    border-width: 2px;
    box-shadow: 0 4px 0 #f2b52d;
  }
  .stm-book-prompt img {
    width: 85px;
    height: 60px;
    border-width: 2px;
  }
}
.stage-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 850;
  color: var(--navy);
  white-space: nowrap;
}
.stage-picker button {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}
.stage-picker button b { display: inline-grid; place-items: center; min-width: 25px; height: 25px; margin-left: 5px; border-radius: 8px; background: #168ad9; color: #fff; }
.bond-scene {
  width: min(590px, 100%);
  display: grid;
  gap: 28px;
  justify-items: center;
}
.ten-balls {
  display: grid;
  grid-template-columns: repeat(5, 58px);
  gap: 13px;
  padding: 20px 23px;
  border: 4px solid #2c72ad;
  border-radius: 24px;
  background: #eef8ff;
}
.ball {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #d9e7ef;
  border: 3px solid #a9bdc9;
  display: grid;
  place-items: center;
  font-weight: 950;
  color: #fff;
  transition:
    background 0.35s,
    border-color 0.35s,
    transform 0.35s;
}
.bond-scene.revealed .ball.used {
  background: #ff8a4c;
  border-color: #dc5c22;
  transform: translateY(-3px);
}
.bond-scene.revealed .ball.left {
  background: #27a9e8;
  border-color: #0879b7;
  transform: translateY(3px);
}
.number-bond {
  position: relative;
  width: 300px;
  height: 160px;
}
.bond-node {
  position: absolute;
  width: 84px;
  height: 84px;
  border: 4px solid #173f6b;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 31px;
  font-weight: 950;
  z-index: 2;
}
.bond-total {
  left: 108px;
  top: 0;
}
.bond-part-a {
  left: 20px;
  bottom: 0;
}
.bond-part-b {
  right: 20px;
  bottom: 0;
}
.bond-line {
  position: absolute;
  top: 76px;
  width: 125px;
  height: 4px;
  background: #173f6b;
  transform-origin: center;
}
.bond-line.left {
  left: 55px;
  transform: rotate(36deg);
}
.bond-line.right {
  right: 55px;
  transform: rotate(-36deg);
}
.bond-scene.revealed .bond-part-a {
  color: #dc5c22;
  border-color: #dc5c22;
}
.bond-scene.revealed .bond-part-b {
  color: #0879b7;
  border-color: #0879b7;
}
.bond-legend {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-weight: 850;
}
.bond-legend span:before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -2px;
}
.bond-legend .used-key:before {
  background: #ff8a4c;
}
.bond-legend .left-key:before {
  background: #27a9e8;
}
@media (max-width: 760px) {
  .stage-picker {
    font-size: 0;
  }
  .stage-picker button {
    font-size: 13px;
  }
  .ten-balls {
    grid-template-columns: repeat(5, 44px);
    gap: 8px;
    padding: 15px;
  }
  .ball {
    width: 44px;
    height: 44px;
  }
  .number-bond {
    transform: scale(0.86);
    margin: -10px 0;
  }
  .bond-scene {
    gap: 18px;
  }
}
.practice-intersections15 {
  display: grid;
  grid-template-columns: 58px minmax(260px, 520px);
  grid-template-rows: 38px minmax(260px, 430px) 42px;
  align-items: center;
  justify-content: center;
  width: min(650px, 96%);
  margin: 0 auto;
  color: #29495f;
  font-weight: 900;
}
.practice-axis-top15 { grid-column: 2; font-size: 18px; }
.practice-axis-left15 { grid-row: 2; line-height: 1.25; }
.practice-grid15 {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
  border: 3px solid #29495f;
  background: #fff;
}
.practice-grid15 i {
  display: grid;
  place-items: center;
  border-right: 1px solid #9db1bf;
  border-bottom: 1px solid #9db1bf;
}
.practice-grid15 i:nth-child(9n) { border-right: 0; }
.practice-grid15 i:nth-last-child(-n+9) { border-bottom: 0; }
.practice-grid15 i.active { background: #e7f7ff; }
.practice-grid15 i b {
  width: clamp(8px, 1.2vw, 14px);
  height: clamp(8px, 1.2vw, 14px);
  border-radius: 50%;
  background: #ef5030;
  box-shadow: 0 0 0 3px #fff;
  animation: intersectionPop .32s calc(var(--order) * 35ms) both;
}
.practice-intersections15 figcaption { grid-column: 1 / -1; font-size: 21px; }
.practice-visual.has-image .practice-intersections15 ~ .correct-hanamaru {
  inset: 8px 8px auto auto;
  width: 68px;
  height: 68px;
  font-size: 47px;
  transform: rotate(-8deg);
  animation-name: hanamaru-in-flow;
}
@media (max-width: 600px) {
  .practice-intersections15 { grid-template-columns: 42px minmax(220px, 1fr); grid-template-rows: 32px minmax(220px, 78vw) 38px; }
}
@media (max-width: 580px) {
  .stage-picker {
    position: absolute;
    right: 72px;
  }
  .spec-toggle {
    font-size: 0;
    padding: 9px;
  }
  .spec-toggle:after {
    content: "設計";
    font-size: 13px;
  }
  .ten-balls {
    grid-template-columns: repeat(5, 39px);
    gap: 7px;
  }
  .ball {
    width: 39px;
    height: 39px;
  }
  .bond-scene {
    gap: 10px;
  }
  .number-bond {
    transform: scale(0.78);
    margin: -18px 0;
  }
  .bond-legend {
    font-size: 14px;
  }
}
.bond-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.bond-svg line {
  stroke: #173f6b;
  stroke-width: 4;
  stroke-linecap: round;
}
.bond-scene.revealed .ball.used {
  animation: bondPop 0.42s ease both;
}
.bond-scene.revealed .ball.left {
  animation: bondPop 0.42s 0.18s ease both;
}
.bond-scene.revealed .bond-node {
  animation: bondNode 0.5s 0.28s ease both;
}
@keyframes bondPop {
  0% {
    opacity: 0.35;
    transform: scale(0.65);
  }
  70% {
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
  }
}
@keyframes bondNode {
  0% {
    opacity: 0.3;
    transform: scale(0.78);
  }
  75% {
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
  }
}
.numberline-scene {
  width: min(680px, 100%);
  display: grid;
  gap: 16px;
  justify-items: center;
}
.numberline-svg {
  width: 100%;
  max-width: 620px;
  overflow: visible;
}
.numberline-svg .axis,
.numberline-svg g line {
  stroke: #31516f;
  stroke-width: 3;
  stroke-linecap: round;
}
.numberline-svg text {
  font-family: inherit;
  font-size: 16px;
  font-weight: 850;
  text-anchor: middle;
  fill: #31516f;
}
.numberline-svg .jump {
  fill: none;
  stroke: #f05c32;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 500;
  animation: drawJump 0.8s ease both;
}
.numberline-svg .jump-1 {
  animation-delay: 0.55s;
}
.numberline-svg .jump-label {
  fill: #e44f2c;
  font-size: 19px;
  animation: bondNode 0.35s 0.55s ease both;
}
.numberline-svg .start-dot {
  fill: #ffb23f;
}
.numberline-svg .end-dot {
  fill: #f05c32;
}
.numberline-svg .point-label {
  fill: #e44f2c;
  font-size: 18px;
}
.line-bond {
  transform: scale(0.82);
  margin: -22px 0;
}
.line-bond .bond-part-b {
  color: #e44f2c;
  border-color: #e44f2c;
}
.numberline-scene:not(.revealed) .line-bond .bond-part-b {
  color: #173f6b;
  border-color: #173f6b;
}
@keyframes drawJump {
  from {
    stroke-dashoffset: 500;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@media (max-width: 580px) {
  .numberline-svg {
    min-width: 330px;
  }
  .line-bond {
    transform: scale(0.72);
    margin: -30px 0;
  }
}
.dot-scene {
  display: grid;
  gap: 24px;
  justify-items: center;
  width: min(650px, 100%);
}
.dot-board {
  width: 480px;
  height: 300px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 52px);
  grid-template-rows: repeat(4, 52px);
  gap: 16px;
  place-content: center;
  border: 4px solid #2c72ad;
  border-radius: 24px;
  background: #f4fbff;
}
.array-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #27a9e8;
  border: 3px solid #0879b7;
  display: block;
  animation: dotSettle 0.55s calc(var(--n) * 0.025s) ease both;
}
.dot-board .c1 {
  background: #ff8a4c;
  border-color: #db5b22;
}
.dot-board .c2 {
  background: #ffd34d;
  border-color: #d8a900;
}
.dot-board .c3 {
  background: #48c77c;
  border-color: #209552;
}
.dot-board .c4 {
  background: #8d7bea;
  border-color: #6351bd;
}
.dot-scene.scatter .dot-board {
  display: block;
}
.dot-scene.scatter .array-dot {
  position: absolute;
  left: calc(25px + (var(--n) * 73) %410px);
  top: calc(20px + (var(--n) * 47) %235px);
}
.dot-board.three {
  grid-template-columns: repeat(4, 52px);
  grid-template-rows: repeat(3, 52px);
}
.dot-note {
  padding: 12px 24px;
  border-radius: 999px;
  background: #e9f5ff;
  color: var(--navy);
  font-size: 24px;
  font-weight: 950;
  animation: bondNode 0.5s ease both;
}
@keyframes dotSettle {
  from {
    opacity: 0.3;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (max-width: 580px) {
  .dot-board {
    width: 310px;
    height: 235px;
    grid-template-columns: repeat(6, 35px);
    grid-template-rows: repeat(4, 35px);
    gap: 10px;
  }
  .array-dot {
    width: 31px;
    height: 31px;
    border-width: 2px;
  }
  .dot-board.three {
    grid-template-columns: repeat(4, 35px);
    grid-template-rows: repeat(3, 35px);
  }
  .dot-note {
    font-size: 18px;
  }
  .dot-scene.scatter .array-dot {
    left: calc(15px + (var(--n) * 43) %270px);
    top: calc(15px + (var(--n) * 31) %190px);
  }
}
.dot-scene.scatter .array-dot {
  left: var(--sx);
  top: var(--sy);
  transform: translate(-50%, -50%);
}
.intersection-scene {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(620px, 100%);
}
.intersection-svg {
  width: min(520px, 100%);
  overflow: visible;
}
.grid-lines line {
  stroke: #536575;
  stroke-width: 2;
}
.grid-lines text,
.axis-title {
  font-family: inherit;
  fill: #284863;
  font-size: 16px;
  font-weight: 850;
  text-anchor: middle;
}
.axis-title {
  font-size: 18px;
}
.axis-title.vertical {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transform-origin: 17px 151px;
}
.intersection-dot {
  fill: #424d57;
  stroke: #fff;
  stroke-width: 2;
}
.intersection-scene.revealed .intersection-dot {
  fill: #ee4b3f;
  animation: intersectionPop 0.38s calc(var(--n, 0) * 0.04s) ease both;
}
.tidy-arrow {
  fill: none;
  stroke: #f4a51c;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: arrowBounce 1.2s ease-in-out infinite;
}
.intersection-note {
  padding: 10px 24px;
  border-radius: 999px;
  background: #eaf6ff;
  color: var(--navy);
  font-size: 22px;
  font-weight: 850;
}
.intersection-note b {
  color: #ee4b3f;
}
@keyframes intersectionPop {
  from {
    opacity: 0.25;
    transform: scale(0.55);
    transform-origin: center;
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes arrowBounce {
  50% {
    transform: translateY(8px);
  }
}
@media (max-width: 580px) {
  .intersection-note {
    font-size: 17px;
    padding: 9px 16px;
  }
  .intersection-svg {
    min-width: 320px;
  }
}
.factor-controls {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border: 3px solid #b9d8ed;
  border-radius: 18px;
  background: #f3faff;
}
.factor-controls label {
  display: grid;
  gap: 5px;
  color: #284863;
  font-size: 15px;
  font-weight: 850;
  text-align: center;
}
.factor-controls b {
  padding-bottom: 8px;
  font-size: 28px;
}
.factor-controls strong {
  padding-bottom: 9px;
  color: #ee4b3f;
  font-size: 20px;
}
.factor-input {
  width: 76px;
  height: 52px;
  border: 3px solid #2e83bd;
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font: 900 25px/1 inherit;
  text-align: center;
}
.factor-input:focus {
  outline: 4px solid #ffd869;
  outline-offset: 2px;
}
.intersection-scene.relation .intersection-dot,
.intersection-scene.create .intersection-dot {
  fill: #ee4b3f;
  animation: intersectionPop 0.32s ease both;
}
@media (max-width: 580px) {
  .factor-controls {
    gap: 9px;
    padding: 9px 12px;
  }
  .factor-input {
    width: 62px;
    height: 46px;
  }
  .factor-controls strong {
    width: 100%;
    padding: 0;
    text-align: center;
  }
}
.sate-scene {
  display: grid;
  justify-items: center;
  gap: 20px;
  width: min(680px, 100%);
}
.place-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 150px));
  border: 3px solid #234f73;
  border-radius: 15px;
  overflow: hidden;
  background: #fff;
}
.place-table > * {
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 7px;
  border-right: 2px solid #9ab3c5;
}
.place-table > *:nth-child(3n) {
  border-right: 0;
}
.place-table > b {
  background: #e9f6ff;
  color: #234f73;
  font-size: 18px;
}
.place-table > div {
  border-top: 2px solid #9ab3c5;
  font-size: 27px;
  font-weight: 900;
}
.place-number.changed,
.changed,
.answer-digit {
  color: #ef503e;
  animation: bondNode 0.5s ease both;
}
.hundred-token {
  display: grid;
  place-items: center;
  width: 92px;
  height: 70px;
  border: 4px solid #ef9f24;
  border-radius: 15px;
  background: #fff5da;
  color: #7d4c00;
  font-size: 27px;
  font-weight: 950;
}
.exchange-line,
.group-prompt,
.division-result {
  padding: 12px 22px;
  border-radius: 14px;
  background: #fff4d8;
  color: #173f6b;
  font-size: 22px;
  font-weight: 900;
}
.exchange-line {
  display: flex;
  gap: 20px;
  align-items: center;
}
.exchange-line b,
.division-result {
  color: #ef503e;
}
.sate-transfer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}
.sate-transfer section {
  display: grid;
  gap: 9px;
  justify-items: center;
  padding: 14px;
  border-radius: 16px;
  background: #f3faff;
  min-width: 210px;
}
.sate-sticks {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.sate-stick {
  position: relative;
  display: flex;
  align-items: center;
  padding-right: 20px;
}
.sate-stick:after {
  content: "";
  position: absolute;
  left: 1px;
  right: 0;
  height: 3px;
  background: #9b6633;
  z-index: 0;
}
.sate-stick i {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  border: 2px solid #9b5429;
  border-radius: 45% 55% 48% 52%;
  background: #e99a44;
}
.sate-scene .revealed .sate-stick {
  animation: bondNode 0.4s ease both;
}
.remainder {
  color: #ef503e;
  font-weight: 900;
}
.transfer-arrow {
  color: #ef9f24;
  font-size: 25px;
}
.summary-sticks {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.division-result {
  font-size: 28px;
}
.sate-transfer.compact section {
  min-width: 230px;
}
@media (max-width: 650px) {
  .place-table {
    grid-template-columns: repeat(3, minmax(82px, 1fr));
    width: 100%;
  }
  .place-table > b {
    font-size: 15px;
  }
  .sate-transfer {
    flex-direction: column;
    gap: 10px;
  }
  .transfer-arrow {
    transform: rotate(90deg);
  }
  .sate-transfer.compact .transfer-arrow {
    transform: none;
  }
  .exchange-line,
  .group-prompt {
    font-size: 17px;
  }
  .sate-stick i {
    width: 17px;
    height: 17px;
  }
}
.divisor-sate {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 18px;
  border: 3px solid #f1b64c;
  border-radius: 16px;
  background: #fff7df;
}
.divisor-sate strong {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #173f6b;
  color: #fff;
  font-size: 24px;
}
.divisor-sate small {
  color: #6e4a1f;
  font-size: 15px;
  font-weight: 850;
}
.place-table > div:has(.place-dots) {
  align-content: center;
  gap: 5px;
  min-height: 112px;
}
.place-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 116px;
}
.place-dots i {
  width: 17px;
  height: 17px;
  border: 2px solid #3d505e;
  border-radius: 50%;
  background: #fff;
}
.cell-count {
  font-size: 15px;
  color: #34536a;
  font-weight: 900;
}
.exchange-ten i {
  animation: splitTen 0.65s calc(var(--i) * 0.06s) ease both;
}
.hundred-one i {
  width: 23px;
  height: 23px;
}
.exchange-hint {
  color: #536b7d;
  font-size: 17px;
  font-weight: 800;
}
.grouped-tens {
  display: grid;
  gap: 6px;
}
.formed-stick {
  position: relative;
  display: block;
}
.formed-stick:after {
  content: "";
  position: absolute;
  left: 3px;
  right: -12px;
  top: 50%;
  height: 3px;
  background: #9b6633;
}
.formed-stick .place-dots {
  position: relative;
  z-index: 1;
  flex-wrap: nowrap;
}
.formed-stick .place-dots i {
  background: #e99a44;
  border-color: #9b5429;
  animation: meatColor 0.5s ease both;
}
.loose-dots .place-dots {
  justify-content: flex-start;
}
.transfer-story {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 14px;
  background: #eef8ff;
  color: #294e69;
  font-size: 17px;
  font-weight: 850;
}
.transfer-story b {
  color: #ef503e;
}
.sate-scene .sate-sticks {
  animation: bondNode 0.5s 0.45s ease both;
}
@keyframes splitTen {
  from {
    opacity: 0;
    transform: translateX(-120px) scale(0.25);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
@keyframes meatColor {
  from {
    background: #fff;
    border-color: #3d505e;
  }
  to {
    background: #e99a44;
    border-color: #9b5429;
  }
}
@media (max-width: 650px) {
  .divisor-sate {
    padding: 8px 12px;
  }
  .divisor-sate small {
    font-size: 13px;
  }
  .place-table > div:has(.place-dots) {
    min-height: 104px;
  }
  .place-dots {
    gap: 4px;
  }
  .place-dots i {
    width: 14px;
    height: 14px;
  }
  .transfer-story {
    font-size: 15px;
  }
}
.two-phase .grouped-tens,
.two-phase .phase-one {
  animation: phaseOne 0.55s ease both;
}
.ones-later {
  display: grid;
  gap: 7px;
  justify-items: center;
  opacity: 0;
  animation: phaseTwo 0.65s 2.1s ease forwards;
}
.two-phase .phase-two {
  opacity: 0;
  animation: phaseTwo 0.55s 1.65s ease forwards;
}
.two-phase .formed-stick .place-dots i {
  animation: meatColor 0.6s 0.35s ease both;
}
.two-phase .loose-dots .place-dots i {
  animation: remainderPulse 0.7s 1s ease both;
}
.two-phase .ones-later .sate-sticks {
  animation: none;
}
@keyframes phaseOne {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes phaseTwo {
  from {
    opacity: 0;
    transform: translateX(-45px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes remainderPulse {
  50% {
    background: #ffe067;
    border-color: #e49b00;
    transform: scale(1.25);
  }
}
.summary-sticks {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 150px));
  align-items: start;
  width: auto;
  gap: 0;
}
.summary-place {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 8px;
  min-height: 145px;
  padding: 8px 5px;
  color: #284863;
  font-size: 16px;
  font-weight: 850;
}
.summary-place .sate-sticks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}
.summary-place .sate-stick {
  justify-self: center;
}
@media (max-width: 650px) {
  .summary-sticks {
    grid-template-columns: repeat(3, minmax(82px, 1fr));
    width: 100%;
  }
  .summary-place {
    min-height: 135px;
    padding-inline: 2px;
    font-size: 14px;
  }
  .summary-place .sate-stick i {
    width: 14px;
    height: 14px;
  }
  .summary-place .sate-stick {
    padding-right: 14px;
  }
}

/* Stage 2: Buku SANSU strip and 100-grid */
.stage2-tens {
  display: grid;
  gap: 18px;
  width: min(760px, 96%);
}
.ten-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  min-height: 118px;
  border: 3px solid #253a4b;
}
.ten-box {
  display: grid;
  place-items: center;
  border-right: 1.5px solid #253a4b;
  background: #fff;
  color: #23394a;
  font-size: 19px;
}
.ten-box:last-child {
  border-right: 0;
}
.ten-box.filled {
  background: #ff572d;
  color: #fff;
  animation: stage2Fill 0.35s calc(var(--i) * 0.09s) ease both;
}
.stage2-brace {
  display: grid;
  grid-template-columns: var(--used, 6fr) var(--rest, 4fr);
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}
.stage2-brace span:first-child {
  color: #e84926;
}
.stage2-brace span:last-child {
  color: #17699b;
}
.stage2-grid-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(170px, 240px);
  gap: 38px;
  align-items: center;
  width: min(760px, 96%);
}
.hundred-board {
  position: relative;
}
.hundred-cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  aspect-ratio: 1;
  border: 2.5px solid #263d4e;
}
.hundred-cells i {
  display: grid;
  place-items: center;
  border-right: 1px solid #344c5d;
  border-bottom: 1px solid #344c5d;
  background: #fff;
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}
.hundred-cells i:nth-child(10n) {
  border-right: 0;
}
.hundred-cells i:nth-last-child(-n + 10) {
  border-bottom: 0;
}
.hundred-cells i.given {
  background: #c6c8ca;
}
.hundred-cells i.answer-ten {
  background: #ff5730;
  animation: stage2Answer 0.35s calc(var(--n) * 0.012s) ease both;
}
.hundred-cells i.answer-one {
  background: #ff7a36;
  color: #fff;
  animation: stage2Answer 0.35s calc(var(--n) * 0.012s) ease both;
}
.given-number {
  position: absolute;
  left: 20%;
  top: 46%;
  font-size: 24px;
  color: #222;
}
.stage2-fields {
  display: grid;
  gap: 14px;
}
.stage2-fields label {
  display: grid;
  grid-template-columns: 1fr 86px;
  align-items: center;
  gap: 14px;
  font-size: 18px;
  font-weight: 800;
}
.stage2-fields b {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 2px solid #263d4e;
  background: #fff;
  color: #f05231;
  font-size: 27px;
}
@keyframes stage2Fill {
  from {
    background: #fff;
    color: #23394a;
  }
  to {
    background: #ff572d;
    color: #fff;
  }
}
@keyframes stage2Answer {
  from {
    opacity: 0.2;
    transform: scale(0.75);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (max-width: 720px) {
  .ten-strip {
    min-height: 76px;
  }
  .ten-box {
    font-size: 13px;
  }
  .stage2-brace {
    font-size: 14px;
  }
  .stage2-grid-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .hundred-board {
    width: min(330px, 88vw);
    margin: auto;
  }
  .stage2-fields {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .stage2-fields label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: center;
    font-size: 14px;
  }
  .stage2-fields b {
    width: 100%;
    min-height: 48px;
    font-size: 22px;
  }
  .given-number {
    font-size: 19px;
  }
}

/* Stage 2 / 78: Buku stops at 70, then one ten is opened to find the ones complement. */
.special-78 .hundred-board {
  padding-top: 38px;
  padding-left: 34px;
}
.stage2-top-scale {
  position: absolute;
  left: 34px;
  right: 0;
  top: 0;
  height: 32px;
  display: grid;
  grid-template-columns: 7fr 1fr 2fr;
  align-items: end;
  text-align: center;
  font-size: 18px;
  font-weight: 950;
  color: #244b69;
}
.stage2-top-scale span {
  padding: 3px 0;
  border-bottom: 3px solid currentColor;
}
.stage2-top-scale .scale-70 {
  grid-column: 1;
}
.stage2-top-scale .scale-30 {
  grid-column: 2/4;
  color: #ee5834;
}
.stage2-top-scale .scale-10 {
  grid-column: 2;
  color: #f19b20;
}
.stage2-top-scale .scale-20 {
  grid-column: 3;
  color: #1789dd;
}
.stage2-side-scale {
  position: absolute;
  left: 0;
  top: 38px;
  bottom: 0;
  width: 28px;
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  color: #31516f;
}
.hundred-cells i.borrowed-ten-used {
  background: #ffe0a3;
  color: #7a4b00;
  animation: stage2Borrow 0.45s calc(var(--n) * 0.018s) ease both;
}
.special-78 .hundred-cells i.answer-ten {
  background: #43a8e3;
}
.special-78 .hundred-cells i.answer-one {
  background: #ff683c;
}
.stage2-rule {
  position: absolute;
  left: 34px;
  right: 0;
  bottom: -58px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 9px;
  border-radius: 13px;
  background: #eef8ff;
  color: #284d69;
  font-size: 18px;
  font-weight: 900;
  animation: stage2Answer 0.45s 1s both;
}
.stage2-rule b {
  color: #ee5834;
}
.stage2-rule span:first-of-type {
  color: #e18914;
}
.stage2-rule span:last-of-type,
.stage2-rule strong {
  color: #e94e2d;
}
.special-78 {
  padding-bottom: 54px;
}
.special-78 .stage2-fields {
  gap: 9px;
}
.special-78 .stage2-fields label {
  grid-template-columns: 1fr 72px;
  font-size: 16px;
}
.special-78 .stage2-fields b {
  min-height: 50px;
  font-size: 23px;
}
@keyframes stage2Borrow {
  from {
    opacity: 0.25;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (max-width: 720px) {
  .special-78 {
    padding-bottom: 48px;
  }
  .special-78 .hundred-board {
    padding-top: 33px;
    padding-left: 30px;
  }
  .stage2-top-scale {
    left: 30px;
    height: 28px;
    font-size: 15px;
  }
  .stage2-side-scale {
    top: 33px;
    width: 24px;
    font-size: 11px;
  }
  .stage2-rule {
    left: 30px;
    bottom: -52px;
    gap: 7px;
    font-size: 15px;
  }
  .special-78 .stage2-fields {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Keep every line in the 100-board continuous and every cell perfectly square. */
.stage2-grid-layout {
  grid-template-columns: minmax(280px, 400px) minmax(170px, 240px);
  width: min(730px, 96%);
}
.hundred-board {
  width: min(400px, 100%);
}
.hundred-cells {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1/1;
  border-width: 3px;
  box-sizing: border-box;
}
.hundred-cells i {
  min-width: 0;
  min-height: 0;
  border: 0 !important;
  box-shadow: inset -1px -1px 0 #344c5d;
  box-sizing: border-box;
}
.hundred-cells i:nth-child(10n) {
  box-shadow: inset 0 -1px 0 #344c5d;
}
.hundred-cells i:nth-last-child(-n + 10) {
  box-shadow: inset -1px 0 0 #344c5d;
}
.hundred-cells i:last-child {
  box-shadow: none;
}
@media (max-width: 720px) {
  .hundred-board {
    width: min(330px, 88vw);
  }
}

/* Stage 3: the same three-by-ten boxes used in Buku SANSU. */
.stage3-scene {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 26px;
  width: min(780px, 100%);
  align-items: start;
}
.place-value-panel {
  display: grid;
  gap: 10px;
}
.place-value-panel h3 {
  margin: 0 28px 2px;
  text-align: center;
  color: #233f59;
  font-size: 22px;
}
.place-value-row {
  display: grid;
  align-items: center;
  gap: 7px;
}
.place-value-row.left {
  grid-template-columns: 24px 1fr;
}
.place-value-row.right {
  grid-template-columns: 1fr 24px;
}
.place-value-row > span {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  height: 42px;
  border: 3px solid #263d4e;
  background: #fff;
}
.place-value-row i {
  display: block;
  border-right: 1px solid #263d4e;
  box-sizing: border-box;
}
.place-value-row i:last-child {
  border-right: 0;
}
.place-value-row i.filled {
  background: #ff5932;
  animation: stage3Fill 0.32s calc(var(--i) * 0.035s) ease both;
}
.place-value-row > b {
  color: #ef5030;
  font-size: 15px;
  text-align: center;
}
.stage3-total {
  grid-column: 1/-1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 12px 20px;
  border-radius: 15px;
  background: #edf8ff;
  color: #244b69;
  font-size: 24px;
  font-weight: 900;
}
.stage3-total span,
.stage3-total strong {
  color: #ef5030;
}
@keyframes stage3Fill {
  from {
    opacity: 0.2;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.place-quiz-input {
  width: 86px;
}
@media (max-width: 720px) {
  .stage3-scene {
    grid-template-columns: 1fr;
    gap: 18px;
    width: min(420px, 100%);
  }
  .place-value-panel h3 {
    font-size: 19px;
  }
  .place-value-row > span {
    height: 34px;
  }
  .stage3-total {
    grid-column: 1;
    font-size: 20px;
  }
  .place-quiz-input {
    width: 64px;
  }
}

/* Stage 5: Buku bar model, with only the complement piece moving to make 10. */
.make10-scene {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(620px, 94%);
}
.make10-expression {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 34px;
  color: #234765;
}
.make10-expression b {
  display: grid;
  place-items: center;
  width: 74px;
  height: 58px;
  border: 3px solid #264962;
  background: #fff;
}
.make10-bars {
  display: flex;
  width: 100%;
  height: 76px;
}
.make10-bars span {
  flex: var(--size);
  display: grid;
  place-items: center;
  border: 3px solid #263d4e;
  border-right: 0;
  background: #fff;
  color: #234765;
  font-size: 25px;
  font-weight: 900;
  box-sizing: border-box;
}
.make10-bars span:last-child {
  border-right: 3px solid #263d4e;
}
.make10-transfer {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  width: 100%;
  align-items: center;
  text-align: center;
  color: #ef5633;
  font-size: 18px;
  font-weight: 900;
}
.make10-transfer b {
  font-size: 30px;
  color: #f0a21d;
}
.make10-bars.result {
  animation: make10Rise 0.65s ease both;
}
.make10-bars.result .remainder-bar {
  background: #dff2ff;
}
.make10-bars.result .moved-bar {
  background: #ffd365;
  animation: moveComplement 0.85s ease both;
}
.make10-bars.result .ten-bar {
  background: #ff6540;
  color: #fff;
}
.make10-answer,
.direct-total {
  padding: 10px 24px;
  border-radius: 999px;
  background: #edf8ff;
  color: #234765;
  font-size: 23px;
  font-weight: 900;
}
.make10-answer strong {
  color: #ef5030;
}
.make10-bars.direct span:first-child {
  background: #dff2ff;
}
.make10-bars.direct span:last-child {
  background: #fff0c6;
}
.direct-total {
  animation: make10Rise 0.5s ease both;
}
.make10-place {
  display: grid;
  grid-template-columns: repeat(2, 170px);
  gap: 18px;
  justify-content: center;
}
.make10-place > div {
  display: grid;
  border: 3px solid #274961;
  background: #fff;
  text-align: center;
}
.make10-place span {
  padding: 10px;
  background: #eaf7ff;
  color: #274961;
  font-weight: 900;
}
.make10-place b {
  padding: 18px;
  color: #ef5030;
  font-size: 34px;
}
.make10-place p {
  grid-column: 1/-1;
  margin: 0;
  text-align: center;
  color: #274961;
  font-size: 20px;
  font-weight: 850;
}
.make10-digits {
  display: grid;
  gap: 8px;
  justify-items: center;
}
.digit-note,
.digit-row {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  gap: 20px;
  text-align: center;
}
.digit-note {
  color: #ef5030;
  font-size: 20px;
  font-weight: 900;
}
.digit-row b {
  display: grid;
  place-items: center;
  height: 112px;
  border: 4px solid #263d4e;
  background: #fff;
  color: #ef5030;
  font-size: 48px;
}
.make10-digits p {
  margin: 5px 0 0;
  color: #244b69;
  font-size: 24px;
  font-weight: 900;
}
@keyframes moveComplement {
  0% {
    opacity: 0.25;
    transform: translate(-90px, -75px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
@keyframes make10Rise {
  from {
    opacity: 0.25;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 580px) {
  .make10-expression {
    font-size: 27px;
  }
  .make10-expression b {
    width: 60px;
    height: 50px;
  }
  .make10-bars {
    height: 60px;
  }
  .make10-bars span {
    font-size: 20px;
  }
  .make10-answer,
  .direct-total {
    font-size: 19px;
  }
  .make10-place {
    grid-template-columns: repeat(2, 130px);
  }
  .make10-place p {
    font-size: 16px;
  }
  .digit-note,
  .digit-row {
    grid-template-columns: repeat(2, 86px);
    gap: 14px;
  }
  .digit-row b {
    height: 86px;
    font-size: 38px;
  }
}
.make10-bars.result .ten-bar {
  position: relative;
  overflow: hidden;
}
.make10-bars.result .moving-part {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--move) * 10%);
  display: grid;
  place-items: center;
  background: #ffd365;
  color: #7a4b00;
  font-size: 15px;
  font-style: normal;
  animation: moveComplement 0.85s ease both;
}

/* Stage 6–7: shared dot difference and equal-shift models. */
.difference-scene {
  display: grid;
  gap: 18px;
  width: min(760px, 96%);
}
.difference-scene label {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: center;
  color: #264964;
  font-weight: 900;
}
.difference-dots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 5px;
}
.difference-dots i,
.crossout-scene i {
  display: block;
  aspect-ratio: 1;
  border: 2px solid #344c5d;
  border-radius: 50%;
  background: #fff;
}
.difference-dots i.original-dot {
  background: #ff633e;
  border-color: #bd3f25;
  animation: dotSettle 0.35s ease both;
}
.difference-dots i.added-dot {
  background: #aeb7bd;
  border-color: #65747e;
  animation: addDot 0.55s ease both;
}
.difference-dots em {
  position: absolute;
  left: 50%;
  top: -20px;
  color: #254762;
  font-size: 14px;
  font-style: normal;
  font-weight: 900;
}
.difference-dots em:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  height: 36px;
  border-left: 3px solid #254762;
}
.difference-note {
  justify-self: center;
  padding: 10px 22px;
  border-radius: 999px;
  background: #eef8ff;
  color: #284d69;
  font-size: 20px;
  font-weight: 900;
}
.difference-note b {
  color: #ef5030;
}
.crossout-scene {
  display: grid;
  grid-template-columns: repeat(14, 34px);
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.crossout-scene i.crossed {
  position: relative;
  background: #eee;
}
.crossout-scene i.crossed:after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  border-top: 4px solid #ef5030;
  transform: rotate(40deg);
}
.crossout-scene b {
  grid-column: 1/-1;
  text-align: center;
  color: #ef5030;
  font-size: 24px;
}
.shortcut-scene {
  display: grid;
  gap: 22px;
  justify-items: center;
}
.shortcut-number {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 46px;
  font-weight: 950;
  color: #244966;
}
.shortcut-number span {
  font-size: 30px;
}
.shortcut-bond {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 18px 24px;
  border: 3px solid #a9d2eb;
  border-radius: 18px;
  background: #f1faff;
  color: #244966;
  font-size: 21px;
  font-weight: 900;
}
.shortcut-bond span {
  padding: 9px 13px;
  border-radius: 10px;
  background: #fff;
}
.shortcut-bond strong {
  color: #ef5030;
}
.shift-scene {
  display: grid;
  gap: 13px;
  justify-items: center;
  width: min(610px, 94%);
}
.shift-original,
.shift-result {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 42px minmax(130px, 1fr);
  align-items: center;
  width: 100%;
  text-align: center;
}
.shift-original span,
.shift-result span {
  padding: 18px;
  border: 3px solid #284a63;
  background: #fff;
  color: #284a63;
  font-size: 28px;
  font-weight: 950;
}
.shift-original b,
.shift-result b {
  font-size: 27px;
}
.shift-actions {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  width: 100%;
  text-align: center;
  color: #ef5030;
  font-size: 19px;
  font-weight: 900;
}
.shift-actions b {
  color: #efa21e;
}
.shift-result {
  animation: make10Rise 0.55s ease both;
}
.shift-result span {
  background: #eaf7ff;
  color: #ef5030;
}
.shift-result strong {
  grid-column: 1/-1;
  margin-top: 13px;
  color: #ef5030;
  font-size: 28px;
}
@keyframes addDot {
  from {
    opacity: 0.15;
    transform: translateX(-40px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 620px) {
  .difference-scene label {
    grid-template-columns: 48px 1fr;
    font-size: 14px;
  }
  .difference-dots {
    gap: 2px;
  }
  .difference-dots i {
    border-width: 1.5px;
  }
  .crossout-scene {
    grid-template-columns: repeat(7, 32px);
  }
  .shortcut-number {
    font-size: 38px;
  }
  .shortcut-bond {
    font-size: 17px;
    padding: 14px;
  }
  .shift-original,
  .shift-result {
    grid-template-columns: minmax(95px, 1fr) 34px minmax(95px, 1fr);
  }
  .shift-original span,
  .shift-result span {
    padding: 14px;
    font-size: 23px;
  }
}

.stm19 { width: min(820px, 95%); margin: auto; padding: clamp(20px, 3vw, 38px); border-radius: 30px; text-align: center; color: #153d68; box-sizing: border-box; overflow: hidden; }
.stm19 h3 { margin: 0 0 22px; font-size: clamp(25px, 3.4vw, 44px); letter-spacing: .03em; }
.route19 { background: linear-gradient(145deg,#fff8d8,#e7f7ff); box-shadow: inset 0 0 0 3px #f0bd38; }
.route19 > div { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; }
.route19 section { display: grid; gap: 7px; padding: 17px 10px; border-radius: 22px; background: #fff; box-shadow: 0 9px 20px #315a7b20; animation: stm19-rise .55s both; }
.route19 section:nth-of-type(2) { animation-delay: .14s; }
.route19 section:nth-of-type(3) { animation-delay: .28s; }
.route19 section b { margin: auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: #168bd0; }
.route19 section strong { font-size: clamp(45px, 7vw, 78px); line-height: 1; color: #e8791c; }
.route19 section span { font-weight: 800; }
.route19 > div > i { font-size: clamp(30px, 4vw, 48px); color: #168bd0; font-style: normal; }
.path19 { background: #eaf8ff; box-shadow: inset 0 0 0 3px #54b7e8; }
.number-path19 { display: flex; justify-content: center; align-items: center; gap: clamp(8px,2vw,22px); }
.number-path19 span { display: grid; place-items: center; width: clamp(72px,11vw,112px); aspect-ratio: 1; border-radius: 50%; background: #fff; border: 5px solid #168bd0; font-size: clamp(34px,6vw,62px); font-weight: 900; }
.number-path19 i { padding: 10px 14px; border-radius: 999px; background: #ffd75a; font-size: clamp(24px,4vw,42px); font-weight: 900; font-style: normal; animation: stm19-slide .65s both; }
.path19 p { margin: 18px 0 0; font-size: clamp(18px,2.2vw,26px); font-weight: 800; }
.spotlight19 { background: #fff1e3; box-shadow: inset 0 0 0 3px #f39a42; }
.expression19 { font-size: clamp(38px,7vw,78px); font-weight: 900; }
.spotlight19 mark, .lane19 mark, .compare19 mark { padding: .08em .2em; border-radius: .25em; background: #ffd84f; color: #183e66; }
.work19 { margin: 24px auto 0; width: fit-content; padding: 12px 22px; border-radius: 16px; background: #fff; font-size: clamp(20px,2.7vw,30px); font-weight: 800; }
.lane19 { background: linear-gradient(180deg,#eefbea,#fff); box-shadow: inset 0 0 0 3px #64bd72; }
.lane-expression19 { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: clamp(32px,6vw,68px); font-weight: 900; }
.lane-expression19 em { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #168bd0; color: #fff; font-size: 22px; font-style: normal; }
.lane-result19 { margin-top: 24px; padding-top: 18px; border-top: 5px solid #64bd72; font-size: clamp(21px,3vw,32px); font-weight: 850; }
.bracket19 { background: #f4efff; box-shadow: inset 0 0 0 3px #8d6bd5; }
.bracket19 > div { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 18px; font-size: clamp(34px,6vw,70px); font-weight: 900; }
.paren19 { padding: .16em .3em; border-radius: 22px; color: #762f9d; background: #fff; box-shadow: 0 0 0 6px #c6a8ef; animation: stm19-pulse 1.5s ease-in-out infinite; }
.bracket19 i { font-style: normal; }
.bracket19 p { font-size: clamp(18px,2.5vw,28px); font-weight: 800; }
.compare19 { background: linear-gradient(135deg,#eef8ff,#fff4e8); box-shadow: inset 0 0 0 3px #68b9e6; }
.compare19 > div { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.compare19 section { display: grid; gap: 12px; padding: 20px 12px; border-radius: 22px; background: #fff; border: 3px solid #9bcfea; }
.compare19 section:last-child { border-color: #f0a443; }
.compare19 small { font-weight: 900; color: #567087; }
.compare19 strong { font-size: clamp(27px,4vw,48px); }
.compare19 b { font-size: clamp(30px,5vw,56px); color: #e36f24; }
.compare19 span { font-weight: 800; }
.summary19 { background: #123f6d; color: #fff; box-shadow: inset 0 0 0 3px #ffd14a; }
.summary19 > div { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.summary19 section { display: grid; gap: 6px; padding: 18px 10px; border-radius: 20px; background: #fff; color: #153d68; }
.summary19 section b { margin: auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #ffd14a; }
.summary19 section strong { font-size: clamp(40px,6vw,68px); color: #e8791c; }
.summary19 section span { font-weight: 800; }
@keyframes stm19-rise { from { opacity:0; transform:translateY(22px); } to { opacity:1; transform:none; } }
@keyframes stm19-slide { from { opacity:.25; transform:translateX(-18px); } to { opacity:1; transform:none; } }
@keyframes stm19-pulse { 50% { transform:scale(1.05); box-shadow:0 0 0 10px #c6a8ef66; } }
@media (max-width: 760px) {
  .route19 > div { grid-template-columns: 1fr; gap: 8px; }
  .route19 section { grid-template-columns: 38px minmax(95px,.7fr) 1fr; align-items:center; text-align:left; padding:10px 14px; }
  .route19 section strong { font-size: clamp(39px,10vw,58px); }
  .route19 > div > i { transform:rotate(90deg); line-height:.7; }
  .compare19 > div, .summary19 > div { grid-template-columns: 1fr; }
  .summary19 section { grid-template-columns: 38px minmax(92px,.6fr) 1fr; align-items:center; text-align:left; padding:10px 14px; }
  .summary19 section strong { font-size: clamp(38px,10vw,56px); }
  .number-path19 { gap: 6px; }
  .number-path19 i { padding:8px; }
}

/* Batch QA fixes: keep the Stage 15/18 learning models inside tablet and phone panels. */
.relation15-new,
.intersection-shell15 {
  max-width: 100%;
  box-sizing: border-box;
}
.intersection-shell15 {
  width: min(560px, 100%);
  padding-right: 12px;
}
.intersection-grid15-new {
  min-width: 0;
}

.buku-work18,
.buku-area18,
.buku-area18 .area,
.buku-area18 .area > section {
  min-width: 0;
  box-sizing: border-box;
}
.buku-area18 .area {
  overflow: hidden;
}
.buku-area18 .area > section {
  height: 100%;
  align-self: stretch;
}
.buku-area18 .area > section:not(.rest) > b,
.buku-area18 .area > .rest > b {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}
.buku-fields18 {
  min-width: 0;
}
.quiz-instruction18,
.quiz-instruction18 b,
.quiz-instruction18 span {
  color: #fff;
}
.quiz-instruction18.needs-choice {
  color: #fff;
  background: #b63d29;
}

/* Supabase-backed Practice */
.practice-loading,
.practice-no-image {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  color: #29495f;
  text-align: center;
}
.practice-loading { font-size: 22px; font-weight: 900; }
.practice-loading.error { color: #c84532; }
.practice-visual {
  position: relative;
  display: grid;
  place-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}
.practice-image {
  display: block;
  width: auto;
  max-width: min(760px, 100%);
  max-height: 430px;
  object-fit: contain;
  border-radius: 12px;
}
.hundred-grid2 {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(430px, 90%);
  margin: 0;
  color: #29495f;
  font-weight: 900;
}
.hundred-grid2 > div {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-top: 2px solid #29495f;
  border-left: 2px solid #29495f;
  background: #fff;
}
.hundred-grid2 span {
  min-width: 0;
  min-height: 0;
  border-right: 2px solid #29495f;
  border-bottom: 2px solid #29495f;
  background: #fff;
}
.hundred-grid2 span.filled { background: #62bce8; }
.hundred-grid2 figcaption { font-size: 18px; }
.practice-no-image span { color: #718596; font-size: 14px; font-weight: 800; }
.practice-no-image b { max-width: 650px; font-size: 26px; line-height: 1.45; }
.correct-hanamaru {
  position: relative;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  box-shadow: 0 12px 32px rgba(32,72,103,.2);
  font-size: 92px;
  line-height: 1;
  flex: none;
  margin: 4px auto;
  transform: rotate(-8deg);
  animation: hanamaru-in-flow .55s cubic-bezier(.2,.85,.25,1.25) both;
  pointer-events: none;
}
.practice-visual.has-image .correct-hanamaru {
  position: absolute;
  inset: 50% auto auto 50%;
  margin: 0;
  transform: translate(-50%,-50%) rotate(-8deg);
  animation-name: hanamaru-in-overlay;
}
.practice-visual.no-image.correct {
  min-height: 168px;
  padding: 8px 0;
}
@keyframes hanamaru-in-flow {
  from { opacity: 0; transform: scale(.35) rotate(-20deg); }
  to { opacity: 1; transform: scale(1) rotate(-8deg); }
}
@keyframes hanamaru-in-overlay {
  from { opacity: 0; transform: translate(-50%,-50%) scale(.35) rotate(-20deg); }
  to { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-8deg); }
}
.practice-feedback {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 18px;
}
.practice-feedback.correct { background: #e8f8ed; color: #247944; }
.practice-feedback.wrong { background: #fff0ea; color: #b9402b; }
.practice-feedback span { font-size: 24px; font-weight: 950; }
.practice-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.practice-choices button {
  min-width: 130px;
  min-height: 54px;
  padding: 10px 18px;
  border: 3px solid #c9dce8;
  border-radius: 14px;
  background: #fff;
  color: #29495f;
  font-family: inherit;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.25;
  touch-action: manipulation;
}
.practice-choices button.selected { border-color: #f0b72e; background: #fff4c9; }
.practice-choices.needs-answer { outline: 4px solid #f06c52; outline-offset: 5px; border-radius: 14px; }
.practice-input-wrap,
.practice-answer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}
.practice-input-wrap input {
  width: min(280px, 55vw);
  height: 58px;
  border: 4px solid #abd4eb;
  border-radius: 14px;
  background: #fff;
  color: #173f67;
  text-align: center;
  font-family: inherit;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}
.practice-input-wrap input.needs-answer { border-color: #f06c52; }
.mastery-active .question-card { position: sticky; top: 0; z-index: 14; }
body.mastery-active {
  overflow: hidden;
}
.mastery-active .shell {
  height: calc(100dvh - 72px);
  min-height: 0;
  overflow: hidden;
}
.mastery-active .lesson {
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.mastery-active.practice-no-visual .workspace { grid-template-columns: 1fr; }
.mastery-active.practice-no-visual .guide-card { grid-template-columns: 88px minmax(0, 1fr) 88px minmax(0, 1fr); align-items: start; }
.mastery-active.practice-no-visual .guide-card > div { min-width: 0; }
.mastery-active.practice-no-visual .guide-card p { overflow-wrap: anywhere; }
.mastery-active.practice-no-visual .guide-card p { margin-bottom: 0; }
.practice-entry { display: grid; gap: 14px; justify-items: center; width: min(620px, 100%); }
.practice-keypad { display: grid; grid-template-columns: repeat(4, minmax(52px, 1fr)); gap: 8px; width: 100%; }
.practice-keypad button { min-height: 48px; border: 3px solid #9bcbe5; border-radius: 13px; background: #fff; color: #173f67; font-family: inherit; font-size: 21px; font-weight: 950; touch-action: manipulation; cursor: pointer; }
.practice-keypad button:active { transform: translateY(1px); background: #eaf7ff; }
.practice-keypad .key-operator { border-color: #79bce2; background: #eaf7ff; color: #0e6fa8; font-size: 25px; }
.practice-keypad .key-back { border-color: #f2c35a; background: #fff6d9; }
.practice-keypad .key-ok { border-color: #5ac276; background: #e9f8ed; color: #247944; }
.practice-answer-line strong { color: #ffd54f; font-size: 30px; }
.practice-choice-entry, .practice-result-panel { display: grid; justify-items: center; gap: 14px; width: min(760px, 100%); }
.practice-inline-check, .practice-result-panel > button { min-width: 180px; min-height: 52px; padding: 8px 22px; border: 3px solid #5ac276; border-radius: 14px; background: #fff; color: #247944; font: inherit; font-size: 19px; font-weight: 950; cursor: pointer; }
.practice-result-panel > button { border-color: #45a6df; background: #168ad9; color: #fff; }
.practice-loading.light { color: #fff; }
.practice-retry { min-width: 180px; min-height: 54px; border: 3px solid #fff; border-radius: 14px; background: #168ad9; color: #fff; font: inherit; font-size: 18px; font-weight: 950; cursor: pointer; }
.completion-hanamaru { display: grid; place-items: center; width: 132px; height: 132px; flex: 0 0 132px; margin: 8px auto; padding: 6px; overflow: visible; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 12px 32px rgba(32,72,103,.2); font-size: 88px; line-height: 1; animation: hanamaru-in-static .55s cubic-bezier(.2,.85,.25,1.25) both; }
.completion-panel { display: flex; align-items: center; justify-content: center; gap: 22px; min-height: 164px; padding: 10px; overflow: visible; flex-wrap: wrap; }
.completion-panel > button { min-width: 190px; min-height: 56px; padding: 9px 22px; border: 3px solid #fff; border-radius: 15px; background: #168ad9; color: #fff; font: inherit; font-size: 19px; font-weight: 950; cursor: pointer; }
@keyframes hanamaru-in-static { from { opacity: 0; transform: scale(.35) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(-8deg); } }
@media (max-width: 620px) {
  .topbar {
    display: grid;
    grid-template-columns: 42px auto minmax(0, 1fr) auto;
    grid-template-rows: 44px 38px;
    height: 100px;
    min-height: 100px;
    padding: 7px 12px;
  }
  .topbar .icon-button { grid-column: 1; grid-row: 1; }
  .topbar .brand-logo { grid-column: 2; grid-row: 1; }
  .topbar .stage-picker { grid-column: 4; grid-row: 1; }
  .topbar .account-actions { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  body.mastery-active .lesson {
    display: flex;
    flex-direction: column;
    max-height: none;
  }
  .mastery-active .shell { height: calc(100dvh - 100px); }
  body.mastery-active .question-card { top: 0; }
  body.mastery-active .workspace {
    display: contents;
  }
  body.mastery-active .question-card { order: 1; top: 0; max-height: none; overflow: visible; padding: 14px 17px; border-radius: 17px; }
  body.mastery-active .question-card h1 { margin: 6px 0; font-size: 20px; line-height: 1.35; }
  body.mastery-active .question-card p { font-size: 15px; line-height: 1.4; }
  body.mastery-active .guide-card { order: 2; margin-top: 12px; }
  body.mastery-active .visual-card { order: 3; margin-top: 12px; }
  body.mastery-active .equation { order: 4; margin-top: 12px; }
  body.mastery-active .controls { order: 5; margin-top: 12px; }
  body.mastery-active .visual { min-height: 0; padding: 18px 14px; }
  body.mastery-active .practice-image { max-height: 260px; }
  body.mastery-active .practice-no-image { min-height: 132px; padding: 14px 10px; }
  body.mastery-active .visual-head { height: 44px; }
  body.mastery-active .practice-input-wrap { gap: 10px; }
  body.mastery-active .practice-input-wrap input {
    width: min(220px, 58vw);
    height: 52px;
    font-size: 24px;
  }
  .practice-entry { gap: 10px; }
  .practice-keypad { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .practice-keypad button { min-height: 48px; font-size: 20px; }
  .completion-hanamaru { width: 112px; height: 112px; font-size: 78px; }
  .practice-image { max-height: 310px; }
  .practice-no-image { min-height: 190px; }
  .practice-no-image b { font-size: 20px; }
  .practice-choices button {
    min-width: 104px;
    min-height: 58px;
    padding: 9px 16px;
    font-size: 22px;
  }
  .correct-hanamaru { width: 104px; height: 104px; font-size: 72px; }
  .hundred-grid2 { width: min(330px, 92%); }
  .hundred-grid2 figcaption { font-size: 16px; }
}
@media (min-width: 621px) and (max-width: 980px) {
  .mastery-active .question-card { top: 0; max-height: none; overflow: visible; }
  .mastery-active.practice-no-visual .guide-card { grid-template-columns: 72px minmax(0, 1fr) 72px minmax(0, 1fr); }
  .mastery-active.practice-no-visual .character-image { width: 72px; height: 84px; }
}
@media (min-width: 621px) and (max-width: 1180px) {
  body.mastery-active .lesson {
    display: flex;
    flex-direction: column;
  }
  body.mastery-active .workspace { display: contents; }
  body.mastery-active .question-card { order: 1; }
  body.mastery-active .guide-card { order: 2; margin-top: 14px; }
  body.mastery-active .visual-card { order: 3; margin-top: 14px; min-width: 0; }
  body.mastery-active .equation { order: 4; margin-top: 14px; }
  body.mastery-active .guide-card {
    grid-template-columns: 64px minmax(0, 1fr) 64px minmax(0, 1fr);
  }
  body.mastery-active .controls { order: 5; margin-top: 14px; }
  body.mastery-active .visual { min-height: 0; padding: 18px; }
  body.mastery-active .practice-image { max-height: 300px; }
}

.practice-groups8 {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(760px, 100%);
  margin: 0;
  color: #24465f;
}
.practice-groups8 > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 16px;
  width: 100%;
}
.group-box8 {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 13px;
  border: 3px solid #63b9e8;
  border-radius: 17px;
  background: #f8fdff;
  opacity: 0;
  transform: translateY(14px) scale(.96);
  animation: group8-in .34s ease-out calc(var(--group) * .22s) forwards;
}
.group-box8 > b {
  position: absolute;
  left: 50%;
  bottom: -14px;
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 27px;
  transform: translateX(-50%);
  border: 2px solid #d8e8f1;
  border-radius: 9px;
  background: #fff;
  color: #176fa7;
  font-size: 15px;
}
.group-box8 > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.group-box8 i {
  width: 20px;
  height: 20px;
  border: 3px solid #e7483f;
  border-radius: 50%;
  background: #ff765e;
  opacity: 0;
  transform: scale(.2);
  animation: item8-pop .28s cubic-bezier(.2,.8,.3,1.3) calc(var(--group) * .22s + var(--item) * .07s + .2s) forwards;
}
.practice-groups8 figcaption {
  padding: 10px 18px;
  border-radius: 999px;
  background: #eaf7ff;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.practice-groups8 figcaption b { color: #e44d3d; font-size: 22px; }
.practice-groups8 figcaption strong { color: #168ad9; font-size: 24px; }
@keyframes group8-in { to { opacity: 1; transform: none; } }
@keyframes item8-pop { to { opacity: 1; transform: scale(1); } }
@media (max-width: 760px) {
  .practice-groups8 > div { grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: 18px 12px; }
  .group-box8 { min-height: 92px; padding: 10px; }
  .group-box8 i { width: 17px; height: 17px; }
  .practice-groups8 figcaption { font-size: 15px; }
}

.mode-hub {
  display: grid;
  grid-template-columns: repeat(5, minmax(115px, 1fr));
  gap: 12px;
  width: min(900px, 100%);
  padding: 18px;
}
.mode-card {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 150px;
  padding: 14px 10px;
  border: 3px solid #9dd2eb;
  border-radius: 18px;
  background: #fff;
  color: #24465f;
  box-shadow: 0 7px 18px #194d6b16;
}
.mode-card span { color: #118fce; font-size: 13px; font-weight: 950; }
.mode-card b { font-size: 21px; }
.mode-card small { font-size: 13px; line-height: 1.35; }
.mode-card.complete { border-color: #64c47d; background: #edf9f0; }
.mode-card.complete span { color: #278a47; font-size: 24px; }
.mode-card.complete.replayable span { font-size: 15px; }
.mode-card.complete.replayable:hover,
.mode-card.complete.replayable:focus-visible { border-color: #299d55; background: #e2f7e8; transform: translateY(-2px); }
.mode-card:disabled { border-color: #d9e1e6; background: #eef2f4; color: #8a9aa5; box-shadow: none; }
.mode-route {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
}
.mode-route span { color: #ffd54f; }

/* Tutorial and Stage introduction */
.tutorial-open { overflow: hidden; }
.stage-map-open { overflow: hidden; }
.stage-map-overlay { position: fixed; inset: 0; z-index: 1900; display: grid; place-items: center; padding: 22px; overflow: auto; background: rgba(16,48,80,.72); backdrop-filter: blur(8px); }
.stage-map-card { width: min(820px, 100%); max-height: min(760px, calc(100vh - 44px)); overflow: auto; padding: 24px; border-radius: 26px; background: #fff; box-shadow: 0 24px 70px rgba(8,35,64,.3); }
.stage-map-head { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 18px; }
.stage-map-logo { width: 116px; height: 72px; flex: none; object-fit: contain; }
.stage-map-head span { color: #b77400; font-size: 14px; font-weight: 950; letter-spacing: .05em; text-transform: uppercase; }
.stage-map-head h2 { margin: 3px 0; color: #173f67; font-size: 30px; }
.stage-map-head p { margin: 0; color: #587186; line-height: 1.45; }
.stage-map-head button { width: 44px; height: 44px; flex: none; border: 1px solid #cadde9; border-radius: 14px; background: #fff; color: #173f67; font-size: 28px; cursor: pointer; }
.stage-map-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stage-map-item { display: grid; overflow: hidden; min-height: 118px; border: 2px solid #d7e3eb; border-radius: 16px; background: #f2f5f7; color: #81909b; font-family: inherit; }
.stage-map-open-stage { display: grid; justify-items: center; gap: 4px; min-height: 78px; padding: 10px 7px 7px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.stage-map-item span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: #dfe6ea; font-weight: 950; }
.stage-map-item b { font-size: 16px; }
.stage-map-item small { font-size: 12px; font-weight: 800; }
.stage-map-actions { display: grid; gap: 5px; margin: 0 7px 7px; }
.stage-map-actions button { min-height: 32px; margin: 0; border-radius: 9px; font: inherit; font-size: 12px; font-weight: 950; cursor: pointer; }
.stage-map-start { border: 0; background: #f4b62e; color: #654400; }
.stage-map-skip { border: 2px solid #168ad9; background: #fff; color: #126aa5; }
.stage-map-item.locked .stage-map-skip { background: #fff; border: 1px solid #becbd4; color: #566b79; }
.stage-map-item.unlocked { border-color: #8bc9ec; background: #eef9ff; color: #235577; }
.stage-map-item.unlocked span { background: #168ad9; color: #fff; }
.stage-map-item.in-progress { border-color: #f2b532; background: #fff8df; color: #765400; }
.stage-map-item.in-progress span { background: #f2b532; color: #5f4200; }
.stage-map-item.complete { border-color: #85d095; background: #eefaf1; color: #257044; }
.stage-map-item.complete span { background: #56b96d; color: #fff; }
.stage-map-item.current { outline: 4px solid #ffd15a; outline-offset: 1px; }
.stage-map-legend { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 18px; color: #587186; font-size: 13px; font-weight: 800; }
.stage-map-legend span { display: flex; gap: 7px; align-items: center; }
.stage-map-legend i { width: 13px; height: 13px; border-radius: 50%; background: #dfe6ea; }
.stage-map-legend i.done { background: #56b96d; }
.stage-map-legend i.learning { background: #f2b532; }
.stage-map-legend i.now { background: #ffd15a; }
.stage-map-loading { padding: 70px 20px; color: #315a77; font-size: 18px; font-weight: 900; text-align: center; }
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
  background: rgba(16, 48, 80, .72);
  backdrop-filter: blur(8px);
}
.tutorial-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px 28px;
  width: min(760px, 100%);
  padding: 26px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 35, 64, .3);
}
.tutorial-progress { grid-column: 1/-1; display: flex; gap: 8px; }
.tutorial-progress i { flex: 1; height: 7px; border-radius: 99px; background: #dbe7ef; }
.tutorial-progress i.active { background: #58bf73; }
.tutorial-character { display: grid; align-content: center; justify-items: center; gap: 8px; }
.tutorial-character img { width: 150px; max-height: 180px; object-fit: contain; }
.tutorial-character b { color: #1b4a72; font-size: 19px; }
.tutorial-copy { display: grid; align-content: center; gap: 9px; }
.tutorial-copy > span { color: #c37a00; font-size: 14px; font-weight: 950; letter-spacing: .06em; text-transform: uppercase; }
.tutorial-copy h2 { margin: 0; color: #173f67; font-size: 30px; line-height: 1.2; }
.tutorial-copy p { margin: 0; color: #49667d; font-size: 18px; line-height: 1.55; }
.tutorial-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tutorial-modes b { display: grid; gap: 3px; padding: 12px; border-radius: 14px; background: #e9f7ff; color: #177dbd; font-size: 20px; }
.tutorial-modes b:last-child { background: #fff4cf; color: #ad7200; }
.tutorial-modes small { color: #49667d; font-size: 13px; }
.tutorial-book { width: 120px; max-height: 160px; margin-top: 7px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(25,57,82,.18)); }
.tutorial-route { margin-top: 8px; padding: 12px; border-radius: 12px; background: #173f67; color: #fff; font-weight: 900; text-align: center; }
.tutorial-flower { font-size: 72px; line-height: 1; }
.tutorial-actions { grid-column: 1/-1; display: flex; justify-content: space-between; gap: 12px; }
.tutorial-actions button { min-height: 48px; padding: 0 20px; border: 2px solid #c8dce9; border-radius: 14px; background: #fff; color: #173f67; font: inherit; font-weight: 900; }
.tutorial-actions button:last-child { border-color: #168ad9; background: #168ad9; color: #fff; }
.tutorial-actions button:disabled { opacity: .35; }
.stage-intro { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(300px, 1.2fr); gap: 22px; width: min(920px, 100%); align-items: center; }
.stage-intro-copy { display: grid; gap: 12px; }
.stage-intro-copy section { display: grid; gap: 6px; padding: 17px; border: 2px solid #d1e5f1; border-radius: 17px; background: #f8fcff; }
.stage-intro-copy section:last-child { border-color: #f4d074; background: #fff9e8; }
.stage-intro-copy span { color: #61798b; font-size: 14px; font-weight: 900; }
.stage-intro-copy b { color: #214967; font-size: 18px; line-height: 1.45; }
.stage-preview { display: grid; place-items: center; min-width: 0; max-height: 330px; overflow: auto; }
.stage-preview > * { max-width: 100%; transform: none; zoom: .72; }
.stage-choice { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.stage-choice button { min-height: 54px; padding: 10px 24px; border: 3px solid #5bc178; border-radius: 15px; background: #fff; color: #246e3e; font-family: inherit; font-size: 18px; font-weight: 950; }
.stage-choice button:last-child { border-color: #f2b532; background: #fff2c8; color: #895b00; }
.stage-choice.locked button { min-width: min(360px, 100%); border-color: #f2b532; background: #fff2c8; color: #895b00; }
.skip-failed-invite { display: grid; grid-template-columns: 150px minmax(180px, 1fr) 150px; align-items: center; gap: 20px; width: min(680px, 100%); }
.skip-failed-invite img { width: 150px; height: 150px; object-fit: contain; }
.skip-failed-invite div { display: grid; gap: 8px; text-align: center; }
.skip-failed-invite b { color: #173f67; font-size: 25px; }
.skip-failed-invite span { color: #587186; font-size: 17px; font-weight: 800; }
.start-stm-together { min-width: min(360px, 100%); min-height: 58px; padding: 10px 24px; border: 3px solid #fff; border-radius: 16px; background: #58bf73; color: #fff; font: inherit; font-size: 20px; font-weight: 950; cursor: pointer; }
.spec-toggle[hidden], .spec-panel[hidden] { display: none !important; }
@media (max-width: 580px) {
  .topbar .progress-wrap { display: none; }
  .stage-picker { position: static; margin-left: auto; }
}
@media (max-width: 620px) {
  .stage-map-overlay { padding: 10px; align-items: start; }
  .stage-map-card { max-height: calc(100vh - 20px); padding: 17px; border-radius: 20px; }
  .stage-map-head h2 { font-size: 24px; }
  .stage-map-head p { font-size: 14px; }
  .stage-map-logo { width: 82px; height: 52px; }
  .stage-map-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stage-map-item { min-height: 108px; }
  .stage-map-open-stage { min-height: 72px; padding: 8px 4px 5px; }
  .stage-map-item b { font-size: 14px; }
  .stage-map-item small { font-size: 11px; }
  .tutorial-overlay { padding: 10px; align-items: start; }
  .tutorial-card { grid-template-columns: 92px 1fr; gap: 14px; padding: 18px; border-radius: 22px; }
  .tutorial-character img { width: 90px; max-height: 120px; }
  .tutorial-copy h2 { font-size: 23px; }
  .tutorial-copy p { font-size: 16px; }
  .tutorial-modes { grid-template-columns: 1fr; }
  .tutorial-book { width: 90px; max-height: 120px; }
  .tutorial-route { font-size: 14px; line-height: 1.5; }
  .tutorial-actions button { padding: 0 12px; font-size: 14px; }
  .stage-home-active .visual { min-height: 0; padding: 16px; }
  .stage-intro { grid-template-columns: 1fr; gap: 12px; }
  .stage-intro-copy section { padding: 13px; }
  .stage-intro-copy b { font-size: 16px; }
  .stage-preview { max-height: 240px; }
  .stage-preview > * { transform: none; zoom: .52; }
  .stage-choice { gap: 9px; }
  .stage-choice button { flex: 1; min-width: 135px; padding: 9px 12px; font-size: 16px; }
  .skip-failed-invite { grid-template-columns: 82px 1fr 82px; gap: 8px; }
  .skip-failed-invite img { width: 82px; height: 96px; }
  .skip-failed-invite b { font-size: 19px; }
  .skip-failed-invite span { font-size: 14px; }
}
@media (min-width: 621px) and (max-width: 1180px) {
  .stage-home-active .workspace { grid-template-columns: minmax(0, 1fr) 245px; }
  .stage-home-active .guide-card {
    grid-template-columns: 72px minmax(0, 1fr) 72px minmax(0, 1fr);
    align-items: start;
  }
  .stage-home-active .guide-card .character-image {
    width: 72px;
    height: 84px;
  }
  .stage-home-active .guide-card > div { min-width: 0; }
  .stage-home-active .guide-card p { overflow-wrap: anywhere; }
  .stage-home-active .visual { min-height: 0; padding: 18px; }
  .stage-intro { grid-template-columns: minmax(230px, .9fr) minmax(0, 1.1fr); gap: 14px; }
  .stage-preview { max-height: 310px; overflow: auto; }
  .stage-preview > * { transform: none; zoom: .55; }
  .mastery-active .visual-card { min-width: 0; }
  .mastery-active .practice-visual { min-width: 0; }
  .mastery-active .equation-card { scroll-margin-bottom: 45vh; }
  .practice-input-wrap input { min-width: 0; width: min(360px, 48vw); font-size: 20px; }
}
@media (max-width: 620px) {
  .stage-home-active .guide-card {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
  }
  .stage-home-active .guide-card .character-image {
    width: 64px;
    height: 76px;
  }
  .stage-home-active .guide-card > div { min-width: 0; }
  .stage-home-active .guide-card p { overflow-wrap: anywhere; }
}
.mode-complete {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 330px;
  color: #24465f;
  text-align: center;
}
.mode-complete img { width: 150px; height: 150px; object-fit: contain; }
.mode-complete b { color: #278a47; font-size: 34px; }
.mode-complete p { margin: 0; font-size: 18px; font-weight: 800; }
.mode-complete.stage-clear-screen {
  gap: 8px;
  min-height: 390px;
  padding: 12px;
}
.mode-complete.stage-clear-screen img {
  width: min(340px, 86vw);
  height: min(300px, 42vh);
  border-radius: 24px;
  object-fit: contain;
  background: #050505;
  box-shadow: 0 16px 34px rgba(6, 22, 42, .25);
}
.mode-complete.stage-clear-screen b { color: #e94b2c; font-size: clamp(30px, 4vw, 46px); }
.mode-complete.stage-clear-screen p { color: #214967; font-size: clamp(17px, 2vw, 22px); }
@media (max-width: 1180px) {
  .mode-hub { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 620px) {
  .mode-hub { grid-template-columns: repeat(2, minmax(120px, 1fr)); padding: 8px; }
  .mode-card { min-height: 125px; }
  .mode-route { font-size: 15px; }
  .mode-complete.stage-clear-screen { min-height: 320px; }
  .mode-complete.stage-clear-screen img { width: min(280px, 82vw); height: min(235px, 34vh); }
}

@media (max-width: 900px) {
  .relation15-new {
    width: 96%;
  }
  .intersection-shell15 {
    width: 100%;
    padding-left: 40px;
  }
  .buku-work18 {
    width: min(680px, 96%);
  }
  .buku-area18 .area {
    height: 210px;
  }
}

@media (max-width: 620px) {
  .intersection-shell15 {
    padding: 30px 6px 8px 30px;
  }
  .intersection-grid15-new {
    min-height: 170px;
  }
  .buku-area18 .area {
    height: 180px;
  }
}

/* Stage 6: the boundary sits between the 10th and 11th dots in both rows. */
.difference-scene {
  position: relative;
  --difference-label: 60px;
}
.difference-scene label b {
  font: inherit;
}
.ten-boundary {
  position: absolute;
  z-index: 3;
  left: calc(var(--difference-label) + (100% - var(--difference-label)) / 2);
  top: -25px;
  bottom: 50px;
  border-left: 3px solid #254762;
  pointer-events: none;
}
.ten-boundary span {
  position: absolute;
  top: -1px;
  left: 0;
  transform: translate(-50%, -100%);
  color: #254762;
  font-size: 14px;
  font-weight: 900;
}
.difference-dots em {
  display: none;
}
.difference-dots.has-answer-group:after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  width: 25%;
  top: -7px;
  bottom: -7px;
  border: 3px solid #1595d3;
  border-radius: 999px;
  box-sizing: border-box;
  pointer-events: none;
  animation: answerRing 0.45s ease both;
}
.shortcut-difference .difference-note {
  border: 3px solid #1595d3;
  background: #eef9ff;
}
.crossout-scene {
  width: min(100%, 620px);
  grid-template-columns: repeat(14, minmax(18px, 34px));
  gap: clamp(3px, 1vw, 8px);
}
.crossout-scene {
  position: relative;
}
.crossout-scene:before {
  content: "10";
  position: absolute;
  left: 71.43%;
  top: -28px;
  transform: translateX(-50%);
  color: #254762;
  font-size: 15px;
  font-weight: 950;
}
.crossout-scene:after {
  content: "";
  position: absolute;
  left: 71.43%;
  top: -6px;
  height: calc(100% + 12px);
  border-left: 3px solid #254762;
  transform: translateX(-50%);
  pointer-events: none;
}
.crossout-scene b {
  position: relative;
  z-index: 2;
  background: #fff;
}
@keyframes answerRing {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 620px) {
  .difference-scene {
    --difference-label: 48px;
  }
  .ten-boundary {
    bottom: 46px;
  }
  .crossout-scene {
    grid-template-columns: repeat(14, minmax(14px, 1fr));
    width: 100%;
  }
}
@media (max-width: 420px) {
  .crossout-scene {
    grid-template-columns: repeat(7, minmax(24px, 32px));
    width: auto;
  }
  .crossout-scene b {
    grid-column: 1/-1;
  }
}

/* Stage 7: bar lengths carry the quantities, following the Buku diagrams. */
.shift-scene {
  width: min(720px, 96%);
}
.bar-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  width: 100%;
}
.bar-equation > b {
  color: #244966;
  font-size: 32px;
  text-align: center;
}
.bar-column {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 78px;
}
.quantity-track {
  display: flex;
  align-items: center;
  width: 100%;
  height: 62px;
}
.quantity-bar {
  position: relative;
  width: var(--bar-width);
  height: 58px;
  border: 3px solid #284a63;
  background: #fff;
  box-sizing: border-box;
  transition: width 0.65s ease;
}
.quantity-bar span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #284a63;
  font-size: 28px;
  font-weight: 950;
}
.bar-parts {
  position: absolute;
  left: 0;
  bottom: 2px;
  display: flex;
  width: 100%;
  height: 9px;
}
.bar-parts span {
  width: var(--part);
  background: #8fd2f2;
  color: transparent;
}
.bar-parts i {
  width: var(--part);
  background: #ef583b;
  color: #ef583b;
  font-size: 0;
}
.receiving-part {
  position: absolute;
  left: var(--base);
  top: 10px;
  width: var(--gain);
  height: 58px;
  display: grid;
  place-items: center;
  border: 3px solid #ef583b;
  color: #ef583b;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  box-sizing: border-box;
  animation: receivePart 0.65s ease both;
}
.transfer-arrow {
  margin: -7px 0 2px;
  color: #ef583b;
  font-size: 18px;
  font-weight: 950;
  text-align: center;
}
.result-bars .quantity-bar {
  background: #eaf7ff;
}
.result-bars .quantity-bar span {
  color: #ef5030;
}
.made-round {
  border-color: #ef9c24;
  background: #fff7d9 !important;
}
.difference-shift .grown-bar:after {
  content: "+";
  position: absolute;
  right: 0;
  top: -23px;
  color: #ef5030;
  font-weight: 950;
}
.shift-answer {
  color: #ef5030;
  font-size: 30px;
  text-align: center;
}
@keyframes receivePart {
  from {
    opacity: 0;
    transform: translateX(-45px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 620px) {
  .bar-equation {
    grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
  }
  .bar-equation > b {
    font-size: 25px;
  }
  .bar-column {
    min-height: 64px;
  }
  .quantity-track {
    height: 50px;
  }
  .quantity-bar {
    height: 46px;
  }
  .quantity-bar span {
    font-size: 22px;
  }
  .receiving-part {
    top: 9px;
    height: 46px;
    font-size: 13px;
  }
  .transfer-arrow {
    font-size: 15px;
  }
}

.multiplication-pattern-scene {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(780px, 98%);
}
.pattern-grid-svg {
  width: 100%;
  max-height: 330px;
}
.pattern-lines line {
  stroke: #385264;
  stroke-width: 1.7;
}
.pattern-lines text {
  fill: #294a61;
  font-size: 14px;
  text-anchor: middle;
}
.pattern-axis-title {
  fill: #294a61;
  font-size: 16px;
  font-weight: 900;
  text-anchor: middle;
}
.pattern-axis-title.vertical {
  transform: rotate(-90deg);
  transform-origin: 18px 140px;
}
.pattern-dots circle {
  fill: #ef583b;
  stroke: #a93420;
  stroke-width: 2;
}
.animate-dots .pattern-dots circle {
  opacity: 0;
  animation: patternDotIn 0.35s ease var(--dot-delay) forwards;
}
.pattern-results {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
  width: calc(100% - 78px);
  margin-left: 38px;
}
.pattern-results > span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 2px solid #385264;
  background: #fff;
  color: #294a61;
  font-size: 20px;
  font-weight: 950;
}
.pattern-results > span.filled {
  background: #eef9ff;
  animation: resultPop 0.35s ease var(--result-delay) both;
}
.pattern-results.factor-5 > span.filled {
  background: #fff6d8;
}
.pattern-results span i {
  position: absolute;
  right: 3px;
  bottom: 1px;
  color: #ef5030;
  font-size: 12px;
  font-style: normal;
}
.pattern-callout,
.pattern-rule {
  padding: 10px 22px;
  border-radius: 999px;
  background: #eef9ff;
  color: #294a61;
  font-size: 20px;
  font-weight: 900;
}
.pattern-callout b {
  color: #ef5030;
}
.pattern-only {
  gap: 26px;
}
.pattern-only .pattern-results {
  width: 100%;
  margin: 0;
}
.pattern-rule {
  display: flex;
  gap: 18px;
  align-items: center;
}
.pattern-rule b {
  color: #ef5030;
  font-size: 26px;
}
.even-rule span {
  color: #1580bd;
}
.five-rule {
  background: #fff6d8;
}
@keyframes patternDotIn {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes resultPop {
  from {
    opacity: 0.2;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 620px) {
  .pattern-results {
    gap: 3px;
    width: calc(100% - 40px);
    margin-left: 20px;
  }
  .pattern-results > span {
    min-height: 38px;
    font-size: 15px;
  }
  .pattern-callout,
  .pattern-rule {
    font-size: 16px;
    padding: 8px 14px;
  }
  .pattern-grid-svg {
    max-height: 265px;
  }
}

.area10-scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(150px, 230px);
  gap: 22px 28px;
  align-items: center;
  justify-content: center;
  width: min(760px, 96%);
  padding: 28px 0 0;
}
.area10-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  width: 100%;
  aspect-ratio: var(--cols) / var(--rows);
  border: 4px solid #29495f;
  background: #fff;
}
.area10-grid i {
  display: block;
  border-right: 1.5px solid #496274;
  border-bottom: 1.5px solid #496274;
  box-sizing: border-box;
}
.area10-grid i.part-a {
  background: #dff2ff;
  animation: areaCellIn 0.35s ease var(--cell-delay) both;
}
.area10-grid i.part-b {
  background: #ffd86a;
  animation: areaCellIn 0.35s ease var(--cell-delay) both;
}
.area10-cut {
  position: absolute;
  z-index: 3;
  background: #243f52;
}
.horizontal-cut .area10-cut {
  left: -10px;
  right: -10px;
  top: var(--cut);
  height: 5px;
  transform: translateY(-50%);
}
.vertical-cut .area10-cut {
  top: -10px;
  bottom: -10px;
  left: var(--cut);
  width: 5px;
  transform: translateX(-50%);
}
.area10-top {
  position: absolute;
  top: 0;
  left: 28%;
  color: #29495f;
  font-size: 21px;
  font-weight: 950;
}
.area10-side {
  position: absolute;
  left: -5px;
  top: 43%;
  color: #29495f;
  font-size: 21px;
  font-weight: 950;
}
.area10-parts {
  display: grid;
  gap: 14px;
}
.area10-parts b {
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 3px solid #29495f;
  border-radius: 12px;
  background: #fff;
  color: #29495f;
  font-size: 20px;
}
.area10-parts b:first-child {
  background: #e9f7ff;
}
.area10-parts b:last-child {
  background: #fff5cb;
}
.area10-total {
  grid-column: 1/-1;
  justify-self: center;
  padding: 9px 22px;
  border-radius: 999px;
  background: #eef8ff;
  color: #29495f;
  font-size: 22px;
  font-weight: 950;
}
.area10-total strong {
  color: #ef5030;
}
@keyframes areaCellIn {
  from {
    opacity: 0.25;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.area10-side {
  left: -28px;
  top: 50%;
  transform: translate(-100%, -50%);
  min-width: 28px;
  text-align: right;
}
.area10-split-labels {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  color: #ef5030;
  font-size: 20px;
  font-weight: 950;
}
.area10-split-labels b {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 8px;
}
.area10-split-labels.on-side {
  left: -42px;
  top: 0;
  width: 34px;
  height: 100%;
}
.area10-split-labels.on-side b {
  top: var(--label-pos);
  right: 0;
  transform: translateY(-50%);
}
.area10-split-labels.on-top {
  left: 0;
  top: -42px;
  width: 100%;
  height: 34px;
}
.area10-split-labels.on-top b {
  left: var(--label-pos);
  top: 0;
  transform: translateX(-50%);
}
.area10-scene:has(.area10-split-labels.on-side) > .area10-side,
.area10-scene:has(.area10-split-labels.on-top) > .area10-top {
  display: none;
}
@media (max-width: 620px) {
  .area10-scene {
    grid-template-columns: minmax(210px, 1fr);
    padding: 42px 42px 0;
  }
  .area10-parts {
    grid-template-columns: 1fr 1fr;
  }
  .area10-parts b {
    min-height: 50px;
    font-size: 16px;
  }
  .area10-top {
    left: 50%;
  }
  .area10-side {
    left: 12px;
  }
  .area10-total {
    font-size: 18px;
  }
  .area10-split-labels.on-side {
    left: -38px;
  }
  .area10-split-labels.on-top {
    top: -38px;
  }
}

/* Stage 11: Buku area models for ×10 and ×100. */
.area11-simple,
.area11-fifty,
.area11-split {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(690px, 94%);
  padding: 34px 36px 0;
}
.area11-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  width: min(420px, 80vw);
  height: clamp(58px, calc(var(--rows) * 31px), 330px);
  border: 3px solid #29495f;
  background: #fff;
}
.area11-grid i,
.area11-fifty-grid i {
  display: block;
  border-right: 1px solid #496274;
  border-bottom: 1px solid #496274;
}
.area11-simple.revealed .area11-grid i,
.area11-fifty.revealed .area11-fifty-grid i {
  background: #dff2ff;
  animation: areaCellIn 0.35s ease var(--cell-delay) both;
}
.area11-top {
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
}
.area11-side {
  position: absolute;
  left: 4px;
  top: 48%;
  transform: translateY(-50%);
  font-size: 22px;
}
.area11-answer {
  padding: 10px 24px;
  border-radius: 999px;
  background: #eef8ff;
  color: #29495f;
  font-size: 22px;
  font-weight: 950;
  animation: make10Rise 0.5s ease both;
}
.area11-answer strong {
  color: #ef5030;
}
.area11-fifty {
  grid-template-columns: minmax(280px, 1fr) 150px;
  align-items: center;
}
.area11-fifty-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(5, 1fr);
  width: 100%;
  aspect-ratio: 2/1;
  border: 3px solid #29495f;
  background: #fff;
}
.area11-fifty-grid i:nth-child(10n) {
  border-right: 0;
}
.area11-fifty-grid i:nth-last-child(-n + 10) {
  border-bottom: 0;
}
.area11-ten-label {
  position: absolute;
  right: calc(100% + 8px);
  top: calc((var(--row) + 0.5) * 20%);
  transform: translateY(-50%);
  color: #ef5030;
  font-size: 14px;
}
.area11-column-label {
  position: absolute;
  left: calc((var(--col) + 0.5) * 10%);
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  color: #29495f;
  font-size: 13px;
}
.area11-factor {
  display: grid;
  gap: 14px;
  color: #29495f;
  text-align: center;
}
.area11-factor span {
  padding: 12px;
  border: 3px solid #29495f;
  background: #fff;
  font-weight: 900;
}
.area11-factor b {
  font-size: 28px;
  color: #ef5030;
}
.area11-fifty .area11-answer {
  grid-column: 1/-1;
}
.area11-split {
  width: min(calc(610px * var(--wide)), 94%);
}
.area11-split-box {
  display: grid;
  grid-template-rows: 10fr 3fr;
  width: 100%;
  height: 330px;
  border: 3px solid #29495f;
  background: #fff;
}
.area11-split-box section {
  position: relative;
  display: grid;
  place-items: center;
  border-bottom: 3px solid #ef5030;
}
.area11-split-box section:last-child {
  border-bottom: 0;
}
.area11-split-box span {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #ef5030;
  font-weight: 900;
}
.area11-split-box strong {
  color: #ef5030;
  font-size: 22px;
}
.area11-split.revealed .area11-split-box section:first-child {
  background: #dff2ff;
  animation: areaCellIn 0.45s ease both;
}
.area11-split.revealed .area11-split-box section:last-child {
  background: #fff1bd;
  animation: areaCellIn 0.45s 0.18s ease both;
}
.area11-split-top {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
}
.area11-split-side {
  position: absolute;
  left: 0;
  top: 48%;
  font-size: 22px;
}
.area11-split .area11-answer {
  margin-top: -4px;
}
@media (max-width: 620px) {
  .area11-simple,
  .area11-fifty,
  .area11-split {
    padding: 32px 24px 0;
  }
  .area11-fifty {
    grid-template-columns: 1fr;
  }
  .area11-fifty-grid {
    width: 94%;
  }
  .area11-factor {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .area11-fifty .area11-answer {
    grid-column: 1;
  }
  .area11-split-box {
    height: 250px;
  }
  .area11-split-box strong {
    font-size: 17px;
  }
  .area11-answer {
    font-size: 18px;
  }
  .area11-side,
  .area11-split-side {
    left: -1px;
  }
}
.area11-unit {
  display: grid;
  gap: 20px;
  justify-items: center;
}
.area11-unit > div {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(460px, 82vw);
  height: 70px;
  border: 3px solid #29495f;
}
.area11-unit i {
  border-right: 1px solid #496274;
}
.area11-unit i:last-child {
  border-right: 0;
}
.area11-unit.revealed i {
  background: #dff2ff;
  animation: areaCellIn 0.35s ease var(--cell-delay) both;
}
.area11-unit p,
.five-ten11 p {
  margin: 0;
  padding: 10px 22px;
  border-radius: 999px;
  background: #eef8ff;
  color: #29495f;
  font-size: 21px;
  font-weight: 900;
}
.area11-unit strong,
.five-ten11 strong {
  color: #ef5030;
}
.five-ten11 {
  display: grid;
  gap: 16px;
  justify-items: center;
  width: min(560px, 92%);
}
.five-ten11 > div {
  display: grid;
  width: min(440px, 82vw);
  border: 3px solid #29495f;
}
.five-ten11 span {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 33px;
  background: #fff;
}
.five-ten11 span i {
  border-right: 1px solid #496274;
  border-bottom: 1px solid #496274;
}
.five-ten11 span i:last-of-type {
  border-right: 0;
}
.five-ten11 span:last-child i {
  border-bottom: 0;
}
.five-ten11 span b {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  color: #ef5030;
  font-size: 15px;
}
.five-ten11.revealed span {
  background: hsl(200 78% var(--shade));
  animation: stage11BandIn 0.38s calc(var(--i) * 0.09s) ease both;
}
.fifty-ten11 {
  display: grid;
  gap: 22px;
  justify-items: center;
  width: min(720px, 96%);
}
.fifty-blocks11 {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  width: 100%;
  height: 270px;
  border: 3px solid #29495f;
}
.fifty-blocks11 span {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid #496274;
  background: #fff;
}
.fifty-blocks11 span:last-child {
  border-right: 0;
}
.fifty-blocks11 span b {
  color: #29495f;
  font-size: 17px;
  writing-mode: vertical-rl;
}
.fifty-blocks11 span em {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  color: #ef5030;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}
.fifty-ten11.revealed .fifty-blocks11 span {
  background: hsl(200 78% var(--shade));
  animation: stage11BlockIn 0.42s calc(var(--i) * 0.11s) ease both;
}
.zero-rule11 {
  display: grid;
  grid-template-columns: auto 34px auto 34px auto;
  align-items: center;
  gap: 8px;
  color: #29495f;
  font-size: 31px;
  font-weight: 950;
}
.zero-rule11 i {
  font-style: normal;
}
.zero-rule11 span,
.zero-rule11 strong {
  display: flex;
}
.zero-rule11 small {
  grid-column: 1/-1;
  text-align: center;
  color: #536f82;
  font-size: 15px;
}
.zero-a {
  color: #168bd0 !important;
}
.zero-b {
  color: #ef9b1c !important;
}
.equation .zero-a,
.equation .zero-b {
  font-weight: 950;
}
@keyframes stage11BandIn {
  from {
    opacity: 0.2;
    transform: translateX(-22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes stage11BlockIn {
  from {
    opacity: 0.15;
    transform: scaleY(0.2);
    transform-origin: bottom;
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}
@media (max-width: 620px) {
  .five-ten11 > div {
    width: min(320px, 78vw);
  }
  .five-ten11 span {
    height: 27px;
  }
  .five-ten11 span b {
    left: calc(100% + 8px);
    font-size: 13px;
  }
  .fifty-blocks11 {
    height: 220px;
  }
  .fifty-blocks11 span b {
    font-size: 13px;
  }
  .fifty-blocks11 span em {
    font-size: 10px;
  }
  .zero-rule11 {
    font-size: 25px;
    gap: 4px;
    grid-template-columns: auto 24px auto 24px auto;
  }
}

/* Stage 13: proportional four-part area models from Buku SANSU. */
.decompose13 {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(560px, 94%);
  color: #29495f;
}
.decompose13-equation {
  font-size: 30px;
}
.decompose13 > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  width: 100%;
  align-items: center;
  border-bottom: 2px solid #d5e5ee;
  padding: 8px 20px;
}
.decompose13 span {
  font-size: 21px;
  font-weight: 900;
}
.decompose13 strong {
  color: #ef5030;
  font-size: 28px;
  letter-spacing: 8px;
}
.decompose13 p {
  margin: 8px 0 0;
  padding: 11px 22px;
  border-radius: 999px;
  background: #eef8ff;
  font-size: 21px;
  font-weight: 900;
  animation: make10Rise 0.5s ease both;
}
.area13-scene {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(280px, 560px);
  grid-template-rows: 46px minmax(250px, 390px);
  width: min(680px, 94%);
  padding: 0 10px;
}
.area13-top-labels {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, var(--wide) fr) minmax(
      74px,
      var(--narrow) fr
    );
  align-items: end;
}
.area13-left-labels {
  display: grid;
  grid-template-rows: minmax(0, var(--upper) fr) minmax(72px, var(--lower) fr);
  align-items: center;
}
.area13-top-labels b,
.area13-left-labels b {
  display: grid;
  place-items: center;
  color: #ef5030;
  font-size: 22px;
}
.area13-grid {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, var(--wide) fr) minmax(
      74px,
      var(--narrow) fr
    );
  grid-template-rows: minmax(0, var(--upper) fr) minmax(72px, var(--lower) fr);
  border: 4px solid #29495f;
  background: #fff;
}
.area13-grid section {
  display: grid;
  place-items: center;
  border-right: 3px solid #29495f;
  border-bottom: 3px solid #29495f;
  color: #29495f;
}
.area13-grid section:nth-child(2),
.area13-grid section:nth-child(4) {
  border-right: 0;
}
.area13-grid section:nth-child(3),
.area13-grid section:nth-child(4) {
  border-bottom: 0;
}
.area13-grid em {
  font-size: 29px;
  font-style: normal;
}
.area13-grid span {
  font-size: 18px;
  font-weight: 900;
}
.area13-scene.revealed .area13-grid section:nth-child(1) {
  background: #dff2ff;
}
.area13-scene.revealed .area13-grid section:nth-child(2) {
  background: #ffd9e5;
}
.area13-scene.revealed .area13-grid section:nth-child(3) {
  background: #dff3d9;
}
.area13-scene.revealed .area13-grid section:nth-child(4) {
  background: #ffe9a9;
}
.area13-scene.revealed .area13-grid section {
  animation: areaCellIn 0.45s ease both;
}
.partial13 {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) 190px;
  gap: 16px 24px;
  align-items: center;
  width: min(650px, 94%);
}
.partial13 h3 {
  grid-column: 1/-1;
  margin: 0;
  padding: 14px 18px;
  border-radius: 14px;
  background: #eef8ff;
  color: #29495f;
  font-size: 22px;
}
.partial13 h3 strong {
  color: #ef5030;
}
.partial13 > div {
  display: grid;
  gap: 6px;
}
.partial13 p {
  display: grid;
  grid-template-columns: 36px 1fr 92px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #d5e5ee;
  font-size: 21px;
}
.partial13 p b,
.partial13 p strong {
  color: #ef5030;
}
.partial13 aside {
  padding: 18px;
  border: 3px solid #ef5030;
  border-radius: 16px;
  color: #29495f;
  font-size: 18px;
  font-weight: 900;
}
.partial13 aside b {
  color: #ef5030;
  font-size: 25px;
}
.partial13.revealed p,
.partial13.revealed aside {
  animation: make10Rise 0.45s ease both;
}
@media (max-width: 620px) {
  .decompose13 > div {
    grid-template-columns: 105px 1fr;
    padding: 7px;
  }
  .decompose13 span {
    font-size: 17px;
  }
  .decompose13 strong {
    font-size: 23px;
  }
  .area13-scene {
    grid-template-columns: 40px minmax(230px, 1fr);
    grid-template-rows: 40px 270px;
    padding: 0;
  }
  .area13-grid {
    grid-template-columns: minmax(0, var(--wide) fr) minmax(
        64px,
        var(--narrow) fr
      );
    grid-template-rows: minmax(0, var(--upper) fr) minmax(64px, var(--lower) fr);
  }
  .area13-top-labels {
    grid-template-columns: minmax(0, var(--wide) fr) minmax(
        64px,
        var(--narrow) fr
      );
  }
  .area13-left-labels {
    grid-template-rows: minmax(0, var(--upper) fr) minmax(64px, var(--lower) fr);
  }
  .area13-grid em {
    font-size: 23px;
  }
  .area13-grid span {
    font-size: 14px;
  }
  .partial13 {
    grid-template-columns: 1fr;
  }
  .partial13 h3 {
    grid-column: 1;
    font-size: 18px;
  }
  .partial13 p {
    font-size: 18px;
  }
  .partial13 aside {
    font-size: 16px;
  }
}
.round-number-scene .round-bar {
  position: relative;
  overflow: hidden;
}
.round-number-scene .round-bar .moving-part {
  left: 0;
}

/* Stage 14: one reusable 12-ball model, regrouped exactly as in Buku SANSU. */
.ball-grid14 {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 64px);
  grid-template-rows: repeat(3, 64px);
  gap: 14px 18px;
  width: max-content;
  margin: 30px auto 58px;
  padding: 16px;
}
.ball14 {
  position: relative;
  z-index: 2;
  display: block;
  width: 58px;
  height: 58px;
  border: 3px solid #29495f;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
}
.ball14:before,
.ball14:after,
.ball14 span:before {
  content: "";
  position: absolute;
  border: 2px solid #29495f;
  border-radius: 50%;
  opacity: 0.8;
}
.ball14:before {
  left: 8px;
  right: 8px;
  top: 10px;
  height: 24px;
  border-left-color: transparent;
  border-right-color: transparent;
  transform: rotate(-18deg);
}
.ball14:after {
  top: 7px;
  bottom: 7px;
  left: 21px;
  width: 20px;
  border-top-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(24deg);
}
.ball14 span:before {
  width: 7px;
  height: 7px;
  right: 8px;
  top: 7px;
  background: #fff;
}
.ball-grid14.revealed .ball14 {
  animation: ball14In 0.38s calc(var(--i) * 0.055s) ease both;
}
.group-box14 {
  position: absolute;
  z-index: 1;
  border: 3px solid #ff5635;
  box-sizing: border-box;
  opacity: 0;
  animation: group14In 0.42s calc(var(--group) * 0.14s + 0.3s) ease forwards;
}
.group-box14 em {
  position: absolute;
  color: #ef5030;
  font-size: 18px;
  font-style: normal;
}
.ball-grid14.columns .group-box14 {
  left: calc(16px + var(--group) * 82px);
  top: 8px;
  width: 72px;
  height: 250px;
}
.ball-grid14.columns .group-box14 em {
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
}
.ball-grid14.rows .group-box14 {
  left: 8px;
  top: calc(8px + var(--group) * 78px);
  width: 324px;
  height: 72px;
}
.ball-grid14.rows .group-box14 em {
  right: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
}
.ball-grid14 > strong {
  position: absolute;
  left: 50%;
  top: calc(100% + 17px);
  transform: translateX(-50%);
  white-space: nowrap;
  color: #ef5030;
  font-size: 24px;
}
.array-top14,
.array-side14 {
  position: absolute;
  color: #ef5030;
  font-size: 23px;
  font-weight: 950;
}
.array-top14 {
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
}
.array-side14 {
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
}
.distribution14 {
  display: grid;
  grid-template-columns: repeat(var(--people, 4), minmax(105px, 1fr));
  gap: 16px;
  width: min(720px, 96%);
  justify-content: center;
}
.distribution14 section {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px 10px;
  border: 3px solid #ef583b;
  background: #fff8ef;
  animation: group14In 0.45s calc(var(--person) * 0.15s) ease both;
}
.distribution14 section > b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #168fd0;
  color: #fff;
}
.distribution14 section > div {
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 7px;
}
.distribution14 section .ball14 {
  width: 40px;
  height: 40px;
}
.distribution14 section .ball14:before {
  left: 5px;
  right: 5px;
  top: 7px;
  height: 16px;
}
.distribution14 section .ball14:after {
  top: 4px;
  bottom: 4px;
  left: 14px;
  width: 14px;
}
.distribution14 section .ball14 span:before {
  width: 5px;
  height: 5px;
  right: 5px;
  top: 4px;
}
.distribution14 section > span {
  color: #29495f;
  font-weight: 900;
}
.distribution14 > strong {
  grid-column: 1/-1;
  text-align: center;
  color: #ef5030;
  font-size: 24px;
}
.division-prompt14 {
  grid-column: 1/-1;
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 26px;
  border: 3px dashed #e8b129;
  border-radius: 18px;
  background: #fff9dc;
}
.division-prompt14 b {
  color: #29495f;
  font-size: 38px;
}
.division-prompt14 span {
  color: #536f82;
  font-size: 20px;
  font-weight: 900;
}
@keyframes ball14In {
  from {
    opacity: 0.2;
    transform: scale(0.65);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes group14In {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 620px) {
  .ball-grid14 {
    grid-template-columns: repeat(4, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 10px 12px;
  }
  .ball14 {
    width: 44px;
    height: 44px;
  }
  .ball-grid14.columns .group-box14 {
    left: calc(16px + var(--group) * 60px);
    width: 52px;
    height: 190px;
  }
  .ball-grid14.rows .group-box14 {
    width: 236px;
    height: 56px;
    top: calc(8px + var(--group) * 58px);
  }
  .distribution14 {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
  .distribution14 > strong {
    grid-column: 1/-1;
  }
  .ball-grid14 > strong {
    font-size: 19px;
  }
  .division-prompt14 b {
    font-size: 30px;
  }
}

/* Stage 15: reuse the intersection model to connect one multiplication with two divisions. */
.relation15 {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(700px, 98%);
}
.relation-grid15 {
  position: relative;
  width: min(650px, 100%);
}
.relation-grid15 .pattern-grid-svg {
  width: 100%;
}
.relation-grid15 .pattern-dots circle {
  fill: #424d57;
}
.relation15.revealed .pattern-dots circle {
  fill: #ef583b;
}
.total-card15 {
  position: absolute;
  left: 36.2%;
  top: 46%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border: 3px solid #29495f;
  background: #fff;
  color: #29495f;
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
}
.total-card15 b {
  font-size: 24px;
}
.focus-top15,
.focus-side15 {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ef583b;
  border-radius: 50%;
  background: #fff;
  color: #ef5030;
  font-size: 19px;
  font-weight: 950;
  animation: resultPop 0.4s ease both;
}
.focus-top15 {
  left: 60%;
  top: -2px;
}
.focus-side15 {
  left: 6.5%;
  top: 69%;
}
.relation-answer15 {
  padding: 10px 24px;
  border-radius: 999px;
  background: #eef8ff;
  color: #ef5030;
  font-size: 25px;
  font-weight: 950;
  animation: make10Rise 0.5s ease both;
}
.fact-family15 {
  display: grid;
  gap: 16px;
  justify-items: center;
  width: min(700px, 96%);
}
.multiplication15,
.divisions15 p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0;
  color: #29495f;
  font-size: 31px;
  font-weight: 950;
}
.multiplication15 b,
.multiplication15 strong,
.divisions15 b,
.divisions15 strong {
  display: grid;
  place-items: center;
  min-width: 68px;
  height: 62px;
  border: 3px solid #29495f;
  background: #fff;
}
.multiplication15 strong,
.divisions15 strong {
  border-color: #ef583b;
  background: #fff2d7;
  color: #ef5030;
}
.family-arrows15 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  color: #ef8f20;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}
.divisions15 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.divisions15 p {
  padding: 16px;
  border: 3px solid #b9d8ed;
  border-radius: 16px;
  background: #f4fbff;
  animation: make10Rise 0.5s ease both;
}
.divisions15 b {
  min-width: 48px;
  height: 48px;
  color: #ef5030;
}
.divisions15 strong {
  min-width: 58px;
  height: 48px;
}
.fact-family15.revealed .multiplication15 strong {
  animation: resultPop 0.4s ease both;
}
@media (max-width: 620px) {
  .total-card15 {
    padding: 8px 11px;
    font-size: 14px;
  }
  .total-card15 b {
    font-size: 19px;
  }
  .focus-top15,
  .focus-side15 {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  .focus-top15 {
    top: 1px;
  }
  .relation-answer15 {
    font-size: 20px;
  }
  .multiplication15,
  .divisions15 p {
    gap: 8px;
    font-size: 23px;
  }
  .multiplication15 b,
  .multiplication15 strong {
    min-width: 52px;
    height: 52px;
  }
  .family-arrows15 {
    gap: 15px;
    font-size: 13px;
  }
  .divisions15 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .divisions15 b,
  .divisions15 strong {
    min-width: 42px;
    height: 42px;
  }
}

/* Stage 16: the Stage 8 intersection grid now exposes added dots and remainders. */
.remainder-grid16 {
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(650px, 96%);
}
.remainder-grid16 svg {
  width: 100%;
  max-height: 360px;
}
.remainder-dot16 {
  fill: #424d57;
  stroke: #fff;
  stroke-width: 2;
}
.remainder-grid16.revealed .remainder-dot16 {
  animation: intersectionPop 0.35s calc(var(--i) * 0.055s) ease both;
}
.remainder-grid16.revealed .remainder-dot16.added,
.remainder-grid16.six.revealed .remainder-dot16,
.remainder-grid16.ten.revealed .remainder-dot16 {
  fill: #ef5030;
}
.remainder-grid16 strong {
  padding: 9px 22px;
  border-radius: 999px;
  background: #eef8ff;
  color: #ef5030;
  font-size: 23px;
}
.eight-box16 {
  fill: none;
  stroke: #ef5030;
  stroke-width: 3;
  stroke-linejoin: round;
  animation: group14In 0.45s 0.55s ease both;
}
.eight-label16 {
  fill: #ef5030;
  font-size: 15px;
  font-weight: 900;
}
.remainder-family16 {
  display: grid;
  gap: 18px;
  justify-items: center;
  width: min(690px, 96%);
}
.base-fact16 {
  padding: 18px 28px;
  border: 3px solid #29495f;
  background: #fff;
  color: #ef5030;
  font-size: 30px;
  font-weight: 950;
}
.family-blanks16,
.remainder-divisions16 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
}
.family-blanks16 span,
.remainder-divisions16 p {
  margin: 0;
  padding: 18px;
  border: 3px solid #29495f;
  background: #fff;
  color: #29495f;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
}
.family-blanks16 span {
  min-height: 62px;
  color: #8797a1;
}
.remainder-divisions16 p {
  animation: make10Rise 0.45s calc(var(--i) * 0.15s) ease both;
}
.remainder-divisions16 b {
  color: #ef5030;
  font-size: 29px;
}
@media (max-width: 620px) {
  .remainder-grid16 svg {
    min-width: 330px;
  }
  .remainder-grid16 strong {
    font-size: 19px;
  }
  .base-fact16 {
    font-size: 24px;
    padding: 14px 18px;
  }
  .family-blanks16,
  .remainder-divisions16 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .family-blanks16 span,
  .remainder-divisions16 p {
    padding: 14px;
    font-size: 20px;
  }
}
.interactive30 {
  display: grid;
  gap: 18px;
  justify-items: center;
  width: min(680px, 96%);
  color: #29495f;
}
.division-input30 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 24px;
  font-weight: 950;
}
.division-input30 input {
  width: 70px;
  height: 52px;
  border: 3px solid #168fd0;
  border-radius: 10px;
  background: #fff;
  color: #29495f;
  text-align: center;
  font: 950 24px/1 inherit;
}
.division-input30 strong {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border-radius: 9px;
  background: #eef8ff;
  color: #168fd0;
}
.division-input30 .remainder-value30 {
  background: #fff1e9;
  color: #ef5030;
}
.intersection30 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  width: min(560px, 100%);
  min-height: 260px;
  padding: 14px;
  border: 3px solid #29495f;
  background: #fff;
  box-sizing: border-box;
}
.intersection30 i {
  display: grid;
  place-items: center;
  border-radius: 10px;
  animation: intersectionPop 0.3s calc(var(--i) * 0.018s) ease both;
}
.intersection30 i b {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #29495f;
  box-shadow: 0 0 0 2px #fff;
}
.intersection30 .grouped {
  background: hsl(calc(var(--group) * 47deg + 20deg) 85% 88%);
  outline: 2px solid hsl(calc(var(--group) * 47deg + 20deg) 70% 55%);
  outline-offset: -2px;
}
.intersection30 .remainder {
  background: #ffe0d8;
  outline: 3px solid #ef5030;
  outline-offset: -3px;
}
.intersection30 .remainder b {
  background: #ef5030;
}
.division-summary30 {
  padding: 10px 20px;
  border-radius: 999px;
  background: #eef8ff;
  font-size: 19px;
  font-weight: 900;
}
.division-summary30 b {
  color: #168fd0;
  font-size: 24px;
}
.division-summary30 strong {
  color: #ef5030;
}
.division-hint30 {
  margin: 0;
  color: #708798;
  font-weight: 900;
}
.division-choice-row16 {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
  width: min(600px, 100%);
}
.division-choice-row16 > label {
  color: #29495f;
  font-size: 17px;
  font-weight: 900;
}
.choices16 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.choices16 button {
  min-width: 52px;
  height: 44px;
  border: 2px solid #b9d8ed;
  border-radius: 10px;
  background: #fff;
  color: #29495f;
  font: 900 19px/1 inherit;
  cursor: pointer;
}
.choices16 button.selected {
  border-color: #168fd0;
  background: #168fd0;
  color: #fff;
  box-shadow: 0 0 0 3px #c9edff;
}
.choices16.total button {
  min-width: 68px;
}
@media (max-width: 620px) {
  .division-input30 {
    font-size: 20px;
  }
  .division-input30 input {
    width: 58px;
    height: 46px;
    font-size: 21px;
  }
  .intersection30 {
    gap: 5px;
    min-height: 230px;
    padding: 9px;
  }
  .intersection30 i b {
    width: 9px;
    height: 9px;
  }
  .division-summary30 {
    font-size: 16px;
  }
  .division-choice-row16 {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .choices16 {
    justify-content: center;
  }
  .division-choice-row16 > label {
    text-align: center;
  }
  .choices16 button {
    min-width: 44px;
    height: 40px;
    font-size: 17px;
  }
  .choices16.total button {
    min-width: 62px;
  }
}

/* Stage 18: one chunk-division model for 468 ÷ 18 and 288 ÷ 12. */
.division-intro18 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #29495f;
  font-size: 42px;
  font-weight: 950;
}
.division-intro18 b,
.division-intro18 strong {
  display: grid;
  place-items: center;
  min-width: 110px;
  height: 90px;
  border: 4px solid #29495f;
  background: #fff;
}
.division-intro18 strong {
  border-color: #ef583b;
  color: #ef5030;
}
.chunk-compare18 {
  display: grid;
  gap: 20px;
  justify-items: center;
  width: min(700px, 96%);
}
.compare-scale18 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}
.compare-scale18 section {
  display: grid;
  gap: 10px;
  place-items: center;
  padding: 24px 12px;
  border: 3px solid #29495f;
  background: #fff;
  color: #29495f;
  animation: make10Rise 0.4s calc(var(--i) * 0.12s) ease both;
}
.compare-scale18 b {
  font-size: 22px;
}
.compare-scale18 span {
  font-size: 29px;
  font-weight: 950;
}
.compare-scale18 .chosen {
  border-color: #ef583b;
  background: #fff2d7;
  color: #ef5030;
  transform: scale(1.04);
}
.chunk-compare18 > strong {
  color: #ef5030;
  font-size: 22px;
}
.chunk-model18 {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(340px, 620px);
  gap: 16px;
  width: min(760px, 96%);
  align-items: center;
}
.chunk-side18 {
  display: grid;
  place-items: center;
  height: 240px;
  color: #29495f;
  font-size: 27px;
  font-weight: 950;
}
.chunk-bar18 {
  display: flex;
  height: 240px;
  border: 4px solid #29495f;
  background: #fff;
}
.chunk-bar18 section {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  box-sizing: border-box;
}
.big-chunk18 {
  border-right: 4px solid #29495f;
}
.big-chunk18:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  border-left: 2px solid #627786;
}
.big-chunk18 span,
.small-chunk18 > span {
  color: #29495f;
  font-size: 30px;
  font-weight: 950;
}
.big-chunk18 i {
  position: absolute;
  left: 50%;
  top: -36px;
  transform: translateX(-50%);
  color: #ef5030;
  font-size: 19px;
  font-style: normal;
  font-weight: 950;
}
.big-chunk18 em {
  position: absolute;
  left: 0;
  right: 0;
  top: -34px;
  display: flex;
  justify-content: space-around;
  color: #29495f;
  font-style: normal;
  font-weight: 900;
}
.small-chunk18 {
  display: grid !important;
  grid-template-rows: repeat(6, 1fr);
}
.small-chunk18 b {
  display: grid;
  place-items: center;
  border-bottom: 1px solid #29495f;
  color: #ef5030;
  font-size: 15px;
  animation: stage11BandIn 0.35s calc(var(--i) * 0.09s) ease both;
}
.small-chunk18 b:last-child {
  border-bottom: 0;
}
.chunk-fields18 {
  grid-column: 2;
  display: flex;
  gap: 12px;
  justify-content: center;
}
.chunk-fields18 label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 2px solid #b9d8ed;
  background: #f5fbff;
  color: #29495f;
  font-weight: 900;
}
.chunk-fields18 b {
  color: #ef5030;
  font-size: 23px;
}
.chunk-result18 {
  grid-column: 1/-1;
  justify-self: center;
  padding: 11px 20px;
  border-radius: 999px;
  background: #eef8ff;
  color: #29495f;
  font-size: 20px;
  font-weight: 900;
}
.chunk-result18 b,
.chunk-result18 strong {
  color: #ef5030;
  font-size: 25px;
}
.chunk-model18.revealed .big-chunk18 {
  background: #dff2ff;
  animation: areaCellIn 0.45s ease both;
}
.chunk-model18.revealed .small-chunk18 {
  background: #fff2c9;
}
.quiz-choices18 {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.quiz-choice18 {
  min-width: 150px;
  padding: 14px 18px;
  border: 3px solid #b9d8ed;
  border-radius: 14px;
  background: #fff;
  color: #29495f;
  font: 900 21px/1.2 inherit;
  cursor: pointer;
}
.quiz-choice18.selected {
  border-color: #168fd0;
  background: #eaf7ff;
  box-shadow: 0 0 0 4px #c9edff;
}
@media (max-width: 620px) {
  .division-intro18 {
    gap: 9px;
    font-size: 29px;
  }
  .division-intro18 b,
  .division-intro18 strong {
    min-width: 74px;
    height: 67px;
  }
  .compare-scale18 {
    gap: 6px;
  }
  .compare-scale18 section {
    padding: 16px 6px;
  }
  .compare-scale18 b {
    font-size: 16px;
  }
  .compare-scale18 span {
    font-size: 22px;
  }
  .chunk-model18 {
    grid-template-columns: 34px minmax(260px, 1fr);
    gap: 7px;
  }
  .chunk-side18,
  .chunk-bar18 {
    height: 190px;
  }
  .big-chunk18 span,
  .small-chunk18 > span {
    font-size: 23px;
  }
  .chunk-fields18 {
    flex-wrap: wrap;
  }
  .chunk-result18 {
    font-size: 16px;
  }
  .quiz-choice18 {
    min-width: 110px;
    font-size: 17px;
  }
}

/* Stage 18 follows the five printed BUKU diagrams without changing their sequence. */
.buku-work18 {
  display: grid;
  grid-template-columns: minmax(360px, 610px) 210px;
  gap: 30px;
  align-items: center;
  width: min(880px, 98%);
}
.buku-area18 {
  position: relative;
  padding-left: 54px;
  padding-top: 36px;
  color: #29495f;
}
.buku-area18 .side {
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-25%);
  font-size: 22px;
  font-weight: 900;
}
.buku-area18 .area {
  display: grid;
  height: 270px;
  border: 3px solid #29495f;
  background: #fff;
}
.buku-area18.whole {
  width: min(520px, 90%);
  padding-top: 0;
}
.buku-area18.whole .area {
  display: grid;
  place-items: center;
}
.buku-area18.whole .area b {
  font-size: 30px;
}
.buku-area18.split468 .area {
  grid-template-columns: 25% 50% 25%;
}
.buku-area18.example288 .area {
  grid-template-columns: 32% 32% 36%;
}
.buku-area18 .area section {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 2px solid #29495f;
  font-size: 22px;
  font-weight: 900;
}
.buku-area18 .area section:last-child {
  border-right: 0;
}
.buku-area18 .area section em {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  font-style: normal;
  font-weight: 900;
}
.buku-area18 .area section b {
  font-weight: 900;
  text-align: center;
  line-height: 1.45;
}
.buku-area18 .area section u {
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.buku-area18 .area .rest {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
}
.buku-area18 .area .rest i {
  display: grid;
  place-items: center;
  width: 100%;
  border-bottom: 1px solid #29495f;
  color: #ef5030;
  font-size: 16px;
  font-style: normal;
  font-weight: 900;
  animation: stage11BandIn 0.28s calc(var(--i) * 0.09s) ease both;
}
.buku-area18 .area .rest i:last-child {
  border-bottom: 0;
}
.buku-fields18 {
  display: grid;
  gap: 14px;
}
.buku-fields18 label {
  display: grid;
  grid-template-columns: 1fr 96px;
  align-items: center;
  gap: 8px;
  color: #29495f;
  font-size: 18px;
  font-weight: 900;
}
.buku-fields18 label b {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 2px solid #29495f;
  background: #fff;
  color: #ef5030;
  font-size: 24px;
}
.buku-fields18 strong {
  color: #ef5030;
  font-size: 24px;
  white-space: nowrap;
}
.buku-work18.revealed .area section {
  animation: areaCellIn 0.4s ease both;
}
.quiz-question18 {
  display: grid;
  gap: 20px;
}
.quiz-instruction18 {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  color: #29495f;
}
.quiz-instruction18 b {
  font-size: 30px;
}
.quiz-instruction18 span {
  font-size: 17px;
  font-weight: 800;
}
.quiz-instruction18.needs-choice {
  border-radius: 12px;
  background: #fff0eb;
  color: #d74429;
}
.quiz-choice18 {
  display: grid;
  gap: 5px;
}
.quiz-choice18 span {
  color: #ef5030;
  font-size: 18px;
}
.quiz-target18 {
  display: grid;
  gap: 10px;
  justify-items: center;
  color: #29495f;
}
.quiz-target18 > b {
  font-size: 31px;
}
.quiz-target18 span {
  font-size: 23px;
  font-weight: 900;
}
.quiz-target18 small {
  color: #ef5030;
  font-size: 17px;
  font-weight: 900;
}
@media (max-width: 760px) {
  .buku-work18 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .buku-area18 {
    padding-left: 38px;
    padding-top: 32px;
  }
  .buku-area18 .area {
    height: 220px;
  }
  .buku-area18 .side {
    left: 2px;
    font-size: 18px;
  }
  .buku-fields18 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .buku-fields18 label {
    grid-template-columns: 1fr 65px;
    font-size: 15px;
  }
  .buku-fields18 label b {
    min-height: 40px;
    font-size: 20px;
  }
  .buku-fields18 strong {
    grid-column: 1/-1;
    text-align: center;
    font-size: 21px;
  }
  .buku-area18 .area section {
    font-size: 17px;
  }
  .buku-area18.whole {
    width: 96%;
  }
}

/* Final checked layout: Stage 13 keeps the mathematical side-length proportions. */
.area13-top-labels,
.area13-grid {
  grid-template-columns: var(--wide-pct) calc(100% - var(--wide-pct));
}
.area13-left-labels,
.area13-grid {
  grid-template-rows: var(--upper-pct) calc(100% - var(--upper-pct));
}
.area13-grid section {
  min-width: 0;
  min-height: 0;
  padding: 6px;
  text-align: center;
}
.area13-grid span {
  line-height: 1.25;
}
.practice-area13 {
  margin: 8px auto;
}
.practice-area13 .area13-grid span {
  font-size: clamp(20px, 2.2vw, 30px);
}
.practice-area13 .area13-grid section {
  position: relative;
}
.practice-area13 .area13-grid small {
  position: absolute;
  top: 7px;
  left: 9px;
  color: #6c8292;
  font-size: 13px;
  font-weight: 900;
}
.practice-area13 .area13-grid .practice-target13 {
  background: #fff1b8;
  outline: 4px solid #f4b72b;
  outline-offset: -4px;
}
.practice-area13 .area13-grid .practice-target13 span {
  color: #c76d00;
  font-size: clamp(30px, 3.4vw, 46px);
}
.practice-division14 {
  display: grid;
  grid-template-columns: auto 42px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: min(900px, 96%);
  margin: 6px auto;
}
.division-source14 {
  display: grid;
  place-items: center;
  min-width: 105px;
  min-height: 105px;
  padding: 14px;
  border-radius: 50%;
  background: #dff2ff;
  color: #174a73;
}
.division-arrow14 { color: #1596d2; font-size: 36px; font-weight: 950; }
.division-groups14 {
  display: grid;
  grid-template-columns: repeat(var(--groups), minmax(70px, 1fr));
  gap: 10px;
}
.division-groups14 section {
  min-height: 100px;
  padding: 10px 7px;
  border: 3px solid #55aee0;
  border-radius: 18px;
  background: #f3fbff;
}
.division-groups14 section > b { display: block; margin-bottom: 8px; color: #326581; font-size: 13px; }
.division-groups14 section > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.division-groups14 i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #8fe2ff 0 12%, #159de1 35%, #0872bd 78%);
  box-shadow: 0 2px 4px #0c568044;
  animation: divideDot14 .42s both;
  animation-delay: calc(var(--order) * 55ms);
}
.practice-division14 figcaption {
  grid-column: 1 / -1;
  color: #244967;
  font-size: 22px;
  font-weight: 900;
}
@keyframes divideDot14 { from { opacity: 0; transform: translate(-24px,-12px) scale(.45); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .practice-division14 { grid-template-columns: 1fr; gap: 9px; }
  .division-source14 { min-width: 0; min-height: 0; border-radius: 18px; }
  .division-arrow14 { transform: rotate(90deg); font-size: 28px; }
  .division-groups14 { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
}

/* Stage 18 tablet fit and BUKU step-one diagram. */
.buku-work18 {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  gap: 18px;
  width: min(820px, 96%);
  box-sizing: border-box;
}
.buku-area18 {
  min-width: 0;
  box-sizing: border-box;
}
.buku-area18 .top-question {
  position: absolute;
  top: -4px;
  left: 57%;
  font-size: 24px;
  font-weight: 900;
}
.buku-area18.whole {
  padding-top: 30px;
}
@media (max-width: 900px) {
  .buku-work18 {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: 94%;
  }
  .buku-area18 {
    width: 100%;
    padding-left: 36px;
    padding-top: 30px;
  }
  .buku-area18 .area {
    height: 180px;
  }
  .buku-area18 .side {
    left: 0;
    font-size: 17px;
  }
  .buku-area18 .top-question {
    top: 0;
  }
  .buku-fields18 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .buku-fields18 label {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 5px;
    font-size: 14px;
  }
  .buku-fields18 label b {
    min-height: 36px;
    font-size: 18px;
  }
  .buku-fields18 strong {
    grid-column: 1/-1;
    text-align: center;
    font-size: 19px;
  }
  .buku-area18 .area section {
    font-size: 15px;
  }
  .buku-area18.whole {
    width: 94%;
    padding-top: 28px;
  }
  .buku-area18.whole .area {
    height: 190px;
  }
}

/* A recognisable football replaces abstract circles in Stage 14. */
.ball14 {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  overflow: visible;
}
.ball14:before,
.ball14:after,
.ball14 span:before {
  content: none;
}
.ball14 span {
  display: block;
  font-size: 50px;
  line-height: 1;
  filter: drop-shadow(0 2px 1px rgba(41, 73, 95, 0.2));
}
.distribution14 section .ball14 span {
  font-size: 36px;
}

/* Stage 15: one responsive intersection surface for multiplication and both divisions. */
.relation15-new {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(760px, 98%);
  color: #29495f;
}
.factor-controls15 {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.factor-controls15 label {
  display: grid;
  gap: 4px;
  justify-items: center;
  font-weight: 900;
}
.factor-controls15 label span {
  font-size: 14px;
}
.factor-controls15 input,
.division-control15 input {
  width: 74px;
  height: 52px;
  border: 3px solid #168fd0;
  border-radius: 10px;
  background: #fff;
  color: #29495f;
  text-align: center;
  font: 950 23px/1 inherit;
}
.factor-controls15 > b {
  padding-bottom: 13px;
  font-size: 25px;
}
.factor-controls15 > strong {
  padding-bottom: 11px;
  color: #ef5030;
  font-size: 25px;
}
.intersection-shell15 {
  position: relative;
  width: min(620px, 88vw);
  padding: 36px 24px 16px 46px;
}
.top-number15,
.left-number15 {
  position: absolute;
  display: grid;
  place-items: center;
  color: #ef5030;
  font-size: 22px;
  font-weight: 950;
}
.top-number15 {
  left: calc(50% + 12px);
  top: 4px;
}
.left-number15 {
  left: 8px;
  top: 52%;
}
.intersection-grid15-new {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(22px, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(22px, 1fr));
  gap: 7px;
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border: 3px solid #29495f;
  background-color: #fff;
  background-image:
    linear-gradient(#d5e5ee 1px, transparent 1px),
    linear-gradient(90deg, #d5e5ee 1px, transparent 1px);
  background-size: calc(100% / var(--cols)) calc(100% / var(--rows));
  box-sizing: border-box;
}
.intersection-grid15-new > p {
  grid-column: 1/-1;
  align-self: center;
  margin: 0;
  text-align: center;
  font-weight: 900;
}
.point-cell15 {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: hsl(calc(var(--group) * 42deg + 18deg) 88% 91%);
  animation: intersectionPop 0.25s var(--delay) ease both;
}
.point-cell15 b {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #29495f;
  box-shadow: 0 0 0 2px #fff;
}
.relation15-new:not(.group-by-top):not(.group-by-left) .point-cell15 {
  background: transparent;
}
.group-by-top .point-cell15,
.group-by-left .point-cell15 {
  outline: 2px solid hsl(calc(var(--group) * 42deg + 18deg) 70% 58%);
  outline-offset: -2px;
}
.division-control15 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 25px;
  font-weight: 950;
}
.division-control15 strong {
  color: #ef5030;
}
.division-control15 em {
  color: #708798;
  font-size: 15px;
  font-style: normal;
}
.total-answer15 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 900;
}
.total-answer15 input {
  width: 92px;
  height: 46px;
  border: 3px solid #ef583b;
  border-radius: 10px;
  background: #fff2d7;
  color: #ef5030;
  text-align: center;
  font: 950 24px/1 inherit;
}
.group-caption15 {
  padding: 9px 18px;
  border-radius: 999px;
  background: #eef8ff;
  color: #ef5030;
  font-size: 19px;
  font-weight: 950;
}
.relation15-new + .fact-family15 {
  margin-top: 4px;
}
.buku-relation15 {
  display: grid;
  grid-template-columns: minmax(330px, 620px) 150px;
  gap: 12px 20px;
  align-items: center;
  width: min(800px, 98%);
}
.buku-grid15 {
  min-width: 0;
}
.buku-grid15 .pattern-grid-svg {
  display: block;
  width: 100%;
  max-height: 330px;
}
.buku-grid15 .pattern-dots circle {
  fill: #424d57;
}
.buku-total15 {
  display: grid;
  gap: 8px;
  color: #29495f;
  font-size: 18px;
  font-weight: 900;
}
.buku-total15 strong {
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 10px;
  border: 3px solid #29495f;
  background: #fff;
  color: #ef5030;
  font-size: 27px;
  line-height: 1.3;
  text-align: center;
}
.buku-relation15 > .relation-answer15 {
  grid-column: 1/-1;
  justify-self: center;
}
@media (max-width: 620px) {
  .area13-scene {
    grid-template-columns: 36px minmax(240px, 1fr);
    grid-template-rows: 36px 250px;
  }
  .area13-grid em {
    font-size: 19px;
  }
  .area13-grid span {
    font-size: 12px;
  }
  .ball14 span {
    font-size: 40px;
  }
  .distribution14 section .ball14 span {
    font-size: 31px;
  }
  .factor-controls15 {
    gap: 7px;
  }
  .factor-controls15 input,
  .division-control15 input {
    width: 60px;
    height: 46px;
    font-size: 20px;
  }
  .intersection-shell15 {
    width: min(370px, 91vw);
    padding: 32px 10px 10px 34px;
  }
  .intersection-grid15-new {
    gap: 3px;
    min-height: 210px;
    padding: 6px;
  }
  .point-cell15 b {
    width: 8px;
    height: 8px;
  }
  .top-number15 {
    left: calc(50% + 8px);
  }
  .left-number15 {
    left: 2px;
  }
  .division-control15 {
    font-size: 21px;
  }
  .fact-family15 {
    width: 100%;
  }
}
@media (max-width: 620px) {
  .buku-relation15 {
    grid-template-columns: 1fr 100px;
    gap: 8px;
    width: 100%;
  }
  .buku-grid15 .pattern-grid-svg {
    min-width: 300px;
  }
  .buku-total15 {
    font-size: 14px;
  }
  .buku-total15 strong {
    min-height: 78px;
    font-size: 20px;
  }
}

/* Final tablet/phone containment overrides. */
.relation15-new,
.intersection-shell15 {
  max-width: 100%;
  box-sizing: border-box;
}
.intersection-shell15 {
  width: min(560px, 100%);
  padding-right: 12px;
}
.intersection-grid15-new {
  min-width: 0;
}
.buku-work18,
.buku-area18,
.buku-area18 .area,
.buku-area18 .area > section {
  min-width: 0;
  box-sizing: border-box;
}
.buku-area18 .area {
  overflow: hidden;
}
.buku-area18 .area > section {
  height: 100%;
  align-self: stretch;
}
.buku-area18 .area > section:not(.rest) > b,
.buku-area18 .area > .rest > b {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}
.quiz-instruction18,
.quiz-instruction18 b,
.quiz-instruction18 span {
  color: #fff;
}
.quiz-instruction18.needs-choice {
  color: #fff;
  background: #b63d29;
}
@media (max-width: 900px) {
  .relation15-new {
    width: 96%;
  }
  .intersection-shell15 {
    width: 100%;
    padding-left: 40px;
  }
  .buku-work18 {
    width: min(680px, 96%);
  }
  .buku-area18 .area {
    height: 210px;
  }
}
@media (max-width: 620px) {
  .intersection-shell15 {
    width: 100%;
    padding: 30px 6px 8px 30px;
  }
  .intersection-grid15-new {
    min-height: 170px;
  }
  .buku-area18 .area {
    height: 180px;
  }
}
