/* Learning Land — styles. Theme colours come from --bg1/--bg2/--accent/--accent2,
   set per child in app.js. Built for tablets and touch first. */
:root {
  --bg1: #fff3c4; --bg2: #ffd1f0; --accent: #7c4dff; --accent2: #ff7ab8;
  --ink: #2b2745; --muted: #6b6785; --card: #ffffff; --line: #e7e3f2;
  --good: #2bb673; --bad: #ef5b5b; --warn: #f5a524;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(43, 39, 69, .12), 0 10px 24px rgba(43, 39, 69, .10);
  --font-read: "Andika", "Comic Sans MS", "Chalkboard SE", "Comic Neue", sans-serif;
  --font-fun: "Fredoka", "Andika", "Comic Sans MS", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { touch-action: manipulation; }  /* no double-tap zoom when little fingers tap fast */
body {
  font-family: var(--font-read);
  color: var(--ink);
  background: var(--bg1);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }

/* Floating theme emoji in the background */
#backdrop { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; background: linear-gradient(160deg, var(--bg1), var(--bg2)); }
#backdrop span { position: absolute; opacity: .16; animation: floaty 18s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-28px) rotate(6deg); } }

#app { position: relative; z-index: 1; }
.screen { max-width: 1040px; margin: 0 auto; padding: 16px 16px 48px; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.center-screen { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.big-emoji { font-size: 90px; }

h1, h2, .logo, .title { font-family: var(--font-fun); }
.logo { text-align: center; font-size: clamp(2.4rem, 7vw, 4rem); margin: 28px 0 4px; color: var(--accent); text-shadow: 0 4px 0 rgba(255, 255, 255, .8); }
h1.title { text-align: center; font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 8px 0 18px; color: var(--accent); }
.sub { text-align: center; font-size: clamp(1.1rem, 3vw, 1.4rem); color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .95rem; }

/* Buttons */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-family: var(--font-fun); font-size: 1.1rem; font-weight: 700;
  box-shadow: var(--shadow); background: var(--card); text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .1s; color: var(--ink);
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 39, 69, .15); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: var(--accent2); color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, .85); }
.btn.danger { background: #fff; color: var(--bad); }
.btn.big { font-size: clamp(1.15rem, 3vw, 1.45rem); padding: 16px 28px; }
.btn.small { font-size: .95rem; padding: 8px 14px; }
.row { display: flex; gap: 12px; margin-top: 16px; align-items: center; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 0; margin-left: auto; }

.mute {
  position: fixed; right: 12px; bottom: 12px; z-index: 30; width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .9); font-size: 26px; box-shadow: var(--shadow);
}

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tb-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip { background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 1.05rem; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }

