:root {
  --sky: #71d7ff;
  --sky-light: #dff8ff;
  --sunny: #ffd84d;
  --melon: #ff8a65;
  --grass: #7bd66f;
  --mint: #b9f18a;
  --berry: #ff5e9a;
  --purple-ink: #4f3d7a;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 40px rgba(78, 64, 115, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Fredoka", sans-serif;
  color: var(--purple-ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 216, 77, 0.45), transparent 20%),
    linear-gradient(180deg, var(--sky) 0%, #8fe2ff 42%, #fdf7b3 42%, #f7f3a4 62%, #9ce977 62%, #74d35d 100%);
}

.game-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  display: grid;
  gap: 22px;
}

.hero-card,
.play-card,
.progress-card {
  background: var(--card);
  border: 4px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e76f51;
}

h1,
h2 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  line-height: 0.95;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 4.4rem);
}

h2 {
  font-size: 2rem;
}

.subtitle,
.progress-card p,
.prompt-text {
  margin: 10px 0 0;
  font-size: 1.1rem;
}

.scoreboard {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.score-pill {
  min-width: 120px;
  padding: 14px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fff3b4, #ffd84d);
  border: 3px solid rgba(255, 255, 255, 0.78);
  text-align: center;
}

.score-label {
  display: block;
  font-size: 0.9rem;
}

.score-value {
  display: block;
  font-size: 2rem;
  font-family: "Baloo 2", cursive;
}

.play-card {
  position: relative;
  padding: 26px;
  overflow: hidden;
}

.play-card::before,
.play-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.play-card::before {
  width: 180px;
  height: 180px;
  top: -50px;
  right: -40px;
}

.play-card::after {
  width: 90px;
  height: 90px;
  bottom: 20px;
  left: -20px;
}

.mascot-bubble {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 24px;
  padding: 16px 22px;
  font-size: 1.35rem;
  background: #fff6d9;
  border: 3px solid #ffcf4f;
  border-radius: 20px;
}

.equation-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  flex-wrap: nowrap;
}

.number-group,
.answer-group {
  min-width: 0;
  width: clamp(120px, 18vw, 180px);
  display: grid;
  justify-items: center;
  gap: 10px;
}

.big-number,
.symbol {
  font-family: "Baloo 2", cursive;
  font-size: clamp(3rem, 7vw, 5rem);
  line-height: 1;
}

.symbol {
  align-self: flex-start;
  margin-top: 4px;
}

.visual-row {
  min-height: 82px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 220px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.counter-item {
  font-size: 2.6rem;
  filter: drop-shadow(0 5px 4px rgba(79, 61, 122, 0.2));
  animation: pop-in 0.35s ease both;
}

.visual-row.is-small {
  gap: 8px;
}

.visual-row.is-small .counter-item {
  font-size: 2.1rem;
}

.visual-row.is-tiny {
  gap: 6px;
  max-width: 200px;
}

.visual-row.is-tiny .counter-item {
  font-size: 1.7rem;
}

.answer-group input,
.answer-group button,
.secondary-button {
  font: inherit;
  border: 0;
}

.answer-group input {
  width: 140px;
  padding: 14px 16px;
  border-radius: 20px;
  text-align: center;
  font-size: 2rem;
  color: var(--purple-ink);
  background: #ffffff;
  box-shadow: inset 0 0 0 3px #ffd584;
  animation: answer-nudge 2.4s ease-in-out infinite;
}

.answer-group input:focus {
  outline: 4px solid rgba(113, 215, 255, 0.45);
  animation: none;
}

.answer-group button,
.secondary-button {
  cursor: pointer;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 600;
  color: white;
  background: linear-gradient(180deg, #ff8cb8, var(--berry));
  box-shadow: 0 10px 18px rgba(255, 94, 154, 0.28);
}

.secondary-button {
  color: var(--purple-ink);
  background: linear-gradient(180deg, #d3f89d, #95e55c);
  box-shadow: 0 10px 18px rgba(123, 214, 111, 0.28);
}

.helper-row {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-card {
  padding: 22px 26px 26px;
}

.coin-trail {
  margin-top: 16px;
  min-height: 76px;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
}

.trail-stack {
  position: relative;
  width: 112px;
  height: 66px;
  animation: bounce-in 0.45s ease both;
}

.coin,
.bill-layer,
.bill-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.coin {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7bf, #ffd84d 60%, #e6ac00 100%);
  border: 4px solid #ffef95;
  font-size: 1.5rem;
  box-shadow: 0 10px 14px rgba(230, 172, 0, 0.25);
}

.single-coin {
  position: relative;
  animation: bounce-in 0.45s ease both;
}

.big-coin-stack {
  width: 82px;
  height: 82px;
}

.big-coin {
  width: 74px;
  height: 74px;
  font-family: "Baloo 2", cursive;
  font-size: 1.9rem;
}

.stack-coin {
  inset: auto;
  transform: rotate(-6deg);
}

.stack-coin:nth-child(even) {
  transform: rotate(4deg);
}

.bill-stack {
  width: 112px;
  height: 74px;
}

.bill-layer,
.bill-face {
  border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, 0.82);
}

.bill-layer {
  background: linear-gradient(135deg, #d9f7b8, #93db73);
  box-shadow: 0 12px 18px rgba(72, 139, 54, 0.18);
}

.bill-stack .layer-back {
  transform: translate(8px, 6px) rotate(4deg);
}

.bill-stack .layer-mid {
  transform: translate(4px, 3px) rotate(2deg);
}

.bill-face {
  width: 96px;
  height: 62px;
  margin: auto;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 0 12px;
  background:
    radial-gradient(circle at 24% 50%, rgba(255, 255, 255, 0.35), transparent 24%),
    linear-gradient(135deg, #ebffd7, #8dd870);
  box-shadow: 0 12px 18px rgba(72, 139, 54, 0.24);
}

.bill-emoji {
  font-size: 1.8rem;
}

.bill-value {
  font-family: "Baloo 2", cursive;
  font-size: 1.6rem;
  color: #2f7a23;
}

#fireworksCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.2) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-10deg);
  }
  70% {
    transform: scale(1.12) rotate(6deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes answer-nudge {
  0%,
  100% {
    box-shadow: inset 0 0 0 3px #ffd584;
  }
  50% {
    box-shadow: inset 0 0 0 3px #ffd584, 0 0 0 10px rgba(255, 212, 132, 0.22);
  }
}

@media (max-width: 700px) {
  .game-shell {
    width: min(100% - 20px, 980px);
    padding-top: 20px;
  }

  .hero-card,
  .helper-row {
    justify-content: center;
    text-align: center;
  }

  .scoreboard {
    justify-content: center;
  }

  .equation-stage {
    gap: 8px;
    flex-wrap: wrap;
  }

  .number-group,
  .answer-group {
    width: min(180px, 44vw);
  }

  .visual-row {
    max-width: 180px;
    min-height: 72px;
  }

  .symbol {
    margin-top: 2px;
  }

  .visual-row.is-small .counter-item {
    font-size: 1.9rem;
  }

  .visual-row.is-tiny .counter-item {
    font-size: 1.55rem;
  }
}
