:root {
  --cream: #fff8ed;
  --paper: #ffffff;
  --ink: #17364b;
  --muted: #6f7f89;
  --coral: #ff6547;
  --coral-dark: #dc432e;
  --teal: #08aeb8;
  --teal-dark: #087d88;
  --yellow: #ffbf2f;
  --purple: #8d61dc;
  --purple-dark: #6c45b1;
  --green: #55b972;
  --green-dark: #338f50;
  --shadow: 0 18px 44px rgba(35, 67, 84, 0.12);
  --small-shadow: 0 8px 20px rgba(35, 67, 84, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 191, 47, 0.17) 0 84px, transparent 85px),
    radial-gradient(circle at 93% 4%, rgba(8, 174, 184, 0.12) 0 125px, transparent 126px),
    var(--cream);
  font-family: "Avenir Next", "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 5px solid rgba(8, 174, 184, 0.28);
  outline-offset: 4px;
}

.home-screen,
.game-screen {
  min-height: 100vh;
}

.home-screen {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.topbar,
.game-topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 950;
  letter-spacing: -0.7px;
}

.brand img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgba(23, 54, 75, 0.12));
}

.welcome {
  min-height: 310px;
  margin-top: 10px;
  padding: 48px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.8fr);
  align-items: center;
  gap: 30px;
  position: relative;
  overflow: hidden;
  color: white;
  background: var(--ink);
  border-radius: 38px;
  box-shadow: 0 12px 0 #0e2839, var(--shadow);
}

.welcome::before {
  content: "";
  width: 270px;
  height: 270px;
  position: absolute;
  right: -75px;
  bottom: -110px;
  border-radius: 50%;
  background: rgba(8, 174, 184, 0.22);
}

.welcome-copy,
.welcome-art {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: #ffd879;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 1.6px;
}

.welcome h1 {
  margin: 13px 0 10px;
  font-size: clamp(48px, 6vw, 76px);
  line-height: 0.94;
  letter-spacing: -4px;
  font-weight: 1000;
}

.welcome h1 span {
  color: #ff8069;
}

.welcome p {
  margin: 20px 0 0;
  color: #d6e0e5;
  font-size: 18px;
  font-weight: 700;
}

.welcome-art {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.welcome-art img {
  width: min(470px, 118%);
  max-height: 300px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.25));
  animation: float 4s ease-in-out infinite;
}

.welcome-letter,
.welcome-number {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  position: absolute;
  border: 7px solid white;
  border-radius: 24px;
  color: white;
  font-size: 48px;
  line-height: 1;
  font-weight: 1000;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.welcome-letter {
  left: 3%;
  top: 5%;
  background: var(--coral);
  transform: rotate(-9deg);
}

.welcome-number {
  right: 4%;
  bottom: 4%;
  background: var(--teal);
  transform: rotate(8deg);
}

.activity-grid {
  margin-top: 46px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.activity-card {
  min-height: 206px;
  padding: 24px;
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  position: relative;
  overflow: hidden;
  text-align: left;
  border: 0;
  border-radius: 30px;
  background: white;
  box-shadow: 0 8px 0 rgba(23, 54, 75, 0.09), var(--small-shadow);
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.activity-card::after {
  content: "";
  width: 150px;
  height: 150px;
  position: absolute;
  right: -76px;
  bottom: -85px;
  border-radius: 50%;
  opacity: 0.09;
  background: currentColor;
}

.activity-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 0 rgba(23, 54, 75, 0.08), 0 22px 38px rgba(35, 67, 84, 0.14);
}

.activity-card:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 rgba(23, 54, 75, 0.08), var(--small-shadow);
}

.letters-card {
  color: var(--coral-dark);
  background: #fff0ea;
}

.numbers-card {
  color: var(--teal-dark);
  background: #eafafb;
}

.addition-card {
  color: var(--purple-dark);
  background: #f3effc;
}

.subtraction-card {
  color: var(--green-dark);
  background: #edf9f0;
}

.pictures-card {
  color: #9b6600;
  background: #fff7db;
}

.listening-card {
  color: #315ca7;
  background: #edf4ff;
}

.activity-bubble {
  width: 138px;
  height: 138px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  color: white;
  background: var(--coral);
  border: 8px solid white;
  border-radius: 36px 30px 38px 28px;
  box-shadow: 0 9px 0 var(--coral-dark), 0 14px 24px rgba(220, 67, 46, 0.18);
  font-size: 60px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -6px;
  transform: rotate(-3deg);
}

.number-bubble {
  color: white;
  background: var(--teal);
  box-shadow: 0 9px 0 var(--teal-dark), 0 14px 24px rgba(8, 125, 136, 0.16);
  font-size: 34px;
  letter-spacing: -3px;
  transform: rotate(3deg);
}

.addition-card .math-bubble {
  background: var(--purple);
  box-shadow: 0 9px 0 var(--purple-dark), 0 14px 24px rgba(108, 69, 177, 0.16);
}

.subtraction-card .math-bubble {
  background: var(--green);
  box-shadow: 0 9px 0 var(--green-dark), 0 14px 24px rgba(51, 143, 80, 0.16);
}

.math-bubble {
  font-size: 39px;
  letter-spacing: -3px;
}

.picture-bubble {
  background: var(--yellow);
  box-shadow: 0 9px 0 #d99a12, 0 14px 24px rgba(217, 154, 18, 0.18);
}

.picture-bubble img {
  width: 122%;
  height: 122%;
  object-fit: contain;
  filter: drop-shadow(0 7px 6px rgba(75, 48, 0, 0.18));
}

.icon-bubble img {
  width: 122%;
  height: 122%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgba(23, 54, 75, 0.17));
}