/* Player picker */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; max-width: 900px; margin: 0 auto; }
.profile-tile {
  border: 6px solid var(--c, var(--accent)); background: linear-gradient(180deg, #fff, var(--c2, #fff)); border-radius: 28px;
  padding: 22px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s;
}
.profile-tile:hover { transform: translateY(-4px) rotate(-1deg); }
.profile-tile .av { font-size: 84px; line-height: 1; }
.profile-tile .nm { font-family: var(--font-fun); font-size: 1.7rem; font-weight: 700; }
.profile-tile .meta { color: var(--muted); font-size: 1.05rem; }
.profile-tile.add { border-style: dashed; border-color: #b9b3d6; background: rgba(255, 255, 255, .7); }
.grownups { display: flex; margin: 36px auto 0; }

/* Home */
.hello { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 12px 0 22px; }
.av-big { font-size: 88px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .1)); }
.bubble {
  background: #fff; border-radius: 26px; padding: 16px 24px; font-family: var(--font-fun); font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700; box-shadow: var(--shadow); position: relative; color: var(--accent);
}
.bubble small { display: block; font-family: var(--font-read); font-size: 1.05rem; color: var(--muted); font-weight: 400; }
.subject-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.subject-grid .subject-card { flex: 1 1 28%; max-width: calc((100% - 36px) / 3); }
.subject-card {
  border: 0; border-radius: 30px; padding: 26px 10px; box-shadow: var(--shadow); color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s;
}
.subject-card:hover { transform: translateY(-5px) scale(1.02); }
.subject-card .icon { font-size: clamp(56px, 10vw, 84px); line-height: 1.1; }
.subject-card .title { font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 700; }
.s-reading { background: linear-gradient(160deg, #ff7eb3, #ff4f8b); }
.s-writing { background: linear-gradient(160deg, #7ccfff, #3a8dff); }
.s-math { background: linear-gradient(160deg, #8ee07a, #2fb66b); }
.s-science { background: linear-gradient(160deg, #b18cff, #7048e8); }
.s-garden { background: linear-gradient(160deg, #ffc56b, #f08c00); }
.s-coding { background: linear-gradient(160deg, #5ce1e6, #1098ad); }
.s-geography { background: linear-gradient(160deg, #6fd3a8, #0c8f72); }
.s-history { background: linear-gradient(160deg, #e0a37a, #a0522d); }
.subject-card .pips span { color: rgba(255, 255, 255, .45); }
.subject-card .pips span.on { color: #ffe066; }
.pips { font-size: 1.4rem; letter-spacing: 2px; white-space: nowrap; }
.pips span { color: #d8d4e8; }
.pips span.on { color: #f5b301; }

/* Subject → skill cards */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.skill-card {
  position: relative; border: 0; background: #fff; border-radius: 24px; padding: 18px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px; border-bottom: 6px solid var(--accent);
}
.skill-card:hover { transform: translateY(-3px); }
.skill-card .icon { font-size: 54px; }
.skill-card .title { font-family: var(--font-fun); font-size: 1.35rem; font-weight: 700; }
.skill-card .desc { color: var(--muted); font-size: .98rem; text-align: center; }
.badge { position: absolute; top: 10px; right: 10px; background: var(--accent2); color: #fff; font-weight: 700; border-radius: 999px; padding: 2px 10px; font-size: .85rem; transform: rotate(8deg); }

/* Round */
.round-title { font-family: var(--font-fun); font-weight: 700; color: var(--accent); }
.dots { display: inline-flex; gap: 6px; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, .8); border: 2px solid rgba(0, 0, 0, .1); }
.dot.now { background: var(--accent2); transform: scale(1.25); }
.dot.good { background: var(--good); }
.dot.miss { background: var(--warn); }

.qbody { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.prompt { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 24px; padding: 12px 18px 12px 12px; box-shadow: var(--shadow); max-width: 820px; width: 100%; }
.prompt .speak { flex: none; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); font-size: 28px; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.prompt-text { font-size: clamp(1.25rem, 3.6vw, 1.75rem); font-weight: 700; line-height: 1.3; }

.stage { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 40px; }
.stage:empty { display: none; }
.big {
  border: 0; background: #fff; border-radius: 28px; box-shadow: var(--shadow); padding: 4px 34px;
  font-size: clamp(3.5rem, 13vw, 7rem); font-weight: 700; line-height: 1.25; color: var(--accent); font-family: var(--font-read);
}
.story { border: 0; background: #fffbe8; border-radius: 20px; padding: 16px 22px; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.5; box-shadow: var(--shadow); max-width: 760px; font-family: var(--font-read); }
.visual { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pic { font-size: clamp(5rem, 16vw, 8rem); line-height: 1.1; }
.pic.tap { border: 0; background: #fff; border-radius: 30px; padding: 6px 26px; box-shadow: var(--shadow); }
.picword { font-size: 2rem; font-weight: 700; letter-spacing: 2px; }
.objs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; max-width: 560px; font-size: clamp(2.2rem, 7vw, 3.4rem); background: rgba(255, 255, 255, .75); border-radius: 22px; padding: 10px 14px; }
.objs.many { font-size: clamp(1.8rem, 5vw, 2.6rem); max-width: 520px; }
.objs .gone { opacity: .25; filter: grayscale(1); position: relative; }
.objs .gone::after { content: '✖'; position: absolute; left: 0; right: 0; text-align: center; color: var(--bad); opacity: 1; font-size: .9em; }
.eq { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.eq .objs { max-width: 260px; }
.op { font-size: 3rem; font-weight: 700; color: var(--accent); }
.eqtext { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 700; }
.eqtext.huge { font-size: clamp(3rem, 12vw, 5.5rem); background: #fff; border-radius: 26px; padding: 6px 30px; box-shadow: var(--shadow); }
.shape { width: clamp(150px, 34vw, 220px); height: auto; fill: var(--accent2); stroke: var(--accent); stroke-width: 4; stroke-linejoin: round; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .1)); }
.pattern { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; background: rgba(255, 255, 255, .8); padding: 12px 16px; border-radius: 22px; font-size: clamp(2.2rem, 7vw, 3.4rem); }
/* compass town map (geography) */
.cmap { display: grid; grid-template-columns: 1.4em repeat(3, 1.8em) 1.4em; grid-template-rows: 1.2em repeat(3, 1.8em) 1.2em; gap: 6px;
  justify-content: center; align-items: center; justify-items: center; font-size: clamp(2.2rem, 8vw, 3.4rem);
  background: rgba(255, 255, 255, .85); padding: 10px 14px; border-radius: 22px; margin: 0 auto; width: max-content; }
.cmap .cm-cell { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #e8f5e9; border-radius: 14px; }
.cmap .cm-dir { font-size: .55em; font-weight: 700; color: var(--accent); }
.pattern .q { color: var(--accent); font-weight: 700; border: 4px dashed var(--accent); border-radius: 14px; padding: 0 12px; }

/* Answer buttons */
.answers { display: grid; gap: 14px; width: 100%; max-width: 820px; grid-template-columns: repeat(3, 1fr); }
.answers.n2 { grid-template-columns: repeat(2, 1fr); }
.answers.n4 { grid-template-columns: repeat(4, 1fr); }
.answer {
  border: 0; background: #fff; border-radius: 24px; min-height: 96px; padding: 10px; box-shadow: var(--shadow);
  font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 700; transition: transform .1s, background .2s; font-family: var(--font-read);
}
.answer:hover:not(:disabled) { transform: translateY(-3px); }
.answer:active:not(:disabled) { transform: translateY(3px); }
.answer.letter, .answer.num { font-size: clamp(2.6rem, 8vw, 3.6rem); }
.answer.emoji { font-size: clamp(3rem, 9vw, 4.2rem); }
.answer.word { font-size: clamp(1.5rem, 4.5vw, 2.2rem); }
.answer.sentence { font-size: clamp(1.15rem, 3.6vw, 1.6rem); text-align: left; padding: 14px 20px; }
.answers:has(.sentence) { grid-template-columns: 1fr; }
.answer.group { font-size: clamp(1.6rem, 4.5vw, 2.3rem); display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 2px 6px; min-height: 140px; }
.answer.big-num { font-size: clamp(3.5rem, 12vw, 5rem); min-height: 130px; }
.answer.right { background: var(--good); color: #fff; animation: bounce .5s; }
.answer.wrong { background: #ffe1e1; color: #c44; animation: shake .4s; opacity: .7; }
.answer.reveal { background: #e2fbe9; outline: 5px solid var(--good); animation: pulse 1s infinite; }
@keyframes bounce { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes pulse { 50% { transform: scale(1.05); } }
.shake { animation: shake .4s; }

/* Grades 2–5 */
.story.long { font-size: clamp(1.1rem, 2.8vw, 1.45rem); text-align: left; line-height: 1.6; }
.vert { display: inline-grid; justify-items: end; background: #fff; border-radius: 24px; padding: 10px 30px 14px; box-shadow: var(--shadow);
  font-size: clamp(2.6rem, 9vw, 4.2rem); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.vert > div:last-child { border-bottom: 5px solid var(--ink); padding-bottom: 4px; }
.vop { color: var(--accent); margin-right: .4em; }
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 .1em; }
.fr > span:first-child { border-bottom: .08em solid currentColor; padding: 0 .15em; }
.answer.fracopt { font-size: clamp(2rem, 6vw, 2.8rem); }
.fbar { width: min(320px, 80vw); height: auto; }
.fbar .on { fill: var(--accent2); stroke: var(--accent); stroke-width: 3; }
.fbar .off { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.visual .eq .fbar { width: min(240px, 40vw); }
.clock { width: clamp(180px, 40vw, 250px); height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .1)); }
.clock .face { fill: #fff; stroke: var(--accent); stroke-width: 6; }
.clock .num { font: 700 20px var(--font-read); text-anchor: middle; fill: var(--ink); }
.clock .tick { stroke: #b9b3cf; stroke-width: 2; }
.clock .hour { stroke: var(--accent); stroke-width: 9; stroke-linecap: round; }
.clock .minute { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.clock .pin, .geo .pin { fill: var(--ink); }
.coins { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; background: rgba(255, 255, 255, .75); border-radius: 22px; padding: 12px 16px; max-width: 560px; }
.coin { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: #3b3650;
  background: radial-gradient(circle at 35% 30%, #fafafa, #b8bcc6); border: 3px solid #8d929e; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.coin.c-p { width: 62px; height: 62px; background: radial-gradient(circle at 35% 30%, #f3b98a, #b8692f); border-color: #8c4a1c; color: #fff; }
.coin.c-n { width: 70px; height: 70px; }
.coin.c-d { width: 56px; height: 56px; font-size: .9rem; }
.coin.c-q { width: 82px; height: 82px; font-size: 1.15rem; }
.geo { width: min(320px, 80vw); height: auto; }
.geo .ray { stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.geo .mark { fill: none; stroke: var(--accent2); stroke-width: 4; }
.geo .fill { fill: color-mix(in srgb, var(--accent2) 35%, white); stroke: var(--accent); stroke-width: 4; }
.geo .top { fill: color-mix(in srgb, var(--accent2) 20%, white); stroke: var(--accent); stroke-width: 4; }
.geo .side { fill: color-mix(in srgb, var(--accent2) 55%, white); stroke: var(--accent); stroke-width: 4; }
.geo .lbl { font: 700 20px var(--font-read); fill: var(--ink); text-anchor: middle; }
.geo .lbl.start { text-anchor: start; }
.geo .lbl.end { text-anchor: end; }
.groups { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.groups .objs { font-size: clamp(1.6rem, 5vw, 2.4rem); padding: 8px 10px; max-width: 180px; }
.pic.small { font-size: clamp(2.4rem, 7vw, 3.4rem); }
.slots.long { gap: 6px; }
.slots.long .slot { width: 46px; height: 58px; font-size: 2rem; border-width: 3px; border-radius: 12px; }
.tiles.long { gap: 8px; max-width: 760px; }
.tiles.long .tile { width: 58px; height: 58px; font-size: 2rem; }

/* Science & Garden */
.plant { width: clamp(150px, 34vw, 210px); height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .1)); }
.plant .soil { fill: #e8d3b8; }
.plant .dim { fill: #e4e0ef; stroke: #c9c3dc; stroke-width: 3; }
.plant g[fill="none"] { fill: none; }
.plant g.dim[fill="none"] { stroke-width: 6; }
.plant .roots { stroke: #8b5a2b; stroke-width: 7; }
.plant .stem { stroke: #2f9e44; stroke-width: 10; }
.plant .leaves { fill: #51cf66; stroke: #2b8a3e; stroke-width: 3; }
.plant .flower { fill: var(--accent2); stroke: var(--accent); stroke-width: 3; }
.plant .flower .mid { fill: #ffd43b; }
.plant .dim .mid { fill: #e4e0ef; }
.pattern .arrow { color: var(--muted); font-size: .7em; align-self: center; }

/* Coding: jigsaw pieces. The right-hand tab of one piece sits in the left-hand notch of the next. */
.jig { --jc: #4c8dff; position: relative; display: inline-flex; align-items: center; gap: 4px; height: 58px; padding: 0 18px 0 20px;
  border-radius: 10px; color: #fff; font-weight: 700; font-size: 1.9rem; font-family: var(--font-fun); line-height: 1;
  background: radial-gradient(circle at 0 50%, transparent 10px, var(--jc) 10.5px); }   /* the notch is a real hole, so the previous tab shows through */
.jig::after { content: ''; position: absolute; right: -9px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--jc); z-index: 2; }
.jig .lb { font-size: 1rem; }
.jig .times { font-size: 1.15rem; background: rgba(0, 0, 0, .22); border-radius: 8px; padding: 3px 7px; margin-left: 4px; }
.jig .num { position: absolute; top: -10px; left: 6px; font-style: normal; font-size: .85rem; background: var(--ink); color: #fff; border-radius: 999px; padding: 1px 7px; z-index: 3; }
.c-move { --jc: #4c8dff; } .c-turn { --jc: #9b5de5; } .c-loop { --jc: #f59f00; } .c-var { --jc: #f76707; } .c-if { --jc: #12b886; } .c-look { --jc: #e64980; }
.jig-btn { border: 0; background: none; padding: 0; position: relative; transition: transform .12s; }
.jig-btn:active { transform: scale(.94); }
.jig-btn.running .jig { box-shadow: 0 0 0 4px #ffd43b; transform: scale(1.08); }
.prog { display: flex; flex-wrap: wrap; align-items: center; row-gap: 14px; width: 100%; max-width: 820px; min-height: 82px; padding: 12px 18px;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.prog .jig-btn + .jig-btn { margin-left: 0; }
.prog-empty { color: var(--muted); font-size: 1.1rem; }
.prog-count { margin-left: auto; color: var(--muted); font-weight: 700; padding-left: 12px; }
.prog.static { width: auto; min-height: 0; padding: 14px 18px; }
.palette { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; padding: 12px 18px; background: rgba(255, 255, 255, .7); border-radius: 20px; }
.btn.go { background: var(--good); }
.board-wrap { width: 100%; display: flex; justify-content: center; }
.board { position: relative; display: grid; grid-template-columns: repeat(var(--w), 1fr); grid-template-rows: repeat(var(--h), 1fr); width: min(92vw, calc(var(--w) * 76px)); aspect-ratio: var(--w) / var(--h);
  background: #fff; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.cell { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; border: 1px dashed #e2ddf0; font-size: clamp(1.5rem, 6vw, 2.5rem); }
.hero, .hero-static { position: relative; display: flex; align-items: center; justify-content: center; font-size: clamp(1.7rem, 6.5vw, 2.8rem); }
.hero { position: absolute; z-index: 2; pointer-events: none; transition: left .32s ease, top .32s ease; }
.hero.crash { animation: shake .4s; }
.hero.crash::after { content: '💥'; position: absolute; top: -6px; right: -4px; font-size: .6em; }
.facing { position: absolute; right: -2px; bottom: -2px; font-style: normal; font-size: .45em; width: 1.4em; height: 1.4em; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border-radius: 50%; transition: transform .25s; }
.code-note { color: var(--muted); font-weight: 700; }
.code { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; background: #fff; padding: 14px 18px; border-radius: 20px; box-shadow: var(--shadow); }
.jv { background: var(--jc, #4c8dff); color: #fff; font-weight: 700; font-size: clamp(1.15rem, 3.4vw, 1.5rem); padding: 9px 18px; border-radius: 8px; }
.jv.wrap { padding: 0; display: flex; flex-direction: column; align-items: stretch; }
.jv.wrap .head { padding: 9px 18px; }
.jv.wrap .inner { margin-left: 22px; background: #fff; padding: 4px 0 4px 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.jv.wrap .foot { height: 12px; }
.answer.seq { font-size: clamp(1.5rem, 4.4vw, 2.1rem); letter-spacing: 2px; overflow-wrap: anywhere; }
.answer.jigopt { display: flex; align-items: center; justify-content: center; }
.answer.jigopt .jig { font-size: 1.6rem; height: 50px; }

/* Spelling tiles */
.slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.slot { width: 72px; height: 84px; border-radius: 16px; background: rgba(255, 255, 255, .6); border: 4px dashed var(--accent); display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; }
.slot.filled { background: #fff; border-style: solid; }
.slot.right { background: var(--good); color: #fff; border-color: var(--good); }
.slot.reveal { background: #e2fbe9; border-color: var(--good); }
.tiles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; max-width: 640px; }
.tile { width: 76px; height: 76px; border: 0; border-radius: 18px; background: var(--accent2); color: #fff; font-size: 2.6rem; font-weight: 700; box-shadow: var(--shadow); font-family: var(--font-read); }
.tile:disabled { opacity: .25; transform: scale(.9); }

/* Tracing */
.trace-wrap { position: relative; width: 100%; max-width: 820px; height: clamp(240px, 46vh, 380px); background: #fff; border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.trace-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.trace-ink { touch-action: none; cursor: crosshair; }
.trace-wrap.done { outline: 6px solid var(--good); }

/* Feedback pop-ups */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.cheer {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--font-fun); font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.6rem); padding: 14px 30px; border-radius: 30px; background: #fff; box-shadow: var(--shadow);
  animation: cheer 1.5s ease-out forwards; white-space: nowrap; max-width: 94vw; text-align: center;
}
.cheer.good { color: var(--accent); }
.cheer.bad { color: #d9822b; font-size: clamp(1.6rem, 5vw, 2.6rem); white-space: normal; }
@keyframes cheer { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.95); } }
.confetti { position: fixed; top: -40px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
.confetti.emoji { width: auto; height: auto; font-size: 34px; }
@keyframes fall { to { top: 105vh; transform: translateX(40px) rotate(540deg); } }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; visibility: hidden; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 60; transition: transform .3s, opacity .3s, visibility .3s; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Results */
.results { text-align: center; }
.result-stars { font-size: clamp(4rem, 15vw, 7rem); margin-top: 24px; }
.result-stars span { color: rgba(255, 255, 255, .7); display: inline-block; animation: starpop .5s backwards; text-shadow: 0 4px 0 rgba(0, 0, 0, .1); }
.result-stars span.on { color: #ffc400; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }
.results h1 { color: var(--accent); font-size: clamp(2rem, 6vw, 3rem); margin: 6px 0; }
.new-sticker { font-family: var(--font-fun); font-weight: 700; font-size: 1.4rem; margin: 10px 0; color: var(--accent); }
.levelups { margin: 10px auto; display: inline-flex; flex-direction: column; gap: 6px; }
.levelup { background: #fff; border-radius: 16px; padding: 8px 16px; font-weight: 700; box-shadow: var(--shadow); }

/* Stickers */
.sticker { width: 96px; height: 96px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 56px; box-shadow: var(--shadow); border: 5px solid var(--c, var(--accent)); }
.sticker.pop { animation: stickerpop .8s .4s backwards; width: 130px; height: 130px; font-size: 80px; }
@keyframes stickerpop { 0% { transform: scale(0) rotate(-180deg); } 70% { transform: scale(1.2) rotate(10deg); } 100% { transform: scale(1); } }
.sticker.locked { background: rgba(255, 255, 255, .5); color: #c5c0da; font-family: var(--font-fun); font-size: 40px; border-style: dashed; border-color: #cfc9e6; box-shadow: none; }
.book { background: linear-gradient(180deg, #fff, var(--c2)); border-radius: 26px; padding: 14px 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.book h2 { margin: 4px 0 12px; color: var(--c); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; justify-items: center; }

/* Forms */
.card { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { margin: 4px 0 12px; font-size: 1.4rem; }
.form label, .form .label { display: block; font-weight: 700; font-size: 1.15rem; margin: 14px 0 8px; }
.text-in { display: block; width: 100%; margin-top: 8px; font: inherit; font-size: 1.5rem; padding: 12px 16px; border-radius: 16px; border: 3px solid var(--line); }
.text-in:focus { border-color: var(--accent); outline: none; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { border: 3px solid var(--line); background: #fff; border-radius: 18px; padding: 8px 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); }
.choice-grid.avatar .choice { padding: 6px 10px; }
.emoji-choice { font-size: 2.1rem; line-height: 1.1; }
.form-err { color: var(--bad); font-weight: 700; min-height: 1em; }

/* Gate modal */
.modal-back { position: fixed; inset: 0; background: rgba(30, 25, 60, .45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 26px; padding: 24px; width: min(380px, 100%); text-align: center; box-shadow: var(--shadow); }
.modal p { font-size: 1.3rem; }
.gate-input { font: inherit; font-size: 2rem; width: 140px; text-align: center; padding: 8px; border-radius: 14px; border: 3px solid var(--line); }
.gate-msg { color: var(--bad); font-size: 1rem !important; min-height: 1.2em; }

/* Break reminder */
.break-back { z-index: 80; background: color-mix(in srgb, var(--accent) 35%, rgba(30, 25, 60, .5)); }
.modal.break { width: min(460px, 100%); border-top: 10px solid var(--accent); font-family: var(--font-fun); }
.break-emoji { font-size: 84px; line-height: 1; animation: bounce 1.2s ease-in-out infinite; }
.break h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 10px 0; }
.break-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; font-size: 1.35rem; text-align: left; }
.break-list li { background: color-mix(in srgb, var(--accent) 10%, white); border-radius: 16px; padding: 10px 16px; }
.break-wait { font-size: 1.6rem; font-weight: 700; color: var(--muted); padding: 14px; }
.select-in { font: inherit; font-size: 1rem; padding: 4px 8px; border-radius: 10px; border: 2px solid var(--line); background: #fff; }

/* Grown-ups dashboard */
.parents .card { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.table-wrap { overflow-x: auto; margin: 6px 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: .98rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .9rem; }
.skills th:first-child { color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.skills { table-layout: fixed; min-width: 760px; }
.skills th:nth-child(1) { width: 26%; } .skills th:nth-child(2) { width: 13%; } .skills th:nth-child(3) { width: 20%; }
.skills th:nth-child(4) { width: 12%; } .skills th:nth-child(5) { width: 14%; } .skills th:nth-child(6) { width: 15%; }
.bar { display: inline-flex; align-items: center; gap: 8px; }
.bar .track { display: inline-block; width: 90px; height: 10px; border-radius: 6px; background: #efedf6; overflow: hidden; }
.bar .fill { display: block; height: 100%; border-radius: 6px; min-width: 4px; }
.bar .bar-num { font-variant-numeric: tabular-nums; min-width: 3.2em; }
.fill.low { background: var(--bad); }
.fill.mid { background: var(--warn); }
.fill.top { background: var(--good); }
.status { padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.st-none { background: #f0eef6; color: var(--muted); }
.st-low { background: #ffe3e3; color: #b42d2d; }
.st-mid { background: #fff1d6; color: #915c00; }
.st-top { background: #dcf7e7; color: #1c7a47; }
.child { border-top: 8px solid var(--c); }
.child-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.child-head .av { font-size: 56px; }
.child-head h2 { margin: 0; }
.activity { margin: 14px 0 6px; }
.activity .label { font-weight: 600; color: var(--muted); margin-bottom: 6px; font-size: .92rem; }
.spark { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 90px; max-width: 520px; }
.spark .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.spark .stick { width: 100%; max-width: 26px; background: var(--c); border-radius: 5px 5px 2px 2px; }
.spark .stick.empty { background: #e9e6f2; }
.spark .day { font-size: .72rem; color: var(--muted); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

.spinner { width: 64px; height: 64px; border-radius: 50%; border: 8px solid rgba(255, 255, 255, .6); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones */
@media (max-width: 640px) {
  .subject-grid .subject-card { flex-basis: 100%; max-width: 100%; }
  .subject-card { flex-direction: row; justify-content: center; gap: 14px; padding: 16px; }
  .answers.n4 { grid-template-columns: repeat(2, 1fr); }
  .answers { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .answer { min-height: 80px; }
  .hello { flex-direction: column; text-align: center; }
  .slot { width: 56px; height: 68px; font-size: 2.3rem; }
  .tile { width: 62px; height: 62px; font-size: 2.1rem; }
  .prompt .speak { width: 50px; height: 50px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
