/*
  Pebbo: learning app screens (Screenery template)
  The world is modelling clay: candy colours pressed into puffy shapes, lit from the top left, squashed under a thumb.
  1. Tokens  2. Base and browser surfaces  3. The clay kit (surfaces, buttons, fields, switches, sheets, toast)
  4. Stage: intro, notes, phone, switcher  5. App screens: welcome, map, lesson, done, gate, parents
  6. Page sections: recipe, clay lab, small hands, footer  7. Motion  8. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* Ink and ground */
  --plum: #2b1d4a;          /* all text on pastels (11:1 and up) */
  --plum-soft: #54456f;     /* secondary text, 7:1 on dough */
  --dough: #ffe6ef;         /* page ground: bubblegum pastel */
  --cloud: #ffffff;

  /* Candy, saturated pastels. Text on these is always --plum. */
  --grape: #6c3ff0;         /* primary action: white text 5.6:1 */
  --grape-deep: #5126c9;
  --lilac: #cdb9ff;
  --lilac-soft: #efe6ff;
  --mint: #7fe0b8;
  --mint-soft: #ddf7eb;
  --mint-ink: #17694a;      /* green words on white, 6.4:1 */
  --sky: #8fd8ff;
  --sky-soft: #e0f4ff;
  --lemon: #ffd955;
  --lemon-soft: #fff3c8;
  --peach: #ffbc94;
  --berry: #ff6fae;
  --berry-soft: #ffe2ef;
  --berry-ink: #a3195a;     /* pink words on white, 6.9:1 */

  /* Buddy colours */
  --b-mint: #5fd6a8;
  --b-grape: #b49bff;
  --b-peach: #ffad7a;
  --b-sky: #6fd0ff;

  /* Clay light, as shadows. --hi presses light in, --lo presses shade in, --drop lifts it off the table. */
  --hi: inset 6px 7px 12px rgb(255 255 255 / .7);
  --lo: inset -6px -8px 14px rgb(43 29 74 / .16);
  --drop: 0 12px 20px -8px rgb(43 29 74 / .35), 0 2px 4px rgb(43 29 74 / .08);
  --drop-pressed: 0 4px 8px -4px rgb(43 29 74 / .35);
  --well: inset 4px 5px 10px rgb(43 29 74 / .14), inset -4px -4px 8px rgb(255 255 255 / .8);

  /* Type */
  --f-display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, sans-serif;

  /* Space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --gutter: clamp(16px, 4vw, 48px);

  /* Shape */
  --r-s: 14px; --r-m: 22px; --r-l: 30px; --r-pill: 999px;

  /* Motion: a spring that overshoots, and a plain exponential ease for everything quiet */
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --t-press: 90ms;
  --t-spring: 520ms;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--lilac) var(--dough); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--dough);
  color: var(--plum);
  font: 400 1.0625rem/1.6 var(--f-body);
  caret-color: var(--grape);
  accent-color: var(--grape);
  overflow-x: clip;
}
::selection { background: var(--lemon); color: var(--plum); }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.08; margin: 0; text-wrap: balance; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--grape-deep); text-underline-offset: .22em; text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; }
:focus-visible { outline: 3px solid var(--grape); outline-offset: 3px; border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: var(--s4); top: -60px; z-index: 50; background: var(--plum); color: var(--cloud); padding: 10px 16px; border-radius: var(--r-pill); font-weight: 800; }
.skip:focus { top: var(--s3); }
.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.h2 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); margin-bottom: var(--s4); }
.sect-lede { max-width: 62ch; color: var(--plum-soft); font-size: 1.125rem; }

/* ---------- 3. The clay kit ---------- */
.clay {
  --c: var(--cloud);
  background: var(--c);
  border-radius: var(--r-m);
  box-shadow: var(--hi), var(--lo), var(--drop);
}
.clay-well { background: color-mix(in srgb, var(--plum) 4%, var(--cloud)); box-shadow: var(--well); border: 0; border-radius: var(--r-s); }

