/* Kid theme overrides for the picture-math pages (addition, subtraction, multiplication, division) */
body.kids { padding: 0; font-size: 1.08rem; line-height: 1.5; }
body.kids .container {
    position: relative; z-index: 1;
    max-width: 1150px; width: calc(100% - 24px);
    margin: 1rem auto 0; padding: 1.5rem;
    background: rgba(255, 255, 255, .94);
    border-radius: 32px;
    box-shadow: var(--k-shadow);
}
body.kids .back-link { display: none; }
body.kids h1 {
    font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 800; line-height: 1.15;
    color: var(--k-ink); text-align: center; margin: .25rem 0 1rem;
    animation: k-bounce-in .6s cubic-bezier(.3,1.6,.5,1);
}
body.kids h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem); color: var(--k-purple);
    border-left: 0; padding: 0; margin: 2rem 0 1rem; text-align: center;
}
body.kids h3 { color: var(--k-red); }

/* Math page switcher */
.m-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 0 0 1.25rem; }
.m-switch a {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 48px;
    padding: .5rem 1rem; border-radius: 999px; text-decoration: none; font-weight: 800;
    color: var(--k-ink); background: #fff3c4; box-shadow: 0 4px 0 #e8c95a;
    transition: transform .15s;
}
.m-switch a:hover { transform: translateY(-3px) rotate(-2deg); }
.m-switch a.on { background: var(--k-orange); color: #fff; box-shadow: 0 4px 0 #d66a1f; }
.m-stars {
    display: inline-flex; align-items: center; gap: .3rem; min-height: 48px;
    padding: .5rem 1rem; border-radius: 999px; font-weight: 800;
    background: #fff; box-shadow: 0 4px 0 #e8c95a; color: #b07800;
}

/* Cards and grids */
body.kids .explanation-box { background: #e7f5ff; border-radius: 24px; padding: 1.25rem; border: 3px dashed #9fd3ff; }
body.kids .tips-grid,
body.kids .examples-grid,
body.kids .tables-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
body.kids .tip-card { border-radius: 20px; border-left: 0; background: #fff6df; box-shadow: 0 4px 0 #f1dca6; padding: 1rem; }
body.kids .tip-card:nth-child(3n+2) { background: #e9fbef; box-shadow: 0 4px 0 #bfe8cd; }
body.kids .tip-card:nth-child(3n+3) { background: #f3ecff; box-shadow: 0 4px 0 #d6c8f5; }
body.kids .addition-card,
body.kids .example-card,
body.kids .table-card {
    border-radius: 24px; border: 0; box-shadow: var(--k-shadow); min-width: 0;
    transition: transform .2s cubic-bezier(.3,1.6,.5,1);
}
body.kids .addition-card:nth-child(4n+1), body.kids .example-card:nth-child(4n+1), body.kids .table-card:nth-child(4n+1) { background: #ffe3ea; }
body.kids .addition-card:nth-child(4n+2), body.kids .example-card:nth-child(4n+2), body.kids .table-card:nth-child(4n+2) { background: #e0f2ff; }
body.kids .addition-card:nth-child(4n+3), body.kids .example-card:nth-child(4n+3), body.kids .table-card:nth-child(4n+3) { background: #e3f9e9; }
body.kids .addition-card:nth-child(4n+4), body.kids .example-card:nth-child(4n+4), body.kids .table-card:nth-child(4n+4) { background: #fff4c9; }
body.kids .addition-card:hover, body.kids .example-card:hover, body.kids .table-card:hover { transform: translateY(-6px) rotate(-1deg); }
body.kids .pictures,
body.kids .visual-example { letter-spacing: 2px; overflow-wrap: anywhere; word-break: break-word; }
body.kids .answer { background: #fff; color: var(--k-green); }

/* Practice area */
body.kids .practice-area {
    background: linear-gradient(180deg, #fffbe8, #fff1c9);
    border: 4px solid var(--k-sun); border-radius: 32px; padding: 1.25rem;
}
body.kids .mode-switch { flex-wrap: wrap; gap: .6rem; }
body.kids .mode-btn {
    min-height: 48px; padding: .6rem 1.2rem; font-size: 1.05rem; font-weight: 800;
    border-radius: 999px; background: #fff; color: var(--k-ink); box-shadow: 0 4px 0 #e2d5a8;
}
body.kids .mode-btn.active { background: var(--k-blue); color: #fff; box-shadow: 0 4px 0 #1f78c9; }
body.kids .manual-controls { flex-wrap: wrap; align-items: center; gap: .6rem; }
body.kids select,
body.kids input[type="number"] {
    min-height: 52px; font-size: 1.2rem; font-weight: 700; border: 3px solid var(--k-orange);
    border-radius: 999px; padding: .4rem 1rem; background: #fff; color: var(--k-ink); max-width: 100%;
}
body.kids input[type="number"] { width: 11rem; text-align: center; }
body.kids .practice-area button:not(.mode-btn):not(.m-choice) {
    min-height: 52px; padding: .6rem 1.3rem; margin: .3rem .15rem; font-size: 1.1rem; font-weight: 800;
    border-radius: 999px; background: var(--k-orange); color: #fff; box-shadow: 0 5px 0 #d66a1f;
}
body.kids .practice-area button#newQuestionBtn,
body.kids .practice-area button#newPracticeBtn { background: var(--k-purple); box-shadow: 0 5px 0 #6b44c9; }
body.kids .practice-area button:active { transform: translateY(4px); box-shadow: none !important; }
body.kids .addition-visual,
body.kids .subtraction-visual,
body.kids .multiplication-visual,
body.kids .division-visual {
    font-size: clamp(1.5rem, 6vw, 2.2rem); letter-spacing: 2px; line-height: 1.4;
    overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
    animation: k-bounce-in .45s cubic-bezier(.3,1.6,.5,1);
}
body.kids .left-group, body.kids .right-group, body.kids .group { border-radius: 18px; max-width: 100%; overflow-wrap: anywhere; }
body.kids #additionQuestion, body.kids #practiceQuestion {
    font-size: clamp(1.6rem, 7vw, 2.6rem) !important; color: var(--k-ink); margin: .75rem 0 !important;
}
body.kids .feedback { font-size: 1.2rem; min-height: 1.6em; }
body.kids .auto-message, body.kids #autoMessage { border-radius: 18px !important; }

/* Tap-the-answer choices */
.m-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin: .5rem 0 1rem; }
.m-choices-label { width: 100%; font-weight: 800; color: var(--k-ink-soft); }
body.kids .m-choice {
    min-width: 72px; min-height: 72px; padding: .4rem 1rem; border: 0; border-radius: 22px;
    font-size: 2rem; font-weight: 800; color: #fff; cursor: pointer;
    box-shadow: 0 6px 0 rgba(0,0,0,.18);
    animation: k-bounce-in .45s cubic-bezier(.3,1.6,.5,1) backwards;
    transition: transform .12s;
}
.m-choice:nth-child(2) { background: var(--k-red); animation-delay: .05s; }
.m-choice:nth-child(3) { background: var(--k-blue); animation-delay: .1s; }
.m-choice:nth-child(4) { background: var(--k-green); animation-delay: .15s; }
.m-choice:nth-child(5) { background: var(--k-purple); animation-delay: .2s; }
.m-choice:hover { transform: translateY(-4px) scale(1.05); }
.m-choice.right { animation: m-yay .6s; background: var(--k-green) !important; }
.m-choice.wrong { animation: m-shake .4s; opacity: .45; }
@keyframes m-yay { 50% { transform: scale(1.25) rotate(6deg); } }
@keyframes m-shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Footer inside container */
body.kids .footer-note { background: var(--k-green); border-radius: 24px; font-weight: 700; }
body.kids .footer-links a { display: inline-block; padding: .4rem .2rem; }

/* Parents section */
.m-parents { margin-top: 2rem; background: #f5f9ff; border-radius: 24px; padding: 1.25rem; }
.m-parents h2 { margin-top: 0 !important; }
.m-parents p { margin: .5rem 0; color: var(--k-ink-soft); }

@media (max-width: 600px) {
    body.kids .container { width: calc(100% - 16px); padding: 1rem .9rem; border-radius: 24px; }
    body.kids .practice-area { padding: 1rem .6rem; }
    body.kids .manual-controls select { flex: 1 1 140px; }
    body.kids input[type="number"] { width: 100%; }
    body.kids .practice-area button:not(.mode-btn):not(.m-choice) { flex: 1 1 auto; }
    body.kids .mode-btn { flex: 1 1 140px; }
    body.kids .m-choice { min-width: 64px; min-height: 64px; font-size: 1.7rem; }
}
body.kids .table-row { flex-wrap: wrap; gap: .25rem; align-items: center; }
body.kids .table-row .visual-example { flex-basis: 100%; }
body.kids .table-title { font-size: 1.25rem; font-weight: 800; }

/* ================= Simple kid maths game (MathGame) ================= */
.mg { max-width: 900px; margin: 0 auto 1.5rem; }
.mg-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.mg-mascot { display: flex; align-items: center; gap: .5rem; flex: 1 1 260px; min-width: 0; }
.mg-face { font-size: 3rem; animation: k-wiggle 3s infinite; display: inline-block; }
.mg-bubble { position: relative; background: #fff; border-radius: 20px; padding: .55rem 1rem; font-weight: 800; font-size: 1.1rem; box-shadow: 0 4px 0 rgba(45,42,74,.12); }
.mg-bubble::before { content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%); border: 9px solid transparent; border-right-color: #fff; border-left: 0; }
.mg-sound { border: 0; cursor: pointer; min-height: 48px; padding: .4rem 1rem; border-radius: 999px; font-weight: 800; font-size: 1rem; background: #e6f6ff; box-shadow: 0 4px 0 #9fd3ff; color: var(--k-ink); }
.mg-sound.off { background: #eee; box-shadow: 0 4px 0 #ccc; }
.mg-levels { display: flex; gap: .45rem; overflow-x: auto; padding: .8rem 2px .6rem; scrollbar-width: none; justify-content: center; flex-wrap: wrap; }
.mg-levels::-webkit-scrollbar { display: none; }
.mg-lvl { flex: 0 0 auto; border: 0; cursor: pointer; min-height: 52px; padding: .35rem .9rem; border-radius: 18px; font-weight: 800; font-size: 1rem; line-height: 1.1; color: var(--k-ink); background: #fff; box-shadow: 0 4px 0 rgba(45,42,74,.14); }
.mg-lvl small { display: block; font-size: .75rem; font-weight: 600; color: var(--k-ink-soft); }
.mg-lvl.on { background: var(--k-purple); color: #fff; box-shadow: 0 4px 0 #6b44c9; }
.mg-lvl.on small { color: #eee; }
@media (max-width: 600px) { .mg-levels { flex-wrap: nowrap; justify-content: flex-start; } }
.mg-dots { display: flex; justify-content: center; gap: .4rem; margin: .2rem 0 .8rem; }
.mg-dots span { width: 16px; height: 16px; border-radius: 50%; background: #e9e4f7; }
.mg-dots .g { background: var(--k-green); }
.mg-dots .y { background: var(--k-sun); }
.mg-dots .now { background: var(--k-orange); animation: mgPulse 1s infinite; }
@keyframes mgPulse { 50% { transform: scale(1.35); } }
.mg-card { background: #fff; border-radius: 30px; padding: 1.2rem 1rem; box-shadow: 0 8px 0 #e3dcf5, 0 16px 28px rgba(45,42,74,.12); text-align: center; }
.mg-card.pop { animation: k-bounce-in .45s both; }
.mg-q { display: flex; align-items: center; justify-content: center; gap: .6rem; font-size: clamp(2.4rem, 11vw, 4rem); font-weight: 800; color: var(--k-ink); line-height: 1.1; }
.mg-say { border: 0; cursor: pointer; width: 56px; height: 56px; border-radius: 50%; font-size: 1.6rem; background: var(--k-sky); box-shadow: 0 4px 0 #8cc9ef; flex: 0 0 auto; }
.mg-pic { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .4rem; }
.mg-pic .grp { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; padding: .6rem; border-radius: 22px; background: #fff4d6; max-width: 100%; }
.mg-pic .grp.g2 { background: #e3f6ff; }
.mg-pic .sign { font-size: 2.6rem; color: var(--k-red); }
.mg-pic.mul .grp { background: #f0ebff; padding: .4rem; position: relative; }
.mg-pic.mul .grp.lit { background: #c9f7dc; transform: scale(1.05); transition: transform .2s; }
.mg-pic.mul .grp.lit::after { content: attr(data-n); position: absolute; top: -12px; right: -8px; background: var(--k-green); color: #fff; font-weight: 800; border-radius: 999px; padding: 0 .5rem; font-size: 1rem; }
.mo { position: relative; border: 0; background: none; padding: 0; cursor: pointer; font-size: clamp(1.7rem, 7vw, 2.4rem); line-height: 1.15; width: 1.4em; transition: opacity .3s; }
.mg-pic.mul .mo { font-size: clamp(1.2rem, 5vw, 1.7rem); }
.mg-pic.mul.tiny .mo { font-size: clamp(.95rem, 3.6vw, 1.3rem); }
.mo.hop { animation: mgHop .35s; }
@keyframes mgHop { 50% { transform: translateY(-10px) scale(1.25); } }
.mo.counted::after { content: attr(data-n); position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--k-red); color: #fff; font-size: .8rem; font-weight: 800; line-height: 22px; text-align: center; }
.mo.gone { color: transparent; text-shadow: 0 0 0 rgba(45,42,74,.25); cursor: default; }
.mo.gone::before { content: "✖"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--k-red); font-size: 1.4em; opacity: 1; }
.mg-pic.div .mo.gone { visibility: hidden; }
.mg-pic.div .mo.gone::before { content: none; }
.plates { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .4rem; }
.plate { min-width: 92px; padding: .4rem; border-radius: 22px; background: #fdf0ff; box-shadow: 0 4px 0 #ecd2f5; }
.plate .kid { font-size: 2rem; display: block; }
.plate .on { min-height: 36px; display: flex; flex-wrap: wrap; justify-content: center; max-width: 120px; margin: 0 auto; }
.plate .ck { font-size: 1.4rem; animation: k-bounce-in .3s both; }
.mg-hint { margin: .3rem 0 0; font-weight: 700; color: var(--k-ink-soft); }
.mg-help { margin: .6rem 0; }
.mg-show { border: 0; cursor: pointer; min-height: 52px; padding: .4rem 1.3rem; border-radius: 999px; font-weight: 800; font-size: 1.1rem; color: #fff; background: var(--k-purple); box-shadow: 0 5px 0 #6b44c9; }
.mg-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-top: .8rem; }
@media (max-width: 560px) { .mg-choices { grid-template-columns: repeat(2, 1fr); } }
.mg-c { border: 0; cursor: pointer; min-height: 76px; border-radius: 24px; font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 800; color: var(--k-ink); box-shadow: 0 6px 0 rgba(45,42,74,.15); transition: transform .12s; touch-action: manipulation; }
.mg-c:nth-child(1) { background: #ffd9e0; } .mg-c:nth-child(2) { background: #cdeeff; } .mg-c:nth-child(3) { background: #d5f6d8; } .mg-c:nth-child(4) { background: #fff1b8; }
.mg-c:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(45,42,74,.15); }
.mg-c.right { background: var(--k-green); color: #fff; animation: k-bounce-in .4s; }
.mg-c.wrong { opacity: .45; animation: mgShake .4s; }
@keyframes mgShake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.mg-trophy .cup { font-size: 5rem; animation: k-bounce-in .6s, k-wiggle 2s 1s infinite; display: inline-block; }
.mg-trophy h3 { font-size: 2rem; margin: .2rem 0; color: var(--k-ink); }
.mg-trophy p { font-size: 1.2rem; font-weight: 700; }
.mg-trophy .big-stars { font-size: 2.6rem; letter-spacing: .3rem; }
.mg-end { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .8rem; }
.mg-end .k-btn { min-height: 58px; font-size: 1.15rem; }
details.m-grown { margin: 1.5rem auto; max-width: 1100px; background: #f7f4ff; border-radius: 24px; padding: .6rem 1rem; }
details.m-grown > summary { cursor: pointer; font-weight: 800; font-size: 1.1rem; min-height: 48px; display: flex; align-items: center; }
.m-fun { padding-left: 1.2rem; line-height: 1.7; }
