:root {
  --blue: #2956a3;
  --gold: #dbbd6d;
  --white: #ffffff;
  --ink: #182e54;
  --soft-blue: #eaf0fb;
  --soft-gold: #fff6dd;
  --line: #dbe4f4;
  --shadow: 0 22px 60px rgba(24, 46, 84, 0.14);
  --blue-gradient: linear-gradient(135deg, #2e57a2, #182e54);
  --gold-gradient: linear-gradient(135deg, #fcde8a, #c0a250);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 8%, rgba(252, 222, 138, 0.32), transparent 24rem),
    linear-gradient(180deg, #ffffff 0%, #f7f9fe 100%);
  color: var(--ink);
  font-family: "Lato", Arial, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(41, 86, 163, 0.12));
}

.is-menu .brand img {
  width: 144px;
  height: 144px;
}

.brand strong {
  display: block;
  font-size: 1.18rem;
  font-weight: 900;
}

.brand small,
.welcome p,
.play-header p,
.result-view p,
.kid-status span,
.progress-pill {
  font-family: "JetBrains Mono", Consolas, monospace;
  letter-spacing: 0;
}

.brand small {
  color: #59719f;
}

.kid-status {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(24, 46, 84, 0.08);
}

.kid-status span {
  color: #6a7ea6;
  font-size: 0.78rem;
}

.kid-status strong {
  color: var(--blue);
}

.hub-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--blue);
  box-shadow: 0 10px 28px rgba(24, 46, 84, 0.08);
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.hub-link:hover {
  transform: translateY(-2px);
  border-color: rgba(41, 86, 163, 0.28);
  box-shadow: var(--shadow);
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(220px, 0.76fr) 1.5fr;
  gap: 24px;
  align-items: stretch;
}

.welcome {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px 16px 44px 0;
}

.welcome p {
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.welcome h1 {
  max-width: 430px;
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
  color: var(--ink);
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: center;
}

.activity-card {
  position: relative;
  min-height: 174px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 36px rgba(24, 46, 84, 0.08);
  color: var(--ink);
  cursor: pointer;
  padding: 18px;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.activity-card:hover {
  transform: translateY(-4px);
  border-color: rgba(41, 86, 163, 0.28);
  box-shadow: var(--shadow);
}

.activity-card strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.activity-card span {
  color: #6076a0;
  line-height: 1.35;
}

.activity-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border-radius: 8px;
  color: var(--white);
  background: var(--blue-gradient);
  font-size: 1.7rem;
  font-weight: 900;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.26);
}

.activity-card:nth-child(even) .activity-icon {
  color: var(--ink);
  background: var(--gold-gradient);
}

.play-view,
.result-view {
  min-height: 620px;
}

.play-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--blue);
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 900;
}

.play-header p {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.play-header h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.65rem);
  letter-spacing: 0;
}

.progress-pill {
  border-radius: 8px;
  background: var(--blue-gradient);
  color: var(--white);
  padding: 12px 16px;
  font-weight: 700;
}

.game-stage {
  min-height: 480px;
  display: grid;
  gap: 18px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 44px);
}

