/* Read with Mip: kids' demo. Huge targets, audio-first, calm. */
@font-face { font-family: 'Nunito'; src: url('/fonts/nunito.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Andika'; src: url('/fonts/andika-regular.woff2') format('woff2'); font-weight: 400; font-display: block; }
@font-face { font-family: 'Andika'; src: url('/fonts/andika-bold.woff2') format('woff2'); font-weight: 700; font-display: block; }
:root {
  --cream: #FBF4E6; --paper: #FFFDF8; --ink: #2f2a22; --muted: #6b6355; --line: #eadfc8;
  --sage: #7FA37A; --leaf: #4F7F52; --leaf-dark: #3d6640; --coral: #F08A6B; --sun: #F4C552; --sky: #8EC5E0; --soil: #8B6B4A;
  --kid: 'Andika', 'Nunito', system-ui, sans-serif; --ui: 'Nunito', system-ui, sans-serif;
  --tap: 88px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--cream); color: var(--ink); font-family: var(--ui); overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font-family: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
#app { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; position: relative; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 10px; min-height: 64px; }
.icon-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--paper); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; cursor: pointer; font-size: 1.5rem; }
.icon-btn svg { width: 28px; height: 28px; }
.grownup-btn { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 10px 16px; font-weight: 800; font-size: .95rem; cursor: pointer; min-height: 60px; min-width: 60px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); display: block; }
.dots i.on { background: var(--sage); }
.dots i.now { background: var(--sun); transform: scale(1.3); }

