/* ---------- Ask Mom button ---------- */

.ask-mom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  padding: 4px 16px 4px 6px;
  border: 3px solid #F48FB1;
  border-radius: 999px;
  background: #FFF0F6;
  color: #C2185B;
  font-size: clamp(1rem, 4.2vw, 1.2rem);
  font-weight: 800;
  box-shadow: 0 4px 0 #F48FB1;
}

[dir=rtl] .ask-mom { padding: 4px 6px 4px 16px; }
.ask-mom img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.ask-mom:active { transform: translateY(3px); box-shadow: 0 1px 0 #F48FB1; }
.ask-mom-row { display: flex; justify-content: center; }

/* ---------- Overlay ---------- */

.mom-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  background: rgba(43, 45, 66, .4);
  animation: fade-in .2s ease-out;
}

.mom-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 600px;
  height: 100%;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(170deg, #FFF3F8, #F1ECFF);
  animation: slide-up .35s cubic-bezier(.3, 1.2, .6, 1);
}

.mom-head { display: flex; flex: none; align-items: center; gap: 10px; }

.mom-face {
  flex: none;
  width: clamp(76px, 13vh, 120px);
  height: clamp(76px, 13vh, 120px);
  border: 4px solid #F48FB1;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .08);
}

.mom-face.talking { animation: mom-talk .55s ease-in-out infinite alternate; }

.mom-say {
  position: relative;
  flex: 1;
  min-height: 3.2em;
  margin: 0;
  padding: 10px 14px;
  border-radius: 20px;
  background: #fff;
  font-size: clamp(1rem, 4.4vw, 1.3rem);
  font-weight: 800;
  line-height: 1.45;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .07);
}

.mom-say::before {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-start: -9px;
  border: 10px solid transparent;
  border-inline-end-color: #fff;
  border-inline-start: 0;
  translate: 0 -50%;
}

.mom-stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 16px);
  min-height: 0;
  padding: 10px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .06);
  overflow: hidden;
}

.mom-eq {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 2.6em;
  font-size: clamp(1.3rem, 6.4vw, 2rem);
  font-weight: 800;
}

.mom-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25em; }
.mom-line .op { color: var(--pink); }

