/* Pandai Study — main styles. Mobile-first, big touch targets, high contrast text. */
:root {
  --bg: #FFF8EC;
  --dot: #F6E7CC;
  --ink: #2B2D42;
  --muted: #676B7E;
  --card: #FFFFFF;
  --line: #F0E1C6;
  --good: #22A861;
  --good-soft: #E6F8EE;
  --danger: #D64545;
  --blue: #3A86FF;

  --a12: #F25C84; --a12-strong: #C93A63; --a12-soft: #FFE3EB;
  --a34: #FFA62B; --a34-strong: #B85F00; --a34-soft: #FFF0D6;
  --a56: #2EC4B6; --a56-strong: #0B7F75; --a56-soft: #DDF7F4;

  --accent: #7C5CFF; --accent-strong: #5B3FD6; --accent-soft: #EEE9FF;

  --radius: 26px;
  --shadow: 0 5px 0 rgba(43, 45, 66, .08), 0 12px 26px rgba(43, 45, 66, .07);
  --font: ui-rounded, "Nunito", "Varela Round", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-learn: "Andika", "Century Gothic", "Comic Sans MS", "Trebuchet MS", sans-serif;
}
body[data-age="1-2"] { --accent: var(--a12); --accent-strong: var(--a12-strong); --accent-soft: var(--a12-soft); }
body[data-age="3-4"] { --accent: var(--a34); --accent-strong: var(--a34-strong); --accent-soft: var(--a34-soft); }
body[data-age="5-6"] { --accent: var(--a56); --accent-strong: var(--a56-strong); --accent-soft: var(--a56-soft); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  /* soft sky fading into fresh green */
  background: linear-gradient(180deg, #CDEEFF 0, #E6F7FF 260px, #F2FBEA 700px) no-repeat, #F2FBEA;
  -webkit-tap-highlight-color: transparent;
}
main { flex: 1 0 auto; }
.grass-footer { flex: none; height: 110px; margin-top: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 110' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C200 10 400 20 600 45 C800 70 1000 20 1200 40 V110 H0Z' fill='%23A8E6A1'/%3E%3Cpath d='M0 75 C250 45 500 55 700 75 C900 95 1050 60 1200 70 V110 H0Z' fill='%235CBF4A'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat; position: relative; }
.grass-footer::before { content: "🌷 🌳 🐇 🌼 🌳 🦋 🌸 🌳 🐞 🌻"; position: absolute; left: 0; right: 0; top: 14px; text-align: center; font-size: 26px; letter-spacing: clamp(6px, 4vw, 60px); white-space: nowrap; overflow: hidden; }
body[data-page="landing"] .grass-footer { display: none; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; border-radius: 12px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  border-bottom: 4px solid #9FDB8F;
}
.lang-toggle { display: inline-flex; padding: 4px; border-radius: 999px; background: #E3F5DC; border: 3px solid #9FDB8F; }
.lang-toggle button { min-width: 48px; min-height: 38px; padding: 2px 10px; border: 0; border-radius: 999px; background: transparent; font-weight: 900; cursor: pointer; color: #2F6B2A; }
.lang-toggle button.on { background: #2FBF71; color: #fff; box-shadow: 0 3px 0 #1E8A50; }
.setting-row { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.subhead { margin: -8px 0 14px; font-size: 1.2rem; font-weight: 800; color: #2F6B2A; }
.age-count { margin-top: 6px; font-weight: 900; background: #fff; padding: 2px 12px; border-radius: 99px; }
.quiz-top { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-top .dots { margin: 0; }
.q-count { font-weight: 900; color: var(--muted); background: #fff; border-radius: 99px; padding: 2px 12px; border: 3px solid var(--line); }
.bubble.has-emoji { display: grid; place-items: center; }
.bubble-emoji { font-size: 2.6em; pointer-events: none; line-height: 1; }
.wiggle { animation: wiggle .7s; }
@keyframes wiggle { 20% { transform: rotate(-8deg) scale(1.08); } 45% { transform: rotate(7deg) scale(1.1); } 70% { transform: rotate(-4deg); } }

/* ---------- landing: the park scene ---------- */
#app.landing { max-width: none; padding: 0; }
.scene {
  position: relative; overflow: hidden;
  min-height: calc(100svh - 68px);
  background: linear-gradient(180deg, #6EC6FF 0%, #A9E1FF 40%, #DDF5FF 72%);
  isolation: isolate;
}
.sky { position: absolute; inset: 0; z-index: 0; }
.scene .tap { cursor: pointer; }
.scene .sun { position: absolute; top: 3%; right: 4%; width: clamp(100px, 15vw, 190px); }
.sun .rays { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cloud { position: absolute; left: -30%; width: clamp(120px, 17vw, 240px); animation: drift linear infinite; filter: drop-shadow(0 6px 6px rgba(80, 140, 200, .15)); }
.c1 { top: 6%; animation-duration: 60s; animation-delay: -12s; }
.c2 { top: 20%; width: clamp(90px, 12vw, 170px); animation-duration: 80s; animation-delay: -45s; opacity: .9; }
.c3 { top: 2%; animation-duration: 70s; animation-delay: -35s; }
.c4 { top: 28%; width: clamp(80px, 10vw, 150px); animation-duration: 95s; animation-delay: -70s; opacity: .85; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(170vw); } }
.wind { position: absolute; top: 34%; left: 6%; width: 60%; height: 90px; opacity: .8; }
.wind svg { width: 100%; height: 100%; }
.gust { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 60 900; animation: gust 4.5s linear infinite; }
.gust.g2 { animation-delay: -2.2s; stroke-width: 4; }
@keyframes gust { from { stroke-dashoffset: 960; } to { stroke-dashoffset: 0; } }
.kite { position: absolute; top: 9%; left: 5%; width: clamp(64px, 8vw, 110px); transform-origin: 50% 100%; animation: sway 3.4s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-8deg) translateY(0); } to { transform: rotate(8deg) translateY(-12px); } }
.air-balloon { position: absolute; top: 24%; right: 20%; width: clamp(54px, 6.5vw, 90px); animation: hover 6s ease-in-out infinite alternate; }
@keyframes hover { from { transform: translateY(0); } to { transform: translateY(-34px) translateX(16px); } }
.birds { position: absolute; top: 13%; left: 38%; width: clamp(70px, 9vw, 120px); animation: fly 26s linear infinite; }
.birds svg { overflow: visible; }
.birds path { fill: none; stroke: #2B3A55; stroke-width: 3.5; stroke-linecap: round; animation: flap .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes flap { to { transform: scaleY(.45); } }
@keyframes fly { 0% { transform: translateX(-60vw); } 100% { transform: translateX(80vw); } }
.flutter { position: absolute; font-size: clamp(28px, 3.4vw, 44px); z-index: 2; animation: flutter 7s ease-in-out infinite; }
.f1 { left: 20%; bottom: 30%; }
.f2 { right: 26%; bottom: 36%; animation-delay: -3s; animation-duration: 9s; }
.f3 { left: 58%; bottom: 26%; animation-delay: -5s; animation-duration: 6s; }
@keyframes flutter { 0%, 100% { transform: translate(0, 0) rotate(-6deg); } 25% { transform: translate(30px, -26px) rotate(8deg); } 50% { transform: translate(60px, 4px) rotate(-4deg); } 75% { transform: translate(24px, 20px) rotate(6deg); } }
.scene .ground { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: clamp(250px, 44vh, 470px); z-index: 1; }
.swing { transform-box: view-box; animation: swing 2.2s ease-in-out infinite alternate; }
.swing.s1 { transform-origin: 463px 216px; }
.swing.s2 { transform-origin: 519px 216px; animation-delay: -1.1s; }
@keyframes swing { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.seesaw { transform-box: view-box; transform-origin: 918px 319px; animation: seesaw 2.6s ease-in-out infinite alternate; }
@keyframes seesaw { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.duck { animation: paddle 5s ease-in-out infinite alternate; }
@keyframes paddle { to { transform: translateX(40px); } }
.scene .ground .tap:hover { filter: brightness(1.06); }

.scene-title { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(28px, 8vh, 90px) 16px 0; pointer-events: none; }
.scene-title > * { pointer-events: auto; }
.scene-mascot .mascot { width: clamp(80px, 13vw, 130px); height: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); }
.scene-title h1 { margin: 4px 0 0; font-size: clamp(2.6rem, 10vw, 5.4rem); font-weight: 900; letter-spacing: 1px; line-height: 1; }
.scene-title h1 .l { display: inline-block; -webkit-text-stroke: 3px #fff; paint-order: stroke fill; text-shadow: 0 5px 0 rgba(0, 0, 0, .12); animation: hop 2.8s ease-in-out infinite; }
.l0 { color: #E63946; } .l1 { color: #FB8C00; } .l2 { color: #F2A900; } .l3 { color: #2FA84F; } .l4 { color: #1E88E5; } .l5 { color: #8E44AD; }
@keyframes hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-10px) rotate(-4deg); } }
.scene-sub { margin: 10px 0 18px; font-size: clamp(1.05rem, 2.6vw, 1.4rem); font-weight: 800; color: #1F4E79; background: rgba(255, 255, 255, .75); padding: 6px 16px; border-radius: 99px; }
.btn-play {
  min-height: 72px; padding: 12px 40px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: clamp(1.5rem, 4.5vw, 2rem); font-weight: 900; color: #fff;
  background: linear-gradient(#3DD17F, #22A861); box-shadow: 0 7px 0 #17803F, 0 14px 30px rgba(23, 128, 63, .35);
  animation: pulse 1.8s ease-in-out infinite; touch-action: manipulation;
}
.btn-play:active { transform: translateY(5px); box-shadow: 0 2px 0 #17803F; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 1.2rem; }
.brand .mascot { width: 44px; height: 44px; }
.spacer { flex: 1; }
.chip-age, .btn-parent {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px;
  border-radius: 999px; text-decoration: none; font-weight: 800; white-space: nowrap;
}
.chip-age { background: var(--accent-soft); color: var(--ink); border: 3px solid var(--accent); }
.btn-parent { background: #fff; color: var(--ink); border: 3px solid var(--line); }

#app { width: 100%; max-width: 1100px; margin: 0 auto; padding: 18px 16px 64px; outline: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; padding: 10px 22px;
  border: 0; border-radius: 999px;
  font-weight: 900; font-size: 1.1rem; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .16);
  transition: transform .08s, box-shadow .08s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .16); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-go { background: var(--good); color: #fff; }
.btn-accent { background: var(--accent-strong); color: #fff; }
.btn-soft { background: #fff; color: var(--ink); border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn-danger { background: #fff; color: var(--danger); border: 3px solid #F3C6C6; box-shadow: none; }
.btn-sm { min-height: 44px; padding: 6px 16px; font-size: 1rem; }
.btn-back { min-height: 48px; padding: 6px 16px; font-size: 1rem; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2.3rem); flex: 1 1 260px; }
.page-head .tr, h2 .tr { display: block; font-size: .55em; font-weight: 600; color: var(--muted); font-style: italic; margin-top: 4px; }
h2 .tr { display: inline; margin-left: 8px; }
.title-icon { font-size: 1.1em; }
.instr { font-size: 1.2rem; font-weight: 700; background: #fff; border-radius: 18px; padding: 10px 16px; border: 3px dashed var(--line); margin: 0 0 16px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

/* ---------- home ---------- */
.hero { display: flex; align-items: center; gap: 18px; margin: 8px 0 6px; }
.hero h1 { font-size: clamp(2.2rem, 8vw, 3.6rem); margin: 0; color: var(--ink); letter-spacing: -.5px; }
.hero-sub { margin: 4px 0 0; font-size: 1.15rem; font-weight: 700; color: var(--muted); }
.hero-mascot .mascot { width: clamp(90px, 22vw, 140px); height: auto; }
.bob { animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.lead { font-size: 1.15rem; font-weight: 700; margin: 10px 0 16px; }

.age-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.age-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 26px 18px 22px; border: 0; border-radius: 32px; cursor: pointer;
  color: var(--ink); box-shadow: var(--shadow);
  border-bottom: 10px solid var(--c);
  background: var(--soft);
  transition: transform .15s;
}
.age-card:hover { transform: translateY(-4px) rotate(-.5deg); }
.age-card:active { transform: scale(.98); }
.age-card.current { outline: 5px solid var(--c); }
.age-1-2 { --c: var(--a12); --soft: var(--a12-soft); }
.age-3-4 { --c: var(--a34); --soft: var(--a34-soft); }
.age-5-6 { --c: var(--a56); --soft: var(--a56-soft); }
.age-icon { font-size: 4.2rem; line-height: 1.1; }
.age-title { font-size: 2.1rem; font-weight: 900; }
.age-tr { font-weight: 700; color: var(--muted); }
.age-tag { font-size: 1.05rem; font-weight: 700; margin-top: 6px; }
.age-tag i { font-weight: 600; color: var(--muted); }
.age-subjects { font-size: 1.6rem; margin-top: 8px; letter-spacing: 4px; }
.badge { position: absolute; top: 12px; right: 14px; background: var(--good); color: #fff; font-size: .85rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; }

.features { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 26px; }
.feature { background: #fff; border-radius: 22px; padding: 16px; box-shadow: var(--shadow); }
.feature p { margin: 4px 0 0; font-size: .98rem; color: var(--muted); }
.f-icon { font-size: 1.8rem; display: block; }

/* ---------- tiles (subjects, activities) ---------- */
.parent-tip { background: #fff; border-radius: 18px; padding: 10px 16px; margin-bottom: 16px; border: 3px solid var(--accent-soft); }
.parent-tip summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.parent-tip p { margin: 8px 0 4px; }
.tile-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 20px 12px 16px; min-height: 190px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 4px solid transparent; text-decoration: none; color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.tile:active { transform: scale(.97); }
.tile-icon { font-size: 3.4rem; line-height: 1.15; }
.tile-title { font-weight: 900; font-size: 1.2rem; }
.tile-tr { font-size: .92rem; color: var(--muted); font-style: italic; }
.tile-progress { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; font-size: .9rem; font-weight: 700; color: var(--muted); }
.bar { display: inline-block; width: 80px; height: 10px; border-radius: 99px; background: #EFE7D8; overflow: hidden; vertical-align: middle; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.type-chip { margin-top: 8px; font-size: .8rem; font-weight: 800; background: var(--accent-soft); padding: 2px 10px; border-radius: 99px; }
.tile-stars { margin-top: 6px; color: #F2A900; font-size: 1.2rem; letter-spacing: 2px; font-weight: 900; }
.activity-tile:not(.done) .tile-stars { color: var(--accent-strong); font-size: .95rem; letter-spacing: 0; }
.done-badge { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #fff; font-weight: 900; }

/* ---------- art items ---------- */
.art { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1; font-size: var(--art, 64px); }
.art-sm { --art: 44px; } .art-md { --art: 64px; } .art-lg { --art: 76px; } .art-xl { --art: 84px; }
.art .emoji { font-size: 1em; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.art .emoji-badge { font-size: .5em; }
.art .swatch { display: block; width: 1.45em; height: 1.45em; border-radius: 50%; border: 4px solid rgba(0, 0, 0, .12); }
.art svg.shape, .art svg.pic { width: 1.5em; height: 1.5em; }
.art-text { font-family: var(--font-learn); font-weight: 700; font-size: 1em; color: var(--ink); }
.art-text.long { font-size: .62em; }
.art-count { display: flex; flex-wrap: wrap; justify-content: center; gap: .04em; max-width: 3.3em; }
.art-count .emoji { font-size: .5em; }
.art-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .15em; }
.art-row > .emoji { font-size: .8em; }
.art-row > .art-text { font-size: .8em; background: var(--accent-soft); border: 4px dashed var(--accent); border-radius: 16px; padding: .05em .3em; }
.art-op { font-size: .7em; font-weight: 900; padding: 0 .1em; }
.crossed { position: relative; opacity: .45; }
.crossed::after { content: ""; position: absolute; left: -8%; right: -8%; top: 48%; border-top: .09em solid #D62839; transform: rotate(-35deg); }

/* ---------- stage / cards ---------- */
.stage { position: relative; }
.stage-bar { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 12px; color: var(--muted); }
.counter { background: #fff; border-radius: 99px; padding: 4px 14px; border: 3px solid var(--line); color: var(--ink); }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
body[data-age="1-2"] .card-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.pic-card {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 190px; padding: 18px 10px 14px;
  background: #fff; border: 5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer;
  touch-action: manipulation;
}
.pic-card.seen { border-color: var(--good); }
.pic-label { font-size: 1.3rem; font-weight: 900; line-height: 1.15; }
.pic-label small { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); font-style: italic; }
.pic-sub { font-family: var(--font-learn); font-size: 1.1rem; font-weight: 700; color: var(--accent-strong); letter-spacing: 1px; }
.tick { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--good); color: #fff; font-weight: 900; display: grid; place-items: center; transform: scale(0); transition: transform .2s; }
.pic-card.seen .tick { transform: scale(1); }
.bounce { animation: bounce .55s; }
@keyframes bounce { 30% { transform: scale(1.08) rotate(-2deg); } 60% { transform: scale(.96) rotate(1deg); } }

/* ---------- quiz ---------- */
.dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #E9DFCC; }
.dot.on { background: var(--accent); }
.dot.done { background: var(--good); }
.quiz-prompt { display: flex; align-items: center; justify-content: center; gap: 14px; text-align: center; margin-bottom: 8px; }
.quiz-prompt-text { font-size: clamp(1.4rem, 4.5vw, 2rem); font-weight: 900; margin: 0; }
.quiz-prompt-tr { margin: 2px 0 0; color: var(--muted); font-style: italic; font-weight: 700; }
.speak-btn { flex: none; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent-strong); color: #fff; font-size: 1.6rem; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.speak-btn:active { transform: translateY(3px); box-shadow: none; }
.quiz-art { display: flex; justify-content: center; margin: 10px auto 16px; padding: 14px 20px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.choices { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); max-width: 760px; margin: 0 auto; }
.choice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 160px; padding: 14px 8px;
  background: #fff; border: 5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer;
  transition: opacity .2s; touch-action: manipulation;
}
.choice:hover { border-color: var(--accent); }
.choice-label { font-weight: 800; font-size: 1.1rem; line-height: 1.15; }
.choice.correct { border-color: var(--good); background: var(--good-soft); animation: pop .45s; }
.choice.wrong { opacity: .35; animation: shake .4s; }
.choice .art-text { font-size: .9em; }
.choice .art-text.long { font-size: .62em; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.shake { animation: shake .4s; }

/* ---------- match ---------- */
.match-board { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; max-width: 720px; margin: 0 auto; align-items: start; }
.match-col { display: flex; flex-direction: column; gap: 12px; }
.match-mid { align-self: center; font-size: 2rem; color: var(--muted); }
.match-item {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 84px; padding: 8px 10px;
  background: #fff; border: 5px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); cursor: pointer; touch-action: manipulation;
}
.match-label { font-weight: 800; font-size: 1.05rem; }
.match-item.sel { border-color: var(--blue); background: #EAF2FF; transform: scale(1.03); }
.match-item.matched { cursor: default; border-color: var(--mc); background: color-mix(in srgb, var(--mc) 16%, white); }
.match-item.matched::after { content: "✓"; font-weight: 900; color: var(--mc); }
.m0 { --mc: #22A861; } .m1 { --mc: #3A86FF; } .m2 { --mc: #E07A00; } .m3 { --mc: #8E44AD; } .m4 { --mc: #D6336C; } .m5 { --mc: #0B7F75; }

/* ---------- colouring ---------- */
.colour-layout { display: grid; gap: 16px; grid-template-columns: 1fr; justify-items: center; }
@media (min-width: 760px) { .colour-layout { grid-template-columns: 1fr 230px; align-items: start; } }
.colour-pic { width: 100%; max-width: 520px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.colour-pic svg { width: 100%; height: auto; display: block; }
.colour-pic [data-region] { cursor: pointer; transition: fill .15s; }
.colour-side { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.palette { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.pal { width: 62px; height: 62px; border-radius: 50%; background: var(--c); border: 5px solid #fff; box-shadow: 0 0 0 3px var(--line), var(--shadow); cursor: pointer; }
.pal.on { box-shadow: 0 0 0 5px var(--ink); transform: scale(1.1); }

/* ---------- bubbles ---------- */
.bubble-progress { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bp { width: 24px; height: 24px; border-radius: 50%; background: #EFE4D0; }
.bp.on { background: #FFD23F; box-shadow: 0 0 0 3px #F2A900 inset; }
.bubble-field { position: relative; height: min(62vh, 520px); border-radius: var(--radius); overflow: hidden; background: linear-gradient(#DDF3FF, #F4FBFF); box-shadow: var(--shadow); }
.bubble {
  position: absolute; bottom: -140px; border: 0; padding: 0; cursor: pointer; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .95) 0 12%, transparent 13%), radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c) 55%, white), var(--c));
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .6), 0 6px 14px rgba(0, 0, 0, .12);
  animation: floatUp linear forwards;
  touch-action: manipulation;
}
.bubble.popped { animation: popOut .3s forwards; }
@keyframes floatUp { from { transform: translateY(0) translateX(0); } 50% { transform: translateY(-340px) translateX(18px); } to { transform: translateY(-720px) translateX(-10px); } }
@keyframes popOut { to { transform: scale(1.6); opacity: 0; } }

/* ---------- tracing ---------- */
.trace-title { text-align: center; font-size: 1.5rem; font-weight: 900; margin-bottom: 8px; }
.trace-title small { display: block; font-size: .9rem; color: var(--muted); font-style: italic; }
.trace-board { display: flex; justify-content: center; width: 100%; max-width: 620px; margin: 0 auto; }
.trace-canvas { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); touch-action: none; cursor: crosshair; display: block; }
.trace-msg { text-align: center; font-weight: 800; font-size: 1.15rem; min-height: 1.6em; margin: 12px 0; }
.trace-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }

/* ---------- celebration overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: rgba(43, 45, 66, .45); padding: 16px; }
.overlay.open { display: grid; }
.celebrate { position: relative; overflow: hidden; text-align: center; background: #fff; border-radius: 34px; padding: 26px 22px; width: min(460px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: pop .5s; }
.celebrate h2 { font-size: 2.4rem; margin: 6px 0; }
.celebrate h2 small { display: block; font-size: 1.1rem; color: var(--muted); font-style: italic; }
.cel-mascot .mascot { width: 110px; height: 110px; }
.cel-stars { font-size: 3.4rem; letter-spacing: 6px; color: #E8DFCC; }
.cel-stars .on { color: #FFC21A; text-shadow: 0 3px 0 #E09B00; display: inline-block; animation: pop .6s; }
.cel-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span { position: absolute; top: -40px; font-size: 26px; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(560px) rotate(260deg); opacity: 0; } }

/* ---------- parent area ---------- */
.gate { max-width: 460px; margin: 30px auto; text-align: center; }
.gate-q { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 900; margin: 16px 0; }
.gate-input { width: 140px; min-height: 60px; font-size: 1.8rem; text-align: center; border-radius: 16px; border: 3px solid var(--line); }
.gate-msg { min-height: 1.4em; font-weight: 700; color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { min-height: 40px; padding: 4px 14px; border-radius: 99px; border: 3px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; }
.parent-sec { margin-bottom: 18px; scroll-margin-top: 80px; }
.parent-sec h2 { font-size: 1.5rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: #F6EEDF; padding: 6px; border-radius: 22px; }
.seg button { min-height: 48px; padding: 6px 16px; border: 0; border-radius: 16px; background: transparent; font-weight: 800; cursor: pointer; }
.seg button.on { background: #fff; box-shadow: var(--shadow); }
.seg-sm button { min-height: 40px; }
.prog-age { border: 3px solid var(--line); border-radius: 18px; padding: 8px 14px; margin: 10px 0; }
.prog-age summary { cursor: pointer; min-height: 36px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prog-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .95rem; }
.prog-table th { text-align: left; color: var(--muted); font-size: .85rem; padding: 6px 4px; }
.prog-table td { border-top: 2px solid #F4ECDD; padding: 8px 4px; vertical-align: top; }
.prog-table td:first-child { font-weight: 800; white-space: nowrap; }
.prog-table td:nth-child(2) { white-space: nowrap; }
.prog-act { padding: 1px 0; }
@media (max-width: 640px) {
  .prog-table thead { display: none; }
  .prog-table tr { display: block; border-top: 2px solid #F4ECDD; padding: 6px 0; }
  .prog-table td { display: block; border: 0; padding: 2px 0; }
}
.recent { padding-left: 0; list-style: none; margin: 0 0 8px; }
.recent li { padding: 4px 0; }
.ws-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ws-filters select, .builder select, .builder input { min-height: 48px; padding: 6px 12px; border-radius: 14px; border: 3px solid var(--line); background: #fff; }
.ws-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ws-card { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 18px; border: 3px solid var(--line); background: #FFFDF8; text-decoration: none; color: var(--ink); font-size: .95rem; }
.ws-card:hover { border-color: var(--accent); }
.ws-card-icon { font-size: 1.8rem; }
.ws-card-title { font-weight: 900; font-size: 1.05rem; }
.ws-printed { font-size: .82rem; color: var(--good); font-weight: 800; }
.builder { display: grid; gap: 12px; max-width: 520px; }
.b-field { display: flex; flex-direction: column; gap: 4px; font-weight: 800; }
.settings { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.switch { display: flex; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { flex: none; width: 58px; height: 34px; border-radius: 99px; background: #DCD3C2; position: relative; transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: var(--good); }
.switch input:checked + .slider::after { transform: translateX(24px); }
.switch input:focus-visible + .slider { outline: 4px solid var(--blue); outline-offset: 2px; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-weight: 700; }
.range input { width: 200px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.tips li { margin-bottom: 8px; }
.notfound { max-width: 480px; margin: 30px auto; text-align: center; }

/* ---------- on-screen worksheets: toolbar & keypad ---------- */
#app.do-view { max-width: 1000px; }
.do-toolbar { position: sticky; top: 72px; z-index: 15; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; background: #fff; border-radius: 20px; padding: 8px 10px; box-shadow: var(--shadow); margin-bottom: 8px; }
.do-tools, .do-swatches, .do-sizes, .do-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.do-tool, .do-act { min-height: 48px; padding: 4px 12px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-weight: 900; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; touch-action: manipulation; }
.do-tool { font-size: 1.3rem; }
.do-tool span { font-size: .9rem; }
.do-tool[aria-pressed="true"] { background: #2FBF71; border-color: #1E8A50; color: #fff; }
.do-act:disabled { opacity: .4; cursor: default; }
.do-act[aria-pressed="true"] { border-color: var(--blue); background: #EAF2FF; }
.do-check { background: #2FBF71; color: #fff; border-color: #1E8A50; }
.do-sw { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.do-sw[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.12); }
.do-size { width: 40px; height: 40px; border-radius: 12px; border: 3px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.do-size i { display: block; border-radius: 50%; background: var(--ink); }
.do-size[aria-checked="true"] { border-color: var(--ink); }
.do-hint { margin: 0 0 8px; font-weight: 700; color: var(--muted); font-size: .95rem; }
.do-result { margin: 0 0 8px; padding: 10px 14px; border-radius: 16px; background: #FFF4D6; font-weight: 900; font-size: 1.1rem; }
.do-result.all { background: var(--good-soft); color: #13753F; }
.do-warn { background: #FFE8E8; color: #9B1C1C; padding: 8px 12px; border-radius: 12px; font-weight: 700; }
.do-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.do-footer .muted { flex-basis: 100%; margin: 0; font-size: .9rem; }
.do-keypad { position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; width: min(420px, calc(100% - 24px)); background: #fff; border-radius: 26px; padding: 14px; box-shadow: 0 16px 50px rgba(0, 0, 0, .28); }
.do-kp-display { min-height: 64px; display: grid; place-items: center; font-size: 2.6rem; font-weight: 900; font-family: var(--font-learn); background: #F2F8FF; border-radius: 16px; margin-bottom: 10px; color: #1E5FB4; }
.do-kp-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.do-kp-keys.letters { grid-template-columns: repeat(7, 1fr); }
.do-kp-keys button, .do-kp-row button { min-height: 56px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font: inherit; font-size: 1.5rem; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.do-kp-keys.letters button { min-height: 46px; font-size: 1.2rem; }
.do-kp-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 8px; }
.kp-ok { background: #2FBF71 !important; color: #fff; border-color: #1E8A50 !important; }
.kp-del { background: #FFF4E0 !important; }
.kid-ws-group { margin-bottom: 20px; }
.kid-ws-group h2 { font-size: 1.4rem; }
.tile-worksheets { background: #FFFBEA; border-color: #FFD966; }
@media (max-width: 560px) {
  .do-toolbar { position: static; padding: 6px; gap: 6px; }
  .do-tool span, .do-act { font-size: .85rem; }
  .do-tool, .do-act { min-height: 44px; padding: 2px 8px; }
  .do-sw { width: 30px; height: 30px; }
}

/* ---------- worksheet viewer (screen) ---------- */
.ws-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.ws-hint { font-size: .92rem; margin: 0 0 12px; }
.sheet-scale { width: 100%; overflow: hidden; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  body { font-size: 17px; }
  .hide-sm, .hide-xs { display: none; }
  .brand span { display: none; }
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .chip-age, .btn-parent { padding: 4px 10px; }
  .brand span { font-size: 1.05rem; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { min-height: 170px; padding: 16px 8px 12px; }
  .tile-icon { font-size: 2.8rem; }
  .card-grid, body[data-age="1-2"] .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pic-card { min-height: 170px; }
  .art-lg { --art: 64px; } .art-md { --art: 52px; } .art-xl { --art: 64px; } .art-sm { --art: 36px; }
  .choices { gap: 10px; }
  .choice { min-height: 130px; border-width: 4px; }
  .match-board { gap: 6px; }
  .match-item { min-height: 72px; padding: 6px; gap: 4px; flex-direction: column; }
  .match-label { font-size: .9rem; }
  .match-mid { display: none; }
  .match-board { grid-template-columns: 1fr 1fr; }
  .btn { min-height: 52px; padding: 8px 16px; }
  .card { padding: 16px; }
}

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