:root {
  --ink: #16352f;
  --deep: #0f2f2a;
  --teal-900: #134e45;
  --teal-700: #1f6f5b;
  --teal-500: #2f9b7a;
  --mint: #b8f0d0;
  --cream: #fff9ef;
  --sand: #ffe8c2;
  --gold: #f0c14a;
  --coral: #ef6b4a;
  --sky: #c9ebe3;
  --shadow: 0 18px 48px rgba(15, 47, 42, .18);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Nunito", "Fredoka", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(240, 193, 74, .55) 0 5%, transparent 5.2%),
    radial-gradient(circle at 92% 18%, rgba(47, 155, 122, .18) 0 8%, transparent 8.2%),
    linear-gradient(145deg, #e8f7f1 0%, #fff9ef 46%, #dff3ea 100%);
}

button, a { font: inherit; }
button { touch-action: manipulation; }

.pageGlow {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: .5;
  pointer-events: none;
}

.glowOne {
  top: 24%;
  left: -220px;
  background: rgba(47, 155, 122, .28);
}

.glowTwo {
  right: -200px;
  bottom: -80px;
  background: rgba(240, 193, 74, .28);
}

.pageShell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.topBar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 12px 16px 12px 18px;
  color: #f4fff8;
  border: 2px solid rgba(15, 47, 42, .22);
  border-radius: 22px;
  background: linear-gradient(115deg, var(--deep), var(--teal-700));
  box-shadow: 0 12px 0 rgba(15, 47, 42, .1), var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  color: var(--gold);
  font-family: "Anta", sans-serif;
  font-size: clamp(17px, 2vw, 21px);
  letter-spacing: .02em;
  text-decoration: none;
}

.brandDot {
  width: 13px;
  height: 13px;
  border: 3px solid #fff4b2;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px var(--gold);
}

.kidsBadge {
  padding: 8px 14px;
  color: var(--deep);
  border-radius: 999px;
  background: var(--gold);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 14px;
  letter-spacing: .04em;
}

.homeButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  padding: 10px 14px;
  color: #f4fff8;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 13px;
  font-weight: 900;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.homeButton:hover,
.homeButton:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(255, 255, 255, .08);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .7fr);
  align-items: end;
  gap: 28px;
  padding: 48px 8px 26px;
}

.eyebrow {
  margin: 0;
  color: var(--teal-700);
  font-family: "Anta", sans-serif;
  font-size: 11px;
  letter-spacing: .14em;
}

.hero h1 {
  max-width: 760px;
  margin: 8px 0 12px;
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: clamp(40px, 6.4vw, 72px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.02em;
}

.hero h1 span {
  color: var(--coral);
}

.heroText {
  max-width: 620px;
  margin: 0;
  color: #3d5f56;
  font-size: clamp(15px, 1.9vw, 18px);
  font-weight: 700;
  line-height: 1.55;
}

.flowList {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flowList li {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 2px solid rgba(15, 47, 42, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .7);
  box-shadow: 3px 4px 0 rgba(15, 47, 42, .12);
  font-family: "Fredoka", sans-serif;
  font-size: 18px;
  animation: floatIn .55s ease both;
}

.flowList li:nth-child(2) { animation-delay: .05s; }
.flowList li:nth-child(3) { animation-delay: .1s; }
.flowList li:nth-child(4) { animation-delay: .15s; }
.flowList li:nth-child(5) { animation-delay: .2s; }
.flowList li:nth-child(6) { animation-delay: .25s; }

.gameCard {
  overflow: hidden;
  border: 3px solid var(--deep);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 10px 12px 0 var(--deep), var(--shadow);
}

.walletBar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  color: #f4fff8;
  border-bottom: 3px solid var(--deep);
  background: linear-gradient(110deg, var(--deep), var(--teal-700));
}

.walletItem {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px 16px;
  border-right: 1px solid rgba(255, 255, 255, .14);
}

.walletItem:last-child { border-right: 0; }

.walletItem small {
  color: rgba(244, 255, 248, .65);
  font-size: 12px;
  font-weight: 700;
}

.walletItem strong {
  color: var(--gold);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.1;
}

.progressTrack {
  height: 8px;
  background: #d7ebe3;
}

.progressFill {
  height: 100%;
  width: 16.66%;
  background: linear-gradient(90deg, var(--teal-500), var(--gold));
  transition: width .35s ease;
}

.stepPills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
}