/* Stage */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 16px 16px; gap: 14px; text-align: center; }
.caption { font-size: clamp(1.1rem, 4.6vw, 1.45rem); font-weight: 800; line-height: 1.35; max-width: 30em; margin: 0; }
.caption.grownup { background: #e7f0e3; border: 2px solid var(--sage); color: var(--leaf-dark); border-radius: 18px; padding: 12px 16px; font-size: 1.05rem; }
.bubble { position: relative; background: var(--paper); border-radius: 22px; padding: 14px 18px; box-shadow: 0 4px 0 var(--line); }
.mip { width: min(46vw, 230px); }
.mip.small { width: min(28vw, 130px); }
.bounce { animation: bounce .5s ease; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 40% { transform: translateY(-14px) scale(1.04) } }
.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-10px) } 75% { transform: translateX(10px) } }
.pop { animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* Letters */
.letter-tile { font: 700 clamp(6rem, 34vw, 11rem)/1 var(--kid); background: var(--paper); border: 0; border-radius: 32px; width: min(62vw, 300px); aspect-ratio: 1; display: grid; place-items: center; box-shadow: 0 8px 0 var(--line); cursor: pointer; padding-bottom: .12em; }
.letter-tile:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--line); }
.tiles { display: grid; grid-template-columns: repeat(3, var(--tap)); gap: 14px; }
.tile { width: var(--tap); height: var(--tap); border-radius: 22px; border: 0; background: var(--paper); box-shadow: 0 6px 0 var(--line); font: 700 3.4rem/1 var(--kid); cursor: pointer; padding-bottom: 6px; }
.tile.ok { background: #dbead6; box-shadow: 0 6px 0 var(--sage); color: var(--leaf-dark); }
.tile[disabled] { cursor: default; }
.word-row { display: flex; gap: 10px; justify-content: center; }
.word-row .tile { width: clamp(76px, 22vw, 110px); height: clamp(96px, 26vw, 130px); font-size: clamp(3.4rem, 15vw, 5rem); position: relative; }
.word-row .tile::after { content: ''; position: absolute; bottom: 10px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--line); }
.word-row .tile.next::after { background: var(--coral); animation: pulse 1s infinite; }
.word-row .tile.ok::after { background: var(--sage); }
@keyframes pulse { 50% { transform: scale(1.5) } }
.slider { width: min(92vw, 420px); height: 84px; background: var(--paper); border-radius: 999px; position: relative; box-shadow: inset 0 3px 0 var(--line); touch-action: none; }
.slider .track { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }
.slider .thumb { position: absolute; top: 6px; left: 6px; width: 72px; height: 72px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-size: 2rem; box-shadow: 0 4px 0 #d9a93a; cursor: grab; }
.say-fast { margin-top: 4px; }

/* Reading */
.read-text { font: 700 clamp(2.6rem, 12vw, 4.4rem)/1.25 var(--kid); background: var(--paper); border-radius: 26px; padding: 18px 22px; box-shadow: 0 6px 0 var(--line); max-width: 100%; }
.read-text.word { font-size: clamp(4rem, 22vw, 7rem); padding: 18px 36px; }
.w { cursor: pointer; border-radius: 10px; padding: 0 .05em; display: inline-flex; align-items: center; justify-content: center; min-height: 60px; min-width: 60px; vertical-align: middle; }
.w.hl { background: var(--sun); }
.story-page { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.story-page img { border-radius: 22px; width: min(100%, 560px); aspect-ratio: 4/3; object-fit: cover; box-shadow: 0 6px 0 var(--line); }
.story-page .read-text { font-size: clamp(2rem, 9vw, 3.2rem); }
.heart-word { position: relative; }
.heart-word .heart { position: absolute; top: -18px; right: -18px; font-size: 2.4rem; }
.pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: min(100%, 520px); }
.pic { border: 0; background: var(--paper); border-radius: 22px; padding: 8px; box-shadow: 0 6px 0 var(--line); cursor: pointer; aspect-ratio: 1; }
.pic img { width: 100%; height: 100%; object-fit: contain; }
.pic.ok { box-shadow: 0 6px 0 var(--sage); background: #dbead6; }

/* Trace */
.trace-wrap { position: relative; width: min(80vw, 340px); aspect-ratio: 1; background: var(--paper); border-radius: 30px; box-shadow: 0 8px 0 var(--line); touch-action: none; }
.trace-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 30px; }

/* Buttons */
.go { min-width: var(--tap); min-height: var(--tap); border-radius: 999px; border: 0; background: var(--leaf); color: #fff; font-size: 2.4rem; box-shadow: 0 6px 0 var(--leaf-dark); cursor: pointer; padding: 0 28px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; }
.go.text { font-size: 1.3rem; }
.go:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--leaf-dark); }
.hear { min-width: 64px; background: var(--sun); color: var(--ink); box-shadow: 0 5px 0 #d9a93a; border: 0; border-radius: 999px; min-height: 64px; min-width: 64px; padding: 0 18px; font-size: 1.6rem; cursor: pointer; }

/* Grown-up check bar */
.parent-bar { position: sticky; bottom: 0; background: #e7f0e3; border-top: 3px solid var(--sage); padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: slideup .3s ease; }
@keyframes slideup { from { transform: translateY(100%) } }
.parent-bar .q { font-weight: 800; color: var(--leaf-dark); text-align: center; font-size: 1.02rem; }
.parent-bar .row { display: flex; gap: 10px; }
.parent-bar button { flex: 1; min-height: 64px; border-radius: 18px; border: 0; font: 900 1.15rem var(--ui); cursor: pointer; }
.parent-bar .yes { background: var(--leaf); color: #fff; box-shadow: 0 4px 0 var(--leaf-dark); }
.parent-bar .help { background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 var(--line); }

/* Garden */
.garden { position: relative; width: 100%; max-width: 560px; aspect-ratio: 3/4; border-radius: 28px; overflow: hidden; background: #f3ead6 center/cover no-repeat; box-shadow: 0 6px 0 var(--line); }
.garden.mini { aspect-ratio: 5/2; max-width: 420px; background-position: center 72%; }
.plant { position: absolute; width: 18%; transform: translate(-50%, -100%); transition: transform .4s cubic-bezier(.2,1.6,.4,1); }
.plant .tag { font: 700 1.1rem var(--kid); background: #fff8e8; border-radius: 8px; padding: 0 6px; display: inline-block; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); border: 2px solid var(--soil); }
.garden.mini .plant { width: 13%; }
.garden.mini .plant .tag { font-size: .85rem; }

/* Home */
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lessons { display: grid; gap: 12px; width: min(100%, 520px); }
.lesson-btn { display: flex; align-items: center; gap: 14px; min-height: 92px; border: 0; border-radius: 24px; background: var(--paper); box-shadow: 0 6px 0 var(--line); padding: 12px 18px; font: 900 1.3rem var(--ui); text-align: left; cursor: pointer; }
.lesson-btn .num { width: 60px; height: 60px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.lesson-btn.done .num { background: var(--sage); color: #fff; }
.lesson-btn[disabled] { opacity: .55; cursor: default; }
.lesson-btn small { display: block; font: 700 .9rem var(--ui); color: var(--muted); }
.activity { background: var(--paper); border: 3px dashed var(--sage); border-radius: 24px; padding: 16px 18px; font-size: 1.15rem; font-weight: 800; max-width: 34em; }
.activity b { color: var(--leaf-dark); display: block; margin-bottom: 4px; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(47, 42, 34, .45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.sheet { background: var(--paper); border-radius: 26px; padding: 22px; width: min(100%, 520px); max-height: 92vh; max-height: 92svh; overflow: auto; text-align: left; }
.sheet h2 { margin: 0 0 8px; font-size: 1.4rem; }
.sheet p, .sheet li { font-size: 1rem; line-height: 1.5; }
.sheet .btn { display: flex; width: 100%; justify-content: center; align-items: center; min-height: 60px; border-radius: 999px; border: 0; font: 900 1.05rem var(--ui); cursor: pointer; margin-top: 10px; text-decoration: none; }
.btn.primary { background: var(--leaf); color: #fff; }
.btn.ghost { background: transparent; border: 2px solid var(--sage); color: var(--leaf-dark); }
.hold { position: relative; overflow: hidden; }
.hold .fill { position: absolute; inset: 0; width: 0; background: rgba(255,255,255,.35); }
.sheet input[type=text] { width: 100%; min-height: 60px; border-radius: 14px; border: 2px solid var(--line); padding: 10px 14px; font: 1.1rem var(--ui); }
.card-preview { width: 100%; border-radius: 16px; box-shadow: 0 4px 0 var(--line); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.devnote { position: fixed; bottom: 6px; left: 6px; font-size: 11px; background: #fff3; padding: 2px 6px; border-radius: 6px; color: var(--muted); z-index: 30; }

@media (min-width: 700px) { :root { --tap: 104px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
