:root {
  --linen: #F7F1E5;
  --paper: #FFFDF8;
  --wood: #6E4B33;
  --ink: #3D2C29;
  --leaf: #5E8C61;
  --sun: #E8955A;
  --soft: #EADFCB;
  --r: 22px;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--linen); overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#app { min-height: 100dvh; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 14px 14px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* Bilah atas */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 64px; }
.round { width: 64px; height: 64px; border-radius: 50%; background: var(--paper); box-shadow: 0 3px 0 var(--soft); display: grid; place-items: center; font-size: 28px; }
.round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--soft); }
.stars { font-weight: 800; font-size: 22px; background: var(--paper); padding: 10px 16px; border-radius: 999px; }

/* Beranda */
.hello { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.hello img { width: 96px; height: 96px; border-radius: 24px; }
.hello p { margin: 0; font-size: 22px; font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card { background: var(--paper); border-radius: var(--r); padding: 14px 10px 12px; box-shadow: 0 4px 0 var(--soft); display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 160px; position: relative; }
.card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft); }
.card .pic { font-size: 64px; line-height: 1.1; }
.card .name { font-weight: 800; font-size: 17px; text-align: center; }
.card .got { position: absolute; top: 8px; right: 10px; font-size: 18px; }
.card.rest { opacity: .55; }
.card.rest .nest { position: absolute; top: 8px; right: 10px; font-size: 20px; }

/* Main */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.prompt { display: flex; align-items: center; gap: 10px; }
.prompt .say { width: 64px; height: 64px; }
.big { font-size: 150px; line-height: 1; width: 220px; height: 220px; border-radius: 40px; background: var(--paper); display: grid; place-items: center; box-shadow: 0 5px 0 var(--soft); }
.word { font-size: 34px; font-weight: 900; letter-spacing: .5px; min-height: 44px; }
.word .syl { padding: 0 2px; border-radius: 8px; }
.word .syl.on { background: var(--sun); color: #fff; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.choice { font-size: 84px; width: 140px; height: 140px; border-radius: 30px; background: var(--paper); box-shadow: 0 5px 0 var(--soft); display: grid; place-items: center; }
.choice:active { transform: translateY(3px); }
.swatch { width: 96px; height: 96px; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0,0,0,.12); }
.big .swatch { width: 150px; height: 150px; }
.choice.ok { animation: pop .45s ease; background: #E3F0DF; }
.choice.no { animation: wiggle .4s ease; }
.choice.fade { opacity: .35; }
.next { background: var(--leaf); color: #fff; font-weight: 900; font-size: 24px; padding: 18px 34px; border-radius: 999px; box-shadow: 0 5px 0 #3f6642; min-width: 180px; }
.next:active { transform: translateY(3px); box-shadow: 0 2px 0 #3f6642; }
.dots { display: flex; gap: 8px; justify-content: center; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--soft); }
.dots i.on { background: var(--sun); }

/* Selesai */
.done { text-align: center; }
.done .next { display: inline-flex; align-items: center; gap: 8px; }
.done h2 { font-size: 30px; margin: 8px 0; }
.sticker { font-size: 90px; animation: pop .6s ease; }

@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
.word .syl + .syl::before { content: " B7"; color: var(--sun); padding: 0 6px; }

/* ---------- Pipit hidup ---------- */
.pipit { display: inline-block; flex: none; }
.pipit svg { width: 100%; height: 100%; overflow: visible; }
.pipit-sm { width: 64px; height: 64px; }
.pipit-md { width: 112px; height: 112px; }
.pipit-lg { width: 200px; height: 200px; }
.pipit svg > * { transform-box: fill-box; }
.pipit svg { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.pipit .p-head { transform-origin: 50% 85%; animation: look 7s ease-in-out infinite; }
.pipit.mood-curious .p-head { animation: tilt 2.4s ease-in-out infinite; }
.pipit .p-eye { transform-origin: center; animation: blink 4.6s infinite; }
.pipit .p-wing { transform-origin: 85% 30%; }
.pipit .p-beak { transform-origin: 50% 0%; }
body.talking .pipit .p-beak { animation: chirp .22s ease-in-out infinite alternate; }
body.talking .pipit .p-head { animation: nod .5s ease-in-out infinite alternate; }
.pipit.hop svg { animation: hop .6s cubic-bezier(.3,1.6,.5,1) 1; }
.pipit.hop .p-wing { animation: flap .15s ease-in-out 4 alternate; }

@keyframes breathe { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
@keyframes look { 0%,40%,100% { transform: rotate(0); } 48%,60% { transform: rotate(-6deg); } 68%,80% { transform: rotate(4deg); } }
@keyframes tilt { 0%,100% { transform: rotate(-10deg); } 50% { transform: rotate(-4deg); } }
@keyframes blink { 0%,94%,100% { transform: scaleY(1); } 96%,98% { transform: scaleY(.1); } }
@keyframes chirp { from { transform: scaleY(1); } to { transform: scaleY(1.35) translateY(2px); } }
@keyframes nod { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@keyframes hop { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.06, .92); } 55% { transform: translateY(-22%) scale(.97, 1.04); } 85% { transform: translateY(0) scale(1.04, .96); } 100% { transform: none; } }
@keyframes flap { from { transform: rotate(0); } to { transform: rotate(-28deg); } }

/* Gambar ilustrasi */
.pic img, .card .pic img { width: 76px; height: 76px; }
.big img { width: 170px; height: 170px; }
.choice img { width: 104px; height: 104px; }
.icon { width: 36px; height: 36px; }
.next .icon { width: 30px; height: 30px; }
.round .icon { width: 38px; height: 38px; }
.stars img { width: 26px; height: 26px; vertical-align: -6px; margin-right: 4px; }
.sticker img { width: 120px; height: 120px; }
.card.rest .nest img { width: 30px; height: 30px; }
.choice .nest-img { width: 96px; height: 96px; }
body { background: radial-gradient(circle at 20% 0%, #FFF8EA 0, transparent 50%), var(--linen); }
