/* TEDDY'S FUTURE LAB — the child screens. Big, bright, friendly, and easy to press.
   Sizes follow the age group on <body data-band="early|kid|tween|teen|senior">: younger = bigger and rounder, older = calmer. */
body { --k: 1; --kr: 22px; --kpad: 16px; }
body[data-band="early"] { --k: 1.18; --kr: 28px; --kpad: 18px; }
body[data-band="kid"] { --k: 1.08; --kr: 24px; }
body[data-band="teen"], body[data-band="senior"] { --k: .96; --kr: 16px; --kpad: 14px; }
body.kid-mode { font-size: calc(16px * var(--k)); }
body.kid-mode.text-lg { font-size: calc(18px * var(--k)); } body.kid-mode.text-xl { font-size: calc(20px * var(--k)); }

/* subject / area colours: use as style="--c:var(--c-math)" or class c-math */
:root { --c-reading: #8b4dff; --c-writing: #f0469c; --c-math: #2a7fff; --c-science: #12a150; --c-social: #ef6c12; --c-language: #0c9cb3; --c-coding: #6a5cff; --c-robotics: #4a78d8;
  --c-music: #ff3f7f; --c-art: #ff6a3c; --c-life: #0e9f87; --c-games: #ff5a36; --c-world: #2fa84f; --c-stories: #c04dff; --c-friends: #ffb020; --c-trophy: #ffc832; --c-calendar: #1492e6; --c-safety: #16a05b; --c-home: #2a7fff; --c-room: #8f6bff; }
/* --c is the colour of a place; --ci is the colour of words written ON that colour (white, or dark on the two yellows) */
.c-reading { --c: var(--c-reading); } .c-writing { --c: var(--c-writing); } .c-math { --c: var(--c-math); } .c-science { --c: var(--c-science); } .c-social { --c: var(--c-social); } .c-language { --c: var(--c-language); }
.c-coding { --c: var(--c-coding); } .c-robotics { --c: var(--c-robotics); } .c-music { --c: var(--c-music); } .c-art { --c: var(--c-art); } .c-life { --c: var(--c-life); } .c-games { --c: var(--c-games); }
.c-world { --c: var(--c-world); } .c-stories { --c: var(--c-stories); } .c-friends { --c: var(--c-friends); } .c-trophy { --c: var(--c-trophy); } .c-calendar { --c: var(--c-calendar); } .c-safety { --c: var(--c-safety); } .c-home { --c: var(--c-home); } .c-room { --c: var(--c-room); }
.c-reading, .c-writing, .c-math, .c-science, .c-social, .c-language, .c-coding, .c-robotics, .c-music, .c-art, .c-life, .c-games, .c-world, .c-stories, .c-calendar, .c-safety, .c-home, .c-room { --ci: #fff; } .c-friends, .c-trophy { --ci: #3b2500; }

/* ---------- frame ---------- */
#app.kid { grid-template-columns: calc(210px * var(--k)) 1fr; }
#app.kid #topbar { background: color-mix(in srgb, var(--bg2) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); gap: 8px; }
#app.kid #sidebar { background: color-mix(in srgb, var(--bg2) 82%, transparent); padding: 10px 8px calc(16px + var(--safe-b)) calc(8px + var(--safe-l)); }
.stars-bg::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .7;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 72%, #cfe3ff, transparent), radial-gradient(1.5px 1.5px at 44% 30%, #fff, transparent), radial-gradient(1px 1px at 61% 84%, #ffe9a8, transparent), radial-gradient(2px 2px at 73% 22%, #fff, transparent), radial-gradient(1px 1px at 88% 60%, #cfe3ff, transparent), radial-gradient(1.5px 1.5px at 94% 12%, #fff, transparent), radial-gradient(1px 1px at 6% 90%, #fff, transparent); }
:root[data-theme="light"] .stars-bg::before { display: none; }
.klogo { font: 800 calc(19px * var(--k))/1 var(--display); letter-spacing: 0; display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.klogo i { font-style: normal; color: #6cc0ff; text-shadow: 0 2px 0 #1348a8; } .klogo b { color: var(--gold); text-shadow: 0 2px 0 #a85a00; }
:root[data-theme="light"] .klogo i { color: #1f6fe0; text-shadow: none; } :root[data-theme="light"] .klogo b { color: #e08a00; text-shadow: none; }
.klogo img { width: 36px; height: 36px; border-radius: 11px; }
.knav { display: flex; align-items: center; gap: 12px; padding: calc(9px * var(--k)) 12px; margin: 3px 0; border-radius: 16px; color: var(--text); text-decoration: none; border: 2px solid transparent; font-weight: 600; font-size: calc(15px * var(--k)); cursor: pointer; background: none; width: 100%; text-align: left; }
.knav .ico { width: calc(38px * var(--k)); height: calc(38px * var(--k)); display: grid; place-items: center; border-radius: 13px; font-size: calc(20px * var(--k)); flex: none; background: color-mix(in srgb, var(--c, var(--blue)) 26%, var(--panel)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c, var(--blue)) 55%, transparent); }
.knav:hover { background: var(--panel); border-color: var(--line); }
.knav.active { background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--blue)) 42%, var(--panel)), var(--panel)); border-color: color-mix(in srgb, var(--c, var(--blue)) 80%, #fff 0%); box-shadow: 0 0 18px color-mix(in srgb, var(--c, var(--blue)) 40%, transparent); }
.knav.active .ico { background: var(--c, var(--blue)); }
.kchipbar { display: flex; align-items: center; gap: 8px; }
.kstat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; color: var(--text); cursor: pointer; }
.kstat.star { border-color: color-mix(in srgb, var(--gold) 70%, transparent); } .kstat.star b { color: var(--gold); }
.kstat.time.low { border-color: var(--warn); color: var(--warn); }
.kme { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line2); color: var(--text); text-decoration: none; font-weight: 700; cursor: pointer; }
.kme .av, .av-chip { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--panel3); flex: none; display: grid; place-items: center; }
.kme .av svg, .av-chip svg { width: 100%; height: 100%; display: block; }
.grownup-btn { border: 2px dashed var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.grownup-btn:hover { color: var(--text); border-style: solid; }

/* ---------- page head ---------- */
.khead { display: flex; align-items: center; gap: 12px; margin-bottom: calc(14px * var(--k)); flex-wrap: wrap; }
.khead .back { width: calc(46px * var(--k)); height: calc(46px * var(--k)); border-radius: 50%; border: 2px solid var(--line2); background: var(--panel); color: var(--text); font-size: calc(20px * var(--k)); cursor: pointer; display: grid; place-items: center; flex: none; text-decoration: none; }
.khead .emoji { width: calc(52px * var(--k)); height: calc(52px * var(--k)); border-radius: 18px; display: grid; place-items: center; font-size: calc(28px * var(--k)); background: linear-gradient(160deg, color-mix(in srgb, var(--c, var(--blue)) 90%, #fff), var(--c, var(--blue))); box-shadow: 0 6px 0 color-mix(in srgb, var(--c, var(--blue)) 55%, #000), 0 0 22px color-mix(in srgb, var(--c, var(--blue)) 50%, transparent); flex: none; }
.khead .title { flex: 1; min-width: 180px; } .khead h1 { margin: 0; font-size: calc(26px * var(--k)); } .khead p { margin: 2px 0 0; color: var(--muted); }
.khead .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards & tiles ---------- */
.kcard { background: linear-gradient(180deg, color-mix(in srgb, var(--c, var(--blue)) 12%, var(--panel)), var(--panel)); border: 2px solid color-mix(in srgb, var(--c, var(--blue)) 70%, var(--line)); border-radius: var(--kr); padding: var(--kpad); box-shadow: 0 0 20px color-mix(in srgb, var(--c, var(--blue)) 22%, transparent), var(--shadow); min-width: 0; position: relative; }
.kcard > h2, .kcard > h3 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: calc(17px * var(--k)); }
.kcard > h2 .e, .kcard > h3 .e { font-size: 1.2em; }
.kcard.flat { box-shadow: none; }
.kgrid { display: grid; gap: calc(14px * var(--k)); grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--k)), 1fr)); }
.kgrid.big { grid-template-columns: repeat(auto-fill, minmax(calc(220px * var(--k)), 1fr)); }
.kgrid.small { grid-template-columns: repeat(auto-fill, minmax(calc(104px * var(--k)), 1fr)); gap: 10px; }
.kgrid > *, .kcols > * { min-width: 0; }
.kcols { display: grid; gap: calc(14px * var(--k)); grid-template-columns: repeat(2, minmax(0, 1fr)); } .kcols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kcols.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
/* a tile is blue unless it says which place it belongs to (c-math, c-games …): :where() keeps this default weaker than those classes */
:where(.ktile) { --c: var(--blue); }
.ktile { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: calc(118px * var(--k)); padding: 12px 10px; border-radius: var(--kr); cursor: pointer; text-decoration: none; color: var(--ci, #fff); font-weight: 700; font-size: calc(15px * var(--k)); border: 0; position: relative; overflow: hidden;
  background: linear-gradient(165deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 72%, #000)); box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 55%, #000), 0 10px 22px rgba(0,0,0,.3); transition: transform .12s var(--ease), box-shadow .12s; }
.ktile::after { content: ""; position: absolute; left: 8%; right: 8%; top: 5%; height: 34%; border-radius: 999px; background: linear-gradient(180deg, rgba(255,255,255,.34), transparent); pointer-events: none; }
.ktile:hover { transform: translateY(-3px); } .ktile:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 55%, #000); }
.ktile .e { font-size: calc(38px * var(--k)); line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); } .ktile small { font-weight: 500; opacity: .92; font-size: .82em; }
.ktile.locked { filter: grayscale(.85) brightness(.7); } .ktile .tag { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.35); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.ktile.done::before { content: "✓"; position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--c); display: grid; place-items: center; font-size: 14px; z-index: 1; }
.krow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--panel2); border: 2px solid var(--line); min-width: 0; text-decoration: none; color: var(--text); }
.krow.click { cursor: pointer; } .krow.click:hover { border-color: var(--line2); }
.krow .e { font-size: calc(24px * var(--k)); flex: none; } .krow .main { flex: 1; min-width: 0; } .krow .main b { display: block; } .krow .main small { color: var(--muted); display: block; }
.krow.done .main b { text-decoration: line-through; opacity: .7; }