/* Press feedback: sink, squash, then spring back */
.press { transition: transform var(--t-spring) var(--spring), box-shadow 300ms var(--ease), background-color 200ms var(--ease); -webkit-tap-highlight-color: transparent; }
.press:active:not(:disabled) { transform: translateY(3px) scale(.96, .94); transition-duration: var(--t-press); }
.clay.press:active:not(:disabled) { box-shadow: var(--hi), var(--lo), var(--drop-pressed); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 56px; padding: 0 var(--s5);
  border: 0; border-radius: var(--r-m);
  font: 800 1.15rem/1 var(--f-display); letter-spacing: .01em;
  --c: var(--cloud);
}
.btn--go { --c: var(--grape); color: var(--cloud); box-shadow: inset 5px 6px 10px rgb(255 255 255 / .32), inset -5px -7px 12px rgb(20 0 80 / .3), var(--drop); }
.btn--go:hover { --c: #7449f5; }
.btn--soft { --c: var(--lilac-soft); }
.btn--danger { --c: var(--berry-soft); color: var(--berry-ink); }
.btn:disabled { --c: color-mix(in srgb, var(--plum) 10%, var(--cloud)); color: var(--plum-soft); box-shadow: var(--well); cursor: not-allowed; }
.btn.is-loading .btn__label::after { content: ""; display: inline-block; width: 1em; }

.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 16px; background: transparent; color: var(--plum);
}
.icon-btn:hover:not(:disabled) { background: rgb(43 29 74 / .06); }
.icon-btn:disabled { opacity: .3; cursor: default; }

.field { display: grid; gap: var(--s2); }
.field__label { font-weight: 800; font-size: .95rem; }
.field__input { width: 100%; min-height: 54px; padding: 0 var(--s4); font-weight: 700; font-size: 1.1rem; }
.field__input:focus-visible { outline: 3px solid var(--grape); outline-offset: 2px; }
.field__input[aria-invalid="true"] { box-shadow: var(--well), 0 0 0 3px var(--berry); }
.field__msg { min-height: 1.4em; font-size: .92rem; font-weight: 700; color: var(--berry-ink); }
.field__msg.is-ok { color: var(--mint-ink); }
select.field__input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b1d4a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 20px; padding-right: 44px; }

/* Switch: a clay knob in a pressed-in track */
.switch { position: relative; width: 64px; height: 38px; flex: none; border: 0; border-radius: var(--r-pill); background: color-mix(in srgb, var(--plum) 14%, var(--cloud)); box-shadow: var(--well); transition: background-color 250ms var(--ease); }
.switch span { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: var(--cloud); box-shadow: var(--hi), inset -3px -4px 6px rgb(43 29 74 / .18), 0 4px 8px -2px rgb(43 29 74 / .35); transition: transform var(--t-spring) var(--spring); }
.switch[aria-checked="true"] { background: var(--grape); }
.switch[aria-checked="true"] span { transform: translateX(26px); }
.switch::before { content: ""; position: absolute; inset: -5px; } /* 48px target */

/* Sheets inside the app: slide up from the bottom of the phone */
.sheet { position: absolute; inset: 0; z-index: 20; display: grid; align-items: end; background: rgb(43 29 74 / .32); padding: var(--s3); }
.sheet[hidden] { display: none; }
.sheet__card { --c: var(--cloud); border-radius: var(--r-l); padding: var(--s5); display: grid; gap: var(--s4); }
.sheet__title { font-size: 1.6rem; }
.sheet__row { display: grid; gap: var(--s3); }
.toast { position: absolute; left: var(--s4); right: var(--s4); top: 84px; z-index: 30; padding: var(--s3) var(--s4); --c: var(--plum); color: var(--cloud); font-weight: 800; text-align: center; box-shadow: inset 4px 5px 10px rgb(255 255 255 / .15), var(--drop); }
.toast[hidden] { display: none; }

/* Buddy */
.buddy { display: block; width: 72px; height: 72px; overflow: visible; }
.buddy--big { width: 150px; height: 150px; }
.bubble { position: relative; background: var(--cloud); padding: var(--s3) var(--s4); border-radius: 20px; font-weight: 700; box-shadow: var(--hi), var(--lo), var(--drop); }
.bubble::after { content: ""; position: absolute; left: -9px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-right-color: var(--cloud); border-left: 0; }