.listening-bubble {
  background: #4a7fdd;
  box-shadow: 0 9px 0 #315ca7, 0 14px 24px rgba(49, 92, 167, 0.18);
  font-size: 46px;
  letter-spacing: -4px;
  transform: rotate(3deg);
}

.activity-copy {
  min-width: 0;
  display: grid;
  color: var(--ink);
}

.activity-copy strong {
  font-size: clamp(31px, 3.2vw, 44px);
  line-height: 1;
  letter-spacing: -2px;
}

.activity-copy small {
  margin-top: 12px;
  color: currentColor;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 1.1px;
}

.letters-card .activity-copy small { color: var(--coral-dark); }
.numbers-card .activity-copy small { color: var(--teal-dark); }
.addition-card .activity-copy small { color: var(--purple-dark); }
.subtraction-card .activity-copy small { color: var(--green-dark); }
.pictures-card .activity-copy small { color: #9b6600; }
.listening-card .activity-copy small { color: #315ca7; }

.activity-progress {
  min-width: 58px;
  min-height: 58px;
  padding: 7px 9px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 18px;
}

.activity-progress img {
  width: 30px;
  height: 24px;
  object-fit: contain;
}

.activity-progress b {
  font-size: 13px;
  line-height: 1;
}

.progress-tools {
  max-width: 800px;
  margin: 38px auto 0;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(23, 54, 75, 0.09);
  border-radius: 22px;
}

.progress-tools strong {
  color: var(--ink);
  font-size: 16px;
}

.progress-tools p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 650;
}

.reset-progress-feedback {
  min-height: 18px;
  margin-top: 5px;
  display: block;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
}

.reset-progress-button {
  min-height: 48px;
  padding: 0 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(184, 50, 38, 0.16);
  border-radius: 16px;
  color: #a53c32;
  background: #fff2ef;
  box-shadow: 0 4px 0 #ead4cf;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.reset-progress-button:hover {
  background: #ffe9e4;
  transform: translateY(-2px);
}

.reset-progress-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #ead4cf;
}

.game-screen {
  --mode-color: var(--coral);
  --mode-dark: var(--coral-dark);
  padding: 0 max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 10% 8%, color-mix(in srgb, var(--mode-color) 13%, transparent) 0 120px, transparent 121px),
    var(--cream);
}

.game-screen.mode-numbers {
  --mode-color: var(--teal);
  --mode-dark: var(--teal-dark);
}

.game-screen.mode-addition {
  --mode-color: var(--purple);
  --mode-dark: var(--purple-dark);
}

.game-screen.mode-subtraction {
  --mode-color: var(--green);
  --mode-dark: var(--green-dark);
}

.game-screen.mode-pictures {
  --mode-color: var(--yellow);
  --mode-dark: #a86d00;
}

