:root {
  --bg: #fffaf2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #2b2440;
  --muted: #695f87;
  --pink: #ff6fa9;
  --yellow: #ffd35c;
  --green: #7adf9b;
  --blue: #73b8ff;
  --purple: #a88bff;
  --red: #ff7b7b;
  --shadow: 0 18px 45px rgba(81, 50, 145, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Nunito", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 220, 120, 0.45), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 111, 169, 0.28), transparent 24%),
    linear-gradient(180deg, #fff7e8 0%, #f7f8ff 100%);
  color: var(--text);
}

button,
a {
  font: inherit;
}

a {
  color: #7046d8;
  text-decoration: none;
}

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

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 10px;
}

.brand {
  font-family: "Baloo 2", cursive;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(115, 184, 255, 0.22);
  font-weight: 800;
  color: var(--text);
}

.language-picker span {
  color: var(--text);
}

.language-picker select {
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  outline: none;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-weight: 800;
  border: 2px solid rgba(115, 184, 255, 0.22);
}

.nav-links a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(115, 184, 255, 0.18), rgba(168, 139, 255, 0.22));
  border-color: rgba(123, 85, 211, 0.45);
}

.hero {
  padding: 14px 0 20px;
}

.hero__content {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.hero__text,
.hero__panel,
.section,
.activity-card,
.age-card,
.reaction-card,
.scoreboard,
.page-link-card,
.worksheet-card,
.worksheet-page {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.hero__text {
  padding: 34px;
  border-radius: var(--radius-xl);
}

.hero--compact .hero__text {
  min-height: 100%;
}

.eyebrow {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 211, 92, 0.28);
  color: #815a00;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

h1 {
  margin-top: 16px;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

h3 {
  font-size: 1.7rem;
}

p,
li {
  line-height: 1.55;
  color: var(--muted);
}

.hero__badges,
.category-pills,
.color-legend,
.button-row,
.choice-row,
.palette,
.bubble-row,
.trace-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero__badges span,
.category-pills span,
.color-legend span,
.bubble-option {
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--text);
  background: #fff;
  border: 2px solid rgba(115, 184, 255, 0.28);
}

.hero__panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-xl);
}

.scoreboard,
.reaction-card {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.scoreboard__stars {
  margin: 10px 0 8px;
  font-size: 2rem;
  font-weight: 900;
  color: #d97a00;
}

.reaction-card strong {
  display: block;
  font-size: 1.2rem;
  color: var(--text);
}

.reaction-card.success {
  background: linear-gradient(135deg, rgba(122, 223, 155, 0.26), rgba(255, 255, 255, 0.95));
}

.reaction-card.error {
  background: linear-gradient(135deg, rgba(255, 123, 123, 0.2), rgba(255, 255, 255, 0.95));
}

.section {
  margin: 18px 0;
  padding: 26px;
  border-radius: var(--radius-xl);
}

.intro-card {
  display: grid;
  gap: 18px;
}

.age-lane {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

.age-card {
  padding: 20px;
  border-radius: var(--radius-lg);
}

.section-heading {
  margin-bottom: 18px;
}

.page-links,
.activity-grid,
.worksheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.page-link-card,
.activity-card,
.worksheet-card {
  border-radius: var(--radius-xl);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.page-link-card::after,
.activity-card::after,
.worksheet-card::after {
  content: "";
  position: absolute;
  inset: auto -35px -35px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 211, 92, 0.28), transparent 70%);
}

.page-link-card:hover,
.primary-btn:hover,
.secondary-btn:hover,
.choice-btn:hover,
.home-choice:hover,
.palette-btn:hover,
.rangoli-cell:hover {
  transform: translateY(-2px);
}

.primary-btn:active,
.secondary-btn:active,
.choice-btn:active,
.home-choice:active,
.palette-btn:active,
.rangoli-cell:active,
.voice-btn:active,
.card-voice-btn:active {
  transform: translateY(0) scale(0.96);
}

.page-link-card {
  display: block;
  color: inherit;
  transition: transform 0.18s ease;
}

.page-link-card__icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 111, 169, 0.16), rgba(115, 184, 255, 0.16));
  font-size: 1.9rem;
}

.activity-card__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.activity-card {
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.activity-card:focus-within,
.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 48px rgba(81, 50, 145, 0.18);
}