/* ---------- 4. Stage ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--gutter); max-width: 1440px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font: 800 1.7rem/1 var(--f-display); color: var(--plum); text-decoration: none; min-height: 48px; }
.brand__buddy { width: 40px; height: 40px; }
.top__nav { display: flex; gap: var(--s1); flex-wrap: wrap; }
.top__nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-pill); color: var(--plum); font-weight: 800; text-decoration: none; }
.top__nav a:hover { background: var(--lilac-soft); }

.stage {
  max-width: 1440px; margin: 0 auto; padding: var(--s4) var(--gutter) var(--s9);
  display: grid; gap: var(--s6) var(--s7);
  grid-template-columns: minmax(0, 1fr) 400px minmax(0, 1fr);
  grid-template-areas: "intro device switch" "notes device switch";
  grid-template-rows: auto 1fr;
  align-items: start;
  position: relative;
}
/* Big soft clay lumps behind the phone */
.stage::before, .stage::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; box-shadow: var(--hi), var(--lo); }
.stage::before { width: 520px; height: 460px; left: 50%; top: 120px; margin-left: -400px; background: var(--lilac); border-radius: 48% 52% 44% 56% / 55% 45% 55% 45%; }
.stage::after { width: 300px; height: 280px; left: 50%; top: 480px; margin-left: 90px; background: var(--lemon); border-radius: 56% 44% 50% 50% / 46% 54% 46% 54%; }
.stage__intro { grid-area: intro; justify-self: end; max-width: 400px; margin-top: var(--s5); }
.stage__intro h1 { font-size: clamp(2.4rem, 1.2rem + 2.4vw, 3.6rem); margin-bottom: var(--s4); }
.lede { font-size: 1.125rem; color: var(--plum-soft); max-width: 64ch; }

