/* Simbicom Cartoons: big, bright and easy for small fingers */
:root { --brand: #6a1b9a; --brand-2: #8e24aa; --bg: #f3e5f5; --surface: #ffffff; --text: #261a2e; --muted: #6d6275; --line: #e1d5e7; --ok: #2e7d32; }
@media (prefers-color-scheme: dark) { :root { --bg: #17121b; --surface: #231b29; --text: #f1e9f5; --muted: #b3a6bb; --line: #3a2f42; } }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Comic Sans MS", "Trebuchet MS", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
button, select, input { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: .5rem .9rem; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: #c62828; }
button.big { font-size: 1.2rem; padding: .8rem 1.2rem; width: 100%; }
button.icon { font-size: 1.3rem; padding: .35rem .6rem; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: .6rem max(16px, env(safe-area-inset-left)); background: linear-gradient(90deg, #6a1b9a, #1e88e5); color: #fff; }
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; } .brand img { width: 36px; height: 36px; }
.status { display: flex; align-items: center; gap: .5rem; }
.top button.icon { background: rgba(255,255,255,.18); border: 0; color: #fff; }
.pill { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: rgba(255,255,255,.22); }
.pill.ok { background: #2e7d32; }
main { max-width: 1200px; margin: 0 auto; padding: 12px 16px 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem; }
.narrow { max-width: 420px; margin: 2rem auto; display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; }
label.check { display: flex; align-items: center; gap: .5rem; }
input, select { padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.levels { display: flex; gap: .5rem; overflow-x: auto; padding: .3rem 0 .6rem; scrollbar-width: thin; }
.level { flex: none; font-size: 1.1rem; font-weight: 700; border-radius: 999px; padding: .55rem 1.1rem; border: 2px solid var(--line); }
.level.on { background: #fdd835; border-color: #f9a825; color: #3e2723; }
.filters { justify-content: space-between; margin-bottom: .6rem; } .filters label { display: flex; align-items: center; gap: .4rem; }
.stage-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; margin-bottom: 1rem; }
.screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.screen canvas, .screen video, .screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.screen:fullscreen { border-radius: 0; }
.start { position: absolute; inset: 0; margin: auto; width: 180px; height: 180px; border-radius: 50%; border: 0; background: #fdd835; color: #4a148c; font-size: 4rem; display: grid; place-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.35); animation: pulse 1.6s ease-in-out infinite; }
.start span { display: block; font-size: 1rem; font-weight: 700; margin-top: -1.5rem; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .start { animation: none; } }
.now { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .2rem 0; flex-wrap: wrap; }
.subject { margin: 1.2rem 0 .5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; text-align: left; padding: .45rem; border-radius: 14px; border: 2px solid var(--line); }
.tile.on { border-color: #f9a825; box-shadow: 0 0 0 3px #fdd83588; }
.tile small { color: var(--muted); }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, #8e24aa, #1e88e5); }
.thumb img { width: 100%; height: 100%; object-fit: cover; } .thumb .emoji { font-size: 2.6rem; }
.thumb .tick, .thumb .saved, .thumb .new { position: absolute; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: .1rem .45rem; }
.thumb .tick { left: 6px; top: 6px; background: #2e7d32; color: #fff; }
.thumb .saved { right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; }
.thumb .new { right: 6px; top: 6px; background: #e53935; color: #fff; }
.tile { position: relative; }
.tile.locked .thumb { filter: grayscale(.8) brightness(.75); }
.tile.locked .thumb .emoji { visibility: hidden; }
.tile .lock { position: absolute; z-index: 1; left: 50%; top: calc(.45rem + 2.6rem); transform: translate(-50%, -50%); font-size: 1.8rem; text-shadow: 0 2px 6px rgba(0,0,0,.5); pointer-events: none; }
.plan { justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .5rem .8rem; margin-bottom: .4rem; }
.who { max-width: 900px; margin: 2rem auto; padding: 0 16px; text-align: center; }
.who h2 { font-size: 1.8rem; }
.kids { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin: 1rem 0; }
.kid { width: 140px; display: grid; justify-items: center; gap: .25rem; padding: 1rem .5rem; border-radius: 20px; border: 3px solid var(--line); }
.kid .face { font-size: 3.4rem; line-height: 1; }
.kid b { font-size: 1.15rem; } .kid small { color: var(--muted); }
.kid.on, .kid:hover { border-color: #f9a825; }
.kid.add { border-style: dashed; }
.kidbtn { background: rgba(255,255,255,.18); border: 0; color: #fff; font-weight: 700; }
button.link { border: 0; background: none; color: var(--brand-2); text-decoration: underline; }
.chip { border-radius: 999px; padding: .35rem .8rem; } .chip.add { border-style: dashed; }
.avatars { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.av { font-size: 1.6rem; padding: .2rem .45rem; border-radius: 12px; }
.av.on { border-color: #f9a825; box-shadow: 0 0 0 3px #fdd83588; }
@media (max-width: 520px) { .kid { width: calc(50% - .5rem); } }
.plan.warn { background: #fff8e1; border-color: #f9a825; color: #4e342e; font-weight: 700; }
@media (prefers-color-scheme: dark) { .plan.warn { background: #3e2f12; color: #ffe0a3; } }
dialog h3 { margin: .4rem 0 0; font-size: 1rem; }
dialog { border: 0; padding: 0; background: transparent; max-width: min(520px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .card { display: grid; gap: .7rem; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
/* Learning games */
.games { margin: 1rem 0; } .games h2 { margin: 0; font-size: 1.25rem; }
.g-total { margin-left: auto; font-weight: 700; }
.g-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: .5rem; }
.g-tile { display: grid; justify-items: center; gap: .2rem; padding: .9rem .5rem; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); text-align: center; }
.g-tile:hover { border-color: var(--brand-2); } .g-icon { font-size: 2.2rem; }
dialog.game-dlg { max-width: min(760px, calc(100vw - 16px)); }
.game { display: grid; gap: .7rem; min-height: 340px; }
.g-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .g-prog { margin-left: auto; letter-spacing: .05em; }
.g-say { font-size: 1.2rem; padding: .3rem .6rem; }
.g-body { display: grid; gap: .8rem; align-content: start; }
.g-prompt { font-size: 1.25rem; font-weight: 700; margin: 0; text-align: center; }
.g-show { font-size: clamp(2rem, 7vw, 3.4rem); text-align: center; line-height: 1.3; word-break: break-word; }
.g-opts, .g-line { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.g-line { min-height: 2.6rem; }
.g-chip { background: #c8e6c9; color: #1b5e20; border-radius: 10px; padding: .3rem .6rem; font-weight: 700; }
.g-opt, .g-card { font-size: clamp(1.3rem, 5vw, 2rem); min-width: 4.2rem; min-height: 4.2rem; padding: .4rem .9rem; border-radius: 16px; border: 3px solid var(--line); background: var(--surface); }
.g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.g-card.sel { border-color: #1e88e5; background: #e3f2fd; color: #0d47a1; }
.g-opt.yes, .g-card.yes { border-color: #2e7d32; background: #c8e6c9; color: #1b5e20; }
.g-opt.no, .g-card.no { border-color: #c62828; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .g-opt.no, .g-card.no { animation: none; } }
.g-card.shadow { filter: brightness(0); }
.g-card.down { background: linear-gradient(135deg, #8e24aa, #1e88e5); color: #fff; }
.g-cat { grid-column: 1 / -1; margin: .6rem 0 0; font-size: 1rem; color: var(--muted); }
.game { position: relative; overflow: hidden; }
.g-confetti { position: absolute; inset: 0; pointer-events: none; }
.g-confetti span { position: absolute; top: -2rem; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { transform: translateY(460px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .g-confetti { display: none; } }
.g-cheer { text-align: center; font-size: 1.6rem; font-weight: 700; color: var(--ok); }
.g-hint { text-align: center; margin: 0; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #263238; color: #fff; padding: .7rem 1.1rem; border-radius: 12px; z-index: 20; max-width: calc(100vw - 32px); }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } .brand b { font-size: 1.05rem; } }

/* ───────── Simbi the chameleon (games.js mascot()) ───────── */
.simbi { display: inline-block; overflow: visible; animation: simbi-bob 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
.simbi path:first-child { animation: simbi-tail 3s ease-in-out infinite; transform-origin: 20% 70%; transform-box: fill-box; }
.simbi.yay { animation: simbi-hop .55s ease-in-out infinite; }
.simbi.hmm { animation: simbi-think 1.6s ease-in-out infinite; }
@keyframes simbi-bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
@keyframes simbi-hop { 0%, 100% { transform: translateY(0) scale(1, 1) } 40% { transform: translateY(-12px) scale(.96, 1.05) } 80% { transform: translateY(0) scale(1.05, .94) } }
@keyframes simbi-think { 0%, 100% { transform: rotate(0) } 50% { transform: rotate(-6deg) } }
@keyframes simbi-tail { 0%, 100% { transform: rotate(0) } 50% { transform: rotate(-10deg) } }
.g-mascot { flex: 0 0 auto; line-height: 0; }
.g-level { margin: .3rem 0; padding: .35rem .7rem; border-radius: 999px; background: #e8f5e9; color: #2e7d32; font-weight: 600; display: inline-block; }
.g-level.up { background: #fff3e0; color: #e65100; animation: simbi-hop .6s ease-in-out 2; }
.g-opt.show-right { outline: 4px solid #43a047; animation: simbi-hop .6s ease-in-out 3; }

/* ───────── Simbi's adventure: a winding path of steps ───────── */
.adv { margin: 1rem 0; padding: .8rem; border-radius: 18px; background: linear-gradient(180deg, #e3f2fd, #f1f8e9); }
.adv h2 { margin: 0; }
.adv-head { align-items: center; gap: .6rem; }
.adv-head .grow { flex: 1; min-width: 0; }
.sticker-btn { border-radius: 999px; padding: .45rem .9rem; font-weight: 700; background: #fff8e1; border: 2px solid #ffca28; }
.adv-path { display: flex; gap: .2rem; overflow-x: auto; padding: 3.2rem .4rem .8rem; scroll-snap-type: x proximity; }
.adv-node { position: relative; flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: #90caf9; box-shadow: 0 4px 0 #64b5f6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.5rem; scroll-snap-align: center; padding: 0; cursor: pointer; }
.adv-node:nth-child(odd) { margin-top: 22px; }   /* a zig-zag path */
.adv-node.k-cartoon { background: #ce93d8; box-shadow: 0 4px 0 #ab47bc; }
.adv-node.done { background: #ffd54f; box-shadow: 0 4px 0 #ffb300; }
.adv-node.locked { background: #e0e0e0; box-shadow: 0 4px 0 #bdbdbd; opacity: .8; cursor: not-allowed; }
.adv-node.here { background: #66bb6a; box-shadow: 0 4px 0 #388e3c, 0 0 0 6px rgba(102, 187, 106, .35); animation: node-pulse 1.4s ease-in-out infinite; }
.adv-node small { font-size: .6rem; line-height: 1; margin-top: 2px; color: #333; }
.adv-node + .adv-node::before { content: ""; position: absolute; left: -14px; top: 50%; width: 14px; border-top: 4px dotted #90a4ae; }
.adv-me { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); line-height: 0; pointer-events: none; }
@keyframes node-pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.08) } }

/* ───────── sticker book ───────── */
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: .4rem; margin: .5rem 0; }
.sticker { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; border-radius: 14px; background: #f5f5f5; border: 2px dashed #ccc; color: #bbb; padding: 0; }
.sticker.got { background: #fffde7; border: 2px solid #ffca28; color: inherit; animation: sticker-in .5s ease-out both; }
.sticker.on { outline: 4px solid #43a047; }
.hats .sticker { cursor: pointer; }
@keyframes sticker-in { from { transform: scale(.3) rotate(-20deg); opacity: 0 } to { transform: none; opacity: 1 } }

/* ───────── parent report ───────── */
.report .rep { padding: .5rem .6rem; margin: .4rem 0; border-radius: 10px; background: rgba(0, 0, 0, .04); display: grid; gap: .15rem; }

/* ───────── welcome: Simbi walks in, waves and says hello ───────── */
.welcome { position: fixed; inset: 0; z-index: 50; overflow: hidden; background: linear-gradient(180deg, #4fc3f7 0%, #b3e5fc 55%, #8bc34a 55%, #558b2f 100%); }
.welcome.leave { animation: w-out .7s ease-in forwards; }
.w-sky span { position: absolute; font-size: 3rem; }
.w-sun { top: 6%; right: 8%; font-size: 4.5rem !important; animation: w-spin 12s linear infinite; }
.w-cloud.c1 { top: 12%; left: -20%; animation: w-drift 22s linear infinite; }
.w-cloud.c2 { top: 24%; left: -30%; font-size: 2.2rem !important; animation: w-drift 30s linear 4s infinite; }
.w-bird { top: 18%; left: -10%; font-size: 1.6rem !important; animation: w-fly 9s linear 1s infinite; }
.w-land span { position: absolute; bottom: 38%; font-size: 4rem; }
.w-tree.t1 { left: 6%; } .w-tree.t2 { right: 10%; font-size: 4.6rem !important; } .w-house { left: 30%; font-size: 3rem !important; bottom: 40% !important; }
.w-simbi { position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%); line-height: 0; }
.welcome.play .w-simbi { animation: w-walk 1.6s cubic-bezier(.3, .8, .4, 1) both; }
.w-bubble { position: absolute; bottom: 42%; left: 50%; transform: translateX(-50%); width: min(86vw, 420px); background: #fff; border-radius: 22px; padding: .9rem 1.1rem;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .12); display: grid; gap: .3rem; text-align: center; font-size: 1.05rem; }
.w-bubble b { font-size: 1.6rem; color: #6a1b9a; }
.w-bubble::after { content: ""; position: absolute; bottom: -16px; left: 50%; border: 10px solid transparent; border-top: 12px solid #fff; transform: translateX(-50%); }
.welcome.play .w-bubble { animation: w-pop .5s ease-out 1.5s both; }
.w-go { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); font-size: 1.4rem; font-weight: 800; padding: .8rem 2.2rem; border-radius: 999px;
  border: 0; color: #fff; background: #43a047; box-shadow: 0 6px 0 #2e7d32; }
.welcome.play .w-go { animation: w-pop .5s ease-out 2.1s both, go-pulse 1.4s ease-in-out 2.8s infinite; }
@keyframes go-pulse { 0%, 100% { transform: translateX(-50%) scale(1) } 50% { transform: translateX(-50%) scale(1.08) } }
@keyframes w-walk { from { transform: translateX(-160vw) } 70% { transform: translateX(-50%) translateY(-14px) } 85% { transform: translateX(-50%) translateY(0) } to { transform: translateX(-50%) } }
@keyframes w-pop { from { opacity: 0; transform: translateX(-50%) scale(.4) } 80% { transform: translateX(-50%) scale(1.06) } to { opacity: 1; transform: translateX(-50%) scale(1) } }
@keyframes w-drift { to { left: 120% } }
@keyframes w-fly { 0% { left: -10%; transform: translateY(0) } 50% { transform: translateY(-30px) } 100% { left: 110%; transform: translateY(0) } }
@keyframes w-spin { to { transform: rotate(360deg) } }
@keyframes w-out { to { opacity: 0; transform: scale(1.08) } }
@media (prefers-reduced-motion: reduce) { .simbi, .adv-node.here, .welcome *, .welcome { animation: none !important; } }

/* Simbicom Kids: learning activities, lessons */
.acts { margin: 0 0 1rem; }
.act-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.act-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left; padding: .8rem; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); }
.act-tile:hover, .act-tile:focus-visible { border-color: var(--brand-2); }
.act-icon { font-size: 2.2rem; line-height: 1; }
.act-dlg, .lesson-dlg { width: min(760px, 96vw); border: 0; padding: 0; background: transparent; }
.act-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.act-tab { border-radius: 999px; font-weight: 700; }
.act-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ls-pic { min-height: 180px; display: grid; place-items: center; font-size: clamp(2.6rem, 10vw, 5rem); text-align: center; background: var(--bg); border-radius: 16px; padding: .8rem; margin: .6rem 0; word-break: break-word; }
.ls-pic img { max-width: 100%; max-height: 300px; border-radius: 12px; }
.ls-text { font-size: clamp(1.2rem, 3.5vw, 1.6rem); line-height: 1.45; min-height: 3em; }
.ls-nav { justify-content: space-between; }
.ls-nav button { font-size: 1.15rem; padding: .7rem 1.1rem; }

/* Wrong tries fade a little; after 4 the right answer or matches are shaded green (matching cards share a number) */
.g-opt.tried { opacity: .55; }
.g-card.show-right, .g-chip.show-right { outline: 4px solid #43a047; background: #c8e6c9; color: #1b5e20; }
.g-card.show-right { position: relative; animation: simbi-hop .6s ease-in-out 3; }
.g-card[data-n]::after { content: attr(data-n); position: absolute; top: -.5rem; right: -.5rem; background: #2e7d32; color: #fff; border-radius: 50%; width: 1.6rem; height: 1.6rem; font-size: .95rem; line-height: 1.6rem; text-align: center; font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .g-card.show-right, .g-opt.show-right { animation: none; } }
