/* Layout: satu kolom terpusat, ubin besar ramah jari; warna per bidang (baca/tulis/hitung). Tema terang yang disengaja. */
:root {
  color-scheme: light;
  --bg: #eaf5ff;
  --paper: #ffffff;
  --fg: #22304a;
  --muted: #5b6b86;
  --line: #cfe0f3;
  --baca: #ff5a5f;
  --baca-soft: #ffe3e4;
  --tulis: #3a86ff;
  --tulis-soft: #dde9ff;
  --hitung: #17a398;
  --hitung-soft: #d5f4f0;
  --bentuk: #9b5de5;
  --bentuk-soft: #efe4fb;
  --waktu: #e07a00;
  --waktu-soft: #ffeccc;
  --sun: #ffc93c;
  --orange: #ff8c42;
  --good: #1f9d55;
  --bad: #e0464b;
  --ink: #3a86ff;
  --guide: #e9eef6;
  --guide-edge: #9fb3cf;
  --shadow: 0 4px 0 rgba(34, 48, 74, 0.12);
  --radius: 22px;
  --font-display: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Andika', 'Trebuchet MS', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 18px/1.5 var(--font-body);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg);
}
.brand { font: 800 1.5rem/1 var(--font-display); color: var(--tulis); }
.brand em { font-style: normal; color: var(--baca); margin-left: 4px; }
.topbar__title { margin: 0; font: 800 1.4rem/1.1 var(--font-display); text-align: center; text-wrap: balance; }
.topbar__right { display: flex; gap: 8px; align-items: center; }
.btn-round {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--paper); box-shadow: var(--shadow);
  font-size: 1.4rem; display: inline-grid; place-items: center; flex: none;
}
.btn-round:active { transform: translateY(2px); box-shadow: none; }
.star-badge {
  background: var(--sun); color: #5a3d00; font: 800 1.15rem/1 var(--font-display);
  padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}
.star-badge.bump { animation: bump 0.4s ease; }

.lang-toggle {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow);
  font: 800 0.85rem/1 var(--font-display); min-height: 44px; align-items: center;
}
.lang-toggle span { padding: 8px 8px; border-radius: 999px; color: var(--muted); }
.lang-toggle span.on { background: var(--tulis); color: #fff; }

/* ---------- Page ---------- */
.page {
  max-width: 920px; margin: 0 auto;
  padding-block: 8px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.hello { font: 800 clamp(1.6rem, 5vw, 2.4rem)/1.15 var(--font-display); margin: 12px 0 4px; text-wrap: balance; }
.sub, .hint { color: var(--muted); margin: 0 0 20px; }
.menu-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }

/* ---------- Pilih tingkat ---------- */
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.level-card {
  display: grid; justify-items: center; gap: 4px; padding: 28px 16px;
  border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow);
  border: 4px solid transparent; transition: transform 0.15s;
}
.level-card:hover { transform: translateY(-3px); }
.level-card--balita { border-color: var(--sun); }
.level-card--tk { border-color: var(--hitung); }
.level-card--sd { border-color: var(--tulis); }
.level-card__art { font-size: 4rem; line-height: 1; }
.level-card__name { font: 800 2rem/1 var(--font-display); }
.level-card__age { color: var(--muted); }

/* ---------- Menu ---------- */
.chip {
  padding: 8px 16px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow);
  font-weight: 700; min-height: 44px;
}
.chip--level { font-size: 0.95rem; color: var(--muted); }
.bidang { margin-top: 24px; }
.bidang__title { font: 800 1.5rem/1.2 var(--font-display); margin: 0 0 12px; }
.bidang--baca .bidang__title { color: var(--baca); }
.bidang--tulis .bidang__title { color: var(--tulis); }
.bidang--hitung .bidang__title { color: var(--hitung); }
.bidang--bentuk .bidang__title { color: var(--bentuk); }
.bidang--waktu .bidang__title { color: var(--waktu); }
.tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.act-tile {
  position: relative; text-align: left;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); min-height: 96px;
  transition: transform 0.15s;
}
.act-tile:hover { transform: translateY(-3px); }
.act-tile:active { transform: translateY(2px); box-shadow: none; }
.act-tile--baca { background: var(--baca-soft); }
.act-tile--tulis { background: var(--tulis-soft); }
.act-tile--hitung { background: var(--hitung-soft); }
.act-tile--bentuk { background: var(--bentuk-soft); }
.act-tile--waktu { background: var(--waktu-soft); }
.act-tile__icon { grid-row: span 2; font-size: 2.6rem; line-height: 1; }
.act-tile__name { font: 800 1.25rem/1.1 var(--font-display); }
.act-tile__desc { font-size: 0.9rem; color: var(--muted); line-height: 1.3; }
.act-tile__stars {
  position: absolute; top: 8px; right: 10px; font: 800 0.85rem/1 var(--font-display);
  background: var(--sun); color: #5a3d00; padding: 4px 8px; border-radius: 999px;
}