/* ---------- buttons ---------- */
.kbtn { --c: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: calc(48px * var(--k)); padding: 8px calc(20px * var(--k)); border-radius: 999px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 700; font-size: calc(15.5px * var(--k)); color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c)); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 55%, #000), 0 8px 18px color-mix(in srgb, var(--c) 35%, transparent); transition: transform .1s, box-shadow .1s, filter .1s; }
.kbtn:hover { filter: brightness(1.08); } .kbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 55%, #000); }
.kbtn.gold { --c: #f5a800; color: #2a1a00; } .kbtn.green { --c: #1fb863; } .kbtn.red { --c: #ef4a63; } .kbtn.purple { --c: #8a5bff; } .kbtn.pink { --c: #ff5d9e; } .kbtn.orange { --c: #ff8a3d; }
.kbtn.ghost { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 2px var(--line2); } .kbtn.ghost:active { transform: translateY(1px); box-shadow: inset 0 0 0 2px var(--line2); }
.kbtn.sm { min-height: calc(38px * var(--k)); padding: 4px 14px; font-size: calc(13.5px * var(--k)); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 55%, #000); } .kbtn.ghost.sm { box-shadow: inset 0 0 0 2px var(--line2); }
.kbtn.big { min-height: calc(60px * var(--k)); font-size: calc(19px * var(--k)); padding: 10px 30px; } .kbtn.block { width: 100%; }
.kbtn.round { width: calc(54px * var(--k)); min-height: calc(54px * var(--k)); padding: 0; font-size: calc(22px * var(--k)); border-radius: 50%; }
.kbtn[disabled] { filter: grayscale(.8) brightness(.75); cursor: not-allowed; }
.kbtn.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.kchip { display: inline-flex; align-items: center; gap: 6px; padding: calc(7px * var(--k)) calc(14px * var(--k)); border-radius: 999px; border: 2px solid var(--line2); background: var(--chip); color: var(--text); cursor: pointer; font-weight: 600; font-size: calc(14px * var(--k)); }
.kchip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink, #2a1a00); } .kchips { display: flex; flex-wrap: wrap; gap: 8px; }
.kswatch { width: calc(38px * var(--k)); height: calc(38px * var(--k)); border-radius: 50%; border: 3px solid rgba(255,255,255,.75); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.35); padding: 0; } .kswatch.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.ktoolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; border-radius: 18px; background: var(--panel2); border: 2px solid var(--line); }
.ktool { width: calc(46px * var(--k)); height: calc(46px * var(--k)); border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--text); font-size: calc(21px * var(--k)); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ktool.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 28%, var(--panel)); }