.game-screen.mode-listening {
  --mode-color: #4a7fdd;
  --mode-dark: #315ca7;
}

.game-topbar {
  width: min(980px, 100%);
  margin: 0 auto;
}

.back-button,
.again-button,
.home-button {
  min-height: 52px;
  border: 0;
  border-radius: 17px;
  font-weight: 950;
  cursor: pointer;
}

.back-button {
  padding: 0 22px;
  color: var(--ink);
  background: white;
  border: 1px solid rgba(23, 54, 75, 0.08);
  box-shadow: 0 5px 0 #dce5e7;
}

.round-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.progress-pip {
  width: 18px;
  height: 18px;
  border: 3px solid #cad6da;
  border-radius: 50%;
  background: white;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.progress-pip.done {
  border-color: var(--mode-color);
  background: var(--mode-color);
  transform: scale(1.16);
}

.game-topbar-balance {
  width: 74px;
  height: 1px;
  flex: 0 0 auto;
}

.element-speaker {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 5;
  border: 2px solid color-mix(in srgb, var(--mode-color) 22%, white);
  border-radius: 50%;
  color: var(--mode-dark);
  background: color-mix(in srgb, var(--mode-color) 11%, white);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--mode-color) 24%, #cbd6da);
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.element-speaker:hover {
  background: color-mix(in srgb, var(--mode-color) 18%, white);
  transform: translateY(-1px);
}

.element-speaker:active {
  transform: translateY(2px);
  box-shadow: none;
}

.element-speaker svg {
  width: 18px;
  height: 18px;
  display: block;
}

.element-speaker svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.element-speaker svg path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.game-shell {
  width: min(980px, 100%);
  min-height: calc(100vh - 122px);
  margin: 0 auto;
  padding: 30px clamp(20px, 5vw, 60px) 44px;
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 54, 75, 0.08);
  border-radius: 36px;
  box-shadow: var(--shadow);
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: left;
}

.game-symbol {
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: white;
  background: var(--mode-color);
  border: 7px solid white;
  border-radius: 28px 22px 28px 22px;
  box-shadow: 0 7px 0 var(--mode-dark), var(--small-shadow);
  font-size: 39px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -3px;
  transform: rotate(-3deg);
}

.game-symbol.has-image {
  overflow: visible;
  background: color-mix(in srgb, var(--mode-color) 82%, white);
}

.game-symbol.has-image img {
  width: 126%;
  height: 126%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgba(23, 54, 75, 0.16));
}

.game-kicker {
  color: var(--mode-dark);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 1.4px;
}

.game-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1;
  letter-spacing: -2px;
}

.game-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.play-area {
  margin: 36px auto 0;
}

.memory-grid {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.memory-card-wrap {
  min-width: 0;
  position: relative;
  display: grid;
}

.memory-card {
  width: 100%;
  height: 100%;
  min-height: 150px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: transparent;
  background: var(--mode-color);
  box-shadow: 0 7px 0 var(--mode-dark), var(--small-shadow);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.memory-card::before {
  content: "?";
  color: white;
  font-size: 62px;
  line-height: 1;
  font-weight: 1000;
}

.memory-card:hover:not(:disabled) {
  transform: translateY(-4px) rotate(1deg);
}

.memory-card:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--mode-dark);
}

.memory-card .card-face {
  display: none;
}

.memory-card.revealed,
.memory-card.matched {
  color: var(--ink);
  background: white;
  border: 4px solid color-mix(in srgb, var(--mode-color) 35%, white);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--mode-color) 28%, #b9c7cb), var(--small-shadow);
  transform: translateY(-2px);
}

.memory-card.revealed::before,
.memory-card.matched::before {
  display: none;
}

.memory-card.revealed .card-face,
.memory-card.matched .card-face {
  display: grid;
}

.memory-card.matched {
  border-color: #8dd49f;
  background: #f0fff3;
  box-shadow: 0 7px 0 #8dd49f, var(--small-shadow);
  animation: happy-pop 360ms ease;
}

