/* Baloo 2 — self-hosted (vietnamese + latin-ext + latin), embedded so the lesson UI never depends on the viewer's machine fonts. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/baloo2-vietnamese-600.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/baloo2-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/baloo2-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("assets/fonts/baloo2-vietnamese-800.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("assets/fonts/baloo2-latin-ext-800.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("assets/fonts/baloo2-latin-800.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ============================================================
   CungConHoc — Engine bài học mới "Cô dẫn bé làm" (audio-first)
   Production stylesheet. Data-driven by lessons/<id>/lesson.json
   ============================================================ */
:root {
  --ink: #23404d;
  --ink-soft: #52707e;
  --teal: #2ec4b6;
  --teal-dark: #1fa396;
  --coral: #ff8fa3;
  --coral-dark: #e56b81;
  --sun: #ffb703;
  --sun-dark: #e09e00;
  --red: #e63946;
  --card-border: #e8f4f8;
  --card-shadow: #d5e8ee;
  --radius-card: 26px;
  --font: "Baloo 2", "Comic Sans MS", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, #6ec6f5 0%, #aee3ff 40%, #fdf3d0 100%);
  display: flex; justify-content: center;
  min-height: 100dvh; overflow: hidden;
  color: var(--ink);
}

/* ---------- App frame ---------- */
#app {
  width: 100%; max-width: 560px; height: 100dvh;
  display: flex; flex-direction: column; position: relative;
  background: linear-gradient(180deg, #8ed8ff 0%, #cdefff 46%, #fff6d9 100%);
  box-shadow: 0 0 60px rgba(35, 64, 77, .25);
  overflow: hidden;
}
@media (min-width: 900px) {
  #app { max-width: 640px; }
}

/* ---------- Background scene ---------- */
.scene { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.scene-sky { position: absolute; top: 54px; left: 0; width: 100%; height: 190px; }
.scene-sky .cloud { fill: #ffffff; opacity: .85; }
.cloud-c { opacity: .6; }
/* Clouds are static: no continuous decorative motion — the only
   animations left are consequences of the child's own actions
   (feedback, hints, the teacher's mouth while she speaks). */
.scene-hills { position: absolute; bottom: 0; left: 0; width: 100%; height: 150px; }

/* ---------- Top bar ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 6px; position: relative; z-index: 3;
}
#dots { display: flex; gap: 8px; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,.55); border: 2px solid #fff;
  transition: background .3s, transform .3s;
}
.dot.on { background: var(--sun); transform: scale(1.2); }
.dot.done { background: var(--teal); }
#btnReplay {
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: var(--coral); box-shadow: 0 5px 0 var(--coral-dark);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, box-shadow .1s;
}
#btnReplay:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--coral-dark); }

/* ---------- Stage & screens ---------- */
#stage {
  flex: 1; position: relative; z-index: 2;
  padding: 4px 20px 118px;
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; scrollbar-width: none;
}
#stage::-webkit-scrollbar { display: none; }
.screen { display: none; width: 100%; flex-direction: column; align-items: center; }
.screen.active { display: flex; animation: screenIn .38s cubic-bezier(.2,.9,.3,1.2); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

#loading { margin-top: 120px; text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 17px; }
.loading-dot {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--sun); animation: bounce 0.9s ease-in-out infinite alternate;
}
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-16px); } }