.prompt {
  margin: 0;
  text-align: center;
  color: var(--ink);
  font-size: clamp(1.55rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: 0;
}

.subprompt {
  margin: -8px auto 0;
  max-width: 620px;
  text-align: center;
  color: #6076a0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.choice-card,
.memory-card,
.drop-zone,
.draggable-token,
.sound-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(24, 46, 84, 0.08);
}

.choice-card {
  min-height: 118px;
  cursor: pointer;
  padding: 14px;
  font-size: clamp(1.4rem, 3vw, 2.45rem);
  font-weight: 900;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.choice-card small {
  display: block;
  margin-top: 8px;
  color: #6a7ea6;
  font-size: 0.9rem;
  font-weight: 700;
}

.choice-card.is-selected {
  border-color: var(--blue);
  background: var(--soft-blue);
  transform: scale(1.02);
}

.choice-card.is-correct {
  border-color: #6aae6a;
  background: #effaf0;
}

.choice-card.is-wrong {
  border-color: #e0a8a8;
  background: #fff1f1;
}

.color-swatch {
  display: block;
  width: min(96px, 100%);
  height: 56px;
  border-radius: 8px;
  margin: 0 auto 10px;
  border: 1px solid rgba(24, 46, 84, 0.12);
}

.shape-mark {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  background: var(--blue-gradient);
}

.circle {
  border-radius: 50%;
}

.square {
  border-radius: 8px;
}

.triangle {
  width: 0;
  height: 0;
  margin-bottom: 12px;
  border-left: 48px solid transparent;
  border-right: 48px solid transparent;
  border-bottom: 86px solid var(--blue);
  background: transparent;
}

.star {
  clip-path: polygon(50% 0%, 61% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 34%);
}

.diamond {
  transform: rotate(45deg) scale(0.82);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 12px;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: clamp(1.35rem, 4vw, 2.7rem);
  font-weight: 900;
  color: transparent;
  background: var(--blue-gradient);
  transition: transform 160ms ease;
}

.memory-card > * {
  opacity: 0;
}

.memory-card.is-open,
.memory-card.is-matched {
  color: var(--ink);
  background: var(--soft-gold);
  transform: scale(1.02);
}

.memory-card.is-open > *,
.memory-card.is-matched > * {
  opacity: 1;
}

.memory-swatch {
  display: block;
  width: min(72px, 70%);
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(24, 46, 84, 0.16);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.22);
}

.drop-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.token-bank,
.drop-bank {
  display: grid;
  gap: 12px;
}

.draggable-token,
.drop-zone {
  min-height: 74px;
  display: grid;
  place-items: center;
  padding: 12px;
  font-size: 1.25rem;
  font-weight: 900;
}

.draggable-token {
  cursor: grab;
  background: var(--soft-gold);
}

.draggable-token.is-selected {
  border-color: var(--blue);
  background: var(--gold-gradient);
  transform: scale(1.02);
}

.drop-zone {
  border-style: dashed;
  background: #f8fbff;
}

.drop-zone.is-filled {
  border-style: solid;
  border-color: var(--blue);
  background: var(--soft-blue);
}

.sound-button {
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  cursor: pointer;
  background: var(--gold-gradient);
  color: var(--ink);
  font-size: 4rem;
}

.feedback {
  min-height: 28px;
  margin: 0;
  color: var(--blue);
  text-align: center;
  font-weight: 900;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.primary-button,
.ghost-button {
  min-width: 150px;
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: var(--blue-gradient);
  color: var(--white);
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--blue);
}

.result-view {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  text-align: center;
  padding: 36px;
}

.result-view img {
  width: 108px;
  height: 108px;
  object-fit: contain;
}

.result-view p {
  margin: 10px 0 0;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
}

.result-view h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 5rem);
}

.result-view span {
  max-width: 520px;
  color: #6076a0;
  font-size: 1.2rem;
}

.reward-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  animation: floatUp 1200ms ease-out forwards;
}

.is-hidden {
  display: none;
}

@keyframes floatUp {
  from {
    transform: translateY(80px) scale(0.6);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    transform: translateY(-120px) scale(1.2);
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .kid-status {
    align-items: flex-start;
  }

  .hub-link {
    width: fit-content;
  }

  .hero-strip {
    grid-template-columns: 1fr;
  }

  .welcome {
    min-height: auto;
    padding: 18px 0 4px;
  }

  .activity-grid,
  .drop-layout {
    grid-template-columns: 1fr;
  }

  .activity-card {
    min-height: 142px;
  }

  .play-header {
    grid-template-columns: 48px 1fr;
  }

  .progress-pill {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .game-stage {
    min-height: 430px;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .action-row {
    flex-direction: column;
  }
}
