/* Sprout — calm, phone-first, system fonts and emoji only. */

:root {
  --ink: #243044;
  --ink-soft: #516277;
  --paper: #fff4e4;
  --white: #fffcf8;
  --yellow: #ffe38a;
  --yellow-edge: #e6c45a;
  --blue: #bfe6ff;
  --blue-edge: #7ec4ef;
  --green: #c8f0c4;
  --green-edge: #74c47c;
  --lilac: #e4d4ff;
  --lilac-edge: #b79ae6;
  --peach: #ffd3bf;
  --peach-edge: #f0a27d;
  --mint: #d9f6ef;
  --good: #1f7a45;
  --coach: #8a5a32;
  --shadow: rgba(70, 50, 30, 0.08);
  --radius: 28px;
  color-scheme: light;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  touch-action: manipulation;
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(circle at 8% 0%, #ffe1c4 0 18%, transparent 42%),
    radial-gradient(circle at 100% 8%, #d7f3df 0 16%, transparent 40%),
    radial-gradient(circle at 80% 100%, #d9ecff 0 22%, transparent 46%);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 4px solid var(--good);
  outline-offset: 3px;
}

.app {
  width: min(100%, 480px);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.noscript {
  margin: 24px;
  font-size: 1.25rem;
  line-height: 1.4;
}

/* Chrome */

.brand,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  flex: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
}

.logo-mark {
  width: 64px;
  height: 64px;
  display: block;
}

.brand-name {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #1f6b45;
}

.brand-tag {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.icon-btn {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 5px 0 rgba(70, 50, 30, 0.1);
  font-size: 2rem;
  display: grid;
  place-items: center;
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(70, 50, 30, 0.1);
}

.icon-btn[aria-pressed="false"] {
  background: #f1ebe3;
}

.top-icon {
  font-size: 2rem;
  line-height: 1;
}

.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
}

/* Home */

.home-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.menu-btn {
  flex: 1 1 0;
  min-height: 84px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  text-align: left;
  box-shadow: 0 7px 0 var(--edge, rgba(0, 0, 0, 0.08));
}

.menu-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--edge, rgba(0, 0, 0, 0.08));
}

.tone-letters { background: var(--yellow); --edge: var(--yellow-edge); }
.tone-numbers { background: var(--blue); --edge: var(--blue-edge); }
.tone-count { background: var(--green); --edge: var(--green-edge); }
.tone-math { background: var(--lilac); --edge: var(--lilac-edge); }
.tone-skills { background: var(--peach); --edge: var(--peach-edge); }

.menu-art {
  width: 84px;
  height: 72px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 800;
}

.menu-art b {
  font-size: 2.4rem;
}

.menu-label {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.menu-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Grids */

.key-grid {
  display: grid;
  gap: 10px;
}

.key-grid.letters,
.key-grid.numbers {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.key {
  min-height: 80px;
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 5px 0 #f0d8b4;
  font-size: 2rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.key:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #f0d8b4;
}

.key.c0 { background: #fff1c4; }
.key.c1 { background: #d9f1ff; }
.key.c2 { background: #e5f8df; }
.key.c3 { background: #ffe4d4; }

/* Hero letter / number */

.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.hero {
  width: min(100%, 420px);
  min-height: 280px;
  border-radius: 36px;
  background: var(--white);
  box-shadow: 0 8px 0 #f0d8b4, 0 16px 30px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 12px 16px;
}

.hero:active {
  transform: translateY(3px);
}

.hero-letter,
.hero-number {
  font-size: clamp(6rem, 28vw, 8.5rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.hero-picture,
.hero-picture .emoji {
  font-size: clamp(4.5rem, 22vw, 6.5rem);
  line-height: 1.1;
}

.xylo {
  width: min(220px, 60vw);
  height: auto;
  display: block;
}

.hero-word {
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hear-affordance {
  font-size: 1.4rem;
  line-height: 1;
}

.back-btn,
.again,
.choice,
.answer {
  width: 100%;
  min-height: 80px;
  border-radius: 26px;
  font-weight: 800;
  background: var(--white);
  box-shadow: 0 6px 0 #f0d8b4;
}

.back-btn {
  max-width: 420px;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.back-btn:active,
.again:active,
.choice:active,
.answer:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #f0d8b4;
}

.objects {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  font-size: 2.6rem;
  line-height: 1.15;
}

.objects.many { font-size: 2.1rem; }
.objects.most { font-size: 1.7rem; }

/* Counting and math */

.play-card {
  background: rgba(255, 252, 248, 0.78);
  border-radius: 32px;
  padding: 16px 12px 12px;
  box-shadow: 0 8px 0 rgba(240, 216, 180, 0.9);
  min-height: calc(100dvh - 118px);
  display: flex;
  flex-direction: column;
}

.prompt {
  margin: 0;
  text-align: center;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.coach {
  min-height: 1.6em;
  margin: 8px 0 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--coach);
}

.coach.yes { color: var(--good); }
.coach.soft { color: var(--coach); }

.object-cloud {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 8px;
  padding: 12px 4px 4px;
  font-size: 3rem;
  line-height: 1.1;
}

.sum-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.sum-group {
  flex: 1 1 0;
  min-height: 92px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 4px;
  font-size: 2.4rem;
  line-height: 1.15;
  background: var(--mint);
  border-radius: 22px;
  padding: 8px;
}

.plus-sign {
  flex: none;
  width: 48px;
  text-align: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: #6b5b98;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.choice {
  min-height: 96px;
  font-size: 3rem;
  padding: 4px;
}

.choice.is-soft {
  background: #fff1df;
}

.answer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.answer {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-align: left;
}

.answer-num {
  flex: none;
  width: 64px;
  font-size: 2.8rem;
  text-align: center;
}

.answer-pics {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.yes-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
}

.yes-star {
  font-size: 4.5rem;
  line-height: 1;
  animation: pop-in 420ms ease;
}

.again {
  max-width: 420px;
  background: var(--green);
  box-shadow: 0 6px 0 var(--green-edge);
  font-size: 3.1rem;
  line-height: 1;
}

/* Skills */

.skill-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.instruction {
  margin: 0 16px;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  min-height: 1.4em;
}

.instruction.soft { color: var(--coach); }
.instruction.yes { color: var(--good); }

.playfield {
  position: relative;
  flex: 1;
  min-height: 240px;
  margin: 12px 16px;
  border-radius: 32px;
  background: rgba(255, 252, 248, 0.72);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.8);
  overflow: hidden;
  touch-action: none;
}

.hint {
  position: absolute;
  z-index: 3;
  font-size: 3rem;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 4px 0 rgba(255, 255, 255, 0.8));
}

.hint.is-hidden { visibility: hidden; }

.hint-tap { right: 22%; top: 18%; animation: hint-tap 1.3s ease-in-out infinite; }
.hint-double { right: 18%; top: 16%; animation: hint-double 1.5s ease-in-out infinite; }
.hint-hold { left: 58%; bottom: 18%; animation: hint-hold 1.4s ease-in-out infinite; }
.hint-swipe { left: 12%; top: 40%; animation: hint-swipe 1.5s ease-in-out infinite; }
.hint-drag { left: 10%; top: 54%; animation: hint-drag 1.6s ease-in-out infinite; }

.bubble {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #ffffff 0 10%, transparent 22%),
    radial-gradient(circle at 50% 58%, #e7f9ff 0 42%, #7fd4f5 72%, #3aa8d8 100%);
  box-shadow:
    inset 0 -14px 18px rgba(20, 90, 130, 0.22),
    0 12px 0 rgba(90, 170, 200, 0.28);
  animation: float 2.8s ease-in-out infinite;
}

.bubble.is-popped {
  animation: pop-burst 280ms ease forwards;
}

.spark {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 18px;
  height: 18px;
  margin: -9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(127, 212, 245, 0.45);
  opacity: 0;
  pointer-events: none;
}

.bubble.is-popped ~ .spark.s1 { animation: spark-a 420ms ease forwards; }
.bubble.is-popped ~ .spark.s2 { animation: spark-b 420ms ease forwards; }
.bubble.is-popped ~ .spark.s3 { animation: spark-c 420ms ease forwards; }

.drum {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border-radius: 50%;
  background: #ffe7a8;
  box-shadow: 0 8px 0 #e6c56a;
  font-size: 7rem;
  display: grid;
  place-items: center;
}

.drum.is-done { background: #d9f8cf; }

.notes {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  font-size: 2.4rem;
  letter-spacing: 0.2em;
  opacity: 0;
}

.playfield.is-done .notes { opacity: 1; }

.seed-hold {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 200px;
  height: 260px;
  margin-left: -100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  touch-action: none;
}

.stem {
  width: 10px;
  height: 18px;
  border-radius: 8px;
  background: #2f9a55;
  position: relative;
  transform-origin: bottom center;
  transition: height 750ms linear;
}

.seed-hold.is-holding .stem,
.seed-hold.is-done .stem { height: 150px; }

.leaf {
  position: absolute;
  top: 10px;
  width: 36px;
  height: 20px;
  border-radius: 20px 4px;
  background: #5cc47a;
  opacity: 0;
  transition: opacity 200ms linear;
}

.leaf.left { right: 8px; transform: rotate(-28deg); }
.leaf.right { left: 8px; background: #8ed89a; transform: rotate(24deg); }

.seed-hold.is-holding .leaf,
.seed-hold.is-done .leaf { opacity: 1; }

.pot {
  width: 108px;
  height: 58px;
  margin-top: 2px;
  background: #e07a4c;
  border-radius: 8px 8px 18px 18px;
  box-shadow: 0 6px 0 #c4623a;
  position: relative;
}

.pot::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: -8px;
  height: 16px;
  border-radius: 8px;
  background: #c4623a;
}

.pot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: #6b3f22;
}

.seed-hold.is-holding .pot::after,
.seed-hold.is-done .pot::after {
  opacity: 0;
}

.piece,
.goal {
  position: absolute;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  font-size: 4.4rem;
  line-height: 1;
  touch-action: none;
}

.piece { left: 4%; top: 46%; z-index: 2; }
.goal { right: 4%; top: 40%; width: 120px; height: 120px; font-size: 4.8rem; }
.piece.at-goal { left: auto; right: 5%; top: 40%; }

.ball { top: 60%; }
.basket { top: 52%; font-size: 5rem; }
.ball.at-goal { top: 50%; right: 5%; }

.skill-actions {
  padding: 0 16px;
}

.skill-actions[hidden] { display: none; }

.static-arrow {
  display: block;
  position: absolute;
  left: 42%;
  top: 46%;
  font-size: 2.4rem;
  opacity: 0.55;
  pointer-events: none;
}

/* Motion */

@keyframes hint-tap {
  0%, 100% { transform: translate(0, 0); }
  45%, 60% { transform: translate(-18px, 28px) scale(0.92); }
}

@keyframes hint-double {
  0%, 100% { transform: translate(0, 0); }
  20%, 32% { transform: translate(-16px, 26px) scale(0.92); }
  48%, 60% { transform: translate(-16px, 26px) scale(0.92); }
}

@keyframes hint-hold {
  0%, 100% { transform: translate(0, 0); }
  40%, 80% { transform: translate(-20px, 10px) scale(0.9); }
}

@keyframes hint-swipe {
  0%, 100% { transform: translateX(0); }
  70% { transform: translateX(90px); }
}

@keyframes hint-drag {
  0%, 100% { transform: translate(0, 0); }
  70% { transform: translate(110px, -10px); }
}

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

@keyframes pop-burst {
  to { transform: scale(1.35); opacity: 0; }
}

@keyframes spark-a {
  to { opacity: 0; transform: translate(50px, -40px); }
}
@keyframes spark-b {
  to { opacity: 0; transform: translate(-54px, -28px); }
}
@keyframes spark-c {
  to { opacity: 0; transform: translate(8px, -64px); }
}

@keyframes pop-in {
  from { transform: scale(0.6); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  50% { transform: scale(0.94); }
}

.drum.is-pulse { animation: pulse 180ms ease; }

@keyframes wiggle {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.is-wiggle { animation: wiggle 380ms ease; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .menu-btn:active,
  .icon-btn:active,
  .key:active,
  .hero:active,
  .choice:active,
  .answer:active,
  .back-btn:active,
  .again:active {
    transform: none;
  }

  .hint { animation: none !important; }
  .static-arrow { display: block; }
  .bubble.is-popped { opacity: 0; transform: none; }
  .seed-hold.is-holding .stem,
  .seed-hold.is-done .stem { height: 150px; }
}

@media (forced-colors: active) {
  .menu-btn,
  .key,
  .hero,
  .choice,
  .answer,
  .icon-btn,
  .again,
  .playfield {
    border: 2px solid ButtonText;
  }
}

@media (max-height: 700px) {
  .brand-tag { display: none; }
  .logo-mark { width: 52px; height: 52px; }
  .menu-btn { min-height: 72px; }
  .menu-art { width: 72px; height: 60px; font-size: 2.2rem; }
  .hero { min-height: 220px; }
  .object-cloud { min-height: 88px; font-size: 2.5rem; }
  .key { min-height: 68px; border-radius: 18px; }
  .key-grid { gap: 8px; }
}