.memory-speaker {
  top: 10px;
  right: 10px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.memory-card.revealed + .memory-speaker,
.memory-card.matched + .memory-speaker {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.picture-match-board {
  width: min(850px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 76px;
  position: relative;
}

.picture-match-row {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.picture-match-row h3 {
  margin: 0 0 12px;
  color: var(--mode-dark);
  text-align: center;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 1.4px;
}

.picture-match-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.picture-match-item {
  min-width: 0;
  position: relative;
  display: grid;
}

.picture-match-lines {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.picture-match-line {
  fill: none;
  stroke: #55b972;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 3px 0 rgba(51, 143, 80, 0.18));
  animation: draw-connection 380ms ease-out forwards;
}

.picture-match-choice {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 116px;
  padding: 10px;
  display: grid;
  place-items: center;
  position: relative;
  border: 4px solid color-mix(in srgb, var(--mode-color) 30%, white);
  border-radius: 25px;
  color: var(--ink);
  background: white;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--mode-color) 28%, #ccd8dc), var(--small-shadow);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.picture-match-choice.picture-choice {
  min-height: 148px;
  background: color-mix(in srgb, var(--mode-color) 8%, white);
}

.picture-match-choice img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgba(23, 54, 75, 0.14));
}

.picture-match-letter {
  color: var(--mode-dark);
  font-size: clamp(58px, 8vw, 82px);
  line-height: 1;
  font-weight: 1000;
}

.picture-match-choice::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  left: 50%;
  border: 4px solid var(--mode-color);
  border-radius: 50%;
  background: white;
  transform: translateX(-50%);
}

.picture-match-choice.picture-choice::after {
  bottom: -13px;
}

.picture-match-choice.letter-choice::after {
  top: -13px;
}

.picture-match-choice:hover:not(:disabled) {
  z-index: 3;
  border-color: var(--mode-color);
  transform: translateY(-3px);
}

.picture-match-choice:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--mode-color) 28%, #ccd8dc);
}

.picture-match-choice.selected {
  z-index: 3;
  border-color: #e2a51b;
  background: #fff9df;
  box-shadow: 0 7px 0 #e2a51b, var(--small-shadow);
  transform: translateY(-2px) scale(1.02);
}

.picture-match-choice.selected::after {
  border-color: #e2a51b;
  background: var(--yellow);
}

.picture-match-choice.matched {
  border-color: #68c47e;
  background: #e9faed;
  box-shadow: 0 7px 0 #68c47e, var(--small-shadow);
  animation: happy-pop 360ms ease;
}

.picture-match-choice.matched::after {
  border-color: #55b972;
  background: #55b972;
}

.picture-match-choice.wrong {
  border-color: #ff8872;
  background: #fff0ed;
  box-shadow: 0 7px 0 #ff8872;
  animation: gentle-shake 340ms ease;
}

.picture-match-choice:disabled {
  cursor: default;
  opacity: 1;
}

.picture-speaker {
  top: 8px;
  right: 8px;
}

.number-match-board {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(56px, 9vw, 92px) minmax(0, 1fr);
  position: relative;
}

.number-match-column {
  min-width: 0;
  display: grid;
  grid-template-rows: 34px repeat(4, 112px);
  gap: 14px;
  position: relative;
  z-index: 2;
}

.number-match-column h3 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--mode-dark);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 1.4px;
}

.number-match-column h3 span {
  color: var(--yellow);
  font-size: 18px;
  letter-spacing: -2px;
}

.number-match-space {
  grid-column: 2;
}

.number-match-lines {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.number-match-line {
  fill: none;
  stroke: #55b972;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 3px 0 rgba(51, 143, 80, 0.18));
  animation: draw-connection 380ms ease-out forwards;
}

.number-match-choice {
  min-width: 0;
  min-height: 112px;
  padding: 10px;
  display: grid;
  place-items: center;
  position: relative;
  border: 4px solid color-mix(in srgb, var(--mode-color) 22%, white);
  border-radius: 25px;
  color: var(--ink);
  background: white;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--mode-color) 24%, #ccd8dc), var(--small-shadow);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icons-choice {
  background: color-mix(in srgb, var(--mode-color) 7%, white);
}

.number-match-choice::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  top: 50%;
  border: 4px solid var(--mode-color);
  border-radius: 50%;
  background: white;
  transform: translateY(-50%);
}

.icons-choice::after {
  right: -13px;
}

.digit-choice::after {
  left: -13px;
}