.notes { grid-area: notes; justify-self: end; width: 100%; max-width: 400px; }
.notes__title, .switcher__title { font: 800 .95rem/1 var(--f-body); letter-spacing: .02em; color: var(--plum-soft); margin-bottom: var(--s3); }
.notes__body { --c: var(--cloud); background: var(--cloud); border-radius: var(--r-l); padding: var(--s5); box-shadow: var(--hi), var(--lo), var(--drop); }
.notes__screen { font-size: 1.7rem; margin-bottom: var(--s2); }
.notes__body p { color: var(--plum-soft); }
.notes__list { margin: var(--s4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.notes__list li { position: relative; padding-left: 26px; font-weight: 600; }
.notes__list li::before { content: ""; position: absolute; left: 0; top: .45em; width: 14px; height: 14px; border-radius: 50%; background: var(--mint); box-shadow: inset 2px 2px 3px rgb(255 255 255 / .7), inset -2px -2px 3px rgb(43 29 74 / .2); }

.switcher { grid-area: switch; max-width: 300px; margin-top: var(--s7); }
.switcher__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.jump { width: 100%; min-height: 54px; border: 0; text-align: left; padding: 0 var(--s5); font: 800 1.15rem/1 var(--f-display); }
.jump.is-on { outline: 3px solid var(--plum); outline-offset: 3px; }
.switcher__note { margin-top: var(--s5); font-size: .95rem; color: var(--plum-soft); }
.switcher__note code { background: var(--cloud); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }

/* The phone: a puffy grape frame around the app */
.device { grid-area: device; width: 400px; }
.device__frame { padding: 12px; border-radius: 58px; background: var(--grape); box-shadow: inset 8px 10px 16px rgb(255 255 255 / .35), inset -8px -12px 18px rgb(20 0 80 / .35), 0 40px 60px -24px rgb(43 29 74 / .55), 0 6px 14px rgb(43 29 74 / .15); }
.app { position: relative; height: clamp(620px, calc(100svh - 140px), 800px); border-radius: 46px; overflow: hidden; background: var(--cloud); isolation: isolate; outline: none; -webkit-user-select: none; user-select: none; }
.app input { -webkit-user-select: text; user-select: text; } /* rapid taps never select text or start a native text drag */

/* ---------- 5. App screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 18px 18px 18px; overflow: hidden; }
.js .screen:not(.is-active) { display: none; }
.no-js [data-needs-js] { display: none; }
.no-js .screen--welcome { overflow-y: auto; }
.no-js .ob-step { display: block !important; flex: none; overflow: visible; margin: 0 0 var(--s5); }
.no-js .onboard { height: auto; }
.no-js .app { height: auto; }
.no-js .screen--welcome { position: relative; }
.no-js .switcher, .no-js .onboard__foot, .no-js .onboard__head .icon-btn { display: none; }

/* Welcome */
.screen--welcome { background: linear-gradient(180deg, #fff1e4 0%, #ffe1cc 100%); }
.onboard { display: flex; flex-direction: column; height: 100%; gap: var(--s4); }
.onboard__head { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; }
.onboard__spacer { width: 48px; }
.dots { display: flex; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.dots li { width: 12px; height: 12px; border-radius: 50%; background: rgb(43 29 74 / .18); box-shadow: inset 1px 2px 3px rgb(43 29 74 / .2); transition: width 400ms var(--spring), background-color 300ms; }
.dots li.is-on { width: 30px; border-radius: 8px; background: var(--grape); }
.dots li.is-done { background: var(--plum-soft); }
.ob-step { border: 0; margin: 0; padding: 0; min-width: 0; display: none; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 6px 18px; margin: -6px; }
.ob-step.is-on { display: block; }
.ob-title { font: 800 2rem/1.05 var(--f-display); text-wrap: balance; padding: 0; margin-bottom: var(--s4); }
.ob-hint { color: var(--plum-soft); margin: calc(var(--s2) * -1) 0 var(--s4); font-weight: 600; }
.langs, .goals { display: grid; gap: var(--s4); }
.goals { grid-template-columns: 1fr 1fr; }
.choice, .goal { position: relative; display: grid; cursor: pointer; padding: var(--s4) var(--s5); border-radius: var(--r-l); }
.choice input, .goal input, .swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice__big { font: 800 1.9rem/1.1 var(--f-display); }
.choice__small { font-weight: 700; color: var(--plum); }
.choice:has(:checked), .goal:has(:checked) { outline: 4px solid var(--plum); outline-offset: 3px; }
.choice:has(:focus-visible), .goal:has(:focus-visible), .swatch:has(:focus-visible) { outline: 4px solid var(--grape); outline-offset: 4px; }
.choice:has(:checked)::after, .goal:has(:checked)::after { content: ""; position: absolute; right: 16px; top: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--plum) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 18px no-repeat; }
.goal { --c: var(--cloud); text-align: center; padding: var(--s4) var(--s3); justify-items: center; }
.goal__min { font: 800 2.6rem/1 var(--f-display); }
.goal__unit { font-weight: 800; color: var(--plum-soft); }
.goal__name { margin-top: var(--s2); font-weight: 800; font-size: .95rem; background: var(--lilac-soft); padding: 2px 10px; border-radius: var(--r-pill); }
.goal:has(:checked)::after { width: 22px; height: 22px; right: 10px; top: 10px; background-size: 14px; }
.buddy-preview { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) 0 var(--s4); }
.buddy-preview .buddy { width: 128px; height: 128px; flex: none; }
.swatches { display: flex; gap: var(--s4); margin-top: var(--s2); }
.swatch { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--c); box-shadow: var(--hi), var(--lo), var(--drop); }
.swatch:has(:checked) { outline: 4px solid var(--plum); outline-offset: 4px; }
.onboard__foot .btn { width: 100%; }

/* Home map */
.screen--home { background: linear-gradient(180deg, var(--sky-soft) 0%, var(--mint-soft) 60%, #c9f0dc 100%); padding: 0; }
.statbar { display: flex; justify-content: center; gap: var(--s2); padding: 30px 18px 10px; }
.stat { --c: var(--cloud); display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 44px; border-radius: var(--r-pill); font: 800 1.15rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat--streak .i { color: #e0531f; fill: #ff9a3c; }
.stat--stars .i { color: #a86f00; fill: var(--lemon); }
.stat--xp .i { color: var(--grape); fill: var(--lilac); }
.home__scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 18px 24px; scrollbar-width: none; }
.home__hello { text-align: center; margin: 8px 0 18px; }
.home__title { font-size: 2rem; }
.home__goal { font-weight: 700; color: var(--plum-soft); font-variant-numeric: tabular-nums; }
.goalbar { height: 14px; max-width: 220px; margin: 8px auto 0; border-radius: var(--r-pill); background: rgb(255 255 255 / .7); box-shadow: var(--well); overflow: hidden; }
.goalbar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lemon); box-shadow: inset 2px 3px 4px rgb(255 255 255 / .7), inset -2px -3px 4px rgb(140 90 0 / .25); transition: width 900ms var(--ease); }
.path { list-style: none; margin: 0; padding: 0 0 12px; display: grid; gap: 14px; position: relative; }
.path li { position: relative; display: flex; justify-content: center; transform: translateX(var(--x, 0)); }
.node { position: relative; width: 88px; height: 82px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--plum); }
.node .i { width: 34px; height: 34px; }
.node--done { --c: var(--lemon); }
.node--done .i { fill: var(--cloud); color: #8a5a00; }
.node--current { --c: var(--grape); color: var(--cloud); width: 104px; height: 96px; box-shadow: inset 6px 8px 12px rgb(255 255 255 / .35), inset -6px -9px 14px rgb(20 0 80 / .35), 0 14px 22px -8px rgb(43 29 74 / .5), 0 0 0 8px rgb(108 63 240 / .18); }
.node--current .i { width: 40px; height: 40px; fill: var(--lilac); }
.node--locked { --c: #e7e3ee; color: #6d6383; }
.node__label { position: absolute; top: 100%; margin-top: 6px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 800 .95rem/1 var(--f-display); color: var(--plum); }
.node__stars { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; }
.node__stars .i { width: 18px; height: 18px; stroke-width: 2; color: #8a5a00; fill: #fff; }
.node__stars .i.on { fill: var(--lemon); }
.path li { padding-bottom: 26px; }
.path li:has(.node--current) { margin-top: 30px; }
.path__buddy { position: absolute; top: 4px; width: 72px; height: 72px; pointer-events: none; }
.path__start { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 10px; background: var(--cloud); padding: 6px 14px; border-radius: 14px; font: 800 1rem/1.2 var(--f-display); color: var(--grape-deep); white-space: nowrap; box-shadow: var(--drop); }
.path__start::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--cloud); }
.tabbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 18px 22px; background: rgb(255 255 255 / .82); box-shadow: 0 -8px 18px -10px rgb(43 29 74 / .25); }
.tab { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border: 0; border-radius: 18px; background: transparent; font: 800 1.05rem/1 var(--f-display); }
.tab.is-on { background: var(--lilac-soft); box-shadow: var(--well); color: var(--grape-deep); }
.words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.words li { background: var(--lilac-soft); border-radius: 12px; padding: 8px 12px; font-weight: 700; }
.words small { display: block; color: var(--plum-soft); font-weight: 600; }

/* Lesson */
.screen--lesson { background: var(--cloud); }
.lesson__head { display: flex; align-items: center; gap: 10px; padding-top: 14px; }
.progress { flex: 1; height: 20px; border-radius: var(--r-pill); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--mint); box-shadow: inset 3px 3px 5px rgb(255 255 255 / .7), inset -3px -3px 5px rgb(0 80 50 / .25); transition: width 600ms var(--spring); }
.hearts { display: inline-flex; align-items: center; gap: 4px; font: 800 1.25rem/1 var(--f-display); color: var(--berry-ink); min-width: 52px; font-variant-numeric: tabular-nums; }
.hearts .i { fill: var(--berry); color: var(--berry-ink); width: 28px; height: 28px; }
.hearts.is-hit .i { animation: thump 500ms var(--spring); }
.lesson__body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 4px 12px; display: flex; flex-direction: column; }
.ex-title { font-size: 1.75rem; margin-bottom: 6px; }
.ex-prompt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-weight: 700; color: var(--plum-soft); }
.word { font: 800 1.6rem/1.1 var(--f-display); color: var(--grape-deep); }
.say { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 14px; border: 0; border-radius: 16px; --c: var(--sky); font-weight: 800; }
#l-ex { flex: 1; display: flex; flex-direction: column; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pic { position: relative; border: 0; border-radius: var(--r-l); aspect-ratio: 1 / .92; display: grid; place-items: center; padding: 10px; --c: var(--cloud); }
.pic svg { width: 76%; height: 76%; }
.pic[aria-pressed="true"], .opt[aria-pressed="true"] { --c: var(--lilac-soft); outline: 4px solid var(--grape); outline-offset: 2px; }
.pic.is-right, .opt.is-right, .pair.is-right { --c: var(--mint-soft); outline: 4px solid var(--mint-ink); outline-offset: 2px; }
.pic.is-wrong, .opt.is-wrong { --c: var(--berry-soft); outline: 4px solid var(--berry-ink); outline-offset: 2px; }
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pairs__col { display: grid; gap: 12px; align-content: start; }
.pair { min-height: 68px; border: 0; border-radius: var(--r-m); --c: var(--cloud); display: grid; place-items: center; padding: 6px 8px; font: 800 1.2rem/1.1 var(--f-display); }
.pair svg { width: 52px; height: 52px; }
.pair[aria-pressed="true"] { --c: var(--lilac-soft); outline: 4px solid var(--grape); outline-offset: 2px; }
.pair.is-right { opacity: .6; cursor: default; }
.pair.is-wrong { --c: var(--berry-soft); animation: wobble 450ms var(--ease); }
.build__line { min-height: 132px; border-radius: var(--r-m); padding: 12px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; margin-bottom: 18px; background: repeating-linear-gradient(180deg, transparent 0 55px, rgb(43 29 74 / .18) 55px 57px, transparent 57px 66px); }
.build__line.is-over { background-color: var(--lilac-soft); }
.build__bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 60px; }
.wtile { min-height: 52px; padding: 0 18px; border: 0; --c: var(--cloud); font: 800 1.25rem/1 var(--f-display); touch-action: none; user-select: none; -webkit-user-select: none; }
.wtile.is-ghost { visibility: hidden; }
.wtile--drag { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(-4deg) scale(1.08); box-shadow: var(--hi), var(--lo), 0 20px 30px -10px rgb(43 29 74 / .5); }
.listen__big { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0 18px; }
.listen__play { width: 112px; height: 112px; border-radius: 36px; border: 0; --c: var(--sky); display: grid; place-items: center; }
.listen__play .i { width: 52px; height: 52px; }
.listen__slow { border: 0; min-height: 48px; padding: 0 14px; border-radius: 16px; --c: var(--sky-soft); font-weight: 800; }
.listen__spoken { text-align: center; min-height: 1.6em; font-weight: 700; color: var(--plum-soft); margin-bottom: 12px; }
.listen__spoken b { color: var(--grape-deep); font: 800 1.35rem/1.2 var(--f-display); }
.opts { display: grid; gap: 12px; }
.opt { min-height: 60px; border: 0; border-radius: var(--r-m); --c: var(--cloud); font: 800 1.3rem/1 var(--f-display); }
.type__pic { width: 120px; height: 120px; margin: 4px auto 14px; }
.type__input { font-size: 1.4rem; text-align: center; font-family: var(--f-display); min-height: 64px; }
.type__help { margin-top: 10px; text-align: center; color: var(--plum-soft); font-weight: 600; font-size: .95rem; }
.lesson__foot { padding: 12px 0 8px; }
.lesson__foot .btn { width: 100%; }
.feedback { position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; padding: 18px 18px 26px; border-radius: 30px 30px 0 0; background: var(--mint-soft); display: grid; gap: 14px; box-shadow: inset 0 6px 10px rgb(255 255 255 / .8), 0 -10px 24px -12px rgb(43 29 74 / .35); }
.feedback[hidden] { display: none; }
.feedback.is-wrong { background: var(--berry-soft); }
.feedback__row { display: flex; align-items: center; gap: 12px; }
.feedback__buddy { width: 64px; height: 64px; flex: none; }
.feedback__title { font: 800 1.55rem/1.1 var(--f-display); color: var(--mint-ink); }
.feedback.is-wrong .feedback__title { color: var(--berry-ink); }
.feedback__text { font-weight: 700; }
.feedback .btn { --c: var(--mint-ink); color: var(--cloud); box-shadow: inset 5px 6px 10px rgb(255 255 255 / .25), inset -5px -7px 12px rgb(0 40 20 / .3), var(--drop); }
.feedback.is-wrong .btn { --c: var(--berry-ink); }
.rest { flex: 1; display: grid; align-content: center; justify-items: center; text-align: center; gap: 14px; }
.rest .buddy { width: 140px; height: 140px; }
.rest p { color: var(--plum-soft); font-weight: 600; max-width: 28ch; }