/* ---------- progress, stars, badges ---------- */
.kbar { height: calc(14px * var(--k)); border-radius: 999px; background: var(--panel3); overflow: hidden; box-shadow: inset 0 0 0 2px var(--line); }
.kbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c, var(--gold)), color-mix(in srgb, var(--c, var(--gold)) 70%, #fff)); transition: width .4s var(--ease); }
.kstars { letter-spacing: 2px; color: var(--gold); font-size: calc(20px * var(--k)); } .kstars .off { opacity: .25; }
.kbadge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: calc(12.5px * var(--k)); font-weight: 600; }
.kbadge .m { width: calc(72px * var(--k)); height: calc(72px * var(--k)); border-radius: 50%; display: grid; place-items: center; font-size: calc(34px * var(--k)); background: radial-gradient(circle at 35% 30%, #fff6c9, #ffcb3d 55%, #d48a00); box-shadow: 0 4px 0 #a86a00, 0 0 18px rgba(255,203,61,.45); }
.kbadge.off .m { background: var(--panel3); box-shadow: inset 0 0 0 2px var(--line); filter: grayscale(1); opacity: .55; }
.kstatus { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: 2px solid var(--line2); }
.kstatus.demonstrated { color: var(--ok); border-color: var(--ok); } .kstatus.developing { color: var(--blue2); border-color: var(--blue2); } .kstatus.practice { color: var(--warn); border-color: var(--warn); } .kstatus.none { color: var(--muted); }

/* ---------- speech bubble & buddy ---------- */
.kbubble { position: relative; background: #fff; color: #14204a; border-radius: 20px; padding: 12px 16px; font-weight: 500; box-shadow: 0 6px 18px rgba(0,0,0,.25); max-width: 520px; }
.kbubble::after { content: ""; position: absolute; left: -9px; bottom: 18px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
.kbubble.down::after { left: 30px; bottom: -9px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }
.kbubble b { color: #1f6fe0; }
.buddy-row { display: flex; align-items: flex-end; gap: 12px; }
.buddy-row .who { width: calc(96px * var(--k)); flex: none; } .buddy-row .who svg { width: 100%; height: auto; display: block; }
/* the helper button: the buddy's face and “Ask …”. It sits in the top bar on every device (kid.js puts it into .fab-slot), so it never covers anything on the page. */
.fab-slot { display: flex; align-items: center; flex: none; } .fab-slot:empty { display: none; }
#helperFab { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; height: 48px; min-width: 48px; padding: 0 16px 0 3px; border-radius: 999px; border: 2px solid #fff; background: linear-gradient(160deg, #6cc0ff, #2f6fe0); color: #fff; font: 800 15px/1 var(--font); white-space: nowrap; box-shadow: 0 3px 0 rgba(0,0,0,.2); cursor: pointer; transition: transform .16s var(--spring, ease); }
#helperFab > :first-child { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; background: rgba(255,255,255,.28); }
#helperFab svg { width: 100%; height: 100%; display: block; } #helperFab:hover { transform: scale(1.05); } #helperFab:active { transform: scale(.95); }
#helperFab.away { visibility: hidden; }
.helper { position: fixed; z-index: 70; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: min(420px, calc(calc(100 * var(--vw)) - 28px)); height: min(640px, calc(calc(100 * var(--dvh)) - 90px)); display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--line2); border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 30px rgba(47,143,255,.3); overflow: hidden; animation: fadein .2s var(--ease); }
.helper .hh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 35%, var(--panel)), var(--panel)); border-bottom: 2px solid var(--line); }
.helper .hh .who { width: 46px; height: 46px; border-radius: 50%; background: var(--panel3); overflow: hidden; flex: none; display: grid; place-items: center; font-size: 26px; }
.helper .hh .who svg { width: 100%; height: 100%; }
.helper .hh b { display: block; } .helper .hh small { color: var(--muted); display: block; font-size: 11.5px; line-height: 1.25; }
.helper .tutors { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; border-bottom: 1px solid var(--line); scrollbar-width: none; flex: none; } .helper .tutors::-webkit-scrollbar { display: none; }
.helper .tutors button { flex: none; border: 2px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.helper .tutors button.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink, #2a1a00); }
.helper .log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.helper .msg { max-width: 90%; font-size: calc(14.5px * var(--k)); } .helper .msg.card { align-self: stretch; max-width: none; background: color-mix(in srgb, var(--gold) 14%, var(--panel)); border: 2px solid var(--gold); border-radius: 18px; }
.helper .starters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; flex: none; }
.helper .starters button { border: 2px solid var(--line2); background: var(--chip); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.helper .inp { display: flex; gap: 8px; padding: 10px; border-top: 2px solid var(--line); background: var(--bg2); align-items: flex-end; flex: none; }
.helper .inp textarea { min-height: 46px; max-height: 120px; resize: none; border-radius: 16px; }
.helper .note { font-size: 11px; color: var(--faint); text-align: center; padding: 0 10px 8px; background: var(--bg2); flex: none; }

/* ---------- stage (games, drawing, worlds) ---------- */
.kstage { position: relative; border-radius: var(--kr); overflow: hidden; border: 3px solid color-mix(in srgb, var(--c, var(--blue)) 75%, #fff 0%); background: #0a1238; box-shadow: 0 0 26px color-mix(in srgb, var(--c, var(--blue)) 35%, transparent); touch-action: none; user-select: none; -webkit-user-select: none; }
.kstage canvas, .kstage svg.fill { display: block; width: 100%; height: auto; }
.kstage .hud { position: absolute; left: 10px; right: 10px; top: 8px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; font-weight: 700; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.kstage .hud > * { background: rgba(5,10,36,.6); border-radius: 999px; padding: 4px 12px; }
.kstage .center-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: rgba(5,10,36,.72); color: #fff; padding: 16px; }
.kpad { display: grid; grid-template-columns: repeat(3, calc(60px * var(--k))); gap: 6px; justify-content: center; } .kpad button { height: calc(56px * var(--k)); }
.kanswers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kanswer { min-height: calc(60px * var(--k)); border-radius: 18px; border: 3px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 700; font-size: calc(18px * var(--k)); cursor: pointer; padding: 8px 12px; }
.kanswer:hover { border-color: var(--blue2); } .kanswer.right { background: #1fb863; border-color: #7dffb5; color: #fff; } .kanswer.wrong { background: #ef4a63; border-color: #ffb0bd; color: #fff; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.kquestion { font-size: calc(26px * var(--k)); font-weight: 700; text-align: center; padding: 16px; line-height: 1.3; }
.kinput { font-size: calc(20px * var(--k)) !important; text-align: center; border-radius: 16px !important; border-width: 3px !important; min-height: calc(56px * var(--k)) !important; }

/* ---------- celebrations ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(calc(110 * var(--vh))) rotate(720deg); } }
.starburst { position: fixed; left: 50%; top: 42%; z-index: 151; transform: translate(-50%, -50%); pointer-events: none; text-align: center; animation: pop .9s var(--ease) forwards; font-weight: 800; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.35); font-size: 30px; }
.starburst .big { font-size: 96px; line-height: 1; display: block; filter: drop-shadow(0 0 24px rgba(255,203,61,.9)); }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -70%) scale(1); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.bob { animation: bob 3.2s ease-in-out infinite; } .wiggle { animation: wiggle 1.6s ease-in-out infinite; transform-origin: 50% 90%; }

/* ---------- full-screen moments: who is learning, PIN, grown-up gate, time is up ---------- */
.kfull { min-height: 100%; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.kfull .box { width: min(760px, 100%); text-align: center; }
.kfull h1 { font-size: clamp(26px, calc(5 * var(--vw)), 44px); margin-bottom: 6px; }
.who-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin: 22px 0; }
.who { width: 150px; border: 0; background: none; color: var(--text); cursor: pointer; text-align: center; font-weight: 700; font-size: 17px; padding: 0; }
.who .pic { width: 132px; height: 132px; margin: 0 auto 8px; border-radius: 50%; overflow: hidden; background: var(--panel2); border: 4px solid var(--line2); box-shadow: var(--glow); transition: transform .15s var(--ease), border-color .15s; display: grid; place-items: center; font-size: 54px; }
.who:hover .pic { transform: scale(1.06); border-color: var(--gold); } .who .pic svg { width: 100%; height: 100%; display: block; } .who small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 74px); gap: 10px; justify-content: center; margin: 14px auto; }
.pinpad button { height: 66px; border-radius: 20px; border: 2px solid var(--line2); background: var(--panel2); color: var(--text); font-size: 26px; font-weight: 700; cursor: pointer; }
.pinpad button:active { background: var(--blue); }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 12px 0; min-height: 22px; } .pindots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); } .pindots i.on { background: var(--gold); border-color: var(--gold); }
.timeup { position: fixed; inset: 0; z-index: 190; display: grid; place-items: center; padding: 20px; background: var(--sky); text-align: center; overflow: auto; }

/* ---------- welcome ---------- */
.welcome { min-height: 100%; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); text-align: center; }
.welcome .title { font: 800 clamp(40px, calc(9 * var(--vw)), 92px)/.95 var(--display); margin: 0; }
.welcome .title i { font-style: normal; display: block; color: #6cc0ff; text-shadow: 0 4px 0 #1348a8, 0 8px 24px rgba(47,143,255,.6); }
.welcome .title b { display: block; color: #ffcb3d; text-shadow: 0 4px 0 #b26a00, 0 8px 24px rgba(255,170,30,.5); }
.welcome .tagline { font-size: clamp(15px, calc(2.4 * var(--vw)), 21px); color: var(--muted); margin: 14px 0 22px; }
.doors { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.door { width: min(300px, 100%); padding: 22px 18px; border-radius: 28px; border: 3px solid var(--line2); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; box-shadow: var(--glow); transition: transform .15s var(--ease); font-weight: 700; font-size: 20px; }
.door:hover { transform: translateY(-4px); border-color: var(--gold); } .door .e { font-size: 64px; display: block; line-height: 1.1; } .door small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; margin-top: 4px; }
.mascots { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 4px 0 10px; } .mascots svg { width: clamp(84px, calc(16 * var(--vw)), 150px); height: auto; }

/* ---------- tablet & phone ---------- */
@media (max-width: 1023px) {
  /* the frame for phones and tablets (bottom bar, the “More” sheet) is in area-look.css */
  .kcols.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 699px) {
  .kcols, .kcols.c3, .kcols.wide-left { grid-template-columns: minmax(0, 1fr); }
  .klogo span.txt { display: none; } .kme .nm { display: none; } .kme { padding: 3px; } .grownup-btn span { display: none; }
  .kgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kgrid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kgrid.big { grid-template-columns: minmax(0, 1fr); }
  .helper { right: 0; left: 0; bottom: 0; width: auto; height: min(calc(86 * var(--dvh)), 700px); border-radius: 24px 24px 0 0; }
  .who { width: 124px; } .who .pic { width: 108px; height: 108px; }
  .pinpad { grid-template-columns: repeat(3, 68px); } .khead h1 { font-size: calc(21px * var(--k)); }
  .kquestion { font-size: calc(21px * var(--k)); }
}
@media (prefers-reduced-motion: reduce) { .bob, .wiggle { animation: none; } .confetti { display: none; } }
body.calm .bob, body.calm .wiggle { animation: none; } body.calm .confetti { display: none; } body.calm .kcard, body.calm .kstage { box-shadow: none; }

/* ---------- avatar movement (the drawings come from avatars.js) ---------- */
svg.avatar { display: block; overflow: visible; }
/* 3D characters: a box the same shape as the flat drawing, with a canvas inside. While a character waves, cheers or acts out a gesture its canvas is half as big
   again as its box, so a raised arm or a jump is not cut off (the same number is OVER in avatar3d.js). */
.avatar3d { display: block; position: relative; width: 100%; aspect-ratio: 212 / 262; line-height: 0; }
.avatar3d.face { aspect-ratio: 1; }
.avatar3d > canvas, .kstage .avatar3d > canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; display: block; pointer-events: none; }
.avatar3d.av-wave:not(.face) > canvas, .avatar3d.av-cheer:not(.face) > canvas, .avatar3d[data-gesture]:not(.face) > canvas { left: -25%; top: -25%; width: 150%; height: 150%; }
svg.avsnap.av-talk { animation: av-snapbob .5s ease-in-out infinite alternate; } svg.avsnap.av-cheer, svg.avsnap.av-wave { animation: av-jump .5s ease-in-out infinite alternate; }
@keyframes av-snapbob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
svg.avatar .av-eye { animation: av-blink 4.6s infinite; }
@keyframes av-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
svg.av-idle .av-head { animation: av-nod 4s ease-in-out infinite; transform-origin: 100px 140px; }
@keyframes av-nod { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
svg.avatar .av-tail { animation: av-wag 1.1s ease-in-out infinite; transform-origin: 136px 204px; }
@keyframes av-wag { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
svg.avatar .av-blinker { animation: av-pulse 1.6s ease-in-out infinite; }
@keyframes av-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
svg.avatar .av-spin { animation: av-spin .5s linear infinite; }
@keyframes av-spin { 0% { transform: scaleX(1); } 50% { transform: scaleX(.15); } 100% { transform: scaleX(1); } }
svg.avatar .av-flame { animation: av-flame .25s ease-in-out infinite alternate; transform-origin: 100px 204px; }
@keyframes av-flame { from { transform: scaleY(.8); } to { transform: scaleY(1.2); } }
svg.av-talk .av-mouth { animation: av-talk .28s ease-in-out infinite alternate; transform-origin: 100px 124px; }
@keyframes av-talk { from { transform: scaleY(.5); } to { transform: scaleY(1.5); } }
svg.av-wave .av-arm-r, svg.av-cheer .av-arm-r { animation: av-wave .5s ease-in-out infinite alternate; transform-origin: 138px 166px; }
@keyframes av-wave { from { transform: rotate(-80deg); } to { transform: rotate(-112deg); } }
svg.av-cheer { animation: av-jump .5s ease-in-out infinite alternate; }
@keyframes av-jump { from { transform: translateY(0); } to { transform: translateY(-5%); } }
@media (prefers-reduced-motion: reduce) { svg.avatar * , svg.avatar { animation: none !important; } }
body.calm svg.avatar *, body.calm svg.avatar { animation: none !important; }
.kbtn { max-width: 100%; }
@media (max-width: 699px) { .kbtn { white-space: normal; text-align: center; line-height: 1.2; } .kbtn.round { white-space: nowrap; } }
.helper { animation-name: fadein-sheet; }   /* 12.9: the helper sits on the bottom edge; it fades in without sliding, so it never hangs below the screen while it appears */
.door.door-test { border-color: #2fd3a0; box-shadow: 0 0 0 3px #2fd3a033, var(--glow); }
/* 12.9.2: the welcome page always sits on the starry night sky, so its words stay light in every theme */
body.stars-bg .welcome .tagline, body.stars-bg .welcome > div > h2, body.stars-bg .welcome > div > p.muted { color: #dce8ff; }
body.stars-bg .welcome > div > p.small.muted a { color: #9fd0ff; }