.number-match-choice:hover:not(:disabled) {
  z-index: 3;
  border-color: var(--mode-color);
  transform: translateY(-3px);
}

.number-match-choice:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--mode-color) 24%, #ccd8dc);
}

.number-match-choice.selected {
  z-index: 3;
  border-color: var(--yellow);
  background: #fff9df;
  box-shadow: 0 7px 0 #e2a51b, var(--small-shadow);
  transform: translateY(-2px) scale(1.02);
}

.number-match-choice.selected::after {
  border-color: var(--yellow);
  background: var(--yellow);
}

.number-match-choice.matched {
  border-color: #68c47e;
  background: #e9faed;
  box-shadow: 0 7px 0 #68c47e, var(--small-shadow);
  animation: happy-pop 360ms ease;
}

.number-match-choice.matched::after {
  border-color: #55b972;
  background: #55b972;
}

.number-match-choice.wrong {
  border-color: #ff8872;
  background: #fff0ed;
  box-shadow: 0 7px 0 #ff8872;
  animation: gentle-shake 340ms ease;
}

.number-match-choice:disabled {
  cursor: default;
  opacity: 1;
}

.quantity-icons {
  width: min(180px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.quantity-icons i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 25px;
  line-height: 1;
  font-style: normal;
  filter: drop-shadow(0 2px 0 rgba(23, 54, 75, 0.09));
}

.empty-icon-set {
  display: grid;
  place-items: center;
  color: #7e939f;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 1.3px;
}

.empty-icon-set i {
  width: 54px;
  height: 32px;
  margin-bottom: 6px;
  display: block;
  border: 4px dashed #a9bbc3;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.number-match-digit {
  font-size: clamp(56px, 8vw, 78px);
  line-height: 1;
  font-weight: 1000;
}

.letter-face,
.number-face {
  place-items: center;
  font-size: clamp(58px, 8vw, 88px);
  line-height: 1;
  font-weight: 1000;
}

.lowercase-face {
  color: var(--mode-dark);
}

.dot-board {
  width: 104px;
  min-height: 72px;
  display: grid;
  grid-template-columns: repeat(5, 16px);
  align-content: center;
  justify-content: center;
  gap: 9px 6px;
}

.count-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--mode-dark);
  border-radius: 50%;
  background: var(--mode-color);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.empty-count {
  place-items: center;
  color: #9bacb5;
  font-size: 54px;
  font-weight: 1000;
}

.equation-game {
  max-width: 780px;
  margin: 0 auto;
}

.equation-visual {
  min-height: 250px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr) auto 110px;
  align-items: center;
  justify-items: center;
  gap: 18px;
  background: color-mix(in srgb, var(--mode-color) 9%, white);
  border: 3px solid color-mix(in srgb, var(--mode-color) 20%, white);
  border-radius: 30px;
}

.count-group {
  min-width: 126px;
  min-height: 138px;
  padding: 18px;
  display: grid;
  place-items: center;
  background: white;
  border-radius: 24px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--mode-color) 18%, #dce5e7);
}

.count-group .dot-board {
  width: 118px;
  grid-template-columns: repeat(5, 18px);
  gap: 11px 7px;
}

.count-group .count-dot {
  width: 18px;
  height: 18px;
}

.math-sign,
.question-mark {
  color: var(--mode-dark);
  font-size: 64px;
  line-height: 1;
  font-weight: 1000;
}

.question-mark {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--mode-color);
  border-radius: 28px;
  box-shadow: 0 7px 0 var(--mode-dark);
}

.number-equation {
  margin-top: 24px;
  text-align: center;
  color: var(--ink);
  font-size: clamp(40px, 6vw, 62px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: 4px;
}

.answer-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.answer-button {
  min-height: 112px;
  border: 4px solid color-mix(in srgb, var(--mode-color) 24%, white);
  border-radius: 28px;
  color: var(--ink);
  background: white;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--mode-color) 24%, #ccd8dc), var(--small-shadow);
  font-size: 58px;
  line-height: 1;
  font-weight: 1000;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: var(--mode-color);
}

.answer-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--mode-color) 24%, #ccd8dc);
}

.answer-button.correct {
  color: #176f35;
  border-color: #68c47e;
  background: #e9faed;
  box-shadow: 0 7px 0 #68c47e;
  animation: happy-pop 360ms ease;
}