/* ---------- Teacher & speech bubble ---------- */
.teacher-img {
  width: 168px; height: 168px; object-fit: cover; object-position: top center;
  border-radius: 50%; border: 5px solid #fff;
  box-shadow: 0 10px 24px rgba(35,64,77,.22);
  background: #fff8ea; margin-top: 6px;
}
.teacher-row { display: flex; align-items: flex-start; gap: 12px; max-width: 420px; margin-top: 8px; }
.teacher-thumb {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  border: 3px solid #fff; box-shadow: 0 4px 10px rgba(35,64,77,.2); background: #fff8ea;
}
.bubble {
  background: #fff; border-radius: 22px; padding: 14px 18px; position: relative;
  font-size: 19px; line-height: 1.45; text-align: center; font-weight: 600;
  box-shadow: 0 6px 18px rgba(35,64,77,.14); max-width: 360px;
}
.bubble.solo { margin-top: 12px; }
.bubble.solo:before {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  border: 11px solid transparent; border-bottom-color: #fff; border-top: 0;
}
.teacher-row .bubble { text-align: left; }
.teacher-row .bubble:before {
  content: ""; position: absolute; top: 22px; left: -10px;
  border: 11px solid transparent; border-right-color: #fff; border-left: 0;
}
.bubble small { display: block; margin-top: 7px; font-size: 13.5px; color: #8a9ba5; font-weight: 500; line-height: 1.5; }
.bubble b { color: var(--red); }

.course-label {
  margin-top: 12px; font-size: 13px; font-weight: 700; letter-spacing: .6px;
  color: var(--ink-soft); text-transform: uppercase;
}

/* ---------- Big start / next buttons (min 64px touch targets) ---------- */
#btnStart {
  margin-top: 28px; width: 112px; height: 112px; border-radius: 50%;
  border: 4px solid #fff; cursor: pointer; background: var(--sun); color: #fff;
  box-shadow: 0 9px 0 var(--sun-dark);
  display: flex; align-items: center; justify-content: center;
  animation: pulseGlow 1.5s ease-in-out infinite;
  transition: transform .1s, box-shadow .1s;
}
#btnStart:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--sun-dark); }
@keyframes pulseGlow {
  0%,100% { box-shadow: 0 9px 0 var(--sun-dark), 0 0 0 0 rgba(255,183,3,.5); }
  50% { box-shadow: 0 9px 0 var(--sun-dark), 0 0 0 16px rgba(255,183,3,0); }
}
#btnNext {
  position: absolute; right: 20px; bottom: 24px; z-index: 10;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--teal); border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 7px 0 var(--teal-dark);
  display: none; align-items: center; justify-content: center;
  transition: transform .1s, box-shadow .1s;
}
#btnNext.show { display: flex; animation: screenIn .3s ease; }
#btnNext:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }

/* ---------- Listen step: giant letter + mouth ---------- */
#bigLetter {
  font-size: 168px; font-weight: 800; color: var(--red); line-height: 1.05;
  margin-top: 18px; cursor: pointer; user-select: none;
  text-shadow: 0 7px 0 #ffd6da;
  min-width: 120px; min-height: 120px; text-align: center;
}
#mouth {
  width: 118px; height: 68px; background: #7a2e35; border-radius: 50%;
  margin-top: 12px; cursor: pointer; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center;
  border: 4px solid #fff; box-shadow: 0 5px 12px rgba(35,64,77,.25);
}
#mouthTongue { width: 74px; height: 32px; background: var(--coral); border-radius: 50% 50% 0 0; }
#mouth.talking { animation: talk .26s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.78); } to { transform: scaleY(1.1); } }
.hint-text { margin-top: 16px; font-size: 16px; color: var(--ink-soft); font-weight: 600; text-align: center; }

