.balloon-maths-page {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: #eef8fb;
}

.balloon-maths,
.balloon-maths * { box-sizing: border-box; }

.balloon-maths {
  --bm-navy: #0a3558;
  --bm-navy-soft: #31566f;
  --bm-teal: #078486;
  --bm-teal-dark: #066c70;
  --bm-teal-pale: #e9f9f8;
  --bm-sky: #e8f5fa;
  --bm-surface: #ffffff;
  --bm-line: #dcebf0;
  --bm-yellow: #f6be46;
  --bm-radius-lg: 1.75rem;
  --bm-radius-md: 1.15rem;
  --bm-shadow: 0 1.4rem 3.5rem rgb(24 76 101 / 12%);
  width: min(100% - 2rem, 73rem);
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  padding: clamp(.6rem, 1.5vh, 1rem) 0;
  color: var(--bm-navy);
  font-family: Inter, ui-rounded, "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.balloon-maths::before,
.balloon-maths::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.balloon-maths::before {
  top: -5rem;
  left: -4rem;
  width: 17rem;
  height: 17rem;
  background: rgb(58 189 183 / 12%);
}

.balloon-maths::after {
  right: -5rem;
  bottom: -6rem;
  width: 20rem;
  height: 20rem;
  background: rgb(85 154 222 / 10%);
}

.balloon-maths__shell {
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(10 53 88 / 7%);
  border-radius: var(--bm-radius-lg);
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--bm-shadow);
}

.balloon-maths__header {
  display: flex;
  min-height: 4.6rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: .55rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--bm-line);
  background: var(--bm-surface);
}

.balloon-maths__identity,
.balloon-maths__tools {
  display: flex;
  align-items: center;
}

.balloon-maths__identity { gap: .75rem; text-align: left; }
.balloon-maths__tools { gap: .75rem; flex-wrap: wrap; align-content: center; justify-content: flex-end; }

.balloon-maths__mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: .9rem;
  background: var(--bm-teal);
  box-shadow: 0 .4rem .9rem rgb(7 132 134 / 18%);
  color: #fff;
  font-size: 1.65rem;
  font-weight: 800;
}

.balloon-maths__school {
  margin: 0 0 .12rem;
  color: var(--bm-teal);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.balloon-maths__header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.balloon-maths__progress {
  margin: 0;
  padding: .55rem .8rem;
  border-radius: 999px;
  background: var(--bm-teal-pale);
  color: var(--bm-teal-dark);
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.balloon-maths__restart,
.balloon-maths__voice {
  min-width: 4.75rem;
  min-height: 2.75rem;
  padding: .55rem .8rem;
  border: 1px solid #bfd6de;
  border-radius: .8rem;
  background: #fff;
  color: var(--bm-navy-soft);
  font: inherit;
  font-size: .85rem;
  font-weight: 750;
  cursor: pointer;
}

.balloon-maths__voice[aria-pressed="true"] { background: var(--bm-teal-pale); color: var(--bm-teal-dark); }
.balloon-maths__voice:disabled { opacity: .58; cursor: not-allowed; }

.balloon-maths__game {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  padding: clamp(.65rem, 1.5vh, 1rem) clamp(.8rem, 3vw, 2rem) clamp(.55rem, 1.2vh, .8rem);
  background:
    linear-gradient(180deg, rgb(232 248 250 / 60%), transparent 14rem),
    #fbfdfe;
  text-align: center;
}

.balloon-maths__round { transition: opacity 180ms ease; }
.balloon-maths__game.is-loading .balloon-maths__workspace { visibility: hidden; }

.balloon-maths__game.is-loading::before {
  content: "Preparing your round…";
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--bm-navy-soft);
  font-weight: 750;
}

.balloon-maths__workspace {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) clamp(10rem, 17vw, 12.5rem);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "lesson companion"
    "bottom companion";
  align-items: stretch;
  column-gap: clamp(.5rem, 2vw, 1.5rem);
  row-gap: clamp(.4rem, 1vh, .65rem);
}

.balloon-maths__lesson {
  min-width: 0;
  min-height: 0;
  grid-area: lesson;
}