.answer-button.wrong {
  color: #b83226;
  border-color: #ff8872;
  background: #fff0ed;
  animation: gentle-shake 340ms ease;
}

.listening-game {
  width: min(680px, 100%);
  margin: 0 auto;
}

.listening-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.listening-toolbar > span {
  color: var(--mode-dark);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 1.5px;
}

.listening-visual {
  min-height: 260px;
  margin-top: 16px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--mode-color) 8%, white);
  border: 3px solid color-mix(in srgb, var(--mode-color) 18%, white);
  border-radius: 30px;
}

.listening-speaker {
  right: 16px;
  bottom: 16px;
}

.listening-picture,
.listening-mascot {
  width: 235px;
  height: 235px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(23, 54, 75, 0.13));
}

.listening-mascot {
  width: 205px;
  height: 205px;
}

.listening-answers {
  margin-top: 24px;
}

.listening-answer {
  font-size: clamp(42px, 6vw, 60px);
}

.listening-answer-option {
  min-width: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.listening-answer-option .listening-answer {
  width: 100%;
}

.listening-choice-speaker {
  position: static;
}

.spoken-feedback {
  min-height: 28px;
  margin: 24px 0 0;
  text-align: center;
  color: var(--mode-dark);
  font-size: 18px;
  font-weight: 900;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(15, 40, 56, 0.72);
  backdrop-filter: blur(8px);
}

.celebration-card {
  width: min(430px, 100%);
  padding: 42px;
  display: grid;
  justify-items: center;
  text-align: center;
  background: white;
  border: 8px solid #fff2bc;
  border-radius: 38px;
  box-shadow: 0 14px 0 rgba(13, 38, 55, 0.35), 0 30px 70px rgba(0, 0, 0, 0.2);
  animation: celebration-in 340ms ease-out;
}

.celebration-card > img {
  width: 142px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(173, 116, 0, 0.2));
}

.celebration-card > span {
  margin-top: 10px;
  color: #a76c00;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 2px;
}

.celebration-card h2 {
  margin: 7px 0 0;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -2px;
}

.celebration-card p {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.again-button,
.home-button {
  width: 100%;
}

.again-button {
  color: white;
  background: var(--mode-color);
  box-shadow: 0 7px 0 var(--mode-dark);
}

.home-button {
  margin-top: 14px;
  color: var(--ink);
  background: #eef3f5;
  box-shadow: 0 5px 0 #d2dde1;
}

.again-button:active,
.home-button:active,
.back-button:active {
  transform: translateY(4px);
  box-shadow: none;
}

noscript {
  display: block;
  margin: 30px;
  padding: 20px;
  text-align: center;
  background: white;
  border-radius: 18px;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes happy-pop {
  0% { transform: scale(1); }
  55% { transform: scale(1.09) rotate(2deg); }
  100% { transform: scale(1); }
}

@keyframes gentle-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-7px); }
  65% { transform: translateX(7px); }
}