/* Done */
.screen--done { background: radial-gradient(circle at 50% 30%, #fff8d9 0%, var(--lemon-soft) 45%, #ffe7a0 100%); text-align: center; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.done__body { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.done__buddy { width: 150px; height: 150px; }
.done__title { font-size: 2.5rem; }
.done__line { font-weight: 700; color: var(--plum-soft); }
.done__stars { display: flex; gap: 6px; margin: 6px 0 10px; }
.done__stars .i { width: 50px; height: 50px; stroke-width: 1.6; color: #8a5a00; fill: rgb(43 29 74 / .1); }
.done__stars .i.on { fill: var(--lemon); }
.done__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; width: 100%; }
.done__stats .tile { padding: 12px 6px; border-radius: var(--r-m); display: flex; flex-direction: column-reverse; justify-content: center; gap: 4px; min-height: 0; }
.done__stats dt { font: 700 .82rem/1.2 var(--f-body); }
.done__stats dd { margin: 0; font: 800 1.5rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.done__streak { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 800; color: #8a3a12; }
.done__streak .i { fill: #ff9a3c; color: #c2410c; }
.done__foot { position: relative; z-index: 1; }
.done__foot .btn { width: 100%; }

/* Gate */
.screen--gate { background: linear-gradient(180deg, var(--lilac-soft), #ddd0ff); }
.gate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; position: relative; }
.gate__back { position: absolute; left: 0; top: 14px; }
.gate__lock { width: 64px; height: 64px; fill: var(--lilac); stroke: var(--grape-deep); stroke-width: 1.8; stroke-linecap: round; }
.gate__title { font-size: 2.2rem; }
.gate__text { color: var(--plum-soft); font-weight: 600; }
.gate__form { width: 100%; display: grid; gap: 10px; margin-top: 18px; }
.gate__q { font: 800 1.7rem/1.2 var(--f-display); }
.gate__input { text-align: center; font-size: 1.6rem; font-family: var(--f-display); font-variant-numeric: tabular-nums; }

/* Parents */
.screen--parents { background: #f7f4fb; padding: 0; }
.parents__head { display: flex; align-items: center; justify-content: space-between; padding: 30px 14px 6px; }
.parents__title { font-size: 1.5rem; }
.parents__scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 18px 28px; display: grid; gap: 16px; align-content: start; }
.parents__who { font-weight: 700; color: var(--plum-soft); }
.panel { --c: var(--cloud); padding: 18px; border-radius: var(--r-l); }
.panel__title { font-size: 1.3rem; margin-bottom: 10px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--f-body); }
.chart text { fill: var(--plum-soft); font-size: 12px; font-weight: 700; }
.chart .today { fill: var(--plum); font-weight: 800; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.facts div { background: var(--lilac-soft); border-radius: 14px; padding: 10px; }
.facts dt { font-size: .8rem; font-weight: 700; color: var(--plum-soft); }
.facts dd { margin: 0; font: 800 1.2rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.toggles { list-style: none; margin: 0 0 14px; padding: 0; display: grid; }
.toggles li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 2px solid #f0ecf6; }
.toggles__text { font-weight: 800; }
.toggles small { display: block; font-weight: 600; color: var(--plum-soft); font-size: .88rem; }
.field--row { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.parents__fine { text-align: center; font-size: .9rem; color: var(--plum-soft); font-weight: 600; }

/* ---------- 6. Page sections ---------- */
.recipe { background: var(--lilac-soft); padding: var(--s9) 0; border-radius: 64px 64px 0 0; box-shadow: inset 0 10px 20px rgb(255 255 255 / .7); }
.recipe__list { list-style: none; margin: var(--s7) 0 0; padding: 0; display: grid; gap: var(--s4); }
.recipe__row { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 260px); gap: var(--s5); align-items: center; padding: var(--s4) 0; border-bottom: 3px dotted rgb(43 29 74 / .2); }
.recipe__row:last-child { border-bottom: 0; }
.recipe__n { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; font: 800 1.9rem/1 var(--f-display); }
.recipe__row h3 { font-size: 1.6rem; margin-bottom: 4px; }
.recipe__row p { max-width: 60ch; }
.recipe__rule { font-weight: 800; color: var(--grape-deep); }

.claylab { background: var(--mint-soft); padding: var(--s9) 0; }
.claylab__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s7); align-items: center; }
.claylab__text p { max-width: 62ch; margin-bottom: var(--s4); }
.claylab__text code { background: var(--cloud); padding: 1px 6px; border-radius: 6px; }
.code { margin: var(--s5) 0 0; padding: var(--s5); overflow-x: auto; font-size: .95rem; line-height: 1.5; background: rgb(255 255 255 / .7); border-radius: var(--r-m); }
.code code { background: none; padding: 0; }
.claylab__demo { display: grid; justify-items: center; gap: var(--s5); }
.layers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); width: 100%; }
.layers figure { margin: 0; display: grid; justify-items: center; gap: var(--s2); }
.layers figcaption { font-weight: 800; font-size: .95rem; }
.blob { width: 100%; max-width: 110px; aspect-ratio: 1; border-radius: 34px; background: var(--peach); display: block; }
.blob--hi { box-shadow: var(--hi); }
.blob--shade { box-shadow: var(--lo); }
.blob--drop { box-shadow: var(--drop); }
.blob--all { --c: var(--peach); border-radius: 34px; }
.squish { --c: var(--berry); width: 260px; height: 140px; border: 0; border-radius: 48px; font: 800 2rem/1 var(--f-display); color: var(--plum); }
.squish__count { font-weight: 700; color: var(--plum-soft); min-height: 1.6em; font-variant-numeric: tabular-nums; }

.hands { background: var(--lemon-soft); padding: var(--s9) 0; }
.hands__grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s7); align-items: start; }
.hands__buddy { width: 240px; height: 240px; }
.hands__list { margin: var(--s5) 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s6); }
.hands__list dt { font: 800 1.35rem/1.15 var(--f-display); margin-bottom: 4px; }
.hands__list dd { margin: 0; max-width: 46ch; color: var(--plum-soft); }

