:root{
  --bg1:#bfe9ff; --bg2:#e9fbd8; --grass:#7cc96b; --ink:#2b3a2f; --card:#fffdf6;
  --red:#ff5d5d; --orange:#ff9f40; --yellow:#ffd23f; --green:#4cc36b; --blue:#4aa3ff; --purple:#a77bff; --pink:#ff7eb6;
  --r:26px; --shadow:0 6px 0 rgba(0,0,0,.12), 0 10px 24px rgba(0,0,0,.08);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}
html,body{margin:0;height:100%}
body{font-family:"Baloo 2","Nunito","Quicksand",ui-rounded,"SF Pro Rounded",system-ui,sans-serif;color:var(--ink);
  background:linear-gradient(180deg,var(--bg1) 0%,var(--bg2) 70%,#c9ef9f 100%);overflow-x:hidden;min-height:100vh}
#sky{position:fixed;inset:0;pointer-events:none;z-index:0;overflow:hidden}
.cloud{position:absolute;background:#fff;border-radius:50px;opacity:.85;width:120px;height:40px;animation:drift 60s linear infinite}
.cloud::before,.cloud::after{content:"";position:absolute;background:#fff;border-radius:50%}
.cloud::before{width:55px;height:55px;top:-25px;left:18px}.cloud::after{width:40px;height:40px;top:-15px;left:62px}
.c1{top:8%;left:-150px}.c2{top:22%;left:-150px;animation-delay:-25s;transform:scale(.7)}.c3{top:14%;left:-150px;animation-delay:-45s;transform:scale(1.2)}
@keyframes drift{to{left:110%}}
#top{position:sticky;top:0;z-index:5;display:flex;gap:10px;align-items:center;padding:10px 14px}
#stars{margin-right:auto;margin-left:4px;background:var(--card);border-radius:30px;padding:8px 16px;font-size:22px;box-shadow:var(--shadow)}
.round{width:54px;height:54px;border-radius:50%;border:0;background:var(--card);font-size:26px;box-shadow:var(--shadow);cursor:pointer}
.round:active,.btn:active,.tile:active,.opt:active{transform:translateY(4px);box-shadow:0 2px 0 rgba(0,0,0,.12)}
#app{position:relative;z-index:1;max-width:980px;margin:0 auto;padding:6px 14px 40px}
h1{font-size:clamp(28px,6vw,46px);margin:8px 0 4px;text-align:center}
.sub{text-align:center;font-size:18px;opacity:.75;margin:0 0 18px}
.btn{border:0;border-radius:var(--r);padding:16px 28px;font:inherit;font-size:24px;font-weight:700;background:var(--yellow);color:var(--ink);box-shadow:var(--shadow);cursor:pointer}
.btn.green{background:var(--green);color:#fff}.btn.ghost{background:var(--card)}

/* World map */
.worlds{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:18px}
.world{background:var(--card);border-radius:32px;padding:16px;box-shadow:var(--shadow)}
.world h2{margin:0 0 10px;font-size:24px;display:flex;align-items:center;gap:10px}
.world h2 .ico{font-size:34px}
.games{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.tile{border:0;border-radius:22px;padding:12px 8px;font:inherit;font-size:16px;font-weight:700;cursor:pointer;color:var(--ink);
  box-shadow:0 5px 0 rgba(0,0,0,.12);display:flex;flex-direction:column;align-items:center;gap:4px;min-height:110px;justify-content:center}
.tile .e{font-size:42px;line-height:1}
.tile .lv{font-size:13px;opacity:.7}
.w-letters .tile{background:#ffe3ec}.w-numbers .tile{background:#dff1ff}.w-math .tile{background:#fff0c9}
.w-colors .tile{background:#e8ffdc}.w-mind .tile{background:#efe6ff}

/* Game screen */
.stage{background:var(--card);border-radius:34px;padding:18px;box-shadow:var(--shadow);min-height:60vh;display:flex;flex-direction:column;align-items:center;gap:16px}
.q{font-size:clamp(22px,4.6vw,32px);font-weight:800;text-align:center;display:flex;align-items:center;gap:10px;justify-content:center;flex-wrap:wrap}
.q .say{border:0;background:var(--yellow);border-radius:50%;width:48px;height:48px;font-size:24px;cursor:pointer;box-shadow:0 4px 0 rgba(0,0,0,.12)}
.progress{display:flex;gap:6px}.progress i{width:16px;height:16px;border-radius:50%;background:#e4e4da}.progress i.on{background:var(--green)}
.scene{font-size:clamp(40px,9vw,64px);display:flex;flex-wrap:wrap;gap:8px;justify-content:center;max-width:620px;line-height:1.1}
.opts{display:flex;flex-wrap:wrap;gap:14px;justify-content:center}
.opt{border:0;min-width:96px;min-height:96px;border-radius:26px;background:#fff;font:inherit;font-size:46px;font-weight:800;cursor:pointer;
  box-shadow:0 6px 0 rgba(0,0,0,.14);padding:8px 14px;color:var(--ink);transition:transform .1s}
.opt.ok{background:#c9f5c4;animation:pop .4s}.opt.no{background:#ffd4d4;animation:shake .4s}
@keyframes pop{50%{transform:scale(1.18)}}@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.big{font-size:clamp(90px,20vw,150px);font-weight:900;line-height:1}
.swatch{width:100px;height:100px;border-radius:50%;border:6px solid #fff;box-shadow:0 6px 0 rgba(0,0,0,.14);cursor:pointer}

/* balloons */
.sky-box{position:relative;width:100%;height:56vh;border-radius:26px;background:linear-gradient(#cdefff,#f3fbff);overflow:hidden}
.balloon{position:absolute;bottom:-130px;width:84px;height:104px;border-radius:50% 50% 48% 48%;display:flex;align-items:center;justify-content:center;
  font-size:40px;font-weight:900;color:#fff;cursor:pointer;text-shadow:0 2px 0 rgba(0,0,0,.2)}
.balloon::after{content:"";position:absolute;bottom:-26px;left:50%;width:2px;height:26px;background:#888}
.balloon.popped{animation:burst .3s forwards}@keyframes burst{to{transform:scale(1.8);opacity:0}}

/* number line */
.line{display:flex;gap:4px;align-items:flex-end;justify-content:center;flex-wrap:nowrap;width:100%;overflow-x:auto;padding:30px 4px 4px}
.pad{flex:0 0 auto;width:52px;height:52px;border-radius:50%;background:#9be38f;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:22px;position:relative;cursor:pointer}
.pad .frog{position:absolute;top:-38px;font-size:38px;transition:all .3s}

/* drag targets */
.bins{display:flex;gap:14px;flex-wrap:wrap;justify-content:center}
.bin{min-width:130px;min-height:120px;border-radius:24px;border:5px dashed;display:flex;flex-wrap:wrap;align-content:flex-start;gap:4px;padding:8px;font-size:34px;justify-content:center;cursor:pointer}
.items{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;font-size:52px}
.items span{cursor:pointer;border-radius:16px;padding:2px 6px}
.items span.sel{background:#fff2a8;outline:4px solid var(--yellow)}

/* memory */
.mem{display:grid;grid-template-columns:repeat(4,minmax(60px,110px));gap:10px}
.card{aspect-ratio:3/4;border-radius:18px;background:var(--purple);font-size:44px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 5px 0 rgba(0,0,0,.14);transition:transform .3s}
.card.up{background:#fff;transform:rotateY(180deg)}.card .f{transform:rotateY(180deg)}
.card.done{background:#c9f5c4}

/* trace */
canvas.trace{background:#fff;border-radius:24px;box-shadow:inset 0 0 0 4px #eee;touch-action:none;max-width:100%}
.mix{display:flex;align-items:center;gap:14px;font-size:44px;font-weight:800}
.pot{width:130px;height:130px;border-radius:50%;border:8px solid #ddd;background:#fff;transition:background .5s}

.reward{position:fixed;inset:0;z-index:20;background:rgba(255,255,255,.75);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;backdrop-filter:blur(4px)}
.reward .big{animation:pop 1s infinite}
.confetti{position:fixed;top:-20px;font-size:28px;z-index:21;animation:fall 2.2s linear forwards;pointer-events:none}
@keyframes fall{to{transform:translateY(110vh) rotate(540deg)}}
#toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:var(--ink);color:#fff;padding:12px 20px;border-radius:20px;font-size:18px;opacity:0;transition:.3s;z-index:30;pointer-events:none}
#toast.on{opacity:1}
.panel{background:var(--card);border-radius:26px;padding:20px;box-shadow:var(--shadow);font-size:18px;line-height:1.5}
.panel table{width:100%;border-collapse:collapse}.panel td{padding:6px;border-bottom:1px solid #eee}
.profiles{display:flex;flex-wrap:wrap;gap:14px;justify-content:center;margin:16px 0}
.prof{border:0;background:var(--card);border-radius:26px;padding:14px 20px;font:inherit;font-size:22px;font-weight:700;box-shadow:var(--shadow);cursor:pointer}
.prof .e{font-size:54px;display:block}
input.name{font:inherit;font-size:24px;padding:12px 18px;border-radius:20px;border:4px solid #e7e2c8;width:min(100%,320px);text-align:center}
.avatars{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.avatars button{font-size:40px;border:0;background:#fff;border-radius:18px;padding:6px 10px;cursor:pointer;box-shadow:0 4px 0 rgba(0,0,0,.1)}
.avatars button.sel{outline:4px solid var(--green)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@keyframes rise{to{bottom:110%}}
