/* Word Island — the look. Loaded after app.css and only restyles: layout and game rules live in app.css.
   One visual language everywhere: soft sky, white cards with a coloured lower edge, round chunky
   buttons, drawn icons instead of emoji. */

:root {
  --edge: #c7d2fe; --navy: #0c4a6e; --title: #075985;
  --shadow: 0 10px 24px rgba(12, 74, 110, .12);
}
html, body { background: #082f49; }
#app { background: linear-gradient(#7dd3fc 0%, #bae6fd 30%, #e0f2fe 62%, #fef9c3 100%); }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }

/* ---------- Sky ---------- */
#sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#sky .sun { position: absolute; top: -70px; right: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, #fef9c3 0 34%, rgba(254, 240, 138, .55) 35% 52%, rgba(254, 240, 138, 0) 70%); animation: sunPulse 6s ease-in-out infinite; }
#sky .cloud { position: absolute; left: 0; opacity: .85; filter: drop-shadow(0 6px 0 rgba(125, 211, 252, .35)); animation: drift linear infinite; }
#sky .c1 { top: 9%; animation-duration: 70s; animation-delay: -20s; }
#sky .c2 { top: 26%; opacity: .6; animation-duration: 95s; animation-delay: -60s; }
#sky .c3 { top: 47%; opacity: .5; animation-duration: 120s; animation-delay: -95s; }
@keyframes drift { from { transform: translateX(-160px); } to { transform: translateX(520px); } }
@keyframes sunPulse { 50% { transform: scale(1.08); } }
.screen { z-index: 1; }

/* ---------- Buttons ---------- */
.btn { border-radius: 20px; box-shadow: 0 5px 0 #cbd5e1, 0 10px 18px rgba(12, 74, 110, .10); letter-spacing: .2px; }
.btn.go { background: linear-gradient(#4ade80, #22c55e); box-shadow: 0 6px 0 var(--goD), 0 12px 20px rgba(21, 128, 61, .25); text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.btn.go:active { box-shadow: 0 2px 0 var(--goD); }
.btn.big { border-radius: 26px; padding: 16px 52px; }
.btn.unsure, .btn.unsure:active { box-shadow: none; }

/* ---------- Start screen ---------- */
#splash { justify-content: flex-start; padding-top: 9vh; gap: 12px; }
#splash > * { position: relative; z-index: 1; }
#splash .pip { width: 170px; }
#splash h1 { font-size: 52px; color: #fff; -webkit-text-stroke: 0; letter-spacing: .5px;
  text-shadow: 0 3px 0 var(--title), 0 -3px 0 var(--title), 3px 0 0 var(--title), -3px 0 0 var(--title), 2px 2px 0 var(--title), -2px -2px 0 var(--title), 2px -2px 0 var(--title), -2px 2px 0 var(--title), 0 8px 0 rgba(7, 89, 133, .35); }
#splash .tag { font: 700 18px var(--ui); color: var(--title); background: rgba(255, 255, 255, .7); padding: 4px 16px; border-radius: 20px; }
#nameInput { border: 0; box-shadow: 0 4px 0 #7dd3fc, var(--shadow); border-radius: 18px; margin-top: 8px; }
#nameInput:focus { box-shadow: 0 4px 0 var(--sea), var(--shadow); }
#splashArt { position: absolute !important; left: 0; right: 0; bottom: 0; height: 30%; z-index: 0 !important; pointer-events: none; }
#splashArt .island { width: 100%; height: 100%; display: block; }
.island .wave { animation: waves 5s ease-in-out infinite alternate; }
.island .w2 { animation-duration: 4s; animation-direction: alternate-reverse; }
.island .w3 { animation-duration: 3.2s; }
.island .palm { transform-origin: 318px 162px; animation: sway 5s ease-in-out infinite alternate; }
@keyframes waves { from { transform: translateX(0); } to { transform: translateX(-60px); } }
@keyframes sway { from { transform: rotate(-2deg); } to { transform: rotate(3deg); } }

/* ---------- Home: top bar and tabs ---------- */
.top { background: rgba(255, 255, 255, .78); backdrop-filter: blur(10px); padding: 10px 14px; box-shadow: 0 2px 0 rgba(255, 255, 255, .6), 0 6px 16px rgba(12, 74, 110, .08); z-index: 2; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 16px; padding: 4px 12px 4px 9px; box-shadow: 0 3px 0 var(--line); min-width: 58px; justify-content: center; }
.chip .ico { font-size: 20px; }
.hello { font-size: 21px; color: var(--title); }
.tabs { border-top: 0; box-shadow: 0 -6px 18px rgba(12, 74, 110, .10); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 4px; z-index: 2; }
.tabs button { border-radius: 16px; padding: 6px 0 4px; gap: 1px; font-size: 12px; transition: background .15s, color .15s; }
.tabs button span { font-size: 26px; line-height: 1; filter: none; opacity: 1; color: #94a3b8; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), color .15s; }
.tabs button.on { background: #e0f2fe; color: var(--title); }
.tabs button.on span { color: var(--sea); transform: scale(1.12) translateY(-1px); }

/* ---------- Map ---------- */
#tabBody.tab-map { padding-top: 16px; }
.banner { position: relative; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c)); border-radius: 24px; padding: 14px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 14px 22px rgba(12, 74, 110, .16); }
.banner::after { content: ''; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .14); pointer-events: none; }
.banner .wEmoji { font-size: 34px; width: 58px; height: 58px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .92); border-radius: 18px; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.banner .bText { flex: 1; min-width: 0; }
.banner h2 { font-size: 21px; text-shadow: 0 2px 0 rgba(0, 0, 0, .14); }
.banner p { font-size: 12.5px; }
.banner .bProg { height: 8px; border-radius: 8px; background: rgba(0, 0, 0, .18); margin-top: 7px; overflow: hidden; }
.banner .bProg i { display: block; height: 100%; border-radius: 8px; background: #fff; min-width: 0; transition: width .5s; }
.banner b { position: relative; z-index: 1; background: rgba(255, 255, 255, .28); border-radius: 12px; align-self: flex-start; }
.world.side .banner { border: 0; outline: 3px dashed rgba(255, 255, 255, .8); outline-offset: -7px; }

.path { position: relative; }
.trail { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.trail path { fill: none; stroke: rgba(12, 74, 110, .16); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 1 16; }
.trail path.open { stroke: color-mix(in srgb, var(--c) 78%, #fff); }
.node { z-index: 1; background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--c) 62%, #fff) 0 22%, var(--c) 60%);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 66%, #000), 0 14px 18px rgba(12, 74, 110, .22), inset 0 0 0 4px rgba(255, 255, 255, .35); }
.node:active { box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 66%, #000), inset 0 0 0 4px rgba(255, 255, 255, .35); }
.node .nIcon { font-size: 40px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .16)); display: grid; place-items: center; }
.node.locked { background: radial-gradient(circle at 34% 26%, #f1f5f9 0 22%, #cbd5e1 60%); box-shadow: 0 8px 0 #94a3b8, 0 14px 18px rgba(12, 74, 110, .14), inset 0 0 0 4px rgba(255, 255, 255, .5); }
.node.locked .nIcon { font-size: 30px; opacity: 1; color: #94a3b8; filter: none; }
.node.done { background: radial-gradient(circle at 34% 26%, #fef3c7 0 22%, #fbbf24 60%); box-shadow: 0 8px 0 #d97706, 0 14px 18px rgba(12, 74, 110, .22), inset 0 0 0 4px rgba(255, 255, 255, .45); }
.node.done .nIcon { font-size: 36px; filter: none; }
.node.skipped { background: radial-gradient(circle at 34% 26%, #d1fae5 0 22%, #6ee7b7 60%); box-shadow: 0 8px 0 #059669, 0 14px 18px rgba(12, 74, 110, .18), inset 0 0 0 4px rgba(255, 255, 255, .45); }
.node.skipped .nIcon { color: #047857; font-size: 36px; filter: none; }
.node.boss { border-radius: 30px; }
.node.current::before { inset: -10px; border: 5px solid #fff; opacity: .9; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 50%, transparent); }
.node .nStars { top: -18px; display: flex; gap: 1px; font-size: 17px; }
.node .nStars span { color: #cbd5e1; line-height: 0; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .15)); }
.node .nStars span.on { color: #fbbf24; }
.node .nStars span:nth-child(2) { transform: translateY(-5px); }
.node .nTitle { font: 700 12.5px/1.15 var(--ui); color: var(--title); background: rgba(255, 255, 255, .78); padding: 3px 9px; border-radius: 10px; width: auto; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; top: 90px; }
.node.boss .nTitle { top: 104px; }
.node.locked .nTitle { color: var(--soft); background: rgba(255, 255, 255, .5); }
.node .nPip { right: -58px; top: -30px; width: 64px; }
.path { gap: 48px; padding: 30px 0 22px; }
.world.side .path { gap: 46px; }
.practice { border-radius: 22px; background: linear-gradient(#fef3c7, #fde68a); box-shadow: 0 6px 0 #f59e0b, 0 12px 18px rgba(180, 83, 9, .18); color: #92400e; }

/* ---------- Lesson ---------- */
.lbar { padding: 12px 14px 8px; gap: 12px; }
#quitBtn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .8); color: #94a3b8; font-size: 22px; display: grid; place-items: center; box-shadow: 0 3px 0 rgba(12, 74, 110, .10); }
.prog { height: 20px; border-radius: 20px; background: rgba(255, 255, 255, .9); box-shadow: inset 0 3px 0 rgba(12, 74, 110, .10), 0 2px 0 rgba(255, 255, 255, .6); padding: 3px; overflow: visible; }
.prog i { min-width: 14px; height: 14px; border-radius: 14px; background: linear-gradient(#86efac, #22c55e); box-shadow: 0 2px 0 var(--goD); }
.prog i::after { left: 6px; right: 6px; top: 2px; height: 3px; }
#lessonTitle { display: none; }
.prompt { align-items: flex-end; gap: 6px; padding: 2px 14px 6px; min-height: 70px; }
#again { width: 64px; height: 70px; }
#again i { right: -2px; bottom: 2px; width: 24px; height: 24px; padding: 0; display: grid; place-items: center; font-size: 15px; color: var(--sea); box-shadow: 0 2px 0 #bae6fd; }
#promptText { position: relative; background: #fff; padding: 10px 16px 11px; border-radius: 20px; font-size: 19px; color: var(--title); box-shadow: 0 4px 0 rgba(12, 74, 110, .12); margin: 0 0 14px 8px; }
#promptText::before { content: ''; position: absolute; left: -9px; bottom: 12px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
#promptText:empty { display: none; }

.card { border-radius: 30px; box-shadow: 0 8px 0 rgba(12, 74, 110, .12), var(--shadow); }
.card h2 { color: var(--title); }
.bigPic { border-radius: 30px; box-shadow: 0 8px 0 rgba(12, 74, 110, .12), var(--shadow); }
.bigPic:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(12, 74, 110, .12); }
.speaker { background: linear-gradient(#fff, #f0f9ff); box-shadow: 0 8px 0 #7dd3fc, var(--shadow); }
.opt { border-radius: 22px; box-shadow: 0 6px 0 #cbd5e1, 0 10px 16px rgba(12, 74, 110, .08); }
.opt.picked { background: #e0f2fe; box-shadow: 0 6px 0 #38bdf8, 0 0 0 3px #38bdf8 inset; }
.opt.right { background: #dcfce7; box-shadow: 0 6px 0 #22c55e, 0 0 0 3px #22c55e inset; }
.opt.lit { box-shadow: 0 6px 0 #f59e0b, 0 0 0 3px #f59e0b inset; }
.opts.listen .opt i { opacity: .55; filter: grayscale(.3); }
.tile, .sbtn, .slot.full { box-shadow: 0 6px 0 #cbd5e1, 0 10px 14px rgba(12, 74, 110, .08); }
.sbtn { box-shadow: 0 6px 0 #fdba74, 0 10px 14px rgba(12, 74, 110, .08); }
.slot { background: rgba(255, 255, 255, .45); border-color: #7dd3fc; }
.gridPic, .busy, .wanted, .pad { box-shadow: 0 7px 0 rgba(12, 74, 110, .12), var(--shadow); }
.busy { background: linear-gradient(#f0f9ff, #fff); }
.storyAll .line, .chant button, .seqRow span { box-shadow: 0 4px 0 rgba(12, 74, 110, .10); }
.mic { background: linear-gradient(#38bdf8, #0ea5e9); box-shadow: 0 7px 0 #0369a1, 0 14px 20px rgba(3, 105, 161, .28); }
#foot { padding-top: 12px; }
#foot .go { min-width: 210px; font-size: 22px; padding: 14px 26px; border-radius: 22px; }
#foot .help { border-radius: 20px; }
#toast { font-size: 32px; padding: 10px 30px; background: linear-gradient(#4ade80, #22c55e); box-shadow: 0 6px 0 var(--goD), 0 16px 26px rgba(21, 128, 61, .3); text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.dots { color: var(--sea); }

/* ---------- Result ---------- */
#result { gap: 10px; }
#result h1 { color: #fff; font-size: 44px;
  text-shadow: 0 3px 0 var(--title), 0 -3px 0 var(--title), 3px 0 0 var(--title), -3px 0 0 var(--title), 2px 2px 0 var(--title), -2px -2px 0 var(--title), 2px -2px 0 var(--title), -2px 2px 0 var(--title), 0 7px 0 rgba(7, 89, 133, .35); }
#result .pip { width: 150px; }
.resStars { font-size: 74px; gap: 2px; align-items: flex-end; }
.resStars span { filter: grayscale(1) brightness(1.25); opacity: .45; line-height: 0; }
.resStars span.lit { filter: drop-shadow(0 5px 0 rgba(180, 83, 9, .35)); opacity: 1; }
.resStars span:nth-child(2) { font-size: 92px; transform: translateY(-12px); }
.newSticker { border-radius: 30px; border: 0; box-shadow: 0 7px 0 #f59e0b, 0 0 0 5px #fde68a inset, var(--shadow); }
#resNote { display: inline-flex; align-items: center; gap: 6px; font: 800 18px var(--ui); color: #9a3412; background: rgba(255, 255, 255, .8); padding: 5px 16px; border-radius: 20px; }
#resNote .ico { font-size: 22px; }
.confetti { width: 10px; height: 14px; border-radius: 3px; animation: fall2 2.8s cubic-bezier(.3, .2, .6, 1) forwards; }
.confetti.dot { width: 11px; height: 11px; border-radius: 50%; }
.confetti.bar { width: 6px; height: 18px; }
@keyframes fall2 { to { transform: translate(var(--sway, 0), 112vh) rotate(720deg); } }

/* ---------- Starting check intro ---------- */
#place h1 { color: var(--title); }
#place .tag { background: rgba(255, 255, 255, .75); padding: 12px 16px; border-radius: 20px; box-shadow: 0 4px 0 rgba(12, 74, 110, .08); }
#place #plSkip { box-shadow: none; background: none; }

/* ---------- Words, stickers, grown-ups ---------- */
.tabTitle { color: var(--title); font-size: 26px; text-shadow: 0 2px 0 rgba(255, 255, 255, .7); }
.tabSub { font: 800 15px var(--ui); color: var(--title); text-transform: uppercase; letter-spacing: .6px; opacity: .8; }
.tabNote { color: #475569; }
.wchip { border-radius: 16px; box-shadow: 0 4px 0 var(--line), 0 8px 12px rgba(12, 74, 110, .06); padding: 7px 14px 5px; }
.wchip.l5 { box-shadow: 0 4px 0 #fcd34d, 0 8px 12px rgba(12, 74, 110, .06); }
.wchip:active { transform: translateY(3px); }
.stickers { gap: 12px; }
.sticker { border-radius: 20px; border: 0; background: rgba(255, 255, 255, .5); box-shadow: inset 0 0 0 2px rgba(148, 163, 184, .55); font-size: 22px; opacity: .65; }
.sticker.got { border: 0; font-size: 32px; box-shadow: 0 5px 0 #fbbf24, 0 0 0 3px #fde68a inset, 0 10px 14px rgba(12, 74, 110, .08); }
.rows, .plan, .set { border-radius: 20px; box-shadow: 0 4px 0 rgba(12, 74, 110, .08); }
.gate { background: rgba(255, 255, 255, .8); border-radius: 28px; padding: 34px 16px; margin-top: 30px; box-shadow: 0 6px 0 rgba(12, 74, 110, .08); }
.gate input { border: 0; box-shadow: 0 4px 0 #7dd3fc; }
.empty { background: rgba(255, 255, 255, .7); border-radius: 24px; }

@media (max-height: 640px) {
  #splash { padding-top: 5vh; } #splash .pip { width: 130px; } #splash h1 { font-size: 42px; }
  .prompt { min-height: 60px; } #again { width: 54px; height: 60px; }
}

/* ---------- One star: play it again ---------- */
#result.low .pip.bounce .pipSvg .pAll { animation: pipBob 2.6s ease-in-out infinite; }
#result.low .pip.bounce .pipSvg .pWing { animation: none; }
/* not happy, just gently sorry: worried brows and a little head tilt */
#result.low .pipSvg .pHead { animation: none; transform: rotate(-7deg); }
#result.low .pipSvg .pBrow { opacity: 1; transform: rotate(-14deg); }
#result.low .pipSvg .pBrowR { transform: rotate(14deg); }
.resHint { margin: 0; font: 800 17px var(--ui); color: var(--title); background: #fff; padding: 8px 18px; border-radius: 18px; box-shadow: 0 4px 0 rgba(12, 74, 110, .10); }
#resMap { font-size: 16px; color: var(--soft); background: none; box-shadow: none; }
.node.retry { background: radial-gradient(circle at 34% 26%, #fff7ed 0 22%, #fdba74 60%); box-shadow: 0 8px 0 #ea580c, 0 14px 18px rgba(12, 74, 110, .22), inset 0 0 0 4px rgba(255, 255, 255, .45); }
.node.retry::after { content: ''; position: absolute; right: -8px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.5 12a6.5 6.5 0 1 1-2.1-4.8' fill='none' stroke='%23ea580c' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M17.5 3v5h-5' fill='none' stroke='%23ea580c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat; box-shadow: 0 3px 0 rgba(12, 74, 110, .18); }

/* ---------- Right / wrong: Pip reacts beside the question ---------- */
#toast { display: none; }
#again { z-index: 3; transform-origin: 40% 85%; }
body[data-pip="cheer"] #again { animation: pipGrow 1.1s cubic-bezier(.2, .9, .3, 1.2); }
body[data-pip="oops"] #again { animation: pipLean .9s ease-in-out; }
@keyframes pipGrow { 0%, 100% { transform: scale(1); } 18%, 78% { transform: scale(1.55) translate(4px, 4px); } }
@keyframes pipLean { 0%, 100% { transform: scale(1); } 25%, 75% { transform: scale(1.3) translate(3px, 3px); } }
body[data-pip="cheer"] #again i, body[data-pip="oops"] #again i { opacity: 0; }
#again i { transition: opacity .15s; }
body[data-pip="oops"] .pipSvg .pWingL { animation: pipShrugL .9s ease-in-out both; }
body[data-pip="oops"] .pipSvg .pWingR { animation: pipShrugR .9s ease-in-out both; }
@keyframes pipShrugL { 30%, 70% { transform: rotate(38deg); } }
@keyframes pipShrugR { 30%, 70% { transform: rotate(-38deg); } }
#again .spark { position: absolute; left: 50%; top: 45%; width: 16px; height: 16px; margin: -8px; font-size: 16px; line-height: 0; opacity: 0; pointer-events: none; animation: spark .9s ease-out .08s both; }
#again .s0 { --x: -34px; --y: -22px; } #again .s1 { --x: 36px; --y: -26px; } #again .s2 { --x: 40px; --y: 12px; } #again .s3 { --x: -6px; --y: -40px; } #again .s4 { --x: 22px; --y: -42px; }
@keyframes spark { 0% { opacity: 0; transform: translate(0, 0) scale(.2) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.1) rotate(160deg); } }
#promptText { transition: background .15s, color .15s; }
#promptText.fb { color: transparent; }
#promptText.fb::after { content: attr(data-fb); position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px; line-height: 1; white-space: nowrap; animation: bubblePop .3s cubic-bezier(.2, .9, .3, 1.4); }
.prompt { min-height: 96px; }
#promptText.fb.good { background: #22c55e; box-shadow: 0 4px 0 var(--goD); }
#promptText.fb.good::before { border-right-color: #22c55e; }
#promptText.fb.oops { background: #fb923c; box-shadow: 0 4px 0 #c2410c; }
#promptText.fb.oops::before { border-right-color: #fb923c; }
@keyframes bubblePop { from { transform: scale(.6); opacity: 0; } }

/* ---------- Stage select (the world map) and stage scenery ---------- */
#app { transition: background .4s; }
#scenery { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; opacity: 0; transition: opacity .5s; }
#scenery.on { opacity: .9; }
#scenery svg { width: 100%; height: 100%; display: block; }
#scenery .wave { animation: waves 5s ease-in-out infinite alternate; }
#scenery .w2 { animation-duration: 4s; animation-direction: alternate-reverse; }
#scenery .w3 { animation-duration: 3.2s; }

.path.stages { gap: 104px; padding: 26px 0 110px; }
.node.stg { width: 112px; height: 112px; border-radius: 36px; }
.node.stg .nIcon { font-size: 56px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .18)); }
.node.stg.locked .nIcon { font-size: 44px; }
.node.stg.side { border-radius: 50%; outline: 4px dashed rgba(255, 255, 255, .9); outline-offset: -11px; }
.node.stg.current::before { inset: -11px; }
.node.stg .nPip { right: -62px; top: -34px; width: 72px; }
.sLabel { position: absolute; top: 122px; left: 50%; transform: translateX(-50%); width: 168px; background: rgba(255, 255, 255, .92); border-radius: 16px; padding: 6px 10px 8px; box-shadow: 0 4px 0 rgba(12, 74, 110, .12); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sLabel b { font: 800 15px/1.1 var(--ui); color: var(--title); white-space: nowrap; }
.sScore { display: flex; align-items: center; gap: 4px; font: 800 15px/1 var(--ui); color: #b45309; }
.sScore .ico { font-size: 17px; }
.sScore small { font-size: 12px; color: var(--soft); font-weight: 700; margin-left: -3px; }
.sScore em { font: 700 10.5px var(--ui); font-style: normal; text-transform: uppercase; letter-spacing: .5px; color: #0f766e; background: #ccfbf1; padding: 2px 7px; border-radius: 8px; margin-left: 4px; }
.sLabel .bProg { width: 100%; height: 7px; border-radius: 7px; background: #e2e8f0; overflow: hidden; }
.sLabel .bProg i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.node.stg.locked .sLabel { background: rgba(255, 255, 255, .6); }
.node.stg.locked .sLabel b { color: var(--soft); }
.sBadge { position: absolute; right: -10px; top: -10px; width: 38px; height: 38px; border-radius: 50%; background: #22c55e; color: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: 0 3px 0 #15803d, 0 0 0 3px #fff; }
.sBadge.gold { background: #fbbf24; box-shadow: 0 3px 0 #b45309, 0 0 0 3px #fff; }
.backBtn { font-size: 16px; padding: 8px 16px 8px 12px; border-radius: 16px; margin-bottom: 12px; color: var(--title); }
.banner b { display: inline-flex; align-items: center; gap: 4px; }
.banner b .ico { font-size: 17px; }

/* ---------- Stage select: side by side, scrolls sideways ---------- */
#tabBody.tab-map { padding-left: 0; padding-right: 0; }
#tabBody.tab-map > :not(.stageRow) { margin-left: 14px; margin-right: 14px; }
.selTitle { text-align: center; font-size: 30px; color: #fff; margin: 4px 0 10px;
  text-shadow: 0 2px 0 var(--title), 0 -2px 0 var(--title), 2px 0 0 var(--title), -2px 0 0 var(--title), 2px 2px 0 var(--title), -2px -2px 0 var(--title), 2px -2px 0 var(--title), -2px 2px 0 var(--title), 0 5px 0 rgba(7, 89, 133, .3); }
.stageRow { overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 14px 0 6px; }
.stageRow::-webkit-scrollbar { display: none; }
.stTrack { position: relative; display: flex; gap: 18px; width: max-content; padding: 0 calc(50% - 98px); }
.stTile { flex: none; width: 196px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 0 4px; transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); transform: scale(.9); }
.stTile.sel { transform: scale(1); }
.stPic { position: relative; display: block; width: 100%; height: 150px; border-radius: 30px; background: #fff; padding: 7px;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 70%, #000), 0 14px 20px rgba(12, 74, 110, .2); }
.stTile.sel .stPic { box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 70%, #000), 0 0 0 5px var(--c), 0 16px 24px rgba(12, 74, 110, .26); }
.stArt { display: block; width: 100%; height: 100%; border-radius: 24px; overflow: hidden; position: relative; }
.stArt svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 78%; display: block; }
.stEmoji { position: absolute; left: 14px; top: 14px; width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, .94); display: grid; place-items: center; font-size: 27px; line-height: 1; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); }
.stTile.locked .stArt { filter: grayscale(1) brightness(1.08); opacity: .75; }
.stTile.locked .stEmoji { color: #94a3b8; font-size: 24px; }
.stTile.locked .stPic { box-shadow: 0 7px 0 #94a3b8, 0 14px 20px rgba(12, 74, 110, .12); }
.stTile.locked.sel .stPic { box-shadow: 0 7px 0 #94a3b8, 0 0 0 5px #cbd5e1, 0 16px 24px rgba(12, 74, 110, .16); }
.stPic .sBadge { right: -8px; top: -10px; }
.stName { font: 800 16px/1.1 var(--ui); color: var(--title); background: rgba(255, 255, 255, .88); padding: 4px 12px; border-radius: 12px; margin-top: 8px; white-space: nowrap; }
.stStars { display: inline-flex; align-items: center; gap: 3px; font: 800 14px/1 var(--ui); color: #b45309; }
.stStars .ico { font-size: 15px; }
.stStars small { font-size: 11px; color: var(--soft); margin-left: -2px; }
.runner { position: absolute; top: 62px; left: 0; width: 84px; margin-left: -42px; line-height: 0; pointer-events: none; z-index: 2; transition: left 0ms cubic-bezier(.45, 0, .55, 1); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
.runner.left .pipSvg { transform: scaleX(-1); }
/* Pip's run: she leans into it, her little feet scurry, her wings pump, her tail streams behind and
   puffs of dust pop up where she has been. At the far end she skids, bounces and waves. */
.runner { transition-timing-function: cubic-bezier(.5, 0, .25, 1); }
.runner.running .pipSvg .pAll { animation: pipScurry .2s linear infinite; }
.runner.running .pipSvg .pHead { animation: pipHeadBob .2s ease-in-out infinite; }
.runner.running .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .2s linear infinite; }
.runner.running .pipSvg .pFeet ellipse:nth-child(2) { animation-delay: -.1s; }
.runner.running .pipSvg .pWingL { animation: pipPumpL .2s ease-in-out infinite alternate; }
.runner.running .pipSvg .pWingR { animation: pipPumpR .2s ease-in-out infinite alternate-reverse; }
.runner.running .pipSvg .pTail { animation: pipStream .2s ease-in-out infinite alternate; }
.runner.running .pipSvg .pShadow { animation: none; transform: scaleX(.8); }
.runner.running .pipSvg .pEye { animation: none; }
@keyframes pipScurry { 0%, 100% { transform: translateY(0) rotate(13deg) scale(1.04, .96); } 50% { transform: translateY(-6px) rotate(16deg) scale(.98, 1.03); } }
@keyframes pipHeadBob { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(-2deg) translateY(1px); } }
@keyframes pipFoot { 0% { transform: translate(-7px, 0); } 25% { transform: translate(0, -7px) rotate(-20deg); } 50% { transform: translate(8px, -2px); } 100% { transform: translate(-7px, 0); } }
@keyframes pipPumpL { from { transform: rotate(8deg); } to { transform: rotate(52deg); } }
@keyframes pipPumpR { from { transform: rotate(-8deg); } to { transform: rotate(-52deg); } }
@keyframes pipStream { from { transform: rotate(-22deg); } to { transform: rotate(-34deg); } }

.dust { position: absolute; left: 4%; bottom: 2%; width: 15%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .9); opacity: 0; pointer-events: none; }
.runner.left .dust { left: auto; right: 4%; }
.runner.running .dust { animation: pipDust .45s ease-out infinite; }
.runner.running .dust.d2 { animation-delay: .15s; width: 11%; }
.runner.running .dust.d3 { animation-delay: .3s; width: 13%; }
@keyframes pipDust { 0% { opacity: .9; transform: translate(0, 0) scale(.4); } 100% { opacity: 0; transform: translate(-160%, -90%) scale(1.5); } }
.runner.left.running .dust { animation-name: pipDustL; }
@keyframes pipDustL { 0% { opacity: .9; transform: translate(0, 0) scale(.4); } 100% { opacity: 0; transform: translate(160%, -90%) scale(1.5); } }

.runner.arrive .pipSvg .pAll { animation: pipLand .8s cubic-bezier(.3, 1.3, .5, 1) both; }
.runner.arrive .pipSvg .pWingR { animation: pipWave .16s ease-in-out 4 alternate .3s; }
.runner.arrive .pipSvg .pHead { animation: pipCute .8s ease-in-out both; }
@keyframes pipLand { 0% { transform: rotate(-10deg) scale(1.12, .84); } 22% { transform: rotate(4deg) translateY(-14px) scale(.94, 1.08); } 44% { transform: rotate(0) translateY(0) scale(1.07, .92); } 62% { transform: translateY(-5px) scale(.98, 1.03); } 100% { transform: none; } }
@keyframes pipCute { 0%, 100% { transform: rotate(0); } 45%, 80% { transform: rotate(9deg); } }

.stInfo { background: #fff; border-radius: 26px; padding: 14px 14px 16px; margin-top: 10px; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 45%, #cbd5e1), var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.stInfo.pop { animation: rise .3s cubic-bezier(.2, .9, .3, 1.2); }
.siHead { display: flex; gap: 12px; align-items: center; }
.siHead .wEmoji { flex: none; width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; background: color-mix(in srgb, var(--c) 22%, #fff); }
.siHead h2 { font-size: 22px; color: color-mix(in srgb, var(--c) 70%, #0c4a6e); }
.siHead p { margin: 3px 0 0; font-size: 14px; line-height: 1.3; color: #475569; }
.siStats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.siStats span { background: #f1f5f9; border-radius: 16px; padding: 8px 4px 7px; text-align: center; font: 700 11.5px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--soft); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.siStats b { font: 800 20px/1.1 var(--ui); color: var(--ink); display: inline-flex; align-items: center; gap: 3px; letter-spacing: 0; }
.siStats b small { font-size: 13px; color: var(--soft); margin-left: -2px; }
.siStats b .ico { font-size: 20px; }
.siStatus b { color: color-mix(in srgb, var(--c) 80%, #0c4a6e); }
.siStatus.locked b { color: #94a3b8; }
.stInfo .bProg { height: 9px; border-radius: 9px; background: #e2e8f0; overflow: hidden; }
.stInfo .bProg i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.stInfo .btn.go { align-self: center; min-width: 200px; font-size: 22px; }
.siNote { margin: 0; text-align: center; font: 700 15px var(--ui); color: var(--soft); }
.tab-map .practice { width: auto; display: block; margin-top: 16px; }
.tab-map .backBtn { margin-left: 14px; }

/* ---------- Stage select always fits the screen: no up-and-down scroll ---------- */
#tabBody.sel { display: flex; flex-direction: column; overflow: hidden; padding-top: clamp(6px, 1.6vh, 16px); padding-bottom: clamp(8px, 1.6vh, 14px); --th: clamp(78px, 18vh, 150px); }
.sel .selTitle { flex: none; font-size: clamp(21px, 3.8vh, 30px); margin: 0 0 clamp(2px, 1vh, 10px); }
.sel .stageRow { flex: none; padding: clamp(8px, 1.6vh, 14px) 0 4px; }
.sel .stTrack { padding: 0 calc(50% - var(--th) * .66); gap: clamp(10px, 2vh, 18px); }
.sel .stTile { width: calc(var(--th) * 1.32); }
.sel .stPic { height: var(--th); border-radius: calc(var(--th) * .2); padding: clamp(4px, .8vh, 7px); }
.sel .stArt { border-radius: calc(var(--th) * .16); }
.sel .stEmoji { left: 10%; top: 12%; width: calc(var(--th) * .3); height: calc(var(--th) * .3); font-size: calc(var(--th) * .18); border-radius: 28%; }
.sel .stTile.locked .stEmoji { font-size: calc(var(--th) * .16); }
.sel .stName { font-size: clamp(13px, 2vh, 16px); margin-top: clamp(4px, 1vh, 8px); }
.sel .stStars { font-size: clamp(12px, 1.8vh, 14px); }
.sel .runner { width: calc(var(--th) * .58); margin-left: calc(var(--th) * -.29); top: calc(var(--th) * .4); }
.sel .stInfo { flex: 0 1 auto; min-height: 0; overflow: hidden; margin-top: clamp(4px, 1.2vh, 10px); padding: clamp(8px, 1.6vh, 14px) 14px clamp(10px, 1.8vh, 16px); gap: clamp(5px, 1.2vh, 10px); }
.sel .siHead { flex: 0 1 auto; min-height: 40px; overflow: hidden; }
.sel .siHead .wEmoji { width: clamp(40px, 6.4vh, 54px); height: clamp(40px, 6.4vh, 54px); font-size: clamp(22px, 3.6vh, 30px); border-radius: 32%; }
.sel .siHead h2 { font-size: clamp(18px, 2.8vh, 22px); }
.sel .siHead p { font-size: clamp(12.5px, 1.8vh, 14px); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sel .siStats, .sel .stInfo .bProg, .sel .stInfo .btn.go, .sel .siNote { flex: none; }
.sel .siStats span { padding: clamp(4px, .9vh, 8px) 4px clamp(4px, .8vh, 7px); font-size: clamp(10px, 1.4vh, 11.5px); }
.sel .siStats b { font-size: clamp(16px, 2.5vh, 20px); }
.sel .stInfo .btn.go { font-size: clamp(18px, 2.7vh, 22px); padding: clamp(8px, 1.5vh, 12px) 22px; }
.sel .practice { flex: none; margin-top: clamp(6px, 1.4vh, 16px); margin-bottom: 0; font-size: clamp(15px, 2.2vh, 20px); padding: clamp(6px, 1.2vh, 12px) 22px; }
@media (max-height: 700px) { .sel .stInfo .bProg { display: none; } .sel .siHead p { -webkit-line-clamp: 2; } }
@media (max-height: 580px) { .sel .stStars { display: none; } .sel .siHead p { -webkit-line-clamp: 1; } }
/* A phone on its side: stages on the left, the chosen stage's details on the right. */
@media (max-height: 460px) and (min-width: 520px) {
  #tabBody.sel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 4px; --th: clamp(70px, 30vh, 120px); }
  .sel .selTitle { grid-column: 1; grid-row: 1; }
  .sel .stageRow { grid-column: 1; grid-row: 2 / 4; align-self: center; }
  .sel .stInfo { grid-column: 2; grid-row: 1 / 3; align-self: center; margin-top: 0; }
  .sel .practice { grid-column: 2; grid-row: 3; }
  .sel .siHead p { -webkit-line-clamp: 2; }
  .sel .stInfo .bProg { display: none; }
}
/* Breathing room on the stage select when the screen has height to spare. */
.sel .stInfo { margin-top: clamp(6px, 2.6vh, 24px); padding: clamp(9px, 2.4vh, 20px) clamp(12px, 4vw, 20px) clamp(11px, 2.8vh, 22px); gap: clamp(6px, 2vh, 16px); }
.sel .siHead { gap: 14px; }
.sel .siStats { gap: 10px; }
.sel .siStats span { padding: clamp(5px, 1.5vh, 12px) 4px clamp(5px, 1.4vh, 11px); gap: 4px; }
.sel .practice { margin-top: clamp(8px, 3.4vh, 30px); }
.sel .siNote { padding: clamp(0px, .8vh, 6px) 0; }
@media (max-height: 680px) {
  .sel .stInfo { margin-top: 5px; padding: 8px 12px 10px; gap: 5px; }
  .sel .siStats span { padding: 4px 4px; gap: 1px; }
  .sel .practice { margin-top: 6px; }
  .sel .siNote { padding: 0; font-size: 13.5px; }
}

/* ---------- Pop-up on opening: Pip offers the daily review ---------- */
.ask { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(8, 47, 73, .45); animation: askIn .25s ease-out; }
.askCard { position: relative; width: 100%; max-width: 340px; background: #fff; border-radius: 32px; padding: 64px 22px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 8px 0 #fcd34d, 0 24px 40px rgba(8, 47, 73, .35); animation: askPop .4s cubic-bezier(.2, .9, .3, 1.3); }
.askPip { position: absolute; top: -70px; left: 50%; width: 124px; margin-left: -62px; line-height: 0; }
.askPip .pipSvg .pWingR { animation: pipWave .5s ease-in-out infinite alternate; }
@keyframes pipWave { from { transform: rotate(-30deg); } to { transform: rotate(-95deg); } }
.askCard h2 { font-size: 28px; color: var(--title); }
.askCard p { margin: 0; font-size: 16px; color: #475569; line-height: 1.35; }
.askCard .askOf { font: 800 15px/1.4 var(--ui); color: #92400e; background: #fef3c7; padding: 8px 14px; border-radius: 16px; }
.askCard .btn.go { margin-top: 8px; min-width: 220px; font-size: 22px; padding: 14px 22px; }
.askCard .askNo { font-size: 16px; color: var(--soft); background: none; box-shadow: none; padding: 6px 12px; }
@keyframes askIn { from { opacity: 0; } }
@keyframes askPop { from { transform: scale(.7) translateY(30px); opacity: 0; } }

/* The stage row can be dragged sideways with a finger, a mouse or a pen. */
.stageRow { touch-action: pan-x; cursor: grab; overscroll-behavior-x: contain; user-select: none; -webkit-user-select: none; }
.stageRow.dragging { cursor: grabbing; scroll-snap-type: none; }
.stageRow.dragging .stTile { pointer-events: none; }
.stageRow img, .stageRow svg { -webkit-user-drag: none; }

/* ---------- Stage play: Pip jumps into the picture and plays there, differently in every stage ----------
   .rIn does the jump in and out (the same for every stage, aimed with --lx / --ly / --ls: where she lands
   and how small she gets). .rAct does what she gets up to once she is in. Timing: 6s in all; she lands at
   1.2s and leaves at 5.1s, so each stage's play is 3.9s long and starts at 1.25s. */
.rIn, .rAct { display: block; position: relative; transform-origin: 50% 85%; }
.props { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.props .p { opacity: 0; }
.runner.act:not(.act-bonk) .rIn { animation: jumpIn 6s both; }
@keyframes jumpIn {
  0% { transform: none; animation-timing-function: ease-in-out; }
  4% { transform: scale(1.12, .84); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  12% { transform: translate(calc(var(--lx) * .45), -64%) scale(.8); animation-timing-function: cubic-bezier(.6, 0, .9, .6); }
  20% { transform: translate(var(--lx), var(--ly)) scale(calc(var(--ls) * 1.14), calc(var(--ls) * .84)); animation-timing-function: ease-out; }
  24% { transform: translate(var(--lx), var(--ly)) scale(var(--ls)); }
  85% { transform: translate(var(--lx), var(--ly)) scale(var(--ls)); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  92% { transform: translate(calc(var(--lx) * .45), -64%) scale(.8); animation-timing-function: cubic-bezier(.6, 0, .9, .6); }
  97% { transform: scale(1.12, .86); animation-timing-function: ease-out; }
  100% { transform: none; }
}
.runner.act:not(.act-bonk) .pipSvg .pAll, .runner.act:not(.act-bonk) .pipSvg .pHead { animation: none; }
.runner.act:not(.act-bonk) .pipSvg .pShadow { animation: propOff 6s both; }
.runner.act .p { transform-box: fill-box; }
@keyframes propOn { 0%, 19% { opacity: 0; } 23%, 84% { opacity: 1; } 88%, 100% { opacity: 0; } }
@keyframes propOff { 0%, 8% { opacity: 1; } 14%, 92% { opacity: 0; } 100% { opacity: 1; } }
/* shared little moves */
@keyframes fxRise { 0% { opacity: .9; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(var(--sx, 30%), -260%) scale(1.2); } }
@keyframes fxSpark { 0% { opacity: 1; transform: translate(0, 0) scale(.4) rotate(0); } 100% { opacity: 0; transform: translate(var(--sx, 120%), var(--sy, -160%)) scale(1.3) rotate(160deg); } }
@keyframes footTap { from { transform: rotate(0); } to { transform: rotate(-28deg) translateY(-3px); } }
@keyframes eyeScan { 0%, 100% { transform: translateX(-2.5px); } 50% { transform: translateX(2.5px); } }
@keyframes chug { from { translate: 0 0; } to { translate: 0 -3%; } }
@keyframes breathe { from { scale: 1 1; } to { scale: 1.03 .97; } }
.runner.act .dust { opacity: 0; }
.runner.act .dust.d2 { --sx: -40%; } .runner.act .dust.d3 { --sx: 70%; }

/* 1 Rhyme Reef: snorkelling. She tips forward, kicks across the reef and back, blowing bubbles. */
.runner.act-reef .rIn { --lx: -58%; --ly: -12%; --ls: .48; }
.runner.act-reef .rAct { animation: playReef 3.9s ease-in-out 1.25s both; transform-origin: 50% 55%; }
@keyframes playReef { 0% { transform: none; } 8% { transform: translate(0, 0) rotate(48deg); } 27% { transform: translate(112%, -34%) rotate(40deg); } 46% { transform: translate(225%, -10%) rotate(52deg); } 50% { transform: translate(225%, -10%) scaleX(-1) rotate(52deg); } 69% { transform: translate(112%, -34%) scaleX(-1) rotate(40deg); } 90% { transform: translate(0, 0) scaleX(-1) rotate(48deg); } 100% { transform: none; } }
.runner.act-reef .p-snorkel { animation: propOn 6s both; }
.runner.act-reef .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .3s linear 1.25s 13; }
.runner.act-reef .pipSvg .pFeet ellipse:nth-child(2) { animation-delay: 1.4s; }
.runner.act-reef .pipSvg .pWingL { animation: pipPumpL .45s ease-in-out 1.25s 8 alternate; }
.runner.act-reef .pipSvg .pWingR { animation: pipPumpR .45s ease-in-out 1.25s 8 alternate-reverse; }
.runner.act-reef .dust { left: 76%; bottom: 88%; width: 9%; background: rgba(255, 255, 255, .85); animation: fxRise .9s ease-out 1.5s 4; }
.runner.act-reef .dust.d2 { animation-delay: 1.8s; width: 6%; } .runner.act-reef .dust.d3 { animation-delay: 2.1s; width: 7%; }

/* 2 Eagle Eye Lookout: she hops up to the peak, pulls out a telescope and scans the horizon. */
.runner.act-lookout .rIn { --lx: -98%; --ly: 4%; --ls: .44; }
.runner.act-lookout .rAct { animation: playLookout 3.9s ease-in-out 1.25s both; }
@keyframes playLookout { 0% { transform: none; } 9% { transform: translate(36%, -56%); } 13% { transform: translate(38%, -42%); } 21% { transform: translate(74%, -96%); } 25% { transform: translate(76%, -84%); } 34% { transform: translate(112%, -118%); }
  44% { transform: translate(112%, -118%) rotate(-8deg); } 56% { transform: translate(112%, -118%) rotate(4deg); } 60% { transform: translate(112%, -118%) scaleX(-1) rotate(4deg); } 72% { transform: translate(112%, -118%) scaleX(-1) rotate(-8deg); } 80% { transform: translate(112%, -118%) scaleX(-1); } 84% { transform: translate(112%, -118%); } 88% { transform: translate(112%, -118%); } 100% { transform: none; } }
.runner.act-lookout .p-scope { animation: scopeOn 6s both; }
@keyframes scopeOn { 0%, 40% { opacity: 0; transform: scale(.3); } 44%, 80% { opacity: 1; transform: none; } 84%, 100% { opacity: 0; } }
.runner.act-lookout .p-scope { transform-origin: 0 100%; }
.runner.act-lookout .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .26s linear 1.25s 6; }

/* 3 Sound Beach: sunglasses on, lying back in the sand, tapping one foot. */
.runner.act-beach .rIn { --lx: 6%; --ly: -18%; --ls: .56; }
.runner.act-beach .rAct { animation: playBeach 3.9s ease-in-out 1.25s both, breathe 1s ease-in-out 1.9s 3 alternate; transform-origin: 50% 92%; }
@keyframes playBeach { 0% { transform: none; } 12% { transform: rotate(-76deg) translate(-8%, 6%); } 88% { transform: rotate(-76deg) translate(-8%, 6%); } 100% { transform: none; } }
.runner.act-beach .p-shades { animation: shadesOn 6s both; transform-origin: 50% 0; }
@keyframes shadesOn { 0%, 19% { opacity: 0; transform: translateY(-40px); } 26%, 84% { opacity: 1; transform: none; } 88%, 100% { opacity: 0; } }
.runner.act-beach .pipSvg .pFeet ellipse:nth-child(2) { transform-box: fill-box; transform-origin: 0 50%; animation: footTap .35s ease-in-out 1.9s 8 alternate; }
.runner.act-beach .pipSvg .pWingR { animation: beachArm 6s both; }
@keyframes beachArm { 0%, 24% { transform: none; } 30%, 82% { transform: rotate(-150deg); } 88%, 100% { transform: none; } }

/* 4 ABC Lighthouse: a sailor in a little boat, rocking over the waves and back. */
.runner.act-lighthouse .rIn { --lx: -78%; --ly: -1%; --ls: .46; }
.runner.act-lighthouse .rAct { animation: playBoat 3.9s ease-in-out 1.25s both; }
@keyframes playBoat { 0% { transform: none; } 12% { transform: translate(22%, -5%) rotate(-9deg); } 25% { transform: translate(60%, 3%) rotate(9deg); } 37% { transform: translate(98%, -5%) rotate(-9deg); } 50% { transform: translate(130%, 3%) rotate(9deg); }
  62% { transform: translate(98%, -5%) rotate(-9deg); } 75% { transform: translate(60%, 3%) rotate(9deg); } 88% { transform: translate(22%, -5%) rotate(-9deg); } 100% { transform: none; } }
.runner.act-lighthouse .p-sailor { animation: propOn 6s both; }
.runner.act-lighthouse .pipSvg .pWingR { animation: pipWave .3s ease-in-out 2.6s 6 alternate; }

/* 5 Word Family Village: the postie. She scurries to each house in turn and hops to drop a letter. */
.runner.act-village .rIn { --lx: -98%; --ly: 2%; --ls: .46; }
.runner.act-village .rAct { animation: playPost 3.9s ease-in-out 1.25s both; }
@keyframes playPost { 0% { transform: none; } 12% { transform: translate(56%, 0); } 16% { transform: translate(56%, -30%); } 20% { transform: translate(56%, 0); } 38% { transform: translate(200%, 0); } 42% { transform: translate(200%, -30%); } 46% { transform: translate(200%, 0); }
  64% { transform: translate(344%, 0); } 68% { transform: translate(344%, -30%); } 72% { transform: translate(344%, 0); } 76% { transform: translate(344%, 0) scaleX(-1); } 96% { transform: translate(0, 0) scaleX(-1); } 100% { transform: none; } }
.runner.act-village .p-letter { animation: propOn 6s both; }
.runner.act-village .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .24s linear 1.25s 16; }
.runner.act-village .pipSvg .pFeet ellipse:nth-child(2) { animation-delay: 1.37s; }

/* 6 Sight Word Forest: glasses on, book open. She settles down to read, eyes moving along the lines. */
.runner.act-forest .rIn { --lx: 0%; --ly: -4%; --ls: .6; }
.runner.act-forest .rAct { animation: playRead 3.9s ease-in-out 1.25s both; }
@keyframes playRead { 0% { transform: none; } 10% { transform: translateY(5%) scale(1.06, .92); } 16% { transform: translateY(3%); } 36% { transform: translateY(3%) rotate(-4deg); } 56% { transform: translateY(3%) rotate(4deg); } 76% { transform: translateY(3%) rotate(-3deg); } 90% { transform: translateY(3%); } 100% { transform: none; } }
.runner.act-forest .p-read { animation: propOn 6s both; }
.runner.act-forest .p-read .page { transform-box: fill-box; transform-origin: 0 50%; animation: pageFlip .5s ease-in-out 2.8s 2; }
@keyframes pageFlip { 50% { transform: scaleX(.1); } }
.runner.act-forest .pipSvg .pEye { animation: eyeScan 1.1s ease-in-out 1.5s 3; }

/* 7 Sentence Station: conductor's cap on, riding a little red wagon down the line and back, puffing steam. */
.runner.act-station .rIn { --lx: -92%; --ly: 2%; --ls: .44; }
.runner.act-station .rAct { animation: playTrain 3.9s ease-in-out 1.25s both, chug .16s ease-in-out 1.25s 24 alternate; }
@keyframes playTrain { 0% { transform: none; } 45% { transform: translate(430%, 0); } 50% { transform: translate(430%, 0) scaleX(-1); } 94% { transform: translate(0, 0) scaleX(-1); } 100% { transform: none; } }
.runner.act-station .p-train { animation: propOn 6s both; }
.runner.act-station .dust { left: 44%; bottom: 96%; width: 14%; background: rgba(255, 255, 255, .9); animation: fxRise .7s ease-out 1.4s 5; }
.runner.act-station .dust.d2 { animation-delay: 1.65s; } .runner.act-station .dust.d3 { animation-delay: 1.9s; }

/* 8 Story Mountain: she climbs to the summit, plants a flag and jumps for joy. */
.runner.act-mountain .rIn { --lx: -56%; --ly: 5%; --ls: .44; }
.runner.act-mountain .rAct { animation: playSummit 3.9s ease-in-out 1.25s both; }
@keyframes playSummit { 0% { transform: none; } 9% { transform: translate(40%, -68%); } 13% { transform: translate(42%, -54%); } 22% { transform: translate(82%, -116%); } 26% { transform: translate(84%, -102%); } 36% { transform: translate(124%, -150%); }
  50% { transform: translate(124%, -150%); } 58% { transform: translate(124%, -176%); } 66% { transform: translate(124%, -150%); } 74% { transform: translate(124%, -176%); } 82% { transform: translate(124%, -150%); } 88% { transform: translate(124%, -150%); } 100% { transform: none; } }
.runner.act-mountain .p-flag { animation: flagOn 6s both; transform-origin: 50% 100%; }
@keyframes flagOn { 0%, 43% { opacity: 0; transform: translateY(-30px); } 48%, 80% { opacity: 1; transform: none; } 84%, 100% { opacity: 0; } }
.runner.act-mountain .p-flag .cloth { transform-box: fill-box; transform-origin: 0 50%; animation: flagWave .3s ease-in-out 2.8s 8 alternate; }
@keyframes flagWave { from { transform: scaleX(1) skewY(-6deg); } to { transform: scaleX(.8) skewY(8deg); } }
.runner.act-mountain .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .26s linear 1.25s 6; }
.runner.act-mountain .pipSvg .pWingL { animation: pipFlapL .13s ease-in-out 3.2s 10 alternate; }
.runner.act-mountain .pipSvg .pWingR { animation: pipFlapR .13s ease-in-out 3.2s 10 alternate; }

/* 9 Explorer Jungle: she grabs a vine and swings to and fro. */
.runner.act-jungle .rIn { --lx: 0%; --ly: -4%; --ls: .48; }
.runner.act-jungle .rAct { animation: playSwing 3.9s cubic-bezier(.45, 0, .55, 1) 1.25s both; transform-origin: 50% -180%; }
@keyframes playSwing { 0% { transform: none; } 14% { transform: rotate(40deg); } 34% { transform: rotate(-40deg); } 54% { transform: rotate(38deg); } 74% { transform: rotate(-34deg); } 90% { transform: rotate(12deg); } 100% { transform: none; } }
.runner.act-jungle .p-vine { animation: propOn 6s both; }
.runner.act-jungle .pipSvg .pWingR { animation: vineArm 6s both; }
@keyframes vineArm { 0%, 18% { transform: none; } 23%, 85% { transform: rotate(-155deg); } 90%, 100% { transform: none; } }
.runner.act-jungle .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: footTap .4s ease-in-out 1.4s 9 alternate; }

/* 10 Hop Frog Swamp: a lily pad for a hat, and frog-hops from pad to pad and back. */
.runner.act-swamp .rIn { --lx: -62%; --ly: 0%; --ls: .42; }
.runner.act-swamp .rAct { animation: playFrog 3.9s ease-in-out 1.25s both; }
@keyframes playFrog { 0% { transform: none; } 5% { transform: scale(1.16, .8); } 14% { transform: translate(107%, -95%) scale(.94, 1.1); } 23% { transform: translate(214%, 0) scale(1.16, .8); } 28% { transform: translate(214%, 0) scale(1.16, .8); }
  37% { transform: translate(276%, -85%) scale(.94, 1.1); } 46% { transform: translate(338%, 0) scale(1.16, .8); } 50% { transform: translate(338%, 0) scale(-1.16, .8); } 54% { transform: translate(338%, 0) scale(-1.16, .8); } 63% { transform: translate(276%, -85%) scale(-.94, 1.1); }
  72% { transform: translate(214%, 0) scale(-1.16, .8); } 77% { transform: translate(214%, 0) scale(-1.16, .8); } 86% { transform: translate(107%, -95%) scale(-.94, 1.1); } 95% { transform: translate(0, 0) scale(-1.16, .8); } 100% { transform: none; } }
.runner.act-swamp .p-lily { animation: propOn 6s both; }

/* 11 Red Hen Hill: a hen's comb on her head. She pecks along the grass, squats, and out pops an egg. */
.runner.act-hill .rIn { --lx: -64%; --ly: -9%; --ls: .48; }
.runner.act-hill .rAct { animation: playHen 3.9s ease-in-out 1.25s both; }
@keyframes playHen { 0% { transform: none; } 10% { transform: translate(34%, 0); } 14% { transform: translate(34%, 0) rotate(40deg); } 18% { transform: translate(34%, 0); } 22% { transform: translate(34%, 0) rotate(40deg); } 26% { transform: translate(34%, 0); }
  40% { transform: translate(120%, 0); } 44% { transform: translate(120%, 0) rotate(40deg); } 48% { transform: translate(120%, 0); } 52% { transform: translate(120%, 0) rotate(40deg); } 56% { transform: translate(120%, 0); }
  68% { transform: translate(120%, 0) scale(1.14, .82); } 74% { transform: translate(120%, -36%) scale(.95, 1.08); } 80% { transform: translate(120%, 0); } 84% { transform: translate(120%, 0); } 87% { transform: translate(120%, 0) scaleX(-1); } 97% { transform: translate(0, 0) scaleX(-1); } 100% { transform: none; } }
.runner.act-hill .p-hen { animation: propOn 6s both; }
.runner.act-hill .p-hen .egg { transform-box: fill-box; transform-origin: 50% 100%; animation: eggOn 6s both; }
@keyframes eggOn { 0%, 67% { opacity: 0; transform: scale(0); } 71% { opacity: 1; transform: scale(1.25); } 75%, 100% { opacity: 1; transform: none; } }
.runner.act-hill .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .3s linear 1.25s 8; }

/* 12 Blend Cave: miner's helmet, lamp beam sweeping the dark. She tiptoes in, spots a gem and jumps. */
.runner.act-cave .rIn { --lx: -72%; --ly: 3%; --ls: .46; }
.runner.act-cave .rAct { animation: playMiner 3.9s ease-in-out 1.25s both; }
@keyframes playMiner { 0% { transform: none; } 36% { transform: translate(150%, 0); } 42% { transform: translate(150%, 0); } 46% { transform: translate(150%, 0) scaleX(-1); } 54% { transform: translate(150%, 0) scaleX(-1); } 58% { transform: translate(150%, 0); } 64% { transform: translate(150%, 0) scale(1.12, .84); } 71% { transform: translate(150%, -46%); } 78% { transform: translate(150%, 0); } 82% { transform: translate(150%, 0); } 85% { transform: translate(150%, 0) scaleX(-1); } 97% { transform: translate(0, 0) scaleX(-1); } 100% { transform: none; } }
.runner.act-cave .p-miner { animation: propOn 6s both; }
.runner.act-cave .p-miner .beam { animation: beam .5s ease-in-out 1.3s 7 alternate; }
@keyframes beam { from { opacity: .55; } to { opacity: 1; } }
.runner.act-cave .pipSvg .pFeet ellipse { transform-box: fill-box; transform-origin: center; animation: pipFoot .4s linear 1.25s 4; }
.runner.act-cave .dust { left: 96%; bottom: 40%; width: 12%; background: #67e8f9; border-radius: 25%; animation: fxSpark .7s ease-out 3.8s 2; }
.runner.act-cave .dust.d2 { --sx: -90%; --sy: -190%; background: #f0abfc; animation-delay: 3.95s; } .runner.act-cave .dust.d3 { --sx: 30%; --sy: -230%; background: #fde047; animation-delay: 4.1s; }

/* 13 Magic E Castle: a crown, a deep bow, a twirl and a royal wave. */
.runner.act-castle .rIn { --lx: 0%; --ly: -5%; --ls: .56; }
.runner.act-castle .rAct { animation: playRoyal 3.9s ease-in-out 1.25s both; }
@keyframes playRoyal { 0% { transform: none; } 12% { transform: rotate(22deg) scale(1, .94); } 22% { transform: none; } 36% { transform: scaleX(-1); } 50% { transform: scaleX(1); } 62% { transform: translateY(-26%); } 70% { transform: none; } 78% { transform: translateY(-18%); } 86% { transform: none; } 100% { transform: none; } }
.runner.act-castle .p-crown { animation: crownOn 6s both; transform-origin: 50% 100%; }
@keyframes crownOn { 0%, 19% { opacity: 0; transform: translateY(-36px); } 25% { opacity: 1; transform: translateY(2px); } 28%, 84% { opacity: 1; transform: none; } 88%, 100% { opacity: 0; } }
.runner.act-castle .pipSvg .pWingR { animation: pipWave .28s ease-in-out 3.4s 6 alternate; }
.runner.act-castle .dust { left: 44%; bottom: 96%; width: 11%; background: #fde047; border-radius: 25%; animation: fxSpark .8s ease-out 1.6s 3; }
.runner.act-castle .dust.d2 { --sx: -130%; --sy: -150%; animation-delay: 1.85s; } .runner.act-castle .dust.d3 { --sx: 0%; --sy: -220%; animation-delay: 2.1s; }

/* ---------- The stage picture comes alive while Pip plays in it ---------- */
.stTile.alive .aSway, .stTile.alive .aHop, .stTile.alive .aTwinkle, .stTile.alive .aRise, .stTile.alive .aBob, .stTile.alive .aSnow { transform-box: fill-box; }
.stArt::before { content: ''; position: absolute; top: 12%; left: -40%; width: 34%; height: 16%; border-radius: 50%; background: rgba(255, 255, 255, .8); box-shadow: 14px -6px 0 2px rgba(255, 255, 255, .8); opacity: 0; }
.stTile.alive .stArt::before { animation: aCloud 4.2s linear .5s both; }
.stTile.alive .stArt { animation: aGlow 6s ease-in-out both; }
.stTile.alive .wave { animation: waves 1.1s ease-in-out .6s 4 alternate; }
.stTile.alive .wave.w2 { animation-duration: .9s; animation-direction: alternate-reverse; }
.stTile.alive .aSway { transform-origin: 50% 100%; animation: aSway .7s ease-in-out .6s 6 alternate; }
.stTile.alive .aLeaf { animation: aLeaf .8s ease-in-out .6s 5 alternate; }
.stTile.alive .aHop { transform-origin: 50% 100%; animation: aHop .5s ease-in-out .7s 8 alternate; }
.stTile.alive .aHop:nth-of-type(2n) { animation-delay: .95s; }
.stTile.alive .aTwinkle { transform-origin: 50% 100%; animation: aTwinkle .45s ease-in-out .6s 9 alternate; }
.stTile.alive .aTwinkle:nth-of-type(2n) { animation-delay: .82s; }
.stTile.alive .aRise { animation: aRise 1.3s ease-in .6s 3; }
.stTile.alive .aBob { animation: aBob .8s ease-in-out .6s 5 alternate; }
.stTile.alive .aBlink { animation: aBlink .5s steps(2, jump-none) .6s 8; }
.stTile.alive .aSnow { transform-origin: 50% 0; animation: aTwinkle .5s ease-in-out .8s 8 alternate; }
@keyframes aCloud { 0% { opacity: 0; transform: translateX(0); } 12%, 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(460%); } }
@keyframes aGlow { 15%, 85% { filter: brightness(1.08) saturate(1.15); } }
@keyframes aSway { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
@keyframes aLeaf { from { translate: 0 0; } to { translate: 0 -7px; } }
@keyframes aHop { from { transform: translateY(0) scale(1, 1); } to { transform: translateY(-7px) scale(.97, 1.06); } }
@keyframes aTwinkle { from { transform: scale(1); filter: brightness(1); } to { transform: scale(1.14); filter: brightness(1.35); } }
@keyframes aRise { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-60px); opacity: 0; } }
@keyframes aBob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes aBlink { from { fill: #fde047; } to { fill: #fff; } }

/* ---------- A locked stage: she bonks against it, falls over, gets up and dusts herself off ---------- */
.runner.act-bonk .rIn { animation: actBonk 4.4s cubic-bezier(.4, 0, .4, 1) both; transform-origin: 50% 85%; }
@keyframes actBonk {
  0% { transform: none; } 4% { transform: scale(1.1, .86); } 9% { transform: translate(0, -50%) scale(.95); }
  11% { transform: translate(0, -54%) scale(1.14, .78); } 14% { transform: translate(-6%, -40%) rotate(-25deg); }
  22% { transform: translate(-22%, 4%) rotate(-96deg); } 25% { transform: translate(-22%, -4%) rotate(-92deg); } 28% { transform: translate(-22%, 4%) rotate(-96deg); }
  54% { transform: translate(-22%, 4%) rotate(-96deg); } 60% { transform: translate(-16%, 0) rotate(-60deg); } 66% { transform: translate(-4%, -6%) rotate(8deg); }
  70% { transform: none; } 74% { transform: translateX(-5%) rotate(-5deg); } 78% { transform: translateX(5%) rotate(5deg); }
  82% { transform: translateX(-5%) rotate(-5deg); } 86% { transform: translateX(5%) rotate(5deg); } 91% { transform: scale(1.04, .96); } 100% { transform: none; }
}
/* the generic "playing" body moves do not apply to a bonk */
.runner.act-bonk .pipSvg .pAll, .runner.act-bonk .pipSvg .pFeet ellipse { animation: none; }
.runner.act-bonk .pipSvg .pShadow { opacity: 1; }
.runner.act-bonk .pipSvg .pWingL { animation: pipPumpL .16s ease-in-out 3.1s 7 alternate; }
.runner.act-bonk .pipSvg .pWingR { animation: pipPumpR .16s ease-in-out 3.1s 7 alternate-reverse; }
.runner.act-bonk .pipSvg .pBrow { animation: bonkBrow 4.4s both; }
.runner.act-bonk .pipSvg .pEye { animation: bonkEye 4.4s both; }
@keyframes bonkBrow { 0%, 10% { opacity: 0; } 12%, 68% { opacity: 1; transform: rotate(-14deg); } 72%, 100% { opacity: 0; } }
@keyframes bonkEye { 0%, 10% { transform: scaleY(1); } 13%, 54% { transform: scaleY(.12); } 60%, 100% { transform: scaleY(1); } }
/* dizzy stars circle her head while she is down, then dust flies as she brushes herself off */
.runner.act-bonk .dust { left: 44%; bottom: 62%; width: 13%; background: #fde047; border-radius: 30%; animation: bonkFx 4.4s linear both; }
.runner.act-bonk .dust.d2 { animation-name: bonkFx2; animation-delay: 0s; }
.runner.act-bonk .dust.d3 { animation-name: bonkFx3; animation-delay: 0s; }
@keyframes bonkFx { 0%, 24% { opacity: 0; } 27% { opacity: 1; transform: translate(-150%, 0) rotate(0); } 36% { transform: translate(0, -90%) rotate(120deg); } 45% { transform: translate(150%, 0) rotate(240deg); } 54% { opacity: 1; transform: translate(0, 60%) rotate(360deg); } 57%, 71% { opacity: 0; transform: translate(-200%, 330%) scale(.5); background: #fff; border-radius: 50%; } 73% { opacity: .9; } 90%, 100% { opacity: 0; transform: translate(-460%, 250%) scale(1.5); background: #fff; border-radius: 50%; } }
@keyframes bonkFx2 { 0%, 24% { opacity: 0; } 27% { opacity: 1; transform: translate(150%, 0) rotate(0); } 36% { transform: translate(0, 60%) rotate(120deg); } 45% { transform: translate(-150%, 0) rotate(240deg); } 54% { opacity: 1; transform: translate(0, -90%) rotate(360deg); } 57%, 75% { opacity: 0; transform: translate(200%, 330%) scale(.5); background: #fff; border-radius: 50%; } 77% { opacity: .9; } 94%, 100% { opacity: 0; transform: translate(460%, 250%) scale(1.5); background: #fff; border-radius: 50%; } }
@keyframes bonkFx3 { 0%, 24% { opacity: 0; } 27% { opacity: 1; transform: translate(0, -90%) rotate(0); } 36% { transform: translate(150%, 0) rotate(120deg); } 45% { transform: translate(0, 60%) rotate(240deg); } 54% { opacity: 1; transform: translate(-150%, 0) rotate(360deg); } 57%, 79% { opacity: 0; transform: translate(0, 330%) scale(.5); background: #fff; border-radius: 50%; } 81% { opacity: .9; } 97%, 100% { opacity: 0; transform: translate(0, 180%) scale(1.6); background: #fff; border-radius: 50%; } }
/* the locked picture and its padlock shudder when she hits them */
.stTile.bonk .stPic { animation: bonkShake .45s ease-out .46s; }
.stTile.bonk .stEmoji { animation: bonkLock .6s ease-out .46s; }
@keyframes bonkShake { 20% { transform: translate(-4px, 2px) rotate(-1.5deg); } 45% { transform: translate(4px, -1px) rotate(1.5deg); } 70% { transform: translate(-2px, 0); } }
@keyframes bonkLock { 20% { transform: rotate(-18deg) scale(1.2); } 45% { transform: rotate(16deg) scale(1.2); } 70% { transform: rotate(-8deg); } }

/* ---------- Two views of Pip: front, and side (facing the way she is going) ---------- */
.runner .pipSide { position: absolute; left: 0; top: 0; visibility: hidden; }
.runner.running .pipSide { visibility: visible; }
.runner.running .pipSvg:not(.pipSide) { visibility: hidden; }
/* in a play she lands facing us, turns side-on to set off, and faces us again to jump out */
@keyframes viewSide { 0%, 22% { visibility: hidden; } 23%, 85% { visibility: visible; } 86%, 100% { visibility: hidden; } }
@keyframes viewFront { 0%, 22% { visibility: visible; } 23%, 85% { visibility: hidden; } 86%, 100% { visibility: visible; } }
.runner.act-reef .pipSide, .runner.act-lookout .pipSide, .runner.act-village .pipSide, .runner.act-station .pipSide,
.runner.act-swamp .pipSide, .runner.act-hill .pipSide, .runner.act-cave .pipSide { animation: viewSide 6s both; }
.runner.act-reef .pipSvg:not(.pipSide), .runner.act-lookout .pipSvg:not(.pipSide), .runner.act-village .pipSvg:not(.pipSide), .runner.act-station .pipSvg:not(.pipSide),
.runner.act-swamp .pipSvg:not(.pipSide), .runner.act-hill .pipSvg:not(.pipSide), .runner.act-cave .pipSvg:not(.pipSide) { animation: viewFront 6s both; }
/* Story Mountain: side-on for the climb, then she turns to us at the top to plant the flag */
@keyframes viewSideClimb { 0%, 22% { visibility: hidden; } 23%, 44% { visibility: visible; } 45%, 100% { visibility: hidden; } }
@keyframes viewFrontClimb { 0%, 22% { visibility: visible; } 23%, 44% { visibility: hidden; } 45%, 100% { visibility: visible; } }
.runner.act-mountain .pipSide { animation: viewSideClimb 6s both; }
.runner.act-mountain .pipSvg:not(.pipSide) { animation: viewFrontClimb 6s both; }

/* ---------- Inside a stage: a header that stays put while the levels scroll ---------- */
#tabBody.tab-map > .stageHead { position: sticky; top: -16px; z-index: 6; margin: -16px 0 6px; padding: 12px 14px 8px; display: flex; align-items: center; gap: 10px;
  transition: background .2s, box-shadow .2s; }
.stageHead .backBtn { margin: 0; flex: none; }
.stageHead.stuck { background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 16px rgba(12, 74, 110, .14); }
.stageHead.stuck .backBtn { box-shadow: 0 3px 0 #cbd5e1; }
.shName { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding-right: 4px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none; }
.stageHead.stuck .shName { opacity: 1; transform: none; }
.shName b { font: 800 clamp(17px, 5.2vw, 21px)/1.1 var(--ui); color: color-mix(in srgb, var(--c) 70%, #0c4a6e); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------- Inside a stage: an illustrated map (ground, road, scenery) with coin-shaped levels ---------- */
#tabBody.tab-map > .world { margin-left: 0; margin-right: 0; margin-bottom: 0; }
.world > .banner { margin: 0 14px; position: relative; z-index: 2; }
.path.map { gap: 62px; padding: 74px 0 120px; margin-top: -26px; overflow: hidden; }
.mapArt { position: absolute; left: 0; top: 0; pointer-events: none; display: block; }
.path.map .node { width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, #fff7d6 0 18%, #fcd34d 46%, #f59e0b 100%);
  box-shadow: 0 7px 0 #b45309, 0 12px 14px rgba(0, 0, 0, .28), inset 0 0 0 4px rgba(255, 255, 255, .55), inset 0 -6px 0 rgba(180, 83, 9, .25); }
.path.map .node .nIcon { font: 800 30px/1 var(--ui); color: #fff; text-shadow: 0 2px 0 #b45309, 0 -1px 0 #b45309, 1px 0 0 #b45309, -1px 0 0 #b45309; filter: none; padding-bottom: 6px; }
.path.map .node .nIcon .ico { font-size: 34px; filter: drop-shadow(0 2px 0 #b45309); }
/* not played yet: a plain cream coin; played: gold; the one to play next: blue and glowing */
.path.map .node:not(.done):not(.current):not(.locked):not(.skipped) { background: radial-gradient(circle at 34% 24%, #fff 0 18%, #fef3c7 46%, #fde68a 100%); box-shadow: 0 7px 0 #d97706, 0 12px 14px rgba(0, 0, 0, .24), inset 0 0 0 4px rgba(255, 255, 255, .7); }
.path.map .node:not(.done):not(.current):not(.locked):not(.skipped) .nIcon { color: #b45309; text-shadow: none; }
.path.map .node.current { background: radial-gradient(circle at 34% 24%, #f0f9ff 0 18%, #7dd3fc 46%, #0ea5e9 100%); box-shadow: 0 7px 0 #0369a1, 0 12px 16px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .6), 0 0 0 7px rgba(255, 255, 255, .55); }
.path.map .node.current .nIcon { text-shadow: 0 2px 0 #0369a1, 0 -1px 0 #0369a1, 1px 0 0 #0369a1, -1px 0 0 #0369a1; }
.path.map .node.current::before { display: none; }
.path.map .node.locked { background: radial-gradient(circle at 34% 24%, #f8fafc 0 18%, #cbd5e1 46%, #94a3b8 100%); box-shadow: 0 7px 0 #64748b, 0 12px 14px rgba(0, 0, 0, .22), inset 0 0 0 4px rgba(255, 255, 255, .5); }
.path.map .node.locked .nIcon { color: #64748b; text-shadow: none; font-size: 26px; padding-bottom: 2px; }
.path.map .node.locked .nIcon .ico { font-size: 28px; filter: none; }
.path.map .node.skipped { background: radial-gradient(circle at 34% 24%, #ecfdf5 0 18%, #6ee7b7 46%, #10b981 100%); box-shadow: 0 7px 0 #047857, 0 12px 14px rgba(0, 0, 0, .24), inset 0 0 0 4px rgba(255, 255, 255, .55); }
.path.map .node.skipped .nIcon { color: #fff; }
.path.map .node.retry { background: radial-gradient(circle at 34% 24%, #fff7ed 0 18%, #fdba74 46%, #f97316 100%); box-shadow: 0 7px 0 #c2410c, 0 12px 14px rgba(0, 0, 0, .26), inset 0 0 0 4px rgba(255, 255, 255, .55); }
.path.map .node.boss { width: 88px; height: 88px; border-radius: 28px; }
.path.map .node.boss .nIcon .ico { font-size: 44px; }
/* stars sit on the coin's lower edge, as on a board-game map */
.path.map .node .nStars { top: auto; bottom: -15px; font-size: 22px; gap: 0; }
.path.map .node .nStars span { color: #e2e8f0; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .28)); }
.path.map .node .nStars span.on { color: #fde047; }
.path.map .node .nStars span:nth-child(2) { transform: translateY(5px) scale(1.15); }
.path.map .node .nTitle { top: 92px; background: rgba(255, 255, 255, .92); color: var(--title); box-shadow: 0 3px 0 rgba(0, 0, 0, .14); font-size: 12px; padding: 3px 10px; }
.path.map .node.boss .nTitle { top: 106px; }
.path.map .node.locked .nTitle { background: rgba(255, 255, 255, .78); color: #475569; }
.path.map .node .nPip { right: -60px; top: -34px; width: 66px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .18)); }

#tabBody.tab-map:not(.sel) { padding-bottom: 0; }
.path.map .node.retry::after { right: -10px; top: -8px; bottom: auto; }

/* the road ends at the stage's destination: at the bottom for stages that run down to it, at the top for climbs */
.path.map.down { padding: 74px 0 120px; }
.path.map.up { flex-direction: column-reverse; padding: 300px 0 96px; }
.path.map .node.goal { box-shadow: 0 7px 0 #b45309, 0 12px 16px rgba(0, 0, 0, .34), inset 0 0 0 4px rgba(255, 255, 255, .6), 0 0 0 6px rgba(255, 255, 255, .7), 0 0 22px 10px rgba(253, 224, 71, .55); }
.path.map .node.goal.locked { box-shadow: 0 7px 0 #64748b, 0 12px 16px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .5), 0 0 0 6px rgba(255, 255, 255, .6); }

/* a stage that climbs starts at the bottom, so its banner sits at the bottom too */
.world.climbs .path.map { margin-top: 0; margin-bottom: -26px; padding-bottom: 122px; }
.world.climbs > .banner { margin-bottom: 14px; }

/* ---------- The stage map is alive: gentle, slow, looping motion ---------- */
.mapArt .mv, .mapArt [class^="mv-"] { transform-box: fill-box; transform-origin: 50% 100%; }
.mapArt .mv-sway { animation: mvSway 3.4s ease-in-out infinite alternate; }
.mapArt .mv-glint { animation: mvGlint 2.2s ease-in-out infinite alternate; }
.mapArt .mv-rise { animation: mvRise 4.5s ease-in infinite; }
.mapArt .mv-cloud { animation: mvCloud 11s ease-in-out infinite alternate; }
.mapArt .mv-flag { transform-origin: 0 50%; animation: mvFlag .7s ease-in-out infinite alternate; }
.mapArt .mv-fish { animation: mvFish 5s ease-in-out infinite alternate; }
.mapArt .mv-fish.back { animation-name: mvFishBack; animation-duration: 6.5s; }
.mapArt .mv-twinkle { transform-origin: 50% 50%; animation: mvTwinkle 1.6s ease-in-out infinite alternate; }
.mapArt .mv-twinkle:nth-of-type(2n) { animation-delay: -.8s; }
.mapArt .mv-beam { animation: mvBeam 2.2s ease-in-out infinite alternate; }
.mapArt .mv-smoke { transform-origin: 50% 50%; animation: mvSmoke 2.6s ease-out infinite; }
.mapArt .mv-smoke.s2 { animation-delay: -.85s; } .mapArt .mv-smoke.s3 { animation-delay: -1.7s; }
.mapArt .mv-flame { animation: mvFlame .32s ease-in-out infinite alternate; }
.mapArt .mv-sun { transform-origin: 50% 50%; animation: mvSun 3.5s ease-in-out infinite alternate; }
.mapArt .mv-peck { transform-origin: 30% 100%; animation: mvPeck 4.2s ease-in-out infinite; }
@keyframes mvSway { from { transform: rotate(-2.6deg); } to { transform: rotate(2.6deg); } }
@keyframes mvGlint { from { opacity: .72; } to { opacity: 1; filter: brightness(1.25); } }
@keyframes mvRise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
@keyframes mvCloud { from { transform: translateX(-10px); } to { transform: translateX(16px); } }
@keyframes mvFlag { from { transform: scaleX(1) skewY(-4deg); } to { transform: scaleX(.8) skewY(6deg); } }
@keyframes mvFish { from { transform: translate(-22px, 0); } 50% { transform: translate(0, -5px); } to { transform: translate(22px, 0); } }
@keyframes mvFishBack { from { transform: translate(20px, 0); } 50% { transform: translate(0, 5px); } to { transform: translate(-20px, 0); } }
@keyframes mvTwinkle { from { transform: scale(.55); opacity: .5; } to { transform: scale(1.15); opacity: 1; } }
@keyframes mvBeam { from { opacity: .5; } to { opacity: 1; } }
@keyframes mvSmoke { 0% { transform: translateY(8px) scale(.6); opacity: 0; } 25% { opacity: .9; } 100% { transform: translateY(-18px) scale(1.25); opacity: 0; } }
@keyframes mvFlame { from { transform: scale(.92, .9); } to { transform: scale(1.06, 1.22); } }
@keyframes mvSun { from { transform: scale(1); opacity: .3; } to { transform: scale(1.22); opacity: .5; } }
@keyframes mvPeck { 0%, 58%, 100% { transform: rotate(0); } 66% { transform: rotate(13deg); } 74% { transform: rotate(0); } 82% { transform: rotate(13deg); } 90% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .mapArt .mv, .mapArt [class^="mv-"] { animation: none; } }

/* ---------- Pip on the level to play, and the "ready?" pop-up ---------- */
.path.map .node .nPip { z-index: 3; animation: nPipBob 1.1s ease-in-out infinite alternate; }
.path.map .node.pipL .nPip { right: auto; left: -60px; }
.path.map .node .nPip::after { content: ''; position: absolute; left: 14%; right: 14%; bottom: -4px; height: 9px; border-radius: 50%; background: rgba(0, 0, 0, .2); z-index: -1; }
@keyframes nPipBob { from { transform: translateY(0); } to { transform: translateY(-9px); } }
.ask.ready .askCard { animation: rise .3s cubic-bezier(.2, .9, .3, 1.2); }
.rdLevel { font: 800 13px/1 var(--ui); letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--c, #0ea5e9); padding: 6px 12px; border-radius: 12px; }
.rdStars { display: flex; gap: 4px; font-size: 40px; line-height: 1; }
.rdStars span { color: #e2e8f0; } .rdStars span.on { color: #fbbf24; filter: drop-shadow(0 2px 0 #d97706); }
.rdStars span:nth-child(2) { transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .path.map .node .nPip { animation: none; } }

/* ---------- The level to play glows with a slow pulse; Pip waits on the ground beside it (nothing bounces) ---------- */
.path.map .node.current { z-index: 4; animation: nodeGlow 2.4s ease-in-out infinite alternate; }
.path.map .node.current .nIcon { animation: none; }
.path.map .node .nPip { top: auto; bottom: -12px; right: -50px; left: auto; width: 60px; z-index: 3; filter: none; transform-origin: 50% 100%; animation: nPipIdle 3.2s ease-in-out infinite alternate; }
.path.map .node.pipL .nPip { right: auto; left: -50px; }
.path.map .node .nPip::after { display: block; left: 12%; right: 12%; bottom: -3px; height: 10px; background: rgba(0, 0, 0, .22); }
@keyframes nPipIdle { from { transform: scale(1, 1); } to { transform: scale(1.02, .97); } }
@keyframes nodeGlow {
  from { box-shadow: 0 7px 0 #0369a1, 0 12px 16px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .6), 0 0 0 5px rgba(255, 255, 255, .7), 0 0 0 0 rgba(125, 211, 252, 0); }
  to { box-shadow: 0 7px 0 #0369a1, 0 12px 16px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .6), 0 0 0 9px rgba(255, 255, 255, .45), 0 0 22px 12px rgba(125, 211, 252, .6); }
}
@media (prefers-reduced-motion: reduce) { .path.map .node.current, .path.map .node .nPip { animation: none; } }

/* A tapped level does not sink (that dragged Pip down with it): only its number dips, and the pop-up
   takes over from there. */
.path.map .node:active { margin-top: 0; margin-bottom: 0; }
.path.map .node:active .nIcon { transform: translateY(2px) scale(.94); }
.askCard .rdCount { font: 700 14px/1 var(--ui); color: var(--soft); margin-top: -4px; }

/* Pip running along a stage's road to a tapped level (reuses the stage-select runner's running look) */
.path.map { position: relative; }
.path.map .mapRun { top: 0; left: 0; margin: 0; transition: none; z-index: 6; }
.path.map .nPip.arrive { animation: none; }
.path.map .nPip.arrive .pipSvg .pAll { animation: pipLand .8s cubic-bezier(.3, 1.3, .5, 1) both; }
.path.map .nPip.arrive .pipSvg .pWingR { animation: pipWave .16s ease-in-out 4 alternate .3s; }

/* ---------- Small phones: nothing cut off ---------- */
/* long level names (sight-word lists) wrap onto two lines instead of ending in "…", and stay on screen */
.path.map .node .nTitle { white-space: normal; text-align: center; width: max-content; max-width: min(150px, 40vw); line-height: 1.2; }
/* the "Not now / Not yet" buttons are big enough for a small finger */
.askCard .askNo { min-height: 44px; padding: 10px 18px; }
/* the result screen fits short screens: smaller Pip and title, and it can scroll rather than cut the button off */
#result { overflow-y: auto; justify-content: safe center; }
#result .pip { width: clamp(84px, 19vh, 150px); flex: none; }
#result h1 { font-size: clamp(32px, 6.4vh, 44px); }
@media (max-height: 620px) { #result { gap: 6px; padding-top: 12px; padding-bottom: 12px; } }
/* the footer buttons stay on one row on narrow phones (wrapping them doubled the footer's height) */
#foot { flex-wrap: nowrap; }
#foot .go { min-width: min(210px, calc(100vw - 130px)); }
@media (max-width: 359px) { #foot { gap: 10px; padding-left: 10px; padding-right: 10px; } #foot .go { font-size: 20px; padding: 12px 18px; } }
/* short screens: the question bubble and the cards take less height */
@media (max-height: 640px) {
  .prompt { min-height: 64px; }
  #foot { min-height: 72px; padding-top: 8px; }
  .ask { overflow-y: auto; align-items: safe center; padding-top: 70px; }
  .askCard { padding: 50px 18px 16px; gap: 7px; }
  .askPip { width: 100px; margin-left: -50px; top: -58px; }
  .askCard h2 { font-size: 24px; }
  .rdStars { font-size: 30px; }
  .askCard .btn.go { padding: 11px 20px; font-size: 20px; margin-top: 4px; }
}

/* Video lessons (Pip explains an idea before the games) */
.card.vidCard { position: relative; padding: 8px; width: auto; max-width: none; line-height: 0; }
.vidCard video { display: block; height: min(60vh, 60dvh, 118vw); aspect-ratio: 9 / 16; width: auto; border-radius: 22px; background: #fde68a; object-fit: cover; }
.vidCard .vidPlay { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 92px; height: 92px; border-radius: 50%;
  font-size: 40px; line-height: 1; padding: 0 0 0 6px; background: rgba(255,255,255,.92); color: #0c4a6e; box-shadow: 0 6px 0 rgba(12,74,110,.18), var(--shadow); }
.vidCard .vidPlay[hidden] { display: none; }
#foot .go.pulse { animation: pulse 1.3s ease-in-out infinite; }
#foot .back { font-size: 16px; padding: 10px 14px; white-space: nowrap; }
@media (max-width: 420px) { #foot .back { font-size: 26px; padding: 8px 12px; } #foot .back .lbl { display: none; } }
/* Picture names in the listening games: the matching part (first sound or rhyming ending) lit up */
.picName { display: block; margin-top: 4px; font: 700 22px/1.1 var(--read); color: #64748b; letter-spacing: .01em; }
.picName b { color: #f8635f; font-weight: 700; }
.bigPic .picName { font-size: 28px; margin-top: 2px; }
/* the letters that matter grow while their word is being said: as bigger text, so the word makes room
   for them (a scale would spread over the letters next to them). The line height is fixed so nothing jumps. */
.picName { line-height: 30px; height: 30px; white-space: nowrap; }
.bigPic .picName { line-height: 36px; height: 36px; }
.picName b { font-size: 1em; transition: font-size .22s cubic-bezier(.3, 1.6, .5, 1); }
.saying .picName b, .opt.lit .picName b { font-size: 1.4em; }
.picName.long { font-size: 17px; }
.bigPic .picName.long { font-size: 23px; }

/* Intro cards: letters light up and grow while Pip says them (.saying is set from the speech parts). */
.famList button { font: 700 26px/36px var(--read); height: 42px; background: #f1f5f9; color: inherit; border: 0; padding: 2px 12px 4px; border-radius: 12px; white-space: nowrap;
  transition: background .2s, box-shadow .2s; cursor: pointer; }
.famList button b, .card .keyWord b { color: #f8635f; font-weight: 700; transition: font-size .22s cubic-bezier(.3, 1.6, .5, 1); }
.famList button.saying { background: #fff1e6; box-shadow: 0 0 0 3px #fdba74; }
.famList button.saying b, .card .keyWord.saying b { font-size: 1.35em; }
.rime i, .rime b { transition: transform .22s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s; }
.rime i.saying, .rime b.saying { transform: scale(1.18); box-shadow: 0 0 0 4px #fdba74; }
.card .letters, .card .word { transition: transform .22s cubic-bezier(.3, 1.6, .5, 1), color .2s; }
.card .letters.saying, .card .word.saying { transform: scale(1.15); color: #f8635f; }
.card .cap b { transition: font-size .22s cubic-bezier(.3, 1.6, .5, 1); }
.card .cap.saying b { font-size: 1.3em; color: #f8635f; }

/* A tag over a question: a harder bonus one for a quick learner, or one from an earlier level. */
.qTag { align-self: center; font: 800 15px var(--ui, inherit); color: #0f766e; background: #ccfbf1; border-radius: 999px; padding: 4px 14px; margin-bottom: -4px; }
.qTag.hard { color: #9a3412; background: #ffedd5; box-shadow: 0 0 0 2px #fdba74; animation: qTagPop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes qTagPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Sticker book: tap a sticker to see when and where it was won. */
button.sticker { cursor: pointer; font-family: inherit; color: inherit; padding: 0; }
button.sticker:active { transform: scale(.94); }
.stickerAsk .bigSticker { font-size: 84px; line-height: 1; margin: 4px auto 8px; animation: qTagPop .45s cubic-bezier(.3, 1.6, .5, 1); }
.stickerAsk .bigSticker.locked { filter: grayscale(1); opacity: .5; }

/* ---------- Beating a stage's final level ---------- */
.resBoss:empty { display: none; }
.resBoss { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 6px; }
.bossBadge { position: relative; width: 132px; height: 132px; display: grid; place-items: center; animation: bossIn .7s cubic-bezier(.3, 1.6, .5, 1) both; }
.bossBadge .bbRays { position: absolute; inset: -34px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(251, 191, 36, .55) 0 12deg, transparent 12deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%); mask: radial-gradient(circle, #000 35%, transparent 70%); animation: bbSpin 6s linear infinite; }
.bossBadge .bbEmoji { position: relative; width: 116px; height: 116px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 64px;
  box-shadow: 0 0 0 6px #fbbf24, 0 8px 0 6px #b45309, 0 18px 26px rgba(12, 74, 110, .25); }
.bossBadge .bbTrophy { position: absolute; right: -8px; bottom: -6px; width: 48px; height: 48px; border-radius: 50%; background: #fbbf24; color: #fff; display: grid; place-items: center; font-size: 26px;
  box-shadow: 0 3px 0 #b45309, 0 0 0 3px #fff; animation: bossIn .6s .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.bossName { font: 800 22px var(--ui); color: #0c4a6e; margin-top: 10px; }
.bossSub { font: 800 15px var(--ui); color: #b45309; background: #fef3c7; border-radius: 999px; padding: 3px 14px; animation: bossIn .5s .7s cubic-bezier(.3, 1.6, .5, 1) both; }
#result.boss .resStars { transform: scale(1.08); }
@keyframes bossIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes bbSpin { to { transform: rotate(360deg); } }

/* Stage select hand-over: the beaten stage glows, its badge pops on; the next stage's lock shakes off. */
.stTile.celebrate .stPic { animation: stCheer 1.2s .3s ease-in-out 2; }
.stTile.celebrate .stStars { animation: stCount 1.3s .5s ease-out; }
.sBadge.popIn { animation: bossIn .6s cubic-bezier(.3, 1.6, .5, 1); }
.stTile.unlocking .stEmoji { animation: lockShake .9s ease-in-out forwards; }
.stTile.opened .stPic { animation: stOpen .8s cubic-bezier(.3, 1.6, .5, 1); }
.stTile.opened .stPic::after { content: ''; position: absolute; inset: -18px; border-radius: 30px; pointer-events: none;
  background: radial-gradient(circle, rgba(253, 230, 138, .9), rgba(253, 230, 138, 0) 70%); animation: stGlow 1.1s ease-out forwards; }
@keyframes stCheer { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06) rotate(-1.5deg); } }
@keyframes stCount { 0% { transform: scale(1); } 15% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes lockShake { 0% { transform: rotate(0); } 15% { transform: rotate(-16deg); } 30% { transform: rotate(14deg); } 45% { transform: rotate(-12deg); } 60% { transform: rotate(8deg) scale(1.1); }
  80% { transform: translateY(-30px) scale(1.4) rotate(20deg); opacity: .8; } 100% { transform: translateY(-70px) scale(.2) rotate(40deg); opacity: 0; } }
@keyframes stOpen { 0% { transform: scale(.92); filter: grayscale(1); } 60% { transform: scale(1.08); filter: none; } 100% { transform: scale(1); } }
@keyframes stGlow { from { opacity: 1; transform: scale(.7); } to { opacity: 0; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .bossBadge .bbRays { animation: none; } }
/* keep the boss result on one screen */
#result { overflow-x: hidden; }
#result.boss .bossBadge { width: 96px; height: 96px; }
#result.boss .bossBadge .bbRays { inset: -22px; }
#result.boss .bossBadge .bbEmoji { width: 84px; height: 84px; font-size: 46px; box-shadow: 0 0 0 5px #fbbf24, 0 6px 0 5px #b45309, 0 12px 18px rgba(12, 74, 110, .22); }
#result.boss .bossBadge .bbTrophy { width: 36px; height: 36px; font-size: 19px; right: -10px; bottom: -8px; }
#result.boss .bossName { font-size: 19px; margin-top: 6px; }
#result.boss .resSticker .newSticker { transform: scale(.75); margin: -8px 0; }
#result.boss .resStars { transform: none; }
#result.boss { gap: 6px; }
#result.boss .pip { width: 96px; }
#result.boss .resStars { zoom: .78; }
#result.boss .resSticker { zoom: .7; }
#result.boss #resNote { display: none; }
#result.boss .resBoss { margin: 2px 0; }
#result.boss .bossSub { margin-top: 2px; }
.sBadge.waiting { transform: scale(0); }

/* Grown-ups: account box */
.account { background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: 0 4px 0 rgba(12, 74, 110, .08); display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.acHead { display: flex; gap: 12px; align-items: flex-start; }
.acHead .acIcon { font-size: 30px; line-height: 1; }
.acHead b { font: 800 17px var(--ui); color: #0c4a6e; }
.acHead p { margin: 2px 0 0; color: #475569; font-size: 14px; }
.acForm { display: flex; flex-direction: column; gap: 8px; }
.acForm input { font: 600 16px var(--ui); padding: 12px 14px; border-radius: 14px; border: 2px solid #cbd5e1; background: #f8fafc; }
.acForm input:focus { outline: none; border-color: #38bdf8; background: #fff; }
.acOr { text-align: center; color: #94a3b8; font-size: 13px; margin: 0; }
.gBtn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f2937; box-shadow: 0 0 0 2px #e2e8f0, 0 4px 0 #cbd5e1; }
.gLogo { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 800 16px/1 Arial, sans-serif; color: #fff;
  background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.linkBtn { background: none; border: 0; color: #0284c7; font: 700 14px var(--ui); text-decoration: underline; cursor: pointer; padding: 4px; }
.acMsg { margin: 0; font-size: 14px; }
.acMsg:empty { display: none; }
.acMsg.bad { color: #b91c1c; } .acMsg.good { color: #15803d; }
.acStatus { margin: 0; font-size: 14px; color: #15803d; }
.acStatus.error { color: #b45309; }

/* First screen: sign up or log in before playing */
.splashAcc, .savedChip { display: none; }
#splash.needAccount .splashAcc { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(100%, 380px); }
#splash.needAccount #nameInput, #splash.needAccount #startBtn { display: none; }
#splash.needAccount { overflow-y: auto; padding-top: 4vh; gap: 8px; }
#splash.needAccount .pip { width: 110px; }
#splash.needAccount h1 { font-size: 40px; }
#splash.needAccount .tag { display: none; }
.splashAcc .account { width: 100%; text-align: left; box-shadow: 0 6px 0 rgba(12, 74, 110, .12), 0 14px 26px rgba(12, 74, 110, .12); }
.splashAcc .linkBtn { color: #075985; background: rgba(255, 255, 255, .7); border-radius: 999px; padding: 6px 14px; text-decoration: none; }
#splash:not(.needAccount) .savedChip:not(:empty) { display: block; font: 700 14px var(--ui); color: #0c4a6e; background: rgba(255, 255, 255, .75); border-radius: 999px; padding: 5px 14px; margin: 0; }

/* Who's playing? */
.kidPicker { display: none; }
#splash.pickKid .kidPicker { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(100%, 380px); }
#splash.pickKid #nameInput, #splash.pickKid #startBtn, #splash.pickKid .tag { display: none; }
#splash.pickKid { overflow-y: auto; padding-top: 4vh; }
#splash.pickKid .pip { width: 110px; }
.kidPicker h2 { font: 800 26px var(--ui); color: #fff; text-shadow: 0 2px 0 rgba(12, 74, 110, .35); margin: 0; }
.kidGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
.kidBtn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 12px; border: 0; border-radius: 22px; background: #fff; cursor: pointer;
  box-shadow: 0 6px 0 rgba(12, 74, 110, .14), 0 12px 20px rgba(12, 74, 110, .1); font-family: inherit; }
.kidBtn.last { box-shadow: 0 6px 0 #fbbf24, 0 0 0 3px #fde68a, 0 12px 20px rgba(12, 74, 110, .1); }
.kidBtn:active { transform: translateY(3px); }
.kAva { width: 54px; height: 54px; border-radius: 50%; background: #38bdf8; color: #fff; display: grid; place-items: center; font: 800 28px var(--ui); }
.kidBtn:nth-child(4n+2) .kAva { background: #f472b6; } .kidBtn:nth-child(4n+3) .kAva { background: #34d399; } .kidBtn:nth-child(4n+4) .kAva { background: #f59e0b; }
.kidBtn .kName, .kidRow .kName { font: 800 18px var(--ui); color: #0c4a6e; }
.kStars { display: inline-flex; align-items: center; gap: 3px; font: 800 14px var(--ui); color: #b45309; }
.addKid { display: flex; gap: 8px; width: 100%; }
.addKid input { flex: 1; min-width: 0; font: 600 16px var(--ui); padding: 10px 12px; border-radius: 14px; border: 2px solid #cbd5e1; background: #fff; }
.btn.small { padding: 8px 14px; font-size: 15px; min-height: 0; }
.kidsBox { display: flex; flex-direction: column; gap: 8px; border-top: 2px dashed #e2e8f0; padding-top: 10px; }
.kbTitle { font: 800 16px var(--ui); color: #0c4a6e; }
.kidRow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: #f8fafc; }
.kidRow.on { background: #ecfeff; box-shadow: inset 0 0 0 2px #67e8f9; }
.kidRow .kName { flex: 1; font-size: 16px; }
.kTag { font: 800 12px var(--ui); color: #0e7490; background: #cffafe; border-radius: 999px; padding: 3px 10px; }
.savedChip button.linkBtn { font-size: 14px; padding: 0 2px; }
#hello { cursor: pointer; }

/* Sign-in card, in short steps (replaces the long form) */
.account { gap: 8px; padding: 14px; }
.acHead p { font-size: 14px; }
.emBtn { background: #fff; color: #0c4a6e; box-shadow: 0 0 0 2px #e2e8f0, 0 4px 0 #cbd5e1; }
.acTabs { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5f9; border-radius: 14px; padding: 4px; gap: 4px; }
.acTabs button { border: 0; background: none; border-radius: 11px; padding: 8px; font: 800 15px var(--ui); color: #64748b; cursor: pointer; }
.acTabs button.on { background: #fff; color: #0c4a6e; box-shadow: 0 2px 0 #cbd5e1; }
.acForm input { padding: 10px 12px; }
.acFoot { display: flex; justify-content: space-between; align-items: center; }
.acOr { display: none; }
/* First screen: compact, never scrolls */
#splash.needAccount { overflow-y: hidden; padding-top: 3vh; gap: 10px; }
#splash.needAccount .pip { width: 120px; }
#splash.needAccount h1 { font-size: 40px; }
#splash.needAccount.emailStep .pip { width: 72px; }
#splash.needAccount.emailStep h1 { font-size: 30px; }
#splash.needAccount .splashAcc { gap: 8px; }
.onSplash .acHead { align-items: center; }
@media (max-height: 640px) {
  #splash.needAccount .pip { width: 84px; } #splash.needAccount h1 { font-size: 32px; }
  #splash.needAccount.emailStep .pip { display: none; }
}
/* the form is the first step now: "or" between it and Google */
.acOr { display: flex; align-items: center; gap: 10px; margin: 0; color: #94a3b8; font: 700 13px var(--ui); }
.acOr::before, .acOr::after { content: ''; flex: 1; height: 2px; background: #e2e8f0; border-radius: 2px; }
.acFoot:empty { display: none; }
.acFoot { justify-content: flex-end; }
/* "Play without an account": a clear secondary button, above the island art */
#splash .splashAcc { position: relative; z-index: 2; }
.splashAcc > .linkBtn { background: #fff; color: #0c4a6e; font: 800 16px var(--ui); padding: 10px 22px; border-radius: 999px; text-decoration: none;
  box-shadow: 0 0 0 2px rgba(12, 74, 110, .12), 0 4px 0 rgba(12, 74, 110, .18), 0 8px 16px rgba(12, 74, 110, .12); margin-top: 4px; }
.splashAcc > .linkBtn:active { transform: translateY(2px); }

/* Typed confirmation card (password / ERASE / new password) */
.typeCard .askCard { text-align: center; }
.typeCard .askCard p { margin: 0 0 6px; }
.typeCard .acForm { width: 100%; text-align: left; }
.typeCard .acMsg { text-align: center; }
/* after "Play without an account": back to signing up */
.backToAcc { position: relative; z-index: 2; background: #fff; color: #0c4a6e; font: 800 15px var(--ui); padding: 8px 18px; border-radius: 999px; text-decoration: none;
  box-shadow: 0 0 0 2px rgba(12, 74, 110, .12), 0 4px 0 rgba(12, 74, 110, .18); }
.backToAcc[hidden] { display: none; }
#splash.needAccount .backToAcc, #splash.pickKid .backToAcc { display: none; }
@media (max-height: 640px) { .account { gap: 6px; padding: 12px; } .acForm { gap: 6px; } .acForm input { padding: 8px 12px; } }

/* Who's playing? — redesigned */
#splash.pickKid .kidPicker { width: min(100%, 380px); gap: 8px; }
.kidPicker .pkNote { margin: -4px 0 2px; font: 700 15px var(--ui); color: #075985; background: rgba(255, 255, 255, .75); border-radius: 999px; padding: 4px 14px; }
.kidPicker .pkWho { margin: 4px 0 0; font: 700 13px var(--ui); color: #0c4a6e; background: rgba(255, 255, 255, .7); border-radius: 999px; padding: 4px 12px; }
.kidGrid { position: relative; z-index: 2; }
.kidGrid.only { grid-template-columns: 1fr; }
.kidBtn { min-height: 132px; justify-content: center; }
.kidBtn.c0 .kAva { background: #38bdf8; } .kidBtn.c1 .kAva { background: #f472b6; } .kidBtn.c2 .kAva { background: #34d399; } .kidBtn.c3 .kAva { background: #f59e0b; }
.kAva.add { background: #e0f2fe !important; color: #0284c7; font-size: 30px; }
.addTile { background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .95), 0 6px 0 rgba(12, 74, 110, .1); border: 0; }
.addTile .kName { color: #0369a1; }
.addCard { cursor: default; gap: 8px; padding: 14px 12px; }
.addCard input { width: 100%; font: 700 17px var(--ui); text-align: center; padding: 10px; border-radius: 14px; border: 2px solid #bae6fd; background: #f0f9ff; }
.addCard input:focus { outline: none; border-color: #38bdf8; background: #fff; }
.addRow { display: flex; gap: 6px; width: 100%; }
.addRow .btn { flex: 1; }
.kidGrid.only .addCard { padding: 18px 20px; }
#splash.pickKid { overflow-y: auto; }
/* Welcome back the child we know */
.kidWelcome, #splash > .kwLinks { display: none; }
#splash.welcomeKid .kidWelcome { display: block; position: relative; z-index: 2; }
#splash.welcomeKid > .kwLinks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; position: relative; z-index: 2; }
#splash.welcomeKid #nameInput, #splash.welcomeKid .tag { display: none; }
.kwCard { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 24px; padding: 12px 22px 12px 14px; text-align: left;
  box-shadow: 0 6px 0 rgba(12, 74, 110, .14), 0 12px 20px rgba(12, 74, 110, .1); }
.kwCard .kAva { width: 58px; height: 58px; font-size: 30px; }
.kwCard.c0 .kAva { background: #38bdf8; } .kwCard.c1 .kAva { background: #f472b6; } .kwCard.c2 .kAva { background: #34d399; } .kwCard.c3 .kAva { background: #f59e0b; }
.kwCard b { display: block; font: 800 26px/1.1 var(--ui); color: #0c4a6e; }
.kwCard .kStars { font-size: 15px; }
#splash > .kwLinks .linkBtn { background: #fff; color: #0c4a6e; font: 800 14px var(--ui); padding: 8px 14px; border-radius: 999px; text-decoration: none;
  box-shadow: 0 0 0 2px rgba(12, 74, 110, .1), 0 3px 0 rgba(12, 74, 110, .15); }
.pkBack { background: #fff !important; color: #0c4a6e !important; font: 800 14px var(--ui) !important; padding: 7px 16px !important; border-radius: 999px; text-decoration: none !important; position: relative; z-index: 2; }
/* Back on "Where shall we start?" */
.plBack { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; z-index: 3; background: #fff; color: #0c4a6e; font: 800 15px var(--ui);
  padding: 8px 16px; border-radius: 999px; text-decoration: none; box-shadow: 0 0 0 2px rgba(12, 74, 110, .1), 0 3px 0 rgba(12, 74, 110, .15); }
.plBack[hidden] { display: none; }
#place { position: relative; }
/* Welcome card: Switch / Add sit inside the card, under the greeting */
.kwCard { flex-direction: column; align-items: stretch; gap: 0; padding: 12px 14px 0; min-width: 270px; }
.kwTop { display: flex; align-items: center; gap: 14px; padding: 0 8px 12px 0; }
.kwCard .kwLinks { display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid #eef2f7; margin: 0 -14px; }
.kwCard .kwLinks button { border: 0; background: none; padding: 11px 6px 12px; font: 800 14px var(--ui); color: #0369a1; cursor: pointer; }
.kwCard .kwLinks button + button { border-left: 2px solid #eef2f7; }
.kwCard .kwLinks button:active { background: #f0f9ff; }
.kwCard .kwLinks button:first-child { border-bottom-left-radius: 24px; } .kwCard .kwLinks button:last-child { border-bottom-right-radius: 24px; }
.kwCard .kwLinks.one { grid-template-columns: 1fr; } .kwCard .kwLinks.one button { border-radius: 0 0 24px 24px; }
/* Who's playing? edit mode: a red ✕ on each child */
.pkBar { display: flex; gap: 10px; justify-content: center; position: relative; z-index: 2; }
.kidBtn { position: relative; }
.kidBtn.editing { animation: kWiggle .5s ease-in-out infinite alternate; }
.kidBtn:nth-child(2n).editing { animation-delay: -.25s; }
.kRemove { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; background: #ef4444; color: #fff; display: grid; place-items: center;
  font: 800 16px/1 var(--ui); box-shadow: 0 3px 0 #b91c1c, 0 0 0 3px #fff; }
@keyframes kWiggle { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
@media (prefers-reduced-motion: reduce) { .kidBtn.editing { animation: none; } }
/* Back / Edit on Who's playing?: clear buttons, not faint pills */
.pkBar .pkBack { background: #fff !important; color: #0369a1 !important; font: 800 16px var(--ui) !important; padding: 9px 20px !important; border-radius: 999px;
  border: 2px solid #0369a1 !important; box-shadow: 0 4px 0 #0369a1 !important; text-decoration: none !important; }
.pkBar .pkBack:active { transform: translateY(3px); box-shadow: 0 1px 0 #0369a1 !important; }
.pkBar { margin-top: 14px; }
/* more room above Back / Edit; edit badge; Add tile not see-through */
.pkBar { margin-top: 22px; }
.kEdit { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; background: #0284c7; color: #fff; display: grid; place-items: center;
  font: 800 16px/1 var(--ui); box-shadow: 0 3px 0 #075985, 0 0 0 3px #fff; }
.addTile { background: rgba(255, 255, 255, .85); }
.typeCard .acForm .btn { width: 100%; }

/* Learn to count */
.countCard h2 { margin: 0 0 10px; }
.numRow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.numCol { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: 14px; background: #f1f5f9; transition: transform .22s cubic-bezier(.3, 1.6, .5, 1), background .2s; }
.numCol b { font: 800 34px/1 var(--ui); color: #0c4a6e; }
.numCol span { display: flex; flex-direction: column; gap: 4px; }
.numCol i { width: 12px; height: 12px; border-radius: 50%; background: #f59e0b; display: block; }
.numCol.saying { transform: scale(1.15); background: #fff1e6; box-shadow: 0 0 0 3px #fdba74; }
.countRow { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 8px; }
.countThing { position: relative; width: 74px; height: 74px; border: 0; border-radius: 18px; background: #fff; font-size: 44px; display: grid; place-items: center;
  box-shadow: 0 4px 0 rgba(12, 74, 110, .12); cursor: pointer; }
.countThing.counted, .busy .counted { box-shadow: 0 0 0 3px #22c55e, 0 4px 0 rgba(12, 74, 110, .12); }
.cntBadge { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: #22c55e; color: #fff; font: 800 15px/26px var(--ui);
  font-style: normal; text-align: center; box-shadow: 0 0 0 2px #fff; transform: rotate(0deg); }
.busy .counted .cntBadge { top: -6px; right: -6px; }
.busy.calm button { transform: translate(-50%, -50%) !important; }
/* Optional stage: a ribbon across the corner of its picture */
.stPic { overflow: visible; }
.stRibbon { position: absolute; top: 12px; left: -6px; z-index: 2; background: #8b5cf6; color: #fff; font: 800 12px/1 var(--ui); letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 12px 6px 10px; border-radius: 6px 10px 10px 0; box-shadow: 0 3px 0 #6d28d9; }
.stRibbon::after { content: ''; position: absolute; left: 0; bottom: -6px; border-top: 6px solid #4c1d95; border-left: 6px solid transparent; }