@keyframes celebration-in {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes draw-connection {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 860px) {
  .welcome {
    padding: 42px;
    grid-template-columns: 1fr 300px;
  }

  .welcome-art img {
    width: 340px;
  }

  .activity-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .activity-bubble {
    width: 112px;
    height: 112px;
    font-size: 48px;
  }

  .number-bubble,
  .math-bubble {
    font-size: 29px;
  }

  .activity-progress {
    position: absolute;
    right: 15px;
    top: 15px;
    transform: scale(0.84);
  }

  .memory-card {
    min-height: 132px;
  }

  .picture-match-board {
    gap: 64px;
  }

  .picture-match-choice.picture-choice {
    min-height: 130px;
  }

  .picture-match-choice img {
    height: 102px;
  }

  .number-match-column {
    grid-template-rows: 34px repeat(4, 106px);
    gap: 12px;
  }

  .equation-visual {
    min-height: 220px;
    grid-template-columns: minmax(100px, 1fr) auto minmax(100px, 1fr) auto 90px;
    gap: 10px;
    padding: 20px;
  }

  .count-group {
    min-width: 105px;
  }
}

@media (max-width: 680px) {
  body {
    background: var(--cream);
  }

  .home-screen {
    width: min(100% - 24px, 520px);
    padding-bottom: 36px;
  }

  .topbar {
    min-height: 70px;
  }

  .brand {
    font-size: 16px;
  }

  .brand img {
    width: 43px;
    height: 43px;
  }

  .welcome {
    min-height: 245px;
    margin-top: 4px;
    padding: 30px;
    grid-template-columns: 1fr 130px;
    gap: 4px;
    border-radius: 28px;
    box-shadow: 0 8px 0 #0e2839, var(--shadow);
  }

  .eyebrow {
    font-size: 9px;
  }

  .welcome h1 {
    margin-top: 10px;
    font-size: clamp(40px, 12vw, 58px);
    letter-spacing: -3px;
  }

  .welcome p {
    margin-top: 16px;
    font-size: 13px;
  }

  .welcome-art {
    min-height: 170px;
  }

  .welcome-art img {
    width: 190px;
    max-width: none;
  }

  .welcome-letter,
  .welcome-number {
    width: 51px;
    height: 51px;
    border-width: 4px;
    border-radius: 16px;
    font-size: 28px;
  }

  .welcome-letter {
    left: -8%;
  }

  .welcome-number {
    right: -5%;
  }

  .activity-grid {
    margin-top: 30px;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .activity-card {
    min-height: 154px;
    padding: 18px;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 20px;
    border-radius: 25px;
  }

  .activity-bubble {
    width: 106px;
    height: 106px;
    border-width: 6px;
    border-radius: 29px 24px 31px 23px;
    font-size: 46px;
  }

  .number-bubble,
  .math-bubble {
    font-size: 27px;
    letter-spacing: -2px;
  }

  .activity-copy strong {
    font-size: 34px;
  }

  .activity-copy small {
    font-size: 9px;
  }

  .activity-progress {
    right: 8px;
    top: 8px;
    transform: scale(0.7);
  }

  .progress-tools {
    margin-top: 28px;
    padding: 18px;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    border-radius: 20px;
  }

  .reset-progress-button {
    width: 100%;
  }

  .game-screen {
    padding: 0 10px 20px;
  }

  .game-topbar {
    min-height: 70px;
    gap: 9px;
  }

  .back-button {
    min-height: 46px;
    padding: 0 15px;
    font-size: 13px;
  }

  .round-progress {
    gap: 5px;
  }

  .progress-pip {
    width: 13px;
    height: 13px;
    border-width: 2px;
  }

  .game-topbar-balance {
    width: 54px;
  }

  .element-speaker {
    width: 29px;
    height: 29px;
  }

  .element-speaker svg {
    width: 15px;
    height: 15px;
  }

  .game-shell {
    min-height: calc(100vh - 82px);
    padding: 24px 12px 32px;
    border-radius: 28px;
  }

  .game-heading {
    gap: 13px;
  }

  .game-symbol {
    width: 68px;
    height: 68px;
    border-width: 5px;
    border-radius: 22px 18px 22px 18px;
    font-size: 31px;
  }

  .game-kicker {
    font-size: 9px;
  }

  .game-heading h2 {
    font-size: 30px;
  }

  .game-heading p {
    max-width: 205px;
    font-size: 12px;
  }

  .play-area {
    margin-top: 27px;
  }

  .memory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .memory-card {
    min-height: clamp(92px, 24vw, 118px);
    border-radius: 21px;
    box-shadow: 0 6px 0 var(--mode-dark), var(--small-shadow);
  }

  .memory-card::before {
    font-size: 48px;
  }

  .memory-speaker {
    top: 6px;
    right: 6px;
  }

  .picture-match-board {
    gap: 52px;
  }

  .picture-match-row h3 {
    margin-bottom: 8px;
    font-size: 9px;
  }

  .picture-match-choices {
    gap: 6px;
  }

  .picture-match-choice,
  .picture-match-choice.picture-choice {
    min-height: 82px;
    padding: 4px;
    border-width: 3px;
    border-radius: 17px;
    box-shadow: 0 5px 0 color-mix(in srgb, var(--mode-color) 28%, #ccd8dc), var(--small-shadow);
  }

  .picture-match-choice img {
    height: 72px;
  }

  .picture-speaker {
    top: 5px;
    right: 5px;
  }

  .picture-match-letter {
    font-size: clamp(44px, 15vw, 60px);
  }

  .picture-match-choice::after {
    width: 12px;
    height: 12px;
    border-width: 3px;
  }

  .picture-match-choice.picture-choice::after {
    bottom: -9px;
  }

  .picture-match-choice.letter-choice::after {
    top: -9px;
  }

  .picture-match-line {
    stroke-width: 5;
  }

  .letter-face,
  .number-face {
    font-size: clamp(52px, 17vw, 70px);
  }

  .dot-board {
    width: 90px;
  }

  .number-match-board {
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  }

  .number-match-column {
    grid-template-rows: 28px repeat(4, 88px);
    gap: 10px;
  }

  .number-match-column h3 {
    gap: 4px;
    font-size: 9px;
    letter-spacing: 0.8px;
  }

  .number-match-column h3 span {
    font-size: 14px;
  }

  .number-match-choice {
    min-height: 88px;
    padding: 7px 5px;
    border-width: 3px;
    border-radius: 20px;
    box-shadow: 0 6px 0 color-mix(in srgb, var(--mode-color) 24%, #ccd8dc), var(--small-shadow);
  }

  .number-match-choice::after {
    width: 14px;
    height: 14px;
    border-width: 3px;
  }

  .icons-choice::after {
    right: -10px;
  }

  .digit-choice::after {
    left: -10px;
  }

  .quantity-icons {
    width: min(112px, 100%);
    gap: 2px;
  }

  .quantity-icons i {
    width: 19px;
    height: 19px;
    font-size: 18px;
  }

  .empty-icon-set i {
    width: 42px;
    height: 25px;
    margin-bottom: 4px;
    border-width: 3px;
  }

  .number-match-digit {
    font-size: clamp(48px, 16vw, 66px);
  }

  .number-match-line {
    stroke-width: 5;
  }

  .equation-visual {
    min-height: 190px;
    padding: 18px 10px;
    grid-template-columns: minmax(82px, 1fr) auto minmax(82px, 1fr);
    gap: 8px;
    border-radius: 25px;
  }

  .count-group {
    min-width: 82px;
    min-height: 112px;
    padding: 8px;
    border-radius: 19px;
  }

  .count-group .dot-board {
    width: 77px;
    grid-template-columns: repeat(5, 12px);
    gap: 8px 3px;
  }

  .count-group .count-dot {
    width: 12px;
    height: 12px;
    border-width: 1px;
  }

  .math-sign {
    font-size: 42px;
  }

  .equation-visual > .equals-sign,
  .equation-visual > .question-mark {
    display: none;
  }

  .number-equation {
    margin-top: 19px;
    font-size: 43px;
    letter-spacing: 2px;
  }

  .answer-grid {
    margin-top: 25px;
    gap: 10px;
  }

  .answer-button {
    min-height: 88px;
    border-width: 3px;
    border-radius: 22px;
    font-size: 48px;
  }

  .listening-toolbar {
    min-height: 42px;
    gap: 8px;
  }

  .listening-toolbar > span {
    max-width: 120px;
    font-size: 9px;
    letter-spacing: 1px;
  }

  .listening-visual {
    min-height: 190px;
    margin-top: 12px;
    border-radius: 24px;
  }

  .listening-picture,
  .listening-mascot {
    width: 170px;
    height: 170px;
  }

  .listening-mascot {
    width: 155px;
    height: 155px;
  }

  .listening-speaker {
    right: 10px;
    bottom: 10px;
  }

  .listening-answers {
    margin-top: 20px;
  }

  .spoken-feedback {
    margin-top: 18px;
    font-size: 15px;
  }

  .celebration-card {
    padding: 32px 25px;
    border-width: 6px;
    border-radius: 31px;
  }

  .celebration-card > img {
    width: 120px;
    height: 94px;
  }

  .celebration-card h2 {
    font-size: 42px;
  }
}

@media (max-width: 390px) {
  .welcome {
    padding: 26px 20px;
    grid-template-columns: 1fr 110px;
  }

  .welcome-art img {
    width: 158px;
  }

  .activity-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
  }

  .activity-bubble {
    width: 92px;
    height: 92px;
    font-size: 40px;
  }

  .number-bubble,
  .math-bubble,
  .listening-bubble {
    font-size: 24px;
  }

  .activity-copy strong {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