.balloon-maths__round {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto minmax(16rem, 1fr);
}

.balloon-maths__companion {
  grid-area: companion;
  align-self: end;
  min-width: 0;
  padding-top: .35rem;
}

.balloon-maths__speech {
  position: relative;
  z-index: 1;
  width: min(100%, 12rem);
  margin: 0 auto .25rem;
  padding: .7rem .8rem;
  border: 1px solid #c9e3e8;
  border-radius: 1rem 1rem 1rem .35rem;
  background: #fff;
  box-shadow: 0 .5rem 1.2rem rgb(10 53 88 / 9%);
  color: var(--bm-navy-soft);
  font-size: clamp(.78rem, 1.3vw, .92rem);
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
}

.balloon-maths__speech::after {
  content: "";
  position: absolute;
  bottom: -.42rem;
  left: 1rem;
  width: .75rem;
  height: .75rem;
  border-right: 1px solid #c9e3e8;
  border-bottom: 1px solid #c9e3e8;
  background: #fff;
  rotate: 45deg;
}

.balloon-maths__character {
  display: block;
  width: min(100%, 11.25rem);
  height: clamp(8.5rem, min(18vw, 28vh), 13.75rem);
  margin: 0 auto;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 .55rem .45rem rgb(10 53 88 / 9%));
  animation: balloon-maths-character-idle 4.2s ease-in-out infinite;
}

.balloon-maths__character[hidden] { display: none; }
.balloon-maths__companion.has-missing-image { align-self: center; min-height: 7rem; }

.balloon-maths__companion[data-character-state="celebrate"] .balloon-maths__character {
  animation: balloon-maths-character-celebrate 520ms ease-out both;
}

.balloon-maths__companion[data-character-state="encourage"] .balloon-maths__speech,
.balloon-maths__companion[data-character-state="celebrate"] .balloon-maths__speech {
  border-color: #b8dfcd;
  background: #f2fbf6;
}

.balloon-maths__equation {
  width: fit-content;
  min-width: min(100%, 22rem);
  margin: 0 auto;
  padding: clamp(.5rem, 1.25vh, .8rem) clamp(1.3rem, 5vw, 3rem);
  border: 2px solid #b9e7e5;
  border-radius: var(--bm-radius-md);
  background: var(--bm-surface);
  box-shadow: 0 .7rem 1.8rem rgb(16 94 112 / 10%);
  color: var(--bm-navy);
  font-size: clamp(2.35rem, min(6vw, 7vh), 4rem);
  font-weight: 850;
  letter-spacing: .025em;
  line-height: 1.12;
  transition: border-color 240ms ease, background 240ms ease, color 240ms ease;
}

.balloon-maths__game.is-success .balloon-maths__equation {
  border-color: #6ed6b4;
  background: #f0fbf6;
  color: #0c5a45;
}

.balloon-maths__instruction {
  margin: clamp(.4rem, 1vh, .7rem) auto .15rem;
  color: var(--bm-navy-soft);
  font-size: clamp(.98rem, 2vw, 1.12rem);
  font-weight: 650;
}

.balloon-maths__sky {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: auto;
  min-height: 16rem;
  max-width: 66rem;
  margin: clamp(.2rem, .7vh, .4rem) auto 0;
  border: 1px solid #d3edf3;
  border-radius: 1.4rem;
  background:
    radial-gradient(ellipse at 13% 18%, rgb(255 255 255 / 88%) 0 5%, transparent 5.5%),
    radial-gradient(ellipse at 82% 28%, rgb(255 255 255 / 76%) 0 7%, transparent 7.5%),
    linear-gradient(180deg, #dff6fd 0%, #f5fcff 78%, #ecf9ef 100%);
  box-shadow: inset 0 -1.5rem 2.5rem rgb(77 176 139 / 7%);
}

.balloon-maths__sky::before,
.balloon-maths__sky::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgb(255 255 255 / 65%);
  pointer-events: none;
}
.balloon-maths__sky::before { top: 12%; left: 7%; width: 5rem; height: 1.2rem; box-shadow: 2rem -.4rem 0 -.1rem rgb(255 255 255 / 65%); }
.balloon-maths__sky::after { right: 9%; bottom: 12%; width: 6rem; height: 1.35rem; box-shadow: -2.2rem -.35rem 0 -.15rem rgb(255 255 255 / 65%); }