.card-voice-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  min-width: auto;
  padding: 10px 12px;
  border: 2px solid rgba(115, 184, 255, 0.25);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 8px 16px rgba(81, 50, 145, 0.08);
}

.card-voice-btn.speaking,
.voice-btn.speaking {
  background: linear-gradient(135deg, rgba(115, 184, 255, 0.22), rgba(168, 139, 255, 0.24));
  border-color: rgba(123, 85, 211, 0.45);
  animation: promptPulse 0.9s ease infinite;
}

.activity-tag {
  margin: 0 0 6px;
  font-weight: 900;
  color: #7b55d3;
}

.activity-icon {
  font-size: 2rem;
}

.primary-btn,
.secondary-btn,
.choice-btn,
.palette-btn,
.home-choice,
.link-btn {
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn,
.secondary-btn,
.link-btn {
  padding: 12px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn,
.link-btn.primary-btn {
  background: linear-gradient(135deg, var(--pink), #ff9376);
  color: #fff;
  box-shadow: 0 10px 18px rgba(255, 111, 169, 0.3);
}

.secondary-btn,
.link-btn.secondary-btn {
  background: #fff;
  color: var(--text);
  border: 2px solid rgba(168, 139, 255, 0.24);
}

.choice-btn,
.home-choice,
.palette-btn {
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  border: 2px solid rgba(115, 184, 255, 0.25);
  min-width: 64px;
}

.choice-btn.selected,
.home-choice.selected,
.palette-btn.active {
  background: linear-gradient(135deg, rgba(115, 184, 255, 0.18), rgba(168, 139, 255, 0.22));
  border-color: rgba(123, 85, 211, 0.5);
}

.choice-btn.correct,
.home-choice.correct {
  background: rgba(122, 223, 155, 0.38);
  border-color: rgba(48, 140, 87, 0.45);
}

.choice-btn.wrong,
.home-choice.wrong {
  background: rgba(255, 123, 123, 0.3);
  border-color: rgba(214, 77, 77, 0.45);
}

.counting-display,
.pattern-sequence,
.shape-display,
.display-board {
  min-height: 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 247, 232, 0.85));
  border: 2px dashed rgba(123, 85, 211, 0.18);
  margin: 14px 0 16px;
}

.counting-object,
.pattern-item,
.display-emoji {
  font-size: 2.3rem;
}

.display-emoji.large {
  font-size: 3rem;
}

.display-text {
  width: 100%;
  font-weight: 800;
  text-align: center;
  color: var(--text);
}

.display-subtext {
  width: 100%;
  text-align: center;
  font-size: 0.98rem;
  color: var(--muted);
}

.rangoli-grid {
  display: grid;
  grid-template-columns: repeat(6, 46px);
  gap: 8px;
  justify-content: center;
  margin: 18px 0;
}

.rangoli-status {
  margin: 14px 0 0;
  font-weight: 800;
  color: #7b55d3;
  text-align: center;
}

.rangoli-cell {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 2px solid rgba(123, 85, 211, 0.18);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  color: #6a548c;
  cursor: pointer;
  user-select: none;
}

.rangoli-cell.blank {
  background: transparent;
  border: none;
  cursor: default;
}

.rangoli-grid.revealed .rangoli-cell {
  color: transparent;
}

.rangoli-cell[data-fill="red"] {
  background: #ff9393;
}

.rangoli-cell[data-fill="blue"] {
  background: #8ac3ff;
}

.rangoli-cell[data-fill="yellow"] {
  background: #ffe27d;
}

.rangoli-cell[data-fill="green"] {
  background: #93e4aa;
}

.detective-options,
.homes-list {
  display: grid;
  gap: 14px;
  margin: 14px 0 16px;
}

.detective-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detective-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detective-item .choice-btn {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.homes-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 2px solid rgba(123, 85, 211, 0.12);
}

.homes-row__label {
  font-weight: 900;
  color: var(--text);
}

.shape-display {
  flex-direction: column;
  gap: 14px;
}

.shape-badge {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
}

.shape-badge.circle {
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9f6e, #ff6fa9);
}

.shape-badge.square {
  border-radius: 18px;
  background: linear-gradient(135deg, #7adf9b, #43c59a);
}

.shape-badge.triangle {
  width: 0;
  height: 0;
  border-left: 48px solid transparent;
  border-right: 48px solid transparent;
  border-bottom: 86px solid #73b8ff;
  background: transparent;
}

.shape-badge.star {
  clip-path: polygon(50% 0%, 61% 36%, 98% 36%, 68% 57%, 79% 92%, 50% 71%, 21% 92%, 32% 57%, 2% 36%, 39% 36%);
  background: linear-gradient(135deg, #ffd35c, #ffaf3e);
}

.number-strip {
  gap: 14px;
}

.memory-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.memory-label {
  width: 100%;
  text-align: center;
  font-weight: 900;
  color: var(--text);
}

.number-box {
  min-width: 58px;
  padding: 12px 16px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid rgba(115, 184, 255, 0.2);
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
}

.number-box.missing {
  border-style: dashed;
  color: #7b55d3;
}

.map-strip {
  flex-direction: column;
  text-align: center;
}

.map-row {
  font-size: 1.6rem;
  letter-spacing: 0.18em;
}

.worksheet-book {
  display: grid;
  gap: 24px;
  padding-bottom: 24px;
}

.worksheet-page {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.worksheet-page__header {
  margin-bottom: 18px;
}

.worksheet-card {
  min-height: 100%;
}

.print-emoji-row,
.pattern-print-row {
  padding: 12px 0;
  font-size: 1.8rem;
  letter-spacing: 0.14em;
}

.print-rangoli-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.print-rangoli-grid span,
.trace-shape {
  min-height: 62px;
  border-radius: 16px;
  border: 2px dashed rgba(123, 85, 211, 0.3);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.trace-shape {
  width: 74px;
  min-height: 74px;
  color: #9f94ba;
  font-size: 2rem;
}

.match-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.print-checklist {
  padding-left: 18px;
  margin: 0;
}

.bubble-option.blank {
  min-width: 54px;
  border-style: dashed;
}

.sound-toggle {
  white-space: nowrap;
}

#download-worksheets-pdf[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.voice-btn {
  white-space: nowrap;
}

.footer {
  padding: 8px 0 32px;
  text-align: center;
}

.shake {
  animation: shake 0.32s linear;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-4px); }
}

@keyframes promptPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123, 85, 211, 0.2); }
  50% { box-shadow: 0 0 0 10px rgba(123, 85, 211, 0); }
}