.stepPills span {
  padding: 7px 11px;
  border: 2px solid rgba(15, 47, 42, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  color: #56756c;
  font-size: 13px;
  font-weight: 800;
}

.stepPills span.isDone {
  background: var(--mint);
  color: var(--teal-900);
  border-color: rgba(31, 111, 91, .28);
}

.stepPills span.isActive {
  background: var(--gold);
  color: var(--deep);
  border-color: var(--deep);
  box-shadow: 3px 3px 0 var(--deep);
}

.playStage {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  min-height: 460px;
}

.scenePanel {
  border-right: 3px solid var(--deep);
  background:
    linear-gradient(180deg, transparent 0 68%, rgba(255, 255, 255, .2) 68% 69%, transparent 69%),
    linear-gradient(180deg, var(--sky) 0 68%, #7fc98a 68% 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.shopFront {
  width: min(100%, 280px);
  text-align: center;
}

.shopSign {
  display: inline-block;
  margin-bottom: 10px;
  padding: 8px 14px;
  border: 2px solid var(--deep);
  border-radius: 12px;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--deep);
  font-family: "Anta", sans-serif;
  font-size: 14px;
  letter-spacing: .08em;
}

.shopWindow {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px solid var(--deep);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 8px 9px 0 rgba(15, 47, 42, .75);
  animation: shopBob 2.8s ease-in-out infinite;
}

.shopEmoji {
  font-size: clamp(72px, 12vw, 110px);
  line-height: 1;
  transition: transform .28s ease;
}

.shopFront.isPop .shopEmoji {
  animation: emojiPop .45s ease;
}

.shopCounter {
  height: 18px;
  margin: -8px 18px 0;
  border: 2px solid var(--deep);
  border-radius: 0 0 14px 14px;
  background: #d7a15a;
}

.sceneCaption {
  margin: 16px 0 0;
  color: var(--deep);
  font-family: "Fredoka", sans-serif;
  font-size: 20px;
}

.actionPanel {
  display: flex;
  flex-direction: column;
  padding: 28px 26px 24px;
  background:
    linear-gradient(rgba(15, 47, 42, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 47, 42, .04) 1px, transparent 1px),
    #fff6e6;
  background-size: 26px 26px;
}

.stepEyebrow {
  margin: 0 0 6px;
  color: var(--coral);
  font-family: "Anta", sans-serif;
  font-size: 11px;
  letter-spacing: .14em;
}

.actionPanel h2 {
  margin: 0;
  color: var(--deep);
  font-family: "Fredoka", sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}

.stepHint {
  margin: 10px 0 18px;
  color: #4d6b62;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.choiceGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.choiceGrid.stockGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.stockCard {
  display: grid;
  gap: 12px;
  min-height: 168px;
  padding: 14px 12px 12px;
  border: 2px solid var(--deep);
  border-radius: 18px;
  background: #fff;
  box-shadow: 4px 5px 0 var(--deep);
}

.stockCard.isActive {
  background: #e8fff4;
}

.stockCard.isBlocked {
  opacity: .72;
  background: #f3f3f0;
}

.stockCardTop {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.stockEmoji {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(15, 47, 42, .18);
  border-radius: 14px;
  background: #fff8e8;
  font-size: 24px;
}

.stockCopy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stockCopy strong {
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 18px;
  font-weight: 600;
}

.stockCopy small {
  color: #56756c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.stockStepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.stockBtn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid var(--deep);
  border-radius: 12px;
  background: var(--gold);
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--deep);
}

.stockBtn:hover:not(:disabled),
.stockBtn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  outline: 3px solid rgba(239, 107, 74, .28);
  outline-offset: 2px;
}

.stockBtn:disabled {
  cursor: not-allowed;
  opacity: .45;
  background: #e5e1d6;
  box-shadow: none;
}

.stockQty {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 2px solid rgba(15, 47, 42, .2);
  border-radius: 12px;
  background: #fffdf7;
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 24px;
}

.stockLineCost {
  margin: 0;
  color: #56756c;
  font-size: 12px;
  font-weight: 800;
}

.stockSummary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 2px dashed rgba(15, 47, 42, .28);
  border-radius: 14px;
  background: rgba(255, 255, 255, .75);
}

.stockSummary > div {
  display: grid;
  gap: 2px;
  text-align: center;
}

.stockSummary span {
  color: #56756c;
  font-size: 11px;
  font-weight: 800;
}

.stockSummary strong {
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 20px;
}

.stockSummary strong.isBad {
  color: #c0392b;
}

.choiceButton {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 14px 12px;
  text-align: left;
  color: var(--deep);
  border: 2px solid var(--deep);
  border-radius: 16px;
  background: #fff;
  box-shadow: 4px 5px 0 var(--deep);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.choiceButton:hover,
.choiceButton:focus-visible {
  transform: translateY(-2px);
  outline: 3px solid rgba(239, 107, 74, .28);
  outline-offset: 2px;
}

.choiceButton.isSelected {
  background: var(--mint);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--deep);
}