.foot { background: var(--plum); color: #efe8ff; padding: var(--s7) 0; }
.foot__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4) var(--s6); }
.foot__brand { display: inline-flex; align-items: center; gap: var(--s2); font: 800 1.6rem/1 var(--f-display); color: var(--cloud); }
.foot__brand .buddy { width: 44px; height: 44px; }
.foot__fine { max-width: 52ch; }
.foot__nav { display: flex; gap: var(--s2); }
.foot__nav a { color: var(--cloud); min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--s2); font-weight: 700; }
.foot :focus-visible { outline-color: var(--lemon); }

/* ---------- 7. Motion ---------- */
@keyframes thump { 0% { transform: scale(1); } 30% { transform: scale(.7); } 100% { transform: scale(1); } }
@keyframes wobble { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px) rotate(-2deg); } 50% { transform: translateX(7px) rotate(2deg); } 75% { transform: translateX(-4px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-6px) scale(.98, 1.03); } }
@keyframes pop-in { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes jelly { 0% { transform: scale(1, 1); } 30% { transform: scale(1.12, .86); } 55% { transform: scale(.94, 1.08); } 75% { transform: scale(1.03, .97); } 100% { transform: scale(1, 1); } }

@media (prefers-reduced-motion: no-preference) {
  .app:not(.is-calm) .node--current { animation: bob 2.4s ease-in-out infinite; }
  .app:not(.is-calm) .path__buddy, .app:not(.is-calm) .buddy-preview .buddy, .app:not(.is-calm) .done__buddy { animation: bob 3s ease-in-out infinite; transform-origin: 50% 100%; }
  .app:not(.is-calm) .screen.is-active { animation: pop-in 420ms var(--spring); }
  .app:not(.is-calm) .feedback:not([hidden]) { animation: rise 420ms var(--spring); }
  .app:not(.is-calm) .is-jelly { animation: jelly 520ms var(--ease); }
  .app:not(.is-calm) .done__stars .i.on { animation: pop-in 520ms var(--spring) both; }
  .app:not(.is-calm) .done__stars .i.on:nth-child(2) { animation-delay: 160ms; }
  .app:not(.is-calm) .done__stars .i.on:nth-child(3) { animation-delay: 320ms; }
  .squish.is-jelly { animation: jelly 520ms var(--ease); }
}
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
/* Reduced motion and calm mode: presses still sink, but nothing overshoots */
@media (prefers-reduced-motion: reduce) {
  :root { --spring: var(--ease); --t-spring: 200ms; }
  .hearts.is-hit .i, .pair.is-wrong { animation: none; }
}
.app.is-calm { --spring: var(--ease); --t-spring: 200ms; }
.app.is-calm .hearts.is-hit .i, .app.is-calm .pair.is-wrong { animation: none; }

/* ---------- 8. Narrow screens ---------- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: 400px minmax(0, 1fr); grid-template-areas: "intro intro" "device notes" "device switch"; grid-template-rows: auto auto 1fr; }
  .stage::before { margin-left: -560px; }
  .stage::after { display: none; }
  .notes, .switcher { justify-self: start; max-width: 420px; margin-top: 0; }
  .notes { align-self: end; }
  .stage__intro { justify-self: start; max-width: 720px; }
}
@media (max-width: 900px) {
  .recipe__row { grid-template-columns: 56px minmax(0, 1fr); }
  .recipe__n { width: 56px; height: 56px; }
  .recipe__rule { grid-column: 2; }
  .claylab__grid, .hands__grid { grid-template-columns: minmax(0, 1fr); }
  .hands__buddy { width: 160px; height: 160px; }
}
@media (max-width: 760px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "device" "intro" "notes" "switch"; padding: 0 0 var(--s8); gap: var(--s6); }
  .stage::before, .stage::after { display: none; }
  .stage__intro, .notes, .switcher { padding: 0 var(--gutter); max-width: none; justify-self: stretch; }
  .device { width: 100%; }
  .device__frame { padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .app { height: calc(100svh - 64px); min-height: 560px; border-radius: 0; }
  .top { height: 64px; padding-top: 0; padding-bottom: 0; }
  .top__nav { display: none; }
  .hands__list { grid-template-columns: 1fr; }
  .layers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe { border-radius: 40px 40px 0 0; padding: var(--s8) 0; }
  .claylab, .hands { padding: var(--s8) 0; }
  .squish { width: 100%; max-width: 300px; }
  .ob-title { font-size: 1.85rem; }
}
@media (max-width: 380px) {
  .screen { padding: 14px; }
  .goal__min { font-size: 2.1rem; }
  .done__stats dd { font-size: 1.25rem; }
}

/* The welcome greeting fills the space under the language choices */
.ob-greet { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s5); }
.ob-greet .buddy { width: 96px; height: 96px; flex: none; }
.home__scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px); mask-image: linear-gradient(to bottom, transparent 0, #000 28px); }
.rest .btn { width: 100%; max-width: 300px; }
