/* Little Coders: a bright, soft storybook look for ages 5–6 (an exception to the dark space look of the other Quests). */
:root { --ink: #16405C; --line: #1E2A3A; --sky: #CDEFFF; --cream: #FFF6E3; --pip: #5BC0F5; --sun: #FFD23F; --good: #2F9E44; --bad: #E03131; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body.kid { font-family: "Nunito", system-ui, sans-serif; color: var(--ink); background: linear-gradient(180deg, #CDEFFF 0%, #E9F8FF 50%, #FFF6E3 100%); min-height: 100vh; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { max-width: 1180px; margin: 0 auto; padding: 10px 16px 30px; }
.loading { display: grid; place-items: center; min-height: 80vh; }
.load-pip { width: 200px; height: 186px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px); } }

/* top bar */
.kid-top { display: flex; align-items: center; gap: 12px; }
.round-btn { width: 60px; height: 60px; border-radius: 50%; border: 4px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--line); box-shadow: 0 4px 0 #9CCBE6; text-decoration: none; flex: none; }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #9CCBE6; }
.kid-name { flex: 1; font-size: 28px; font-weight: 900; }
.kid-stars { display: flex; align-items: center; gap: 6px; font-size: 28px; font-weight: 900; background: #fff; border: 4px solid var(--line); border-radius: 999px; padding: 4px 16px; color: #B88A00; }
.kid-stars svg { color: #F5B400; }

/* Pip + speech bubble */
.map-head, .lesson-head { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.pip-talk { width: 130px; height: 121px; flex: none; }
.pip-talk.talking .pip-light { animation: blink .35s steps(2) infinite; }
@keyframes blink { 50% { fill: #fff; } }
.speech { flex: 1; min-height: 64px; background: #fff; border: 4px solid var(--line); border-radius: 26px; padding: 12px 20px; font-size: 24px; font-weight: 800; line-height: 1.25; position: relative; }
.speech::before { content: ""; position: absolute; left: -16px; top: 22px; border: 10px solid transparent; border-right: 14px solid var(--line); }
.listen-btn { width: 74px; height: 74px; border-radius: 50%; border: 4px solid var(--line); background: var(--sun); color: var(--line); display: grid; place-items: center; flex: none; box-shadow: 0 5px 0 #C9A21F; }
.listen-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #C9A21F; }

/* map */
.world-tabs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0 14px; }
.world-tab { position: relative; width: 84px; height: 84px; border-radius: 22px; border: 4px solid var(--line); background: #fff; display: grid; place-items: center; padding: 0; box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.world-tab span { position: absolute; bottom: -2px; right: 4px; font-weight: 900; font-size: 20px; }
.world-tab.on { background: var(--wc); transform: scale(1.1); }
.world-tab.locked svg.art { filter: grayscale(1); opacity: .45; }
.tab-lock { position: absolute; top: -8px; left: -8px; background: #fff; border: 3px solid var(--line); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; }
.tab-gold { position: absolute; top: -8px; right: -8px; background: #FFD43B; border: 3px solid var(--line); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; }
.world { background: color-mix(in srgb, var(--wc) 28%, #fff); border: 4px solid var(--line); border-radius: 36px; padding: 16px 24px 28px; }
.world h1 { margin: 0 0 12px; font-size: 34px; font-weight: 900; text-align: center; }
.path { display: grid; grid-template-columns: repeat(5, 1fr); gap: 26px 18px; }
.path .stone:nth-child(n+6) { grid-row: 2; }
.path .stone:nth-child(6) { grid-column: 5; } .path .stone:nth-child(7) { grid-column: 4; } .path .stone:nth-child(8) { grid-column: 3; } .path .stone:nth-child(9) { grid-column: 2; } .path .stone:nth-child(10) { grid-column: 1; }
.stone { position: relative; height: 150px; border-radius: 40px; border: 4px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 7px 0 rgba(0,0,0,.15); transition: transform .12s; }
.stone:hover:not(.locked) { transform: translateY(-4px) scale(1.03); }
.stone-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--wc); border: 3px solid var(--line); display: grid; place-items: center; color: var(--line); }
.stone.k-party .stone-ic { background: #FFD43B; } .stone.k-safe .stone-ic { background: #FFC9C9; } .stone.k-coach .stone-ic { background: #D0BFFF; } .stone.k-make .stone-ic { background: #FFD8A8; }
.stone-n { position: absolute; top: 8px; left: 14px; font-size: 22px; font-weight: 900; }
.stone.locked { background: #EEF1F5; } .stone.locked .stone-ic { background: #DDE2E8; color: #6B7785; }
.stone.locked .stone-stars { opacity: .3; }
.stars { display: inline-flex; gap: 2px; } .stars .st.on { color: #F5B400; } .stars .st.off { color: #D5DCE4; }
.soon { text-align: center; padding: 30px; font-size: 30px; font-weight: 900; }

/* lesson */
.lesson-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; margin: 4px 0 10px; }
.lesson-title > span:first-child { background: #fff; border: 3px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: 16px; }
.dots { margin-left: auto; display: flex; gap: 8px; }
.dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); background: #fff; }
.dots i.now { background: var(--sun); } .dots i.done { background: #69DB7C; }
.stage { position: relative; height: min(64vh, 560px); min-height: 420px; background: #fff; border: 4px solid var(--line); border-radius: 32px; overflow: hidden; touch-action: none; }
.stage > svg.bg, .make-scene > svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.thing { position: absolute; transform: translate(-50%, -50%); background: none; border: none; padding: 0; line-height: 0; }
button.thing { cursor: pointer; }
.drag { cursor: grab; touch-action: none; }
.lifted { cursor: grabbing; z-index: 20; filter: drop-shadow(0 10px 8px rgba(0,0,0,.25)); transform: translate(-50%, -50%) scale(1.12); }
.back { transition: left .3s, top .3s; }
.gone { transition: transform .35s, opacity .35s; transform: translate(-50%, -50%) scale(.2); opacity: 0; }
.boing { animation: boing .45s; }
@keyframes boing { 40% { transform: translate(-50%, -50%) scale(1.18); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.07); } }
.wrong { animation: wobble .5s; }
@keyframes wobble { 25% { rotate: -6deg; } 75% { rotate: 6deg; } }
.stage-msg { display: grid; place-items: center; height: 100%; font-size: 36px; font-weight: 900; text-align: center; }

.tap-target { cursor: pointer; }
.big-listen { width: 100%; height: 100%; border-radius: 50%; border: 6px solid var(--line); background: var(--sun); display: grid; place-items: center; box-shadow: 0 8px 0 #C9A21F; }
.big-go { width: 100%; height: 100%; border-radius: 40px; border: 6px solid var(--line); background: #51CF66; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 44px; font-weight: 900; color: #fff; box-shadow: 0 8px 0 #2F9E44; -webkit-text-stroke: 2px var(--line); }

.choices { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 26px; flex-wrap: wrap; padding: 20px; }
.choice { background: #fff; border: 5px solid var(--line); border-radius: 30px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 7px 0 #9CCBE6; min-width: 150px; }
.choice:hover { transform: translateY(-4px); }
.choice.right { background: #D3F9D8; border-color: var(--good); }
.choice.wrong { background: #FFE3E3; }
.choice-label { font-size: 17px; font-weight: 800; max-width: 170px; text-align: center; line-height: 1.15; }
.swatch { width: 130px; height: 130px; border-radius: 50%; border: 5px solid var(--line); display: block; }

.butterfly { transition: none; } .butterfly.happy svg { animation: flap .25s infinite alternate; }
@keyframes flap { to { transform: scaleX(.7); } }
.progress { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 60%; height: 28px; border: 4px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #FF8DC7, #B197FC); transition: width .2s; }

.peek .peek-animal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -30%) scale(.6); opacity: 0; transition: .35s; }
.peek .peek-bush { position: relative; display: block; transition: .35s; }
.peek.found .peek-animal { transform: translate(-50%, -75%) scale(1); opacity: 1; }
.peek.found .peek-bush { transform: translateY(18px); }
.bubble.popped { transform: translate(-50%, -50%) scale(1.5) !important; opacity: 0; transition: .25s; }
.big-target { z-index: 1; }
.target { border-radius: 26px; padding: 6px; }
.target.wrong { background: #FFE3E3; }
.group-box { display: block; width: 170px; height: 130px; border: 5px solid var(--line); border-radius: 24px; }

.puzzle-frame { position: absolute; border: 5px dashed #7FB6D6; border-radius: 10px; }
.puzzle-frame .ghost { position: absolute; inset: 0; opacity: .14; }
.puzzle-frame .ghost svg { width: 100%; height: 100%; }
.piece { position: absolute; overflow: hidden; border: 3px solid var(--line); border-radius: 6px; background: #fff; }
.piece svg { width: 100%; height: 100%; display: block; }
.piece.snapped { border-color: transparent; border-radius: 0; z-index: 0; transition: left .2s, top .2s; }

.door .behind { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.door .door-face { position: relative; display: block; transform-origin: left center; transition: transform .5s; }
.door.open .door-face { transform: perspective(400px) rotateY(-75deg); }

.scroller { position: absolute; inset: 0; overflow-y: scroll; background: linear-gradient(180deg, #B2F2BB, #69DB7C); }
.tall { position: relative; height: 340%; }
.deco { opacity: .7; pointer-events: none; }
.scroll-hint { position: absolute; right: 22px; bottom: 20px; width: 70px; height: 70px; border-radius: 50%; background: var(--sun); border: 4px solid var(--line); display: grid; place-items: center; transform: rotate(90deg); animation: nudge 1s infinite; pointer-events: none; }
.scroll-hint.hide { display: none; }
@keyframes nudge { 50% { transform: rotate(90deg) translateX(10px); } }
.counter { position: absolute; top: 12px; left: 12px; background: #fff; border: 4px solid var(--line); border-radius: 999px; padding: 4px 10px; display: flex; gap: 4px; }
.counter span { opacity: .25; } .counter span.on { opacity: 1; }

.make-scene { position: absolute; left: 0; right: 0; top: 0; bottom: 96px; cursor: crosshair; overflow: hidden; }
.stamp { pointer-events: auto; }
.tray { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; background: var(--cream); border-top: 4px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 130px 0 14px; overflow-x: auto; }
.tray-item { width: 72px; height: 72px; flex: none; border-radius: 20px; border: 4px solid var(--line); background: #fff; display: grid; place-items: center; padding: 0; cursor: grab; }
.tray-item.on { background: var(--sun); transform: scale(1.08); }
.done-btn { position: absolute; right: 14px; bottom: 12px; z-index: 30; height: 70px; padding: 0 22px; border-radius: 999px; border: 4px solid var(--line); background: #51CF66; color: #fff; font-size: 28px; font-weight: 900; display: flex; align-items: center; gap: 6px; box-shadow: 0 5px 0 #2F9E44; }
.done-btn.hide { display: none; }
.undo-btn { position: absolute; left: 14px; top: 12px; z-index: 5; border: 3px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 800; display: flex; align-items: center; gap: 4px; }

/* keyboard games */
.kb { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; background: #E9ECEF; border: 4px solid var(--line); border-radius: 18px; padding: 10px; }
.kb-row { display: flex; gap: 6px; justify-content: center; }
.kb-row:nth-child(3) { padding-left: 18px; } .kb-row:nth-child(4) { padding-right: 60px; }
.kb-key { position: relative; min-width: 44px; height: 44px; border-radius: 10px; border: 3px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 900; box-shadow: 0 3px 0 #ADB5BD; padding: 0 8px; }
.kb-key.wide { font-size: 14px; min-width: 80px; }
.kb-key.space { min-width: 320px; font-size: 14px; }
.kb-key.bump::after { content: ""; position: absolute; bottom: 5px; width: 12px; height: 3px; border-radius: 2px; background: #868E96; }
.kb-key.mark { background: var(--sun); animation: pulse2 .9s infinite; }
@keyframes pulse2 { 50% { transform: scale(1.12); } }
.kb-key.lit { background: #A5D8FF; } .kb-key.good { background: #8CE99A; } .kb-key.bad { background: #FFA8A8; }
.big-key { position: absolute; transform: translate(-50%, -50%); min-width: 150px; height: 150px; border: 6px solid var(--line); border-radius: 30px; background: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 24px; box-shadow: 0 8px 0 #ADB5BD; }
.big-key span { font-size: 90px; font-weight: 900; } .big-key small { font-size: 60px; font-weight: 800; color: #5C7CFA; }
.big-key .word { font-size: 56px; }
.big-key.boing { animation: boing .45s; }
.castle.glow svg { animation: glow .5s; }
@keyframes glow { 40% { filter: drop-shadow(0 0 22px #FFD43B) brightness(1.15); transform: scale(1.06); } }
.pip-jumper.jump { animation: jump .6s; }
@keyframes jump { 40% { transform: translate(-50%, -110%); } }
.name-boxes { position: absolute; transform: translate(-50%, -50%); display: flex; gap: 10px; }
.name-boxes span { width: 86px; height: 100px; border: 5px solid var(--line); border-radius: 18px; background: #fff; display: grid; place-items: center; font-size: 64px; font-weight: 900; color: #CED4DA; }
.name-boxes span.on { color: var(--ink); background: #D3F9D8; } .name-boxes span.next { border-color: #F5B400; background: #FFF9DB; color: #F5B400; }
.count-row { position: absolute; transform: translate(-50%, -50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 90%; }
.name-card { position: absolute; transform: translate(-50%, -50%); width: 440px; height: 130px; border: 6px solid var(--line); border-radius: 26px; display: flex; align-items: center; gap: 14px; padding: 0 20px; box-shadow: 0 8px 0 rgba(0,0,0,.15); }
.nc-name { font-size: 54px; font-weight: 900; }
.caret { display: inline-block; width: 5px; height: 56px; background: var(--ink); margin-left: 4px; animation: blink2 1s steps(2) infinite; vertical-align: -6px; }
@keyframes blink2 { 50% { opacity: 0; } }
.card-pick { position: absolute; left: 50%; top: 31%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; }
.pp-col { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line); }

.story-page { position: absolute; inset: 0 0 60px 0; display: flex; align-items: center; justify-content: center; gap: 40px; }
.next-btn { position: absolute; right: 24px; bottom: 24px; width: 100px; height: 100px; border-radius: 50%; border: 5px solid var(--line); background: #51CF66; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 0 #2F9E44; transform: none; }
.next-btn.pulse { animation: pulse3 1.4s infinite; }
@keyframes pulse3 { 50% { transform: scale(1.08); } }

/* result + coach time */
.result { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 30px; }
.result-stars { display: flex; gap: 20px; }
.result-stars span { color: #DDE2E8; animation: pop-in .5s backwards; animation-delay: var(--d); }
.result-stars span.on { color: #F5B400; filter: drop-shadow(0 4px 0 #B88A00); }
@keyframes pop-in { from { transform: scale(0) rotate(-40deg); } }
.result-btns { display: flex; gap: 26px; }
.big-btn { min-width: 120px; height: 100px; border-radius: 34px; border: 5px solid var(--line); background: #51CF66; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 28px; font-weight: 900; box-shadow: 0 7px 0 #2F9E44; text-decoration: none; padding: 0 22px; }
.big-btn.ghost { background: #fff; color: var(--line); box-shadow: 0 7px 0 #ADB5BD; }
.coach-time { display: grid; grid-template-columns: auto 1fr; gap: 6px 26px; align-items: center; padding: 30px 40px; height: 100%; align-content: center; }
.ct-badge { grid-row: span 2; width: 140px; height: 140px; border-radius: 50%; background: #D0BFFF; border: 5px solid var(--line); display: grid; place-items: center; }
.coach-time h2 { margin: 0; font-size: 46px; font-weight: 900; }
.ct-list { grid-column: span 2; background: var(--cream); border: 3px solid var(--line); border-radius: 20px; padding: 14px 20px; margin-top: 20px; font-size: 16px; user-select: text; }
.ct-list ol { margin: 6px 0; } .ct-list small { color: #5C6F7F; }

.center-card { max-width: 520px; margin: 10vh auto; text-align: center; background: #fff; border: 5px solid var(--line); border-radius: 34px; padding: 30px; font-size: 22px; font-weight: 800; }
.center-card h1 { margin: 0; font-size: 36px; }
.big-pip { width: 220px; height: 204px; }
@media (max-width: 800px) { .path { grid-template-columns: repeat(2, 1fr); } .path .stone { grid-column: auto !important; grid-row: auto !important; } .speech { font-size: 19px; } .kb-key { min-width: 32px; height: 36px; font-size: 16px; } .kb-key.space { min-width: 200px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.stage-bg { position: absolute; inset: 0; opacity: .45; pointer-events: none; }
.stage-bg svg { width: 100%; height: 100%; }