.choiceButton:disabled {
  cursor: default;
  opacity: .72;
}

.choiceButton .choiceTitle {
  font-family: "Fredoka", sans-serif;
  font-size: 22px;
}

.choiceButton .choiceMeta {
  color: #56756c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.mathBoard {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 2px dashed rgba(15, 47, 42, .28);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  color: #35584f;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  min-height: 64px;
}

.mathBoard:empty { display: none; }

.mathBoard strong {
  color: var(--deep);
  font-family: "Fredoka", sans-serif;
  font-size: 18px;
  font-weight: 400;
}

.feedback {
  min-height: 24px;
  margin: 14px 0 12px;
  color: #4d6b62;
  font-size: 15px;
  font-weight: 800;
}

.feedback.good { color: #1d7a4f; }
.feedback.bad { color: #c0392b; }
.feedback.win { color: #b45309; }

.gameControls {
  display: flex;
  gap: 10px;
  margin-top: auto;
  width: min(100%, 360px);
}

.primaryButton,
.resetButton {
  min-height: 52px;
  border: 2px solid var(--deep);
  border-radius: 14px;
  color: var(--deep);
  font-family: "Fredoka", "Anta", sans-serif;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 4px 5px 0 var(--deep);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primaryButton {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--gold);
}

.resetButton {
  padding: 0 14px;
  background: #fff;
}

.primaryButton:hover,
.resetButton:hover,
.primaryButton:focus-visible,
.resetButton:focus-visible {
  transform: translateY(-2px);
  outline: 3px solid rgba(239, 107, 74, .28);
  outline-offset: 3px;
}

.primaryButton:active,
.resetButton:active,
.choiceButton:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 2px 0 var(--deep);
}

.primaryButton:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.ledgerStrip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 3px solid var(--deep);
  background: var(--teal-900);
  color: #f4fff8;
}

.ledgerStrip > div {
  display: grid;
  gap: 4px;
  padding: 14px 12px;
  border-right: 1px solid rgba(255, 255, 255, .12);
  text-align: center;
}

.ledgerStrip > div:last-child { border-right: 0; }

.ledgerStrip small {
  color: rgba(244, 255, 248, .62);
  font-size: 12px;
  font-weight: 700;
}

.ledgerStrip strong {
  color: var(--gold);
  font-family: "Fredoka", sans-serif;
  font-size: 18px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 28px 10px 4px;
  color: #56756c;
  font-size: 12px;
  font-weight: 800;
}

footer strong {
  color: var(--teal-700);
  font-family: "Anta", sans-serif;
}

.footerMark {
  width: 9px;
  height: 9px;
  background: var(--gold);
  box-shadow: 3px 3px 0 var(--deep);
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shopBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes emojiPop {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.18) rotate(-4deg); }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .playStage { grid-template-columns: 1fr; }
  .scenePanel {
    min-height: 260px;
    border-right: 0;
    border-bottom: 3px solid var(--deep);
  }
  .walletBar { grid-template-columns: repeat(2, 1fr); }
  .walletItem:nth-child(2) { border-right: 0; }
  .walletItem:nth-child(3),
  .walletItem:nth-child(4) { border-top: 1px solid rgba(255, 255, 255, .14); }
  .ledgerStrip { grid-template-columns: repeat(3, 1fr); }
  .ledgerStrip > div:nth-child(3) { border-right: 0; }
  .ledgerStrip > div:nth-child(n + 4) { border-top: 1px solid rgba(255, 255, 255, .12); }
  .ledgerStrip > div:nth-child(6) { border-right: 0; }
  .choiceGrid.stockGrid {
    grid-template-columns: 1fr;
  }
  .stockSummary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pageShell { width: calc(100% - 20px); padding-top: 10px; }
  .topBar { grid-template-columns: 1fr auto; border-radius: 17px; }
  .kidsBadge { display: none; }
  .hero { padding: 30px 2px 20px; }
  .hero h1 { font-size: clamp(34px, 12vw, 52px); }
  .flowList { grid-template-columns: repeat(3, 1fr); }
  .gameCard { border-radius: 20px; box-shadow: 6px 7px 0 var(--deep), var(--shadow); }
  .actionPanel { padding: 22px 16px; }
  .gameControls { width: 100%; }
  .ledgerStrip { grid-template-columns: repeat(2, 1fr); }
  .ledgerStrip > div:nth-child(odd) { border-right: 1px solid rgba(255, 255, 255, .12); }
  .ledgerStrip > div:nth-child(even) { border-right: 0; }
  .ledgerStrip > div:nth-child(n + 3) { border-top: 1px solid rgba(255, 255, 255, .12); }
}

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