.n-a { color: #E2572B; }
.n-b { color: #2B8BE2; }
.n-r { color: var(--green-dark); }
.mom-lbl { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.mom-lbl small { margin-top: 3px; font-size: .38em; white-space: nowrap; }

.mom-box {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.35em;
  border: 3px dashed var(--purple);
  border-radius: 10px;
}

.mom-box.filled { border: 3px solid var(--green); background: var(--green); color: #fff; animation: pop-in .4s; }

.mom-dots { display: flex; flex: none; justify-content: center; gap: 8px; }
.mom-dots span { width: 12px; height: 12px; border-radius: 50%; background: #D9D3F5; transition: background .3s, transform .3s; }
.mom-dots span.on { background: var(--purple); transform: scale(1.2); }

.mom-actions { display: flex; flex: none; gap: 10px; }
.mom-actions .big-btn { flex: 1; margin: 0; padding-inline: 8px; }
.mom-actions .big-btn.ready { animation: pulse 1s ease-in-out infinite; }

/* ---------- Shared stage pieces ---------- */

.mom-count {
  position: relative;
  min-height: 1em;
  color: var(--green-dark);
  font-size: clamp(2.2rem, 7vh, 3.2rem);
  font-weight: 800;
  line-height: 1;
}

.mom-count.pop { animation: pop-in .35s; }

.mom-float {
  position: absolute;
  top: 0;
  inset-inline-start: 100%;
  margin-inline-start: 6px;
  font-size: .55em;
  white-space: nowrap;
  animation: mom-float 1.4s ease-out forwards;
}

.mom-float.up { color: var(--green-dark); }
.mom-float.down { color: #E2572B; }

.mom-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mom-legend span { padding: 2px 10px; border-radius: 10px; color: #fff; font-size: .9rem; font-weight: 800; }
.mom-legend .a { background: #E2572B; }
.mom-legend .b { background: #2B8BE2; }

.mom-stage .ping { animation: mom-ping .45s ease-out; }

/* ---------- Cupcake boxes (lessons 1 and 5) ---------- */

.cake { display: inline-block; line-height: 1; }

.cake-shelf { display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2.4vh, 18px); }
.cake-shelf.packed { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 18px 8px; }

.cake-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 2.3em;
  padding: 6px 8px 4px;
  border: 3px solid #D99A2B;
  border-radius: 12px;
  background: #FFD98A;
  font-size: clamp(1.3rem, 4.2vh, 1.8rem);
  transform: scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .6, 1);
}

.cake-box.on { transform: scale(1); }
.cake-box.ping { animation: mom-ping .45s ease-out; }

.cake-box .box-tally {
  position: absolute;
  top: -13px;
  inset-inline-end: -10px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #fff;
  font-size: .85rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity .2s;
}

.cake-box .box-tally.on { opacity: 1; }

.cake.extra { border-radius: 50%; background: #FFE0D1; box-shadow: 0 0 0 3px #E2572B; animation: mom-drop-in .5s ease-out both; }
.cake.ping { animation: mom-ping .45s ease-out; }
.cake.eaten { animation: mom-eat .7s ease-in forwards; }

.box-num {
  position: absolute;
  bottom: -13px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #E2572B;
  color: #fff;
  font-size: .85rem;
  translate: -50% 0;
  opacity: 0;
}

.box-num.on { opacity: 1; }

.cake-pile {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 6px;
  max-width: 250px;
  max-height: 200px;
  font-size: clamp(1.5rem, 4.4vh, 2rem);
  transform: scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .6, 1), max-height .5s, opacity .4s;
}

.cake-pile.on { transform: scale(1); }
.cake-pile.empty { max-height: 0; opacity: 0; }
.cake-pile .cake { transition: opacity .4s, transform .4s; }
.cake-pile .cake.gone { opacity: 0; transform: translateY(30px) scale(.4); }

.table-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

.chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: #F1ECFF;
  font-size: clamp(.9rem, 2.6vh, 1.1rem);
  font-weight: 800;
  animation: pop-in .35s;
}

.chip.hit { background: var(--green); color: #fff; }

/* ---------- Cupcake tray (swap) ---------- */

.cake-tray {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  background: #EEDCBE;
  box-shadow: inset 0 0 0 4px #C9A97A;
}

.cake-tray .cake {
  display: grid;
  place-items: center;
  width: clamp(40px, 7vh, 52px);
  height: clamp(40px, 7vh, 52px);
  border-radius: 50%;
  font-size: clamp(1.6rem, 4.6vh, 2.1rem);
  transform: scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .6, 1) var(--d), background-color .3s, box-shadow .3s;
}

.cake-tray.on .cake { transform: scale(1); }
.cake-tray .cake.row { background: #FFD3BF; }
.cake-tray .cake.col { background: #CFE4FF; }
.cake-tray .cake.now.row { box-shadow: 0 0 0 3px #E2572B; }
.cake-tray .cake.now.col { box-shadow: 0 0 0 3px #2B8BE2; }

/* ---------- Chocolate bar (split) ---------- */

.choco { display: flex; flex-direction: column; align-items: center; gap: 0; transition: gap .6s; }
.choco.split { gap: 22px; }

.choco-piece {
  --sq: clamp(22px, 3.7vh, 30px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, var(--sq));
  gap: 3px;
  padding: 4px;
  border-radius: 8px;
  background: #5A3420;
  transition: background .5s, transform .6s;
}

.choco .sq {
  width: var(--sq);
  height: var(--sq);
  border-radius: 5px;
  background: #7B4A2C;
  box-shadow: inset -3px -3px 0 #5A3420, inset 3px 3px 0 #9A6340;
  transform: scale(0);
  transition: transform .3s cubic-bezier(.3, 1.6, .6, 1);
}

.choco .sq.on { transform: scale(1); }
.choco.split .p1 { transform: rotate(-2deg); }
.choco.split .p2 { background: #C98A3A; transform: rotate(2deg); }
.choco.split .p2 .sq { background: #E8B766; box-shadow: inset -3px -3px 0 #C98A3A, inset 3px 3px 0 #F6D08F; }
.choco-piece.ping { animation: mom-ping .6s ease-out; }

.choco-piece .crack {
  position: absolute;
  right: -6px;
  bottom: -3px;
  left: -6px;
  height: 4px;
  background: repeating-linear-gradient(90deg, #fff 0 6px, transparent 6px 10px);
  opacity: 0;
  transition: opacity .2s;
}

.choco-piece .crack.on { opacity: 1; }
.choco.split .crack { opacity: 0; }

.choco-piece .side {
  position: absolute;
  top: 50%;
  inset-inline-end: calc(100% + 8px);
  color: #E2572B;
  font-size: .95rem;
  font-weight: 800;
  white-space: nowrap;
  translate: 0 -50%;
  animation: pop-in .35s;
}

.choco-piece .tag {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  animation: pop-in .35s;
}

/* ---------- Times-table staircase (one more / one less) ---------- */

.stairs {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: clamp(200px, 36vh, 280px);
  padding-top: 52px;
}

.stair-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.stair-col small { line-height: 1.6; font-size: .8rem; font-weight: 800; color: #6B6E85; white-space: nowrap; }

.stair {
  display: flex;
  justify-content: center;
  width: clamp(38px, 11vw, 48px);
  height: calc(var(--h) * (100% - 1.6em));
  padding-top: 3px;
  border-radius: 8px 8px 0 0;
  background: #B9AEF7;
  color: #fff;
  font-weight: 800;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .4s cubic-bezier(.3, 1.4, .6, 1) var(--d), background .3s;
}

.stairs.on .stair { transform: scaleY(1); }
.stair.here { background: var(--purple); }

.stair-walker {
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 46px;
  object-fit: contain;
  translate: -50% 0;
  opacity: 0;
  transition: left .5s ease-in-out, top .5s ease-in-out, opacity .3s;
}

.stair-walker.on { opacity: 1; }

/* ---------- Rows or columns choice (swap) ---------- */

.mom-choices { display: flex; gap: 10px; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .35s cubic-bezier(.3, 1.6, .6, 1); }
.mom-choices.on { opacity: 1; transform: scale(1); }
.mom-choices.on.mom-leaving { opacity: 0; transform: scale(.6); pointer-events: none; }

.mom-choice {
  padding: 8px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: clamp(1rem, 4.4vw, 1.2rem);
  font-weight: 800;
  animation: pulse 1.2s ease-in-out infinite;
}

.mom-choice.row { background: #E2572B; box-shadow: 0 4px 0 #A83C1A; }
.mom-choice.col { background: #2B8BE2; box-shadow: 0 4px 0 #1C5FA0; }

/* ---------- Party plates and rock-paper-scissors (zero and one) ---------- */

.party { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.party-plate {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, auto);
  place-content: center;
  gap: 2px;
  width: clamp(84px, 14vh, 104px);
  height: clamp(84px, 14vh, 104px);
  border: 4px solid #D3D9EC;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 58%, #EEF1FA 59%);
  box-shadow: 0 5px 0 #CBD1E6;
  font-size: clamp(1.3rem, 3.8vh, 1.7rem);
  transform: scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .6, 1);
}

.party-plate.on { transform: scale(1); }
.party-plate .drink { line-height: 1; transition: opacity .4s, transform .4s; }
.party-plate .drink.gone { opacity: 0; transform: translateY(-24px) scale(.4); }

.party-plate .zero {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #E2572B;
  font-size: 2.2rem;
  font-weight: 800;
  opacity: 0;
  transition: opacity .3s .3s;
}

.party-plate.empty .zero { opacity: 1; }

.rps-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 340px; }

.rps-card {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  align-items: center;
  gap: 1px;
  padding: 3px 2px 2px;
  border-radius: 10px;
  font-size: clamp(1rem, 2.9vh, 1.3rem);
  line-height: 1.1;
  animation: pop-in .35s;
  transition: opacity .3s;
}

.rps-card i { font-size: .55em; font-style: normal; color: #6B6E85; }
.rps-card b { grid-column: 1 / -1; font-size: .55em; text-align: center; }
.rps-card.win { background: #DDF6E6; }
.rps-card.win b { color: var(--green-dark); }
.rps-card.tie { background: #FFF1C2; }
.rps-card.tie b { color: #B07A00; }
.rps-card.lose { background: #ECEDF3; }
.rps-card.lose b { color: #6B6E85; }
.rps-card.dim { opacity: .3; }

.points-table { border-collapse: collapse; font-size: clamp(.8rem, 2.2vh, 1rem); font-weight: 800; text-align: center; }
.points-table td, .points-table th { min-width: 58px; height: clamp(20px, 3.3vh, 30px); padding: 1px 10px; border: 2px solid #E2DCF7; }
.points-table th { background: #F3EEFF; font-size: .85em; }
.points-table tr.on td { background: #FFF3C4; }
.points-table .tot td { background: #E3F8EA; color: var(--green-dark); }
.points-table .pop { display: inline-block; animation: pop-in .3s; }

/* ---------- Frog jumps on a number line (missing number) ---------- */

.numline { position: relative; width: min(100%, 330px); direction: ltr; }
.numline svg { display: block; width: 100%; height: auto; overflow: visible; }
.numline line { stroke: #2B2D42; stroke-width: 3; stroke-linecap: round; }
.numline line.tick { stroke-width: 2; }
.numline text { fill: #2B2D42; font-size: 13px; font-weight: 800; }
.numline path { fill: none; stroke: #2ECC71; stroke-width: 3; stroke-dasharray: 5 4; animation: fade-in .4s; }
.numline .jump-num circle { fill: #fff; stroke: #2ECC71; stroke-width: 2; }
.numline .jump-num text { font-size: 12px; }
.numline .jump-num { animation: pop-in .35s; transform-box: fill-box; transform-origin: center; }
.numline .jump-num.lit circle { fill: #2ECC71; }
.numline .jump-num.lit text { fill: #fff; }
.numline .jump-num.lit { animation: mom-ping .45s ease-out; }
.numline .frog { position: absolute; top: 0; left: 0; font-size: 2rem; line-height: 1; }

.mom-leaving { opacity: 0 !important; transform: scale(.9); transition: opacity .3s, transform .3s; }

/* ---------- Money (times 10, 11, 12) ---------- */

.wallets { display: flex; flex-direction: column; gap: clamp(6px, 1.4vh, 12px); }

.wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  transform: scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .6, 1);
}

.wallet.on { transform: scale(1); }
.wallet .kid { font-size: clamp(1.6rem, 5vh, 2.2rem); line-height: 1; }

.note {
  display: grid;
  place-items: center;
  width: clamp(64px, 11vh, 84px);
  height: clamp(34px, 5.6vh, 42px);
  border: 3px solid #3E9B57;
  border-radius: 6px;
  background: #CDEBD3;
  color: #1E6B34;
  font-size: 1.2rem;
  font-weight: 800;
  transition: background .3s, color .3s;
}

.note.lit { background: #3E9B57; color: #fff; }

.coin {
  display: grid;
  place-items: center;
  width: clamp(30px, 5vh, 38px);
  height: clamp(30px, 5vh, 38px);
  border: 3px solid #C9A227;
  border-radius: 50%;
  background: #FBEBC0;
  color: #7A5B00;
  font-weight: 800;
  transition: background .3s;
}

.coin.lit { background: #FFC72C; }

/* ---------- Short phones ---------- */

@media (max-height: 700px) {
  .mom-panel { gap: 7px; }
  .mom-face { width: 64px; height: 64px; border-width: 3px; }
  .mom-say { min-height: 0; padding: 7px 12px; font-size: .95rem; line-height: 1.35; }
  .mom-eq { min-height: 2.2em; font-size: 1.25rem; }
  .mom-actions .big-btn { padding-block: 7px; }
  .stairs { padding-top: 48px; }
}

/* ---------- Keyframes ---------- */

@keyframes mom-talk {
  from { transform: translateY(0) rotate(-1.5deg); }
  to { transform: translateY(-4px) rotate(1.5deg); }
}

@keyframes mom-ping {
  50% { transform: scale(1.3); }
}

@keyframes mom-float {
  0% { opacity: 0; transform: translateY(10px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-36px); }
}

@keyframes mom-drop-in {
  from { opacity: 0; transform: translateY(-40px) scale(.5); }
  to { opacity: 1; transform: none; }
}

@keyframes mom-eat {
  to { opacity: 0; transform: translateY(-50px) scale(.3) rotate(-30deg); }
}