/* ---------- Picture cards ---------- */
.cards { display: flex; gap: 16px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }
.card {
  width: 118px; min-height: 138px; padding: 10px 8px 12px;
  background: #fff; border-radius: var(--radius-card); border: 4px solid var(--card-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; position: relative;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.card:active { transform: scale(.94); }
.card .pic { width: 92px; height: 92px; object-fit: cover; border-radius: 18px; pointer-events: none; }
.card .word { font-size: 21px; font-weight: 800; margin-top: 7px; }
.card .word b { color: var(--red); }
/* [5b] 1.0.33: picture-only practice card (hidePracticeLabels) — no
   label slot, so the card hugs its picture instead of leaving a blank
   band underneath; the picture grows slightly to fill the frame. */
.card.pic-only { min-height: 0; padding: 10px 6px; justify-content: center; }
.card.pic-only .pic { width: 98px; height: 98px; }
/* ---------- Pattern strip ---------- */
.pattern-strip { display: flex; gap: 12px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.pattern-item {
  width: 72px; height: 72px; padding: 4px; background: #fff; border-radius: 18px; border: 4px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 var(--card-shadow);
}
.pattern-item .pic { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; pointer-events: none; }
.pattern-item.num { font-size: 40px; font-weight: 800; color: var(--ink); line-height: 1; }
.pattern-item.q {
  border: 4px dashed var(--sun); background: #fffbe6;
  font-size: 48px; font-weight: 800; color: var(--sun-dark); line-height: 1;
}
/* ---------- Passage panel (reading comprehension) ----------
   The passage stays visible above the answer cards for the whole
   question. Cream card, image left, plain passage text right; on
   narrow phones the image stacks above the text. Kept compact so
   the answer cards stay on screen. */
.passage-panel {
  display: flex; gap: 14px; align-items: center;
  width: calc(100% - 32px); max-width: 480px;
  margin-top: 18px; padding: 14px;
  background: #fff8ea; border-radius: var(--radius-card); border: 4px solid var(--card-border);
  box-shadow: 0 5px 0 var(--card-shadow);
}
.passage-panel .passage-img {
  width: 96px; height: 96px; flex: 0 0 96px; object-fit: cover;
  border-radius: 18px; border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(35,64,77,.15); pointer-events: none;
}
.passage-panel .passage-text {
  font-size: 26px; font-weight: 700; line-height: 1.5; color: var(--ink);
  text-align: left;
}
/* The panel sits right above the answer cards: keep the gap tight. */
.passage-panel + .cards { margin-top: 16px; }
@media (max-width: 420px) {
  .passage-panel { flex-direction: column; gap: 10px; padding: 12px; }
  .passage-panel .passage-text { font-size: 24px; text-align: center; }
}
/* Picture currently being read aloud by the teacher */
.card.reading {
  border-color: var(--sun); transform: scale(1.08);
  box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 7px rgba(255,183,3,.4);
}
/* Correct / wrong feedback — gentle, no punishment visuals */
.card.good { border-color: var(--teal); background: #e7fbf7; animation: jump .55s ease; }
.card.bad { border-color: var(--coral); background: #fff0f3; animation: shake .4s ease; }
.card.ghost-pick { border-color: var(--sun); background: #fff7de; animation: jump .55s ease; }
.card.pulse-hint { animation: pulseHint 1s ease-in-out infinite; }
@keyframes jump { 0% { transform: translateY(0); } 40% { transform: translateY(-15px); } 100% { transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes pulseHint {
  0%,100% { box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 0 rgba(255,183,3,.45); }
  50% { box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 13px rgba(255,183,3,0); }
}
@media (min-width: 768px) {
  .card { width: 138px; min-height: 160px; }
  .card .pic { width: 110px; height: 110px; }
  .card.pic-only .pic { width: 118px; height: 118px; }
  .teacher-img { width: 190px; height: 190px; }
  #bigLetter { font-size: 190px; }
}

/* ---------- Numbers learn step & digit choices ---------- */
.digits-row { display: flex; gap: 13px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }
.digits-row.hidden, .big-counter.hidden { display: none; }
.digit {
  width: 74px; height: 88px; border-radius: 22px; cursor: pointer; user-select: none;
  background: #fff; border: 4px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; font-weight: 800; color: var(--red); line-height: 1;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.digit:active { transform: scale(.93); }
.digit.reading {
  border-color: var(--sun); transform: scale(1.1);
  box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 7px rgba(255,183,3,.4);
}
.digit.good { border-color: var(--teal); background: #e7fbf7; animation: jump .55s ease; }
.digit.bad { border-color: var(--coral); background: #fff0f3; animation: shake .4s ease; }
.digit.pulse-hint { animation: pulseHint 1s ease-in-out infinite; }
.digits-row.choices { margin-top: 22px; }
.count-field.hidden { display: none; }

/* ---------- Counting step ---------- */
.count-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.big-counter {
  margin-top: 16px; min-width: 96px; height: 96px; padding: 0 14px;
  border-radius: 50%; background: var(--sun); border: 4px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 58px; font-weight: 800; color: #fff; line-height: 1;
  box-shadow: 0 7px 0 var(--sun-dark), 0 12px 22px rgba(35,64,77,.15);
}
.big-counter.pop { animation: counterPop .45s ease; }
@keyframes counterPop { 0% { transform: scale(.6); } 55% { transform: scale(1.18); } 100% { transform: scale(1); } }
.count-field { display: flex; gap: 14px; margin-top: 22px; justify-content: center; flex-wrap: wrap; max-width: 460px; }
.count-obj {
  width: 96px; height: 96px; border-radius: 24px; cursor: pointer; user-select: none;
  background: #fff; border: 4px solid var(--card-border); position: relative;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 0 var(--card-shadow);
  transition: transform .18s ease, border-color .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.count-obj .pic { width: 80px; height: 80px; object-fit: cover; border-radius: 17px; pointer-events: none; }
.count-obj:active { transform: scale(.93); }
.count-obj.reading {
  border-color: var(--sun); transform: scale(1.09); z-index: 2;
  box-shadow: 0 6px 0 var(--card-shadow), 0 0 0 7px rgba(255,183,3,.4);
}
.count-obj.counted { border-color: var(--teal); background: #e7fbf7; animation: jump .45s ease; }
.count-obj.pulse-hint { animation: pulseHint 1s ease-in-out infinite; }
.count-badge {
  position: absolute; top: -11px; right: -11px; min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 50%; background: var(--teal); border: 3px solid #fff; color: #fff;
  font-size: 19px; font-weight: 800; line-height: 1;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(35,64,77,.25);
}
.count-obj.counted .count-badge { display: flex; }
@media (min-width: 768px) {
  .count-obj { width: 108px; height: 108px; }
  .count-obj .pic { width: 92px; height: 92px; }
  .digit { width: 84px; height: 100px; font-size: 60px; }
}

/* ---------------- Arithmetic steps ----------------
   Two groups with a "+" between them (add), a ten-frame with the
   separated part aside (split), or a full set with the taken-away
   objects crossed out (sub). The equation line is the reveal. */
.arith-groups { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 22px; transition: gap .6s ease; }
.arith-groups.merged { gap: 2px; }
.arith-groups.merged .arith-plus { opacity: 0; }
.arith-group { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; max-width: 460px; }
.arith-plus { font-size: 48px; font-weight: 800; color: var(--sun-dark); line-height: 1; transition: opacity .6s ease; }
.arith-eq { margin-top: 18px; font-size: 40px; font-weight: 800; color: var(--ink); text-align: center; }
.arith-eq.hidden { display: none; }
.arith-split { display: flex; flex-direction: column; align-items: center; margin-top: 22px; }
.ten-frame { display: grid; grid-template-columns: repeat(5, 64px); grid-template-rows: repeat(2, 64px); gap: 8px; padding: 10px; background: #fff; border: 4px solid var(--card-border); border-radius: 20px; box-shadow: 0 6px 0 var(--card-shadow); }
.ten-cell { display: flex; align-items: center; justify-content: center; border: 2px dashed #d8cfc0; border-radius: 12px; }
.ten-cell .count-obj { width: 56px; height: 56px; border-radius: 14px; }
.ten-cell .count-obj .pic { width: 46px; height: 46px; border-radius: 10px; }
.arith-aside { display: flex; flex-direction: column; align-items: center; margin-top: 14px; }
.arith-aside-label { font-size: 22px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; }
.count-obj.removed { opacity: .45; transform: translateY(-10px); }
.count-obj .gone-mark { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 56px; font-weight: 800; color: var(--red); pointer-events: none; }
.count-obj.removed .gone-mark { display: flex; }
.count-obj.removed, .count-obj.separated { cursor: default; }
.count-obj.separated { border-style: dashed; }
/* Many objects (up to 19 in cong-tru-20): shrink so they fit. */
.arith-groups.many .count-obj, .count-field.many .count-obj { width: 72px; height: 72px; }
.arith-groups.many .count-obj .pic, .count-field.many .count-obj .pic { width: 58px; height: 58px; }

/* ---------- Compare step: two groups, tap the bigger one ---------- */
.compare-row { display: flex; gap: 16px; margin-top: 24px; justify-content: center; flex-wrap: wrap; width: 100%; }
.compare-group {
  background: #fff; border: 4px solid var(--card-border); border-radius: var(--radius-card);
  padding: 12px 10px; cursor: pointer; user-select: none;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.compare-group:active { transform: scale(.97); }
.compare-group .count-field { margin-top: 4px; max-width: 236px; gap: 9px; }
.compare-group .count-obj { width: 70px; height: 70px; border-radius: 19px; cursor: pointer; }
.compare-group .count-obj .pic { width: 56px; height: 56px; border-radius: 13px; }
.compare-group.good { border-color: var(--teal); background: #e7fbf7; animation: jump .55s ease; }
.compare-group.bad { border-color: var(--coral); background: #fff0f3; animation: shake .4s ease; }

/* ---------- Letter-tap step: three big letter cards ---------- */
.letter-row { display: flex; gap: 16px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }
.letter-card {
  width: auto; min-width: 104px; padding: 0 18px; height: 122px; border-radius: var(--radius-card); cursor: pointer; user-select: none;
  background: #fff; border: 4px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 84px; font-weight: 800; color: var(--red); line-height: 1;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.letter-card:active { transform: scale(.94); }
.letter-card.good { border-color: var(--teal); background: #e7fbf7; animation: jump .55s ease; }
.letter-card.bad { border-color: var(--coral); background: #fff0f3; animation: shake .4s ease; }
.letter-card.pulse-hint { animation: pulseHint 1s ease-in-out infinite; }
.letter-card.len2 { font-size: 60px; }
.letter-card.len3 { font-size: 44px; }
/* The letter being read aloud by the teacher (same glow as .card.reading) */
.letter-card.reading {
  border-color: var(--sun); transform: scale(1.08);
  box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 7px rgba(255,183,3,.4);
}

/* ---------- Showcase row (shapes / clock faces / tone words) ----------
   Display-only familiarization: the real items in a row, each with its
   picture and written label. The item being read aloud gets the same
   sun border + scale + glow as .card.reading. Wraps to 2 rows on a
   phone; a single item gets the .big treatment. */
.showcase-row { display: flex; gap: 16px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }
.showcase-item {
  width: 160px; min-height: 196px; padding: 12px 10px 14px;
  background: #fff; border-radius: var(--radius-card); border: 4px solid var(--card-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.showcase-item .pic { width: 140px; height: 140px; object-fit: cover; border-radius: 18px; pointer-events: none; }
.showcase-item .word { font-size: 28px; font-weight: 800; margin-top: 8px; }
.showcase-item .word b { color: var(--red); }
.showcase-item.reading {
  border-color: var(--sun); transform: scale(1.08);
  box-shadow: 0 7px 0 var(--card-shadow), 0 0 0 7px rgba(255,183,3,.4);
}
.showcase-item.big { width: 250px; min-height: 290px; }
.showcase-item.big .pic { width: 220px; height: 220px; }
/* [5a] 1.0.33: passage showcase (doc-hieu S2) — one wide reading
   frame instead of a single-word card: big picture on top, the whole
   passage underneath in comfortable reading type (18px / 1.6), never
   the 28px single-word label. The picture uses object-fit: contain,
   NOT cover: p1.jpg is itself a text card (the passage printed large
   inside a rounded frame), so cover would crop whole lines off. At
   390px the frame is 350px wide (stage padding 20px each side):
   picture 230px tall + ~3 lines of 18px text ≈ 360px tall, well
   inside the 844px viewport. */
.showcase-item.passage { width: 100%; max-width: 480px; min-height: 0; padding: 14px 14px 16px; }
.showcase-item.passage .pic { width: 100%; max-width: 320px; height: 230px; object-fit: contain; }
.showcase-item.passage .word { font-size: 18px; font-weight: 700; line-height: 1.6; margin-top: 12px; text-align: center; }

/* ---------- Trace step: canvas tracing table ----------
   4-line ô-ly grid + faint model letter + stroke arrows, drawn by
   the engine on the canvas; the child's own strokes render on top.
   touch-action none so a finger draws instead of scrolling the page.
   The canvas is 320x320 CSS px (shrinks on narrow phones). */
.trace-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; margin-top: 18px; }
.trace-canvas {
  width: 320px; height: 320px; max-width: 100%; aspect-ratio: 1;
  background: #fff; border: 4px solid var(--card-border); border-radius: 20px;
  box-shadow: 0 7px 0 var(--card-shadow), 0 12px 22px rgba(35,64,77,.10);
  touch-action: none; cursor: crosshair;
}
.trace-done {
  margin: 18px auto 0; border: 3px solid #fff; border-radius: 999px;
  font-size: 19px; font-weight: 800; font-family: inherit;
  padding: 14px 32px; min-height: 64px; cursor: pointer;
  background: var(--teal); color: #fff; box-shadow: 0 6px 0 var(--teal-dark);
  transition: transform .1s, box-shadow .1s;
}
.trace-done:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.trace-actions { display: flex; gap: 12px; margin-top: 18px; align-items: center; }
.trace-actions .trace-done { margin: 0; }
.trace-clear {
  border: 3px solid var(--teal); border-radius: 999px;
  font-size: 19px; font-weight: 800; font-family: inherit;
  padding: 14px 24px; min-height: 64px; cursor: pointer;
  background: #fff; color: var(--teal-dark); box-shadow: 0 6px 0 rgba(35,64,77,.12);
  transition: transform .1s, box-shadow .1s;
}
.trace-clear:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(35,64,77,.12); }

/* ---------- Ghost pointer (teacher demo) ---------- */
#ghostPointer {
  position: absolute; z-index: 6; width: 54px; height: 54px;
  pointer-events: none; opacity: 0; transition: left .8s ease, top .8s ease, opacity .3s ease;
}
#ghostPointer .gp-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid rgba(255,183,3,.9); background: rgba(255,183,3,.18);
}
#ghostPointer .gp-dot {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  transform: translate(-50%,-50%); border-radius: 50%; background: var(--sun);
  box-shadow: 0 0 0 3px #fff;
}
#ghostPointer.tap .gp-ring { animation: gpTap .5s ease; }
@keyframes gpTap { 0% { transform: scale(1); } 40% { transform: scale(.72); } 100% { transform: scale(1); } }

/* ---------- Step tag (for parents / older kids only) ---------- */
.step-tag {
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 700;
  padding: 6px 15px; border-radius: 999px; margin-top: 16px; letter-spacing: .4px;
}

/* ---------- End screen ---------- */
.stars { display: flex; gap: 10px; margin-top: 20px; }
.stars svg { width: 58px; height: 58px; filter: drop-shadow(0 4px 6px rgba(224,158,0,.4)); animation: starPop .5s ease backwards; }
.stars svg:nth-child(2) { animation-delay: .15s; }
.stars svg:nth-child(3) { animation-delay: .3s; }
.stars svg.off { filter: grayscale(1); opacity: .3; animation: none; }
@keyframes starPop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
/* EXP badge (GĐ 2): gold "+N EXP" pill under the stars on the end
   screen; inserted by engine.js on "cch:exp-awarded". */
.exp-badge {
  margin-top: 14px; display: inline-block;
  background: linear-gradient(180deg, #ffd964, #ffb700);
  color: #6b4e00; font-size: 20px; font-weight: 800;
  padding: 8px 20px; border-radius: 999px; border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(224,158,0,.35);
  animation: starPop .4s ease backwards;
}
.parent-note {
  margin-top: 18px; background: rgba(255,255,255,.78); border-radius: 18px;
  padding: 13px 17px; font-size: 15px; color: var(--ink-soft); line-height: 1.55;
  max-width: 380px; text-align: center; box-shadow: 0 4px 12px rgba(35,64,77,.08);
}
.parent-note .result-line { display: block; margin-top: 7px; }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
#btnAgain, #btnNextLesson {
  border: 3px solid #fff;
  border-radius: 999px; font-size: 19px; font-weight: 800; font-family: inherit;
  padding: 14px 32px; min-height: 64px; cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
#btnAgain { background: var(--coral); color: #fff; box-shadow: 0 6px 0 var(--coral-dark); }
#btnAgain:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--coral-dark); }
#btnNextLesson { background: var(--teal); color: #fff; box-shadow: 0 6px 0 var(--teal-dark); }
#btnNextLesson:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }

/* Subitize recount: shown after a wrong tap, while the objects are
   back on screen for the child to count again. */
.btn-counted {
  display: none; margin: 18px auto 0;
  border: 3px solid #fff; border-radius: 999px;
  font-size: 19px; font-weight: 800; font-family: inherit;
  padding: 14px 32px; min-height: 64px; cursor: pointer;
  background: var(--teal); color: #fff; box-shadow: 0 6px 0 var(--teal-dark);
  transition: transform .1s, box-shadow .1s;
}
.btn-counted.show { display: block; animation: screenIn .3s ease; }
.btn-counted:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }

@media (prefers-reduced-motion: reduce) {
  .card.pulse-hint, .digit.pulse-hint, .letter-card.pulse-hint, .count-obj.pulse-hint, #mouth.talking { animation: none; }
}