.balloon-maths__play-area {
  position: absolute;
  z-index: 2;
  inset: 2.35rem 0 0;
}

.balloon-maths__total {
  position: absolute;
  z-index: 4;
  top: .55rem;
  left: .75rem;
  margin: 0;
  padding: .3rem .55rem;
  border: 1px solid rgb(7 132 134 / 16%);
  border-radius: 999px;
  background: rgb(255 255 255 / 82%);
  color: var(--bm-navy-soft);
  font-size: .76rem;
  font-weight: 650;
  pointer-events: none;
}

.balloon-maths__total strong { color: var(--bm-teal-dark); font-size: .84rem; }

.balloon-maths__balloon {
  --balloon-color: #f16f72;
  --balloon-shade: #d95761;
  --float-delay: 0s;
  --float-duration: 5s;
  --drift-x: 6px;
  --drift-y: -10px;
  --balloon-slot: clamp(4.6rem, 7vw, 6rem);
  position: absolute;
  width: var(--balloon-slot);
  min-width: 0;
  min-height: 7.8rem;
  height: clamp(8rem, 15vw, 10.8rem);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: balloon-maths-float var(--float-duration) ease-in-out var(--float-delay) infinite;
}

.balloon-maths__balloon--yellow { --balloon-color: #f5c34e; --balloon-shade: #dfa52f; }
.balloon-maths__balloon--teal { --balloon-color: #31b6ad; --balloon-shade: #16968f; }
.balloon-maths__balloon--blue { --balloon-color: #5599df; --balloon-shade: #347bc7; }
.balloon-maths__balloon--purple { --balloon-color: #9b76d8; --balloon-shade: #7d58bb; }
.balloon-maths__balloon--green { --balloon-color: #70bc75; --balloon-shade: #4a9d57; }

.balloon-maths__balloon-shape {
  position: absolute;
  top: .3rem;
  left: 50%;
  width: min(78%, 5.6rem);
  aspect-ratio: .86;
  translate: -50% 0;
  border-radius: 51% 49% 47% 53% / 43% 45% 57% 57%;
  background:
    radial-gradient(ellipse at 30% 23%, rgb(255 255 255 / 78%) 0 6%, rgb(255 255 255 / 18%) 7% 17%, transparent 19%),
    linear-gradient(145deg, var(--balloon-color) 20%, var(--balloon-color) 58%, var(--balloon-shade));
  box-shadow: inset -.35rem -.5rem .9rem rgb(10 53 88 / 12%), 0 .65rem 1rem rgb(10 53 88 / 16%);
  transition: scale 140ms ease, filter 140ms ease;
}

.balloon-maths__balloon-shape::before {
  content: "";
  position: absolute;
  bottom: -.48rem;
  left: 50%;
  border-right: .35rem solid transparent;
  border-bottom: .58rem solid var(--balloon-shade);
  border-left: .35rem solid transparent;
  translate: -50% 0;
}

.balloon-maths__balloon-shape::after {
  content: "";
  position: absolute;
  top: calc(100% + .45rem);
  left: 50%;
  width: 1px;
  height: clamp(3rem, 6vw, 4.1rem);
  background: #91a8b3;
  transform-origin: top;
  rotate: -2deg;
}

.balloon-maths__balloon:hover .balloon-maths__balloon-shape { scale: 1.045; filter: saturate(1.06); }
.balloon-maths__balloon:active .balloon-maths__balloon-shape { scale: .94 .97; }
.balloon-maths__balloon:focus-visible,
.balloon-maths__restart:focus-visible,
.balloon-maths__voice:focus-visible,
.balloon-maths__action:focus-visible,
.balloon-maths__check:focus-visible,
.balloon-maths__retry:focus-visible {
  outline: 3px solid var(--bm-navy);
  outline-offset: 3px;
}
.balloon-maths__balloon[disabled] { cursor: default; }

.balloon-maths__balloon.is-popping {
  pointer-events: none;
  animation: balloon-maths-pop 230ms ease-out forwards;
}

.balloon-maths__bee {
  position: absolute;
  z-index: 6;
  bottom: .55rem;
  left: .7rem;
  width: clamp(3.2rem, 6vw, 4.75rem);
  pointer-events: none;
  transform-origin: center;
}
.balloon-maths__bee[hidden] { display: none; }
.balloon-maths__bee img { display: block; width: 100%; height: auto; filter: drop-shadow(0 .3rem .25rem rgb(10 53 88 / 16%)); }
.balloon-maths__bee.is-flying { animation: balloon-maths-bee-fly 330ms cubic-bezier(.3,.7,.35,1) forwards; }
.balloon-maths__bee.is-returning { animation: balloon-maths-bee-return 260ms ease-in forwards; }

.balloon-maths__burst {
  position: absolute;
  top: -1.4rem;
  left: 65%;
  display: none;
  padding: .2rem .35rem;
  border-radius: .45rem;
  background: #fff4b8;
  color: #ad6500;
  font-size: .62rem;
  font-weight: 900;
  rotate: -8deg;
}
.balloon-maths__bee.is-at-target .balloon-maths__burst { display: block; animation: balloon-maths-burst 180ms ease-out both; }

.balloon-maths__check-panel {
  display: flex;
  width: fit-content;
  max-width: 100%;
  min-height: 4rem;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin: 0 auto;
  padding: .55rem .7rem;
  border: 1px solid #c8e4e3;
  border-radius: 1rem;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 .6rem 1.4rem rgb(10 53 88 / 9%);
}

.balloon-maths__bottom-row {
  grid-area: bottom;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: .75rem;
  min-height: 4rem;
}
.balloon-maths__check-panel p { max-width: 14rem; margin: 0; color: var(--bm-navy-soft); font-size: .82rem; font-weight: 650; line-height: 1.35; text-align: left; }
.balloon-maths__check,
.balloon-maths__retry { min-height: 3rem; padding: .7rem 1rem; border-radius: .85rem; font: inherit; font-weight: 800; cursor: pointer; }
.balloon-maths__check { border: 0; background: var(--bm-teal); box-shadow: 0 .4rem .85rem rgb(7 132 134 / 18%); color: #fff; font-size: 1rem; }
.balloon-maths__check span { margin-right: .35rem; font-size: 1.2rem; }
.balloon-maths__retry { border: 1px solid #d49b34; background: #fff8e8; color: #825207; }
.balloon-maths__check:disabled,
.balloon-maths__restart:disabled { opacity: .55; cursor: wait; }

.balloon-maths__footer {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0;
}

.balloon-maths__game:not(.is-success):not(.has-check-feedback) .balloon-maths__footer {
  margin-top: 0;
}

.balloon-maths__feedback {
  min-height: 1.6rem;
  color: var(--bm-teal-dark);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 800;
}

.balloon-maths__game.is-success .balloon-maths__footer {
  flex: 1 1 22rem;
  width: auto;
  max-width: none;
  margin: 0;
  padding: .7rem .8rem .7rem 1.1rem;
  border: 1px solid #bce4d4;
  border-radius: 1rem;
  background: #effbf5;
}

.balloon-maths__game.is-success::after {
  content: "✦  •  ✦";
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: var(--bm-yellow);
  font-size: 1.4rem;
  animation: balloon-maths-celebrate 600ms ease-out both;
}

.balloon-maths__action {
  min-width: 9.5rem;
  min-height: 3rem;
  padding: .7rem 1.2rem;
  border: 0;
  border-radius: .9rem;
  background: var(--bm-teal);
  box-shadow: 0 .45rem .9rem rgb(7 132 134 / 20%);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.balloon-maths__restart,
.balloon-maths__voice,
.balloon-maths__action { transition: translate 140ms ease, box-shadow 140ms ease, background 140ms ease; }
.balloon-maths__restart:hover,
.balloon-maths__voice:not(:disabled):hover { background: #f4fafb; }
.balloon-maths__action:hover { translate: 0 -2px; background: var(--bm-teal-dark); }

.balloon-maths__completion {
  display: grid;
  height: 100%;
  min-height: 0;
  place-content: center;
  padding: 2rem;
}

.balloon-maths__completion[hidden] { display: none; }

.balloon-maths__completion-icon {
  display: grid;
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 50%;
  background: #fff4ce;
  color: #c98610;
  font-size: 2.5rem;
  box-shadow: 0 .7rem 1.5rem rgb(201 134 16 / 13%);
}

.balloon-maths__completion h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -.03em;
}

.balloon-maths__completion p {
  margin: .65rem 0 0;
  color: var(--bm-navy-soft);
  font-size: 1.08rem;
}

.balloon-maths__game.is-success:not(.is-complete) .balloon-maths__check-panel { flex: 1 1 28rem; }

@keyframes balloon-maths-float {
  0%, 100% { translate: 0 0; rotate: -1deg; }
  35% { translate: var(--drift-x) var(--drift-y); rotate: 1.2deg; }
  70% { translate: 0 3px; rotate: -.6deg; }
}
@keyframes balloon-maths-pop {
  0% { opacity: 1; scale: 1; }
  50% { opacity: .9; scale: 1.16 .9; }
  100% { opacity: 0; scale: .1; }
}
@keyframes balloon-maths-celebrate {
  0% { opacity: 0; scale: .6; rotate: -8deg; }
  60% { opacity: 1; scale: 1.18; }
  100% { scale: 1; rotate: 0; }
}
@keyframes balloon-maths-character-idle {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -.2rem; }
}
@keyframes balloon-maths-character-celebrate {
  0% { translate: 0 .25rem; scale: .96; }
  55% { translate: 0 -.55rem; scale: 1.04; }
  100% { translate: 0 0; scale: 1; }
}
@keyframes balloon-maths-bee-fly {
  0% { transform: translate(0, 0) rotate(-3deg); }
  70% { transform: translate(var(--bee-x), calc(var(--bee-y) - 9px)) rotate(5deg); }
  100% { transform: translate(var(--bee-x), var(--bee-y)) rotate(-4deg); }
}
@keyframes balloon-maths-bee-return {
  0% { transform: translate(var(--bee-x), var(--bee-y)) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
@keyframes balloon-maths-burst {
  0% { opacity: 0; scale: .4; }
  70% { opacity: 1; scale: 1.15; }
  100% { scale: 1; }
}

@media (max-width: 56rem) {
  .balloon-maths {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .balloon-maths__shell { height: auto; }

  .balloon-maths__game { min-height: 0; }

  .balloon-maths__workspace {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "lesson"
      "bottom"
      "companion";
    align-items: center;
    gap: .65rem;
  }

  .balloon-maths__round {
    height: auto;
    grid-template-rows: auto auto auto;
  }
  .balloon-maths__companion {
    display: flex;
    max-width: 28rem;
    min-height: 8rem;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin: -.8rem auto 0;
    padding-top: 0;
  }
  .balloon-maths__speech {
    width: min(52%, 13rem);
    margin: 0;
    border-radius: 1rem 1rem .35rem 1rem;
    text-align: left;
  }
  .balloon-maths__speech::after {
    right: -.42rem;
    bottom: 1rem;
    left: auto;
    border-top: 1px solid #c9e3e8;
    border-right: 1px solid #c9e3e8;
    border-bottom: 0;
  }
  .balloon-maths__character {
    width: min(42%, 8.25rem);
    height: 8.5rem;
    margin: 0;
  }
}

@media (max-width: 43rem) {
  .balloon-maths { width: min(100% - .75rem, 73rem); padding-block: .4rem; }
  .balloon-maths__shell { border-radius: 1.25rem; }
  .balloon-maths__header { min-height: 4.5rem; gap: .6rem; padding: .65rem .8rem; }
  .balloon-maths__mark { width: 2.35rem; height: 2.35rem; border-radius: .72rem; font-size: 1.35rem; }
  .balloon-maths__school { font-size: .56rem; letter-spacing: .08em; }
  .balloon-maths__tools { gap: .4rem; }
  .balloon-maths__progress { padding: .45rem .55rem; font-size: .7rem; }
  .balloon-maths__restart { min-width: 3.2rem; min-height: 2.75rem; padding-inline: .55rem; font-size: .75rem; }
  .balloon-maths__voice { min-width: 3.2rem; min-height: 2.75rem; padding-inline: .55rem; font-size: .7rem; }
  .balloon-maths__game { min-height: 0; padding: 1rem .55rem .8rem; }
  .balloon-maths__equation { min-width: min(100%, 17rem); font-size: clamp(2.15rem, 11vw, 2.75rem); }
  .balloon-maths__instruction { max-width: 18rem; margin-top: .8rem; line-height: 1.35; }
  .balloon-maths__play-area {
    inset: 2.35rem 0 0;
  }
  .balloon-maths__sky { height: 19rem; }
  .balloon-maths__balloon {
    --balloon-slot: clamp(3.5rem, 17vw, 4.25rem);
    min-height: 5.75rem;
    height: 6rem;
  }
  .balloon-maths__balloon-shape { width: min(82%, 3.4rem); }
  .balloon-maths__balloon-shape::after { height: 2rem; }
  .balloon-maths__bottom-row { gap: .45rem; }
  .balloon-maths__footer { flex-direction: column; gap: .4rem; }
  .balloon-maths__companion { min-height: 7rem; margin-top: -.5rem; }
  .balloon-maths__character { height: 7.4rem; }
  .balloon-maths__speech { padding: .6rem .7rem; font-size: .78rem; }
  .balloon-maths__check-panel { width: 100%; flex-wrap: wrap; gap: .45rem; margin: 0; }
  .balloon-maths__check-panel p { max-width: none; font-size: .72rem; text-align: center; }
  .balloon-maths__check { width: 100%; }
  .balloon-maths__retry { width: 100%; }
  .balloon-maths__game.is-success .balloon-maths__footer { width: auto; padding: .65rem; }
}

@media (max-width: 23rem) {
  .balloon-maths__header h1 { font-size: 1.15rem; }
  .balloon-maths__school { display: none; }
  .balloon-maths__balloon { --balloon-slot: clamp(3.25rem, 17vw, 3.75rem); }
}

@media (max-height: 50rem) and (min-width: 44rem) {
  .balloon-maths { padding-block: .4rem; }
  .balloon-maths__header { min-height: 4.15rem; padding-block: .4rem; }
  .balloon-maths__mark { width: 2.5rem; height: 2.5rem; }
  .balloon-maths__game { padding-block: .55rem .45rem; }
  .balloon-maths__equation { padding-block: .4rem; font-size: clamp(2.35rem, min(5vw, 6.5vh), 3.15rem); }
  .balloon-maths__instruction { margin-top: .35rem; }
  .balloon-maths__round { grid-template-rows: auto auto minmax(15rem, 1fr); }
  .balloon-maths__balloon {
    --drift-x: 4px !important;
    --drift-y: -6px !important;
    --balloon-slot: clamp(4.25rem, 6vw, 5.25rem);
    min-height: 6.5rem;
    height: clamp(6.75rem, 13vh, 7.8rem);
  }
  .balloon-maths__balloon-shape::after { height: clamp(2.25rem, 5vh, 3rem); }
  .balloon-maths__companion { padding-top: 0; }
  .balloon-maths__character { height: clamp(7.5rem, min(16vw, 24vh), 10.5rem); }
  .balloon-maths__speech { padding: .55rem .65rem; }
  .balloon-maths__check-panel { min-height: 3.6rem; padding-block: .4rem; }
  .balloon-maths__bottom-row,
  .balloon-maths__footer { min-height: 3.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .balloon-maths__balloon { animation: none; }
  .balloon-maths__round,
  .balloon-maths__balloon-shape,
  .balloon-maths__restart,
  .balloon-maths__voice,
  .balloon-maths__action { transition-duration: .01ms; }
  .balloon-maths__balloon.is-popping { animation-duration: .01ms; }
  .balloon-maths__game.is-success::after { animation: none; }
  .balloon-maths__character { animation: none !important; }
  .balloon-maths__bee.is-flying,
  .balloon-maths__bee.is-returning,
  .balloon-maths__bee.is-at-target .balloon-maths__burst { animation-duration: .01ms; }
}

/* Phase 6: welcome, levels and guided learning */
.balloon-maths [hidden] { display: none !important; }
.balloon-maths__home,
.balloon-maths__level,
.balloon-maths__secondary,
.balloon-maths__primary,
.level-card button {
  min-height: 2.75rem;
  border-radius: .85rem;
  font: inherit;
  font-weight: 800;
}
.balloon-maths__home,
.balloon-maths__secondary { border: 1px solid #b9d5df; background: #fff; color: var(--bm-navy); cursor: pointer; }
.balloon-maths__home { padding: .55rem .7rem; }
.balloon-maths__level {
  margin: 0;
  padding: .45rem .65rem;
  border: 1px solid color-mix(in srgb, var(--level-accent) 38%, white);
  background: color-mix(in srgb, var(--level-accent) 13%, white);
  color: var(--bm-navy);
  white-space: nowrap;
}
.balloon-maths__screen {
  min-height: 0;
  height: calc(100% - 4.7rem);
  overflow: hidden;
}
.balloon-maths__welcome {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(20rem, .95fr);
  align-items: center;
  padding: clamp(2rem, 6vw, 5rem);
  background: linear-gradient(180deg, #e8f9fd, #f8fdff 72%, #edf9ef);
}
.balloon-maths__welcome::before { content: ""; position: absolute; top: 18%; left: 8%; width: 7rem; height: 1.5rem; border-radius: 50%; background: rgb(255 255 255 / 80%); box-shadow: 3rem -.5rem 0 -.2rem rgb(255 255 255 / 80%); }
.balloon-maths__welcome-copy { position: relative; z-index: 2; max-width: 37rem; text-align: left; }
.balloon-maths__eyebrow { margin: 0 0 .55rem; color: var(--bm-teal-dark); font-size: .8rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.balloon-maths__welcome h2,
.balloon-maths__screen-heading h2 { margin: 0; color: var(--bm-navy); font-size: clamp(2.25rem, 4vw, 4rem); line-height: 1.02; }
.balloon-maths__welcome-copy > p:not(.balloon-maths__eyebrow) { max-width: 33rem; margin: 1.2rem 0 1.7rem; color: var(--bm-navy-soft); font-size: clamp(1rem, 1.7vw, 1.3rem); line-height: 1.6; }
.balloon-maths__primary,
.level-card button { padding: .8rem 1.4rem; border: 0; background: var(--bm-teal); box-shadow: 0 .45rem 1rem rgb(7 132 134 / 20%); color: #fff; cursor: pointer; }
.balloon-maths__welcome-art { position: relative; align-self: stretch; min-height: 26rem; }
.balloon-maths__welcome-mina { position: absolute; right: 14%; bottom: 0; height: min(72%, 19rem); width: auto; filter: drop-shadow(0 .7rem .6rem rgb(10 53 88 / 14%)); animation: balloon-maths-character-idle 4.2s ease-in-out infinite; }
.balloon-maths__welcome-bee { position: absolute; right: 4%; bottom: 20%; width: 5rem; animation: balloon-maths-float 4s ease-in-out infinite; }
.welcome-balloon { position: absolute; width: 4.8rem; aspect-ratio: .8; border-radius: 50% 50% 46% 54%; box-shadow: inset -.5rem -.6rem .8rem rgb(10 53 88 / 15%); animation: balloon-maths-float 5s ease-in-out infinite; }
.welcome-balloon::after { content: ""; position: absolute; top: 100%; left: 50%; width: 1px; height: 4rem; background: #91a8b3; }
.welcome-balloon--one { top: 8%; left: 5%; background: #f16f72; }
.welcome-balloon--two { top: 4%; right: 8%; background: #f5c34e; animation-delay: -1s; }
.welcome-balloon--three { top: 28%; left: 34%; background: #9b76d8; animation-delay: -2s; }
.balloon-maths__levels { padding: clamp(1.3rem, 3vw, 2.5rem); background: linear-gradient(180deg, #effbfe, #fff 64%, #f1faF3); }
.balloon-maths__screen-heading { text-align: center; }
.balloon-maths__screen-heading h2 { font-size: clamp(2rem, 3.5vw, 3.2rem); }
.balloon-maths__screen-heading > p:last-child { margin: .6rem 0 1.5rem; color: var(--bm-navy-soft); }
.balloon-maths__level-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.8rem, 2vw, 1.5rem); max-width: 62rem; margin: 0 auto; }
.level-card {
  display: flex;
  min-height: 20rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 1px solid #d4eaf0;
  border-radius: 1.5rem;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 .8rem 2rem rgb(10 53 88 / 9%);
  text-align: center;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.level-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1.1rem 2.4rem rgb(10 53 88 / 13%);
}
.level-card--easy { border-top: .45rem solid #31b6ad; }
.level-card--medium { border-top: .45rem solid #5599df; }
.level-card--hard { border-top: .45rem solid #9b76d8; }
.level-card__stars { min-height: 2rem; color: #edae25; font-size: 1.45rem; letter-spacing: .12em; }
.level-card h3 { margin: .45rem 0; color: var(--bm-navy); font-size: 1.65rem; text-transform: uppercase; }
.level-card p { min-height: 3rem; margin: 0 0 1.2rem; color: var(--bm-navy-soft); }
.balloon-maths__guide { position: absolute; z-index: 3; inset: 2.55rem 0 0; pointer-events: none; }
.balloon-maths__guide-divider { position: absolute; top: 1.95rem; bottom: .75rem; left: 28%; width: 10px; height: calc(100% - 2.7rem); translate: -50% 0; overflow: visible; }
.balloon-maths__guide-divider line { stroke: #e26354; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 8 11; }
.balloon-maths__guide-divider-fallback { display: none; }
.balloon-maths__guide span { position: absolute; top: .25rem; padding: .32rem .75rem; border-radius: 999px; font-size: .76rem; font-weight: 800; letter-spacing: .01em; box-shadow: 0 .3rem .8rem rgb(10 53 88 / 7%); }
.balloon-maths__guide-label--pop,
.balloon-maths__guide span:first-child { left: 14%; translate: -50% 0; border: 1.5px solid #f8b4af; background: #fff3f1; color: #ba3426; }
.balloon-maths__guide-label--keep,
.balloon-maths__guide span:nth-child(2) { left: 64%; translate: -50% 0; border: 1.5px solid #abebd8; background: #effbf6; color: #0c755c; }
.balloon-maths__game[data-difficulty="easy"] .balloon-maths__play-area { inset: 4.5rem 0 0; }
.balloon-maths__game[data-difficulty="easy"] .balloon-maths__balloon[data-group="keep"] { cursor: not-allowed; }
.balloon-maths__game[data-difficulty="easy"] .balloon-maths__balloon { --drift-x: 3px !important; --drift-y: -6px !important; }
.balloon-maths__completion-actions { display: flex; justify-content: center; gap: .7rem; margin-top: 1.25rem; }
.balloon-maths__secondary { padding: .75rem 1rem; }

@media (max-width: 800px) {
  .balloon-maths__screen { height: auto; min-height: calc(100vh - 5rem); overflow: visible; }
  .balloon-maths__welcome { grid-template-columns: 1fr; padding: 2rem 1.2rem 1rem; text-align: center; }
  .balloon-maths__welcome-copy { margin: 0 auto; text-align: center; }
  .balloon-maths__welcome-art { min-height: 18rem; }
  .balloon-maths__level-grid { grid-template-columns: 1fr; max-width: 28rem; }
  .level-card { min-height: 13rem; }
  .balloon-maths__levels { overflow: visible; }
}

@media (max-width: 520px) {
  .balloon-maths__home { font-size: .7rem; }
  .balloon-maths__level { order: 3; font-size: .68rem; }
  .balloon-maths__completion-actions { flex-direction: column; }
  .balloon-maths__guide span { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .balloon-maths__welcome-mina,
  .balloon-maths__welcome-bee,
  .welcome-balloon { animation: none; }
}