/* ---------- Kartu huruf / angka ---------- */
.flash {
  background: var(--paper); border-radius: 28px; box-shadow: var(--shadow);
  display: grid; justify-items: center; gap: 4px; padding: 20px 16px; margin: 8px auto 20px; max-width: 520px;
}
.flash.pop { animation: pop 0.35s ease; }
.flash__letter { font: 700 clamp(5rem, 22vw, 9rem)/1 var(--font-body); color: var(--baca); display: flex; align-items: baseline; gap: 0.2em; }
.flash--number .flash__letter { color: var(--hitung); }
.flash__lower { font-size: 0.6em; color: var(--tulis); }
.flash__emoji { font-size: clamp(3rem, 12vw, 4.5rem); line-height: 1.1; }
.flash__word { font: 700 clamp(1.6rem, 6vw, 2.2rem)/1.2 var(--font-body); }
.flash__word b { color: var(--baca); }
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.letter-key, .num-key {
  aspect-ratio: 1; max-width: 100%; border-radius: 18px; box-shadow: var(--shadow);
  font: 700 2rem/1 var(--font-body); color: #fff;
}
.letter-key:active, .num-key:active { transform: translateY(2px); box-shadow: none; }
.number-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.c0 { background: var(--baca); } .c1 { background: var(--orange); } .c2 { background: #e0a100; }
.c3 { background: var(--hitung); } .c4 { background: var(--tulis); }

/* ---------- Kuis ---------- */
.dots { display: flex; justify-content: center; gap: 8px; margin: 8px 0 16px; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: var(--line); transition: background 0.3s; }
.dot.done { background: var(--sun); }
.quiz { position: relative; display: grid; gap: 20px; }
.prompt {
  position: relative; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow);
  padding: 24px 64px 24px 20px; text-align: center; display: grid; place-items: center; min-height: 120px;
}
.prompt .replay { position: absolute; top: 12px; right: 12px; }
.prompt__text { font: 700 clamp(1.4rem, 5vw, 2rem)/1.3 var(--font-body); text-wrap: balance; }
.prompt__text b { color: var(--baca); }
.options { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.options--groups { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.option {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 110px; padding: 12px; display: grid; place-items: center; border: 4px solid transparent;
  transition: transform 0.12s;
}
.option:active { transform: translateY(2px); box-shadow: none; }
.option.is-correct { border-color: var(--good); background: #e5f7ec; animation: pop 0.35s ease; }
.option.is-wrong { border-color: var(--bad); opacity: 0.45; animation: shake 0.35s ease; }
.option__letter { font: 700 4rem/1 var(--font-body); }
.option__num { font: 800 3.4rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.option__emoji { font-size: 3.6rem; line-height: 1; }

.objects { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.1; max-width: 520px; margin: 0 auto; }
.obj { animation: drop 0.35s ease both; }
.obj--gone { opacity: 0.3; position: relative; }
.obj--gone::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--bad); font-weight: 800; }
.eq-visual { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.eq-op { font: 800 2.4rem/1 var(--font-display); color: var(--tulis); }
.equation { font: 800 clamp(2.4rem, 9vw, 3.4rem)/1 var(--font-display); font-variant-numeric: tabular-nums; }
.equation__blank { display: inline-block; min-width: 1.4em; padding: 0 0.2em; border-radius: 12px; background: var(--sun); color: #5a3d00; }

.bubble {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  font: 800 2rem/1 var(--font-display); padding: 14px 24px; border-radius: 999px; color: #fff;
  animation: float 1.1s ease forwards; white-space: nowrap;
}
.bubble--good { background: var(--good); }
.bubble--try { background: var(--orange); font-size: 1.4rem; }

/* ---------- Suku kata ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chips .chip { min-width: 52px; height: 52px; padding: 0 12px; font: 700 1.6rem/1 var(--font-body); }
.chips .chip[aria-selected="true"] { background: var(--baca); color: #fff; }
.syl-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.syl { border-radius: var(--radius); box-shadow: var(--shadow); color: #fff; padding: 18px 8px; display: grid; justify-items: center; gap: 4px; }
.syl.pop { animation: pop 0.35s ease; }
.syl__parts { font-size: 1.1rem; opacity: 0.9; }
.syl__parts i { font-style: normal; font-weight: 700; }
.syl__whole { font: 700 3.4rem/1 var(--font-body); }

/* ---------- Susun kata ---------- */
.picture {
  position: relative; font-size: clamp(5rem, 22vw, 8rem); line-height: 1; text-align: center;
  background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.picture .replay { position: absolute; top: 12px; right: 12px; font-size: 1.4rem; }
.slots, .tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 20px; }
.slot {
  min-width: 110px; height: 84px; border-radius: 18px; border: 4px dashed var(--guide-edge);
  display: grid; place-items: center; font: 700 2.6rem/1 var(--font-body); color: var(--baca);
}
.slot.full { border-style: solid; border-color: var(--good); background: #e5f7ec; animation: pop 0.3s ease; }
.tile {
  min-width: 110px; height: 84px; padding: 0 16px; border-radius: 18px; background: var(--sun); color: #5a3d00;
  box-shadow: var(--shadow); font: 700 2.6rem/1 var(--font-body);
}
.tile.used { opacity: 0.25; box-shadow: none; }
.tile.shake { animation: shake 0.35s ease; }

/* ---------- Kalimat ---------- */
.sentence { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.word { font: 700 clamp(1.8rem, 7vw, 2.6rem)/1.2 var(--font-body); padding: 4px 6px; border-radius: 10px; border-bottom: 4px solid var(--line); }
.word:active { background: var(--tulis-soft); }

/* ---------- Menulis ---------- */
.trace__nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 8px 0 12px; }
.trace__label { font: 700 2.2rem/1 var(--font-body); min-width: 3ch; text-align: center; color: var(--tulis); }
.trace__label--name { font: 800 1.25rem/1.1 var(--font-display); min-width: 8ch; max-width: 50vw; }
.trace { position: relative; margin: 0 auto; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; max-width: 100%; }
.trace canvas, .trace svg { position: absolute; inset: 0; }
.trace__ink { touch-action: none; cursor: crosshair; }
.trace__result { min-height: 3rem; text-align: center; font-size: 1.2rem; padding-top: 12px; color: var(--muted); }
.trace__stars { font-size: 2.4rem; color: var(--sun); letter-spacing: 0.1em; }
.trace__actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* garis buku tulis, panduan, titik mulai, panah, dan contoh animasi */
.tl-line { stroke: var(--line); stroke-width: 0.8; }
.tl-line--base { stroke: var(--guide-edge); }
.tl-guide path { fill: none; stroke: var(--guide); stroke-linecap: round; stroke-linejoin: round; }
.tl-center path { fill: none; stroke: var(--guide-edge); stroke-width: 1.2; stroke-dasharray: 2.5 3; stroke-linecap: round; }
.tl-demo path { fill: none; stroke: var(--orange); stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.tl-dot { fill: var(--baca); stroke: var(--paper); stroke-width: 1; }
.tl-num { fill: #fff; font: 800 6.5px var(--font-display); text-anchor: middle; }
.tl-arrow { fill: var(--baca); }
/* koreksi */
.tl-miss { fill: none; stroke: var(--orange); stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; animation: blink 1s ease-in-out 3; }
.tl-center path.is-wrong { stroke: var(--bad); stroke-width: 2.4; stroke-dasharray: none; }
.tl-arrow.is-wrong { fill: var(--bad); stroke: var(--bad); stroke-width: 1.5; stroke-linejoin: round; }
.tl-dot.is-hint { fill: var(--bad); animation: blink 0.8s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
/* permainan menulis */
.tl-done path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tl-dot.is-next { animation: nextpulse 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nextpulse { 50% { transform: scale(1.35); } }
.tl-dot.is-done, .tl-num.is-done, .tl-arrow.is-done { opacity: 0; transition: opacity 0.3s; }
.trace__fx { position: absolute; inset: 0; pointer-events: none; }
.trace__reject { position: absolute; inset: 0; animation: reject 0.9s ease forwards; }
@keyframes reject { 0%, 30% { opacity: 1; transform: translateX(0); } 10% { transform: translateX(-6px); } 20% { transform: translateX(6px); } 100% { opacity: 0; transform: translateX(0); } }
.spark { position: absolute; font-size: 1.3rem; translate: -50% -50%; animation: spark 0.9s ease-out both; }
@keyframes spark { from { opacity: 1; transform: scale(0.4); } to { opacity: 0; transform: scale(1.4) translateY(-24px); } }
.trace__buddy { position: absolute; font-size: 2rem; translate: -50% -50%; pointer-events: none; transition: left 0.5s cubic-bezier(.3,1.5,.6,1), top 0.5s cubic-bezier(.3,1.5,.6,1), opacity 0.2s; animation: bob 1.4s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.2)); }
.trace__buddy.is-instant, .trace__buddy.is-walking { transition: opacity 0.2s; }
.trace__buddy.is-walking { animation: none; }
.trace__buddy.is-away { opacity: 0.35; }
.trace__buddy.is-shake { animation: shake 0.4s ease; }
.trace__buddy.is-happy { animation: hop 0.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
@keyframes hop { 50% { transform: translateY(-14px) rotate(10deg); } }
.trace__progress { display: flex; justify-content: center; gap: 6px; min-height: 12px; margin: -4px 0 8px; }
.trace__progress .pip { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background 0.3s, transform 0.3s; }
.trace__progress .pip.done { background: var(--good); transform: scale(1.2); }
.trace__reward { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: rgb(255 255 255 / 0.78); animation: rewardIn 0.6s cubic-bezier(.3,1.6,.6,1) both; }
.trace__reward-e { font-size: clamp(2.5rem, 12vw, 4.5rem); line-height: 1.1; max-width: 90%; text-align: center; word-break: break-all; }
.trace__reward-t { font: 800 1.4rem var(--font-display); color: var(--fg); background: var(--paper); padding: 2px 14px; border-radius: 999px; box-shadow: var(--shadow); }
@keyframes rewardIn { from { opacity: 0; transform: scale(0.3) translateY(40px); } }
.trace__next { margin-top: 10px; }
.trace__tools { display: flex; justify-content: center; gap: 8px; margin: 0 auto 10px; flex-wrap: wrap; }
.tool { display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 6px 10px; border: 0; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); font: 700 0.8rem var(--font-body); color: var(--fg); cursor: pointer; }
.tool__i { font-size: 1.5rem; line-height: 1; }
.tool[aria-pressed="true"] { background: var(--tulis-soft); box-shadow: inset 0 0 0 3px var(--tulis); }
.tool:active { transform: scale(0.94); }
.trace.is-erasing .trace__ink { cursor: cell; }
.trace__eraser { position: absolute; font-size: 2rem; translate: -50% -50%; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.trace.is-erasing.is-rubbing .trace__eraser { opacity: 1; animation: rub 0.25s ease-in-out infinite; }
@keyframes rub { 50% { rotate: 12deg; } }
@media (prefers-reduced-motion: reduce) { .trace__buddy, .tl-dot.is-next, .trace__reward, .trace__reject { animation: none; transition: none; } }
.trace__verdict { font: 800 1.5rem/1.2 var(--font-display); }
.trace__verdict--good { color: var(--good); }
.trace__verdict--warn { color: var(--orange); }
.trace__verdict--bad { color: var(--bad); }
.trace__reason { font-size: 1rem; color: var(--fg); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .tl-miss, .tl-dot.is-hint { animation: none; } }

/* ---------- Pengaturan suara ---------- */
.voice-box { display: grid; gap: 10px; background: var(--bg); border-radius: 16px; padding: 12px 14px; }
.voice-box h3 { margin: 0; }
.dl-bar { width: 100%; height: 14px; accent-color: var(--tulis); }
.dl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-actions:empty { display: none; }
.field { display: grid; gap: 4px; font-weight: 700; font-size: 0.95rem; }
.range { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
.range input { flex: 1; min-width: 0; accent-color: var(--tulis); }
.select { font: inherit; font-weight: 400; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); color: var(--fg); max-width: 100%; }

/* ---------- Rekam suara ---------- */
.rec-group { margin-top: 24px; }
.rec-group .note { margin-bottom: 10px; }
.rec-list { display: grid; gap: 8px; }
.rec {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px;
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 12px;
}
.rec__label { font: 700 1.8rem/1 var(--font-body); text-align: center; color: var(--tulis); }
.rec__text { display: grid; min-width: 0; font-size: 0.95rem; }
.rec__status { font-size: 0.85rem; color: var(--muted); }
.rec.has-clip .rec__status { color: var(--good); font-weight: 700; }
.rec__btns { display: flex; gap: 6px; }
.rec__btns .btn-round { width: 46px; height: 46px; font-size: 1.1rem; }
.rec__btns .btn-round:disabled { opacity: 0.35; cursor: default; }
.rec.is-recording { box-shadow: 0 0 0 3px var(--bad); }
.rec.is-recording .rec__rec { background: var(--bad); animation: pulse 1s infinite; }
.rec.is-recording .rec__status { color: var(--bad); font-weight: 700; }
.note--warn { background: #fff4e0; border-radius: 14px; padding: 10px 14px; color: #7a4b00; }
@keyframes pulse { 50% { transform: scale(1.1); } }
@media (max-width: 480px) {
  .rec { grid-template-columns: 40px 1fr; }
  .rec__btns { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------- Tombol ---------- */
.btn {
  min-height: 56px; padding: 0 22px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow);
  font: 800 1.15rem/1 var(--font-display);
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn--primary { background: var(--good); color: #fff; }
.btn--wide { width: 100%; }
.btn--danger { background: var(--bad); color: #fff; }
.btn--danger-outline { color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }

/* ---------- Selesai ---------- */
.finish { text-align: center; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); padding: 32px 16px; margin-top: 16px; }
.finish h2 { font: 800 2.4rem/1.1 var(--font-display); margin: 0 0 8px; color: var(--tulis); }
.finish__stars { font-size: 3rem; color: var(--line); letter-spacing: 0.08em; }
.finish__stars .on { color: var(--sun); }
.finish__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }

/* ---------- Panel orang tua ---------- */
.parents { border: 0; border-radius: 24px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: 85vh; color: var(--fg); background: var(--paper); }
.parents::backdrop { background: rgba(34, 48, 74, 0.45); }
.parents__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 2px solid var(--line); }
.parents__head h2 { margin: 0; font: 800 1.5rem/1 var(--font-display); }
.parents__body { padding: 16px 20px 24px; display: grid; gap: 12px; }
.parents__body h3 { margin: 8px 0 0; font: 800 1.2rem/1 var(--font-display); }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.switch input { width: 24px; height: 24px; accent-color: var(--tulis); }
.note { font-size: 0.95rem; color: var(--muted); margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
td:not(:first-child), th:not(:first-child) { text-align: right; }
.confirm { background: #fff1f1; border-radius: 16px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm p { margin: 0; flex-basis: 100%; }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* ---------- Animasi ---------- */
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes bump { 50% { transform: scale(1.2); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; }
}

@media (max-width: 480px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 8px; }
  .brand { font-size: 1.2rem; }
  .topbar__title { font-size: 1.15rem; }
  .btn-round { width: 46px; height: 46px; font-size: 1.2rem; }
  .topbar__right { gap: 6px; }
  .star-badge { padding: 8px 10px; font-size: 1rem; }
  .lang-toggle span { padding: 7px 6px; }
  .option { min-height: 96px; }
  .option__letter { font-size: 3.2rem; }
  .slot, .tile { min-width: 90px; height: 72px; font-size: 2.1rem; }
}

/* ---------- Tiga Tahap, Teman Sepuluh, Satu Lebih ---------- */
.chip--done { box-shadow: inset 0 0 0 2px var(--good); }
.steps { display: flex; justify-content: center; gap: 6px; padding: 0; margin: 0 0 14px; list-style: none; flex-wrap: wrap; }
.steps li { padding: 6px 12px; border-radius: 999px; background: var(--paper); color: var(--muted); font-weight: 700; font-size: 0.9rem; box-shadow: var(--shadow); }
.steps li b { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--line); color: var(--fg); font-size: 0.8rem; }
.steps li.on { background: var(--baca); color: #fff; }
.steps li.on b { background: #fff; color: var(--baca); }
.steps li.done b { background: var(--good); color: #fff; }
.flash--meet { cursor: pointer; }
.big-letter { font: 700 clamp(4rem, 20vw, 6rem)/1 var(--font-body); color: var(--baca); }
.ten-frame { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 340px); margin: 0 auto 12px; padding: 8px; border-radius: 16px; background: var(--hitung-soft); }
.ten-frame__cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--paper); border: 2px dashed var(--line); font-size: clamp(1.4rem, 6vw, 2rem); }
.ten-frame__cell.on { border-style: solid; border-color: var(--hitung); animation: drop 0.35s ease both; }
.objects--ghost { opacity: 0.45; outline: 3px dashed var(--hitung); outline-offset: 4px; border-radius: 12px; display: inline-flex; }
.curriculum details { border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.curriculum summary { font-weight: 800; cursor: pointer; }
.curriculum dl { margin: 6px 0 0; display: grid; gap: 4px; }
.curriculum dt { font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.curriculum dd { margin: 0 0 4px; font-size: 0.92rem; }

/* ---------- Bentuk & Pola ---------- */
.shape { width: 100%; height: 100%; display: block; }
.shape path { stroke: rgb(0 0 0 / 0.18); stroke-width: 2; stroke-linejoin: round; }
.flash--shape { cursor: pointer; }
.shape--big { width: min(48vw, 200px); height: min(48vw, 200px); margin: 0 auto; }
.shape-eg { font-size: 2rem; letter-spacing: 0.15em; margin-top: 4px; }
.shape-facts { color: var(--muted); font-weight: 700; margin-top: 4px; }
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.shape-key { aspect-ratio: 1; padding: 12px; border: 0; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); cursor: pointer; }
.shape-key:active { transform: scale(0.94); }
.option .shape { width: clamp(56px, 18vw, 84px); height: clamp(56px, 18vw, 84px); }
/* pola harus terbaca dalam SATU baris supaya ritmenya kelihatan (maks 11 kotak) */
.pattern { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 3px; margin: 40px 0 12px; padding: 4px 2px; overflow: hidden; max-width: 100%; }
.pat-item, .pat-blank { flex: 0 1 44px; min-width: 0; aspect-ratio: 1; }
.pat-item { animation: drop 0.35s ease both; }
.pat-blank { display: grid; place-items: center; border: 3px dashed var(--bentuk); border-radius: 12px; font: 800 1.5rem var(--font-display); color: var(--bentuk); }
.pat-blank.filled { border-style: solid; animation: pop 0.35s ease; }

/* ---------- Ganjil & genap ---------- */
.pairs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px; margin: 8px auto 12px; max-width: 360px; transition: opacity 0.3s; }
.pairs.is-hidden { opacity: 0; height: 0; margin: 0; overflow: hidden; }
.pairs__col { display: grid; gap: 4px; padding: 4px; border-radius: 999px; background: var(--hitung-soft); align-content: start; }
.pairs__col.is-alone { background: var(--baca-soft); box-shadow: 0 0 0 2px var(--baca); }
.counter { width: clamp(18px, 6vw, 26px); aspect-ratio: 1; border-radius: 50%; background: var(--baca); animation: drop 0.35s ease both; }
.option__word { display: grid; justify-items: center; gap: 4px; font: 800 1.4rem var(--font-display); }
.option__icon { font-size: 2rem; }
/* ---------- Ukuran ---------- */
.options--stack { display: grid; grid-template-columns: 1fr; gap: 10px; }
.options--stack .option { grid-template-columns: 1fr; justify-items: start; min-height: 64px; padding: 14px; }
.options--stack .rod { justify-self: start; }
.options--towers { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; }
.options--towers .option { align-items: end; padding: 10px 6px; }
.rod { display: flex; height: 22px; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 0 rgb(0 0 0 / 0.15); }
.rod i { flex: 1; }
.rod__a { background: #e63946; } .rod__b { background: #3a86ff; }
.tower { display: flex; flex-direction: column-reverse; justify-content: flex-start; align-items: center; height: calc(8 * clamp(14px, 4.4vw, 20px) + 7 * 2px); gap: 2px; }
.tower i { width: clamp(30px, 10vw, 44px); height: clamp(14px, 4.4vw, 20px); border-radius: 4px; box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.15); animation: drop 0.3s ease both; }
.balance svg { width: min(100%, 320px); display: block; margin: 0 auto 8px; overflow: visible; }
.balance line { stroke: var(--fg); stroke-width: 2; stroke-linecap: round; }
.balance .beam { stroke-width: 6; stroke: var(--muted); }
.balance .base { fill: var(--line); }
.balance .pivot { fill: var(--fg); }
.balance .pan { fill: var(--sun); stroke: var(--fg); stroke-width: 1.5; }

/* ---------- Nilai tempat (Golden Beads; satuan hijau, puluhan biru) ---------- */
.pv { font: 800 clamp(2.4rem, 9vw, 3.4rem)/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pv--big { font-size: clamp(3.4rem, 15vw, 5rem); display: block; text-align: center; }
.pv-t { color: #2f6fe4; } .pv-o { color: #17924a; }
.option .pv { font-size: clamp(2rem, 8vw, 2.8rem); }
.beads { display: flex; justify-content: center; align-items: flex-end; gap: 22px; margin: 4px auto 12px; }
.beads__col { display: grid; justify-items: center; gap: 6px; padding: 8px 10px; border-radius: 14px; background: rgb(255 255 255 / 0.6); min-width: 64px; }
.beads__label { font: 800 0.85rem var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; }
.beads__tens { display: flex; gap: 4px; min-height: 140px; align-items: flex-end; flex-wrap: wrap; max-width: 200px; justify-content: center; }
.beads__ones { display: flex; flex-direction: column-reverse; flex-wrap: wrap; align-content: flex-start; gap: 3px; height: calc(5 * 14px + 4 * 3px); } /* tumpuk dari bawah, 5 per kolom */
.bar { display: grid; gap: 1px; padding: 2px; border-radius: 6px; background: #b8860b; }
.bar i, .bead { display: block; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #f2b705 55%, #b8860b); }
.bead { width: 14px; height: 14px; }
.bar.is-new { animation: pop 0.5s ease; }
.beads__ones.is-exchanging .bead { animation: gather 0.9s ease forwards; }
@keyframes gather { to { transform: translateX(-40px) scale(0.6); opacity: 0; } }
.proof:empty { display: none; }
.bank { position: relative; }
.bank__target { position: relative; text-align: center; padding: 12px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.bank__target .replay { position: absolute; top: 10px; right: 10px; }
.bank__tray { min-height: 200px; background: #fdf6dd; border-radius: var(--radius); padding: 8px; display: grid; place-items: end center; }
.bank__live { text-align: center; font: 800 1.2rem var(--font-display); margin: 10px 0; }
.bank__controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.bank__group { display: grid; grid-template-columns: 56px 1fr; gap: 6px; }
.bank__btn { min-height: 64px; border: 0; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); font: 800 1.4rem var(--font-display); cursor: pointer; }
.bank__btn:active { transform: translateY(2px); box-shadow: none; }
.bank__add > span { display: inline-flex; align-items: center; gap: 6px; }
.bank__add .bar { grid-auto-flow: column; padding: 1px; }
.bank__add .bar i { width: 6px; height: 6px; }
.bank.is-done .bank__tray { box-shadow: 0 0 0 4px var(--good); }

/* ---------- Jam ---------- */
.clock svg { width: min(62vw, 230px); display: block; margin: 0 auto 8px; }
.clock--small svg { width: clamp(72px, 24vw, 110px); margin: 0; }
.clock__face { fill: #fff; stroke: var(--waktu); stroke-width: 3; }
.clock__ticks line { stroke: var(--muted); stroke-width: 0.8; }
.clock__nums text { font: 800 8px var(--font-display); fill: var(--fg); text-anchor: middle; }
.clock--small .clock__nums text { font-size: 10px; }
.clock__h { stroke: var(--baca); stroke-width: 5; stroke-linecap: round; }
.clock__m { stroke: var(--tulis); stroke-width: 3; stroke-linecap: round; }
.clock__pin { fill: var(--fg); }
.option__time { font-variant-numeric: tabular-nums; font-size: clamp(1.5rem, 6.5vw, 2.2rem); }
/* ---------- Uang (gaya sederhana, bukan desain asli) ---------- */
.coin, .banknote { display: inline-grid; place-items: center; font: 800 0.72rem/1 var(--font-display); color: #3b2f00; box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.18), 0 2px 0 rgb(0 0 0 / 0.12); }
.coin { width: calc(44px + var(--tier) * 3px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #cfd6de 45%, #9aa6b2); border: 3px solid #b6c0ca; }
.money--id-500, .money--en-20, .money--en-50 { background: radial-gradient(circle at 35% 30%, #fff7c2, #f2c94c 45%, #c99a1a); border-color: #e0b43a; }
.money--id-1000 { background: radial-gradient(circle at 50% 50%, #f2c94c 0 42%, #cfd6de 44%); border-color: #b6c0ca; }
.money--en-1, .money--en-2 { background: radial-gradient(circle at 35% 30%, #ffd9b8, #d9824b 45%, #a65a2a); border-color: #c9703a; color: #fff; }
.banknote { width: 86px; height: 44px; border-radius: 6px; color: #fff; border: 3px solid rgb(255 255 255 / 0.5); }
.money--id-2000 { background: #7d8a92; } .money--id-5000 { background: #a0673a; } .money--id-10000 { background: #8e4fbf; }
.money-group { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.prompt .money-group { margin-bottom: 10px; }
.option__money { font-size: clamp(1.4rem, 6vw, 2rem); }
.shop { display: grid; justify-items: center; gap: 6px; }
.shop__item { font-size: 4rem; line-height: 1; }
.shop__tag { font: 800 1.4rem var(--font-display); background: var(--sun); padding: 4px 14px; border-radius: 10px 999px 999px 10px; box-shadow: var(--shadow); }
/* ---------- Gelas, bangun ruang, cermin ---------- */
.glass svg { width: clamp(44px, 14vw, 64px); display: block; }
.glass__cup { fill: rgb(58 134 255 / 0.06); stroke: var(--muted); stroke-width: 3; stroke-linejoin: round; }
.glass__water { fill: #6ec6ff; }
.solid svg { width: clamp(64px, 20vw, 96px); display: block; }
.big-emoji { font-size: clamp(3.5rem, 16vw, 5rem); line-height: 1.1; }
.sym { display: flex; justify-content: center; align-items: stretch; gap: 0; margin-bottom: 10px; }
.sym-grid { display: inline-grid; gap: 3px; padding: 4px; background: var(--line); border-radius: 8px; }
.sym-grid i { width: clamp(22px, 7vw, 32px); aspect-ratio: 1; background: #fff; border-radius: 4px; }
.sym-grid--opt i { width: clamp(16px, 5vw, 24px); }
.sym-mirror { width: 4px; margin: -6px 6px; background: repeating-linear-gradient(to bottom, var(--bentuk) 0 6px, transparent 6px 11px); border-radius: 2px; }
.sym-slot { display: grid; place-items: center; min-width: 60px; border: 3px dashed var(--bentuk); border-radius: 8px; font: 800 1.5rem var(--font-display); color: var(--bentuk); }
/* ---------- Kata sering & cerita ---------- */
.option__sight { font: 700 clamp(1.8rem, 7vw, 2.4rem) var(--font-body); }
.scene { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; cursor: pointer; margin: 8px 0 14px; }
.scene__e { font-size: clamp(3.5rem, 18vw, 5.5rem); line-height: 1.15; }
.scene__t { font: 700 clamp(1.2rem, 5vw, 1.5rem)/1.4 var(--font-body); margin: 10px 0 0; }
.scene__title { text-align: center; margin: 0 0 6px; font: 800 1.3rem var(--font-display); }
.story-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 16px; }
.story-slot { aspect-ratio: 1; display: grid; place-items: center; border: 3px dashed var(--line); border-radius: 14px; font: 800 1.3rem var(--font-display); color: var(--muted); font-size: clamp(1.4rem, 7vw, 2.2rem); }
.story-slot.full { border-style: solid; border-color: var(--good); background: #e5f7ec; animation: pop 0.3s ease; }
.story-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.story-card { min-height: 96px; border: 0; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); font-size: clamp(2.2rem, 10vw, 3rem); cursor: pointer; }
.story-card.used { opacity: 0.3; }
/* ---------- Ratusan ---------- */
.pv-h { color: #d62828; }
.beads--h { gap: 6px; }
.beads__hund { display: flex; flex-wrap: wrap; gap: 4px; max-width: 150px; justify-content: center; align-items: flex-end; min-height: 60px; }
.square { width: 44px; height: 44px; border-radius: 4px; background: radial-gradient(circle, #f2b705 1.6px, #b8860b 2.2px) 0 0 / 4.4px 4.4px, #b8860b; box-shadow: 0 1px 0 rgb(0 0 0 / 0.2); }
.square.is-new { animation: pop 0.5s ease; }
.beads--h .beads__tens { flex-wrap: nowrap; max-width: none; min-height: 120px; } /* batang tidak boleh bertumpuk: bisa terbaca sebagai 20 */
.beads--h .bar i { width: clamp(5px, 1.8vw, 7px); height: clamp(5px, 1.8vw, 7px); }
.beads--h .bar { padding: 1px; }
.beads--h .beads__tens { gap: 2px; }
.beads--h .beads__col { padding: 6px 4px; min-width: 0; }
.beads--h .beads__hund { max-width: 64px; gap: 3px; }
.beads--h .square { width: clamp(26px, 8vw, 30px); height: clamp(26px, 8vw, 30px); background-size: 10% 10%; }
.beads--h .bead { width: 11px; height: 11px; }
.beads--h .beads__ones { height: calc(5 * 11px + 4 * 3px); }
.beads--h .beads__label { font-size: 0.7rem; }
.bank__controls--h { grid-template-columns: 1fr; }
.bank__controls--h .bank__group { grid-template-columns: 56px 1fr; }
.bank__add .square { width: 22px; height: 22px; background-size: 2.2px 2.2px; }

.chips--small .chip { font-size: 0.95rem; padding: 8px 14px; }

/* ---------- Layar sempit (≤ 360px, mis. HP kecil) ---------- */
/* item grid/flex boleh mengecil di bawah lebar isinya: mencegah halaman meluber ke samping */
.prompt, .options, .option, .quiz, .bank__group, .bank__btn { min-width: 0; }
.prompt .equation { overflow-wrap: anywhere; }
@media (max-width: 360px) {
  /* bilah atas: logo + ID|EN + bintang + ⚙️ harus muat di 320px */
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar > * { min-width: 0; }
  .topbar__right { gap: 5px; }
  .brand { font-size: 1.15rem; }
  .topbar__title { font-size: 1.05rem; }
  .btn-round { width: 44px; height: 44px; font-size: 1.2rem; }
  .star-badge { padding: 8px 10px; font-size: 1rem; }
  .lang-toggle span { padding: 7px 6px; }
  .bank__controls { grid-template-columns: 1fr; }
  .equation { font-size: 2.1rem; }
  .ten-frame { gap: 4px; padding: 6px; }
  .ten-frame__cell { font-size: 1.2rem; }
}