@keyframes mobileFloatUp {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

@media (max-width: 920px) {
  .page-links,
  .activity-grid,
  .worksheet-grid,
  .age-lane,
  .hero__content {
    grid-template-columns: 1fr;
  }

  .site-nav {
    display: grid;
    justify-items: start;
  }

  .nav-actions {
    justify-content: flex-start;
  }

  .rangoli-grid {
    grid-template-columns: repeat(6, minmax(38px, 1fr));
  }
}

@media (max-width: 620px) {
  .wrapper {
    width: min(100% - 20px, 1120px);
  }

  .hero__text,
  .section,
  .activity-card,
  .scoreboard,
  .reaction-card,
  .worksheet-page,
  .worksheet-card {
    padding: 18px;
  }

  .detective-options,
  .page-links,
  .worksheet-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .nav-actions {
    width: 100%;
  }

  .language-picker,
  .voice-btn,
  .sound-toggle {
    min-height: 48px;
  }

  .rangoli-cell {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .hero__text,
  .hero__panel,
  .activity-card,
  .page-link-card,
  .worksheet-page {
    animation: mobileFloatUp 0.45s ease both;
  }

  .activity-card:nth-child(2),
  .page-link-card:nth-child(2) {
    animation-delay: 0.05s;
  }

  .activity-card:nth-child(3),
  .page-link-card:nth-child(3) {
    animation-delay: 0.1s;
  }

  .activity-card:nth-child(4),
  .page-link-card:nth-child(4) {
    animation-delay: 0.15s;
  }

  .activity-icon,
  .page-link-card__icon {
    animation: gentleBob 2.2s ease-in-out infinite;
  }

  h1 {
    font-size: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .print-hidden,
  #confetti-canvas {
    display: none !important;
  }

  .wrapper {
    width: 100%;
    max-width: none;
  }

  .worksheet-book {
    gap: 0;
  }

  .worksheet-page,
  .worksheet-card {
    box-shadow: none;
    border: 1px solid #d8d8d8;
    backdrop-filter: none;
    background: #fff;
  }

  .worksheet-page {
    page-break-after: always;
    margin: 0;
    border-radius: 0;
    padding: 12mm;
  }

  .page-break {
    break-before: page;
  }
}
