:root {
  --ink: #24405A;
  --ink-soft: #5B7286;
  --sea: #7AD3DC;
  --sea-deep: #4FBBC6;
  --cream: #FFF6E0;
  --paper: #FFFFFF;
  --line: #E8DDBE;
  --sun: #FFC928;
  --sun-deep: #E3A600;
  --coral: #FF6F59;
  --coral-deep: #D94F3A;
  --leaf: #4CB944;
  --leaf-deep: #36912F;
  --leaf-soft: #E2F6D9;
  --blue: #3FA9F5;
  --pink: #FF7EB6;
  --radius: 24px;
  --font-round: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  background: var(--sea);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#app { height: 100%; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-round); margin: 0; line-height: 1.2; }

.screen { position: relative; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.icon { width: 1.5em; height: 1.5em; display: block; }

/* ---------- Nút ---------- */

.round-btn {
  width: 56px; height: 56px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 0 rgba(36, 64, 90, .18);
  transition: transform .08s, box-shadow .08s;
}
.round-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(36, 64, 90, .18); }
.round-btn:disabled { opacity: .35; }

.btn {
  min-height: 56px; padding: 8px 24px;
  border: 0; border-radius: 18px;
  font-family: var(--font-round); font-weight: 700; font-size: 20px;
  background: var(--paper); color: var(--ink);
  box-shadow: inset 0 0 0 3px var(--line), 0 4px 0 var(--line);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--line), 0 1px 0 var(--line); }
.btn-main { background: var(--coral); color: #fff; box-shadow: 0 6px 0 var(--coral-deep); }
.btn-main:active { box-shadow: 0 2px 0 var(--coral-deep); transform: translateY(4px); }
.btn-huge { font-size: 28px; min-height: 72px; padding: 8px 44px; }
.btn-small { min-height: 44px; font-size: 16px; padding: 4px 16px; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger { color: var(--coral-deep); }

/* ---------- Bản đồ ---------- */

.map-screen { background: var(--sea); }

.map-top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; flex: none; z-index: 2;
}
.brand {
  font-family: var(--font-round); font-weight: 800; font-size: 34px; line-height: 1;
  color: #fff; text-shadow: 0 3px 0 var(--sea-deep);
  margin-right: auto;
}
.star-total {
  display: flex; align-items: center; gap: 6px;
  height: 56px; padding: 0 18px 0 12px;
  border-radius: 28px; background: var(--paper); color: var(--sun-deep);
  box-shadow: 0 4px 0 rgba(36, 64, 90, .18);
  font-family: var(--font-round); font-size: 24px;
}
.star-total b { color: var(--ink); }

/* Bản đồ phủ kín màn hình, thanh trên nằm đè lên phần biển để trống ở mép trên ảnh. Màn dọc thì cuộn ngang. */
.map-top { position: absolute; top: 0; left: 0; right: 0; }
.brand { margin-right: 4px; }
/* Chuyển đảo nằm ở thanh trên vì phần biển mép trên ảnh luôn để trống, không che nút chặng hay rương. */
.island-nav { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.island-nav .round-btn:disabled { visibility: hidden; }
.island-next .icon { transform: scaleX(-1); }
.island-name {
  min-width: 112px; padding: 4px 14px; border-radius: 18px; text-align: center; line-height: 1.1;
  background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 rgba(36, 64, 90, .14);
}
.island-name b { display: block; font: 800 18px/1.1 var(--font-round); }
.island-name span { font-size: 14px; color: var(--ink-soft); }
.island-fresh { background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--coral-deep); animation: breathe 1.3s ease-in-out infinite; }
.map-scroll { position: absolute; inset: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.map-box {
  position: relative; flex: none;
  width: max(100vw, calc(100dvh * 1.5));
  aspect-ratio: 3 / 2;
  container-type: inline-size;
}
@media (max-aspect-ratio: 1/1) {
  .map-scroll { overflow-x: auto; justify-content: flex-start; }
}
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-chest { position: absolute; height: auto; }

.node {
  --disc: clamp(50px, 6.4cqw, 92px);
  position: absolute; transform: translate(-50%, -50%);
  width: 0; height: 0; padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.node-disc {
  flex: none;
  width: var(--disc); height: var(--disc); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-round); font-weight: 800; font-size: calc(var(--disc) * .52); line-height: 1;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 7px 0 var(--line), 0 0 0 6px rgba(255, 255, 255, .7);
  transition: transform .1s;
}
.node:active .node-disc { transform: translateY(4px) scale(.98); }
.node-label {
  position: absolute; top: calc(var(--disc) * .5 + 10px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 170px;
  padding: 3px 12px 5px; border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  font-size: 15px; line-height: 1.2; text-align: center;
  box-shadow: 0 2px 0 rgba(36, 64, 90, .12);
}
.node-label b { display: block; font-family: var(--font-round); font-size: 16px; color: var(--ink-soft); }
.node-stars { display: flex; justify-content: center; gap: 1px; margin-top: 1px; }
.st { font-size: 12px; }
.star-img { width: 1.5em; height: 1.5em; display: block; }
.st:not(.on) .star-img, .big-star:not(.on) .star-img { filter: grayscale(1) opacity(.35); }

.node-current .node-disc {
  background: var(--coral); color: #fff;
  box-shadow: 0 7px 0 var(--coral-deep), 0 0 0 6px rgba(255, 255, 255, .85);
  animation: breathe 1.8s ease-in-out infinite;
}
.node-open .node-disc { background: #FFEFC2; }
.node-done .node-disc { background: var(--sun); box-shadow: 0 7px 0 var(--sun-deep), 0 0 0 6px rgba(255, 255, 255, .85); }
.node-mastered .node-disc { background: var(--leaf); color: #fff; box-shadow: 0 7px 0 var(--leaf-deep), 0 0 0 6px rgba(255, 255, 255, .85); }
.node-locked .node-disc { background: #E9E6DC; color: #A9A597; box-shadow: 0 7px 0 #CFCABB; font-size: 22px; }
.node-locked .node-label { opacity: .78; }

.node-buddy {
  position: absolute; bottom: calc(var(--disc) * .32); left: calc(var(--disc) * .2); width: calc(var(--disc) * .85);
  animation: hop 2.2s ease-in-out infinite;
  pointer-events: none;
}
.node-buddy .mascot { width: 100%; display: block; }

.shake { animation: shake .36s; }

.voice-note {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(calc(100vw - 32px), 760px);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 18px;
  background: var(--paper); box-shadow: 0 6px 18px rgba(36, 64, 90, .22);
  font-size: 15px; line-height: 1.3;
}
.voice-note span { flex: 1 1 280px; }

/* ---------- Hộp thoại ---------- */

.sheet-wrap {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(36, 64, 90, .45);
  animation: fade .16s;
}
.sheet {
  width: min(100%, 460px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 20px 24px 24px; border-radius: 30px;
  background: var(--paper); text-align: center;
  animation: pop .22s cubic-bezier(.3, 1.4, .6, 1);
}
.sheet .mascot { width: 96px; display: block; margin: 0 auto 6px; }
.sheet h2 { font-size: 30px; }
.sheet p { margin: 8px 0 0; font-size: 18px; color: var(--ink-soft); }
.sheet-kicker { display: block; font-family: var(--font-round); font-size: 20px; color: var(--coral-deep); }
.sheet-stars { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.sheet-stars .st { font-size: 20px; }
.sheet-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 18px; }
.sheet-actions .btn { min-width: 220px; }

.gate-form { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-family: var(--font-round); font-size: 30px; }
.gate-form input {
  width: 110px; height: 60px; text-align: center;
  font: inherit; color: inherit;
  border: 3px solid var(--line); border-radius: 14px;
  user-select: text; -webkit-user-select: text;
}
.form-error { color: var(--coral-deep) !important; font-size: 16px; margin: 8px 0 0; }

/* ---------- Màn làm bài ---------- */

.q-screen { background: var(--cream) url(assets/scene/lesson.webp) center / cover; padding: 10px 18px 14px; gap: 8px; }

.q-top { display: flex; align-items: center; gap: 14px; flex: none; }
.pips { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pip { width: 26px; height: 12px; border-radius: 6px; background: #EADFC2; }
.pip.now { background: var(--coral); }
.pip.ok { background: var(--leaf); }
.pip.tried { background: var(--sun); }
.pip-review { width: 14px; }
.q-count { font-family: var(--font-round); font-size: 20px; color: var(--ink-soft); min-width: 56px; text-align: right; }

.q-prompt { display: flex; align-items: center; justify-content: center; gap: 14px; flex: none; min-height: 60px; }
.q-prompt h1 { font-size: clamp(26px, 3.8vw, 40px); font-weight: 700; text-align: center; }
.speak-btn {
  width: 60px; height: 60px; flex: none; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue); color: #fff; box-shadow: 0 5px 0 #2B8BD6;
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #2B8BD6; }
.tag { padding: 3px 12px; border-radius: 12px; background: var(--sun); font-family: var(--font-round); font-size: 16px; white-space: nowrap; }
.tag-review { background: #CFEFF3; }

.q-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; }

.scene {
  flex: 1; width: min(100%, 820px); min-height: 150px;
  padding: 14px; border-radius: var(--radius);
  background: var(--paper); box-shadow: 0 6px 0 var(--line);
  container-type: size;
}
.scene-plain { background: none; box-shadow: none; container-type: normal; display: grid; place-items: center; padding: 0; }
/* Cảnh nền dạng đếm: chỉnh vị trí cắt ảnh để phần trống rộng nhất nằm sau các vật. */
.scene-meadow { background: #BDEFF8 url(assets/scene/meadow.webp) center bottom / 130% auto no-repeat; }
.scene-pond { background: #A9EEEC url(assets/scene/pond.webp) center 40% / 130% auto no-repeat; }
.scene-sky { background: url(assets/scene/sky.webp) center / cover; }
.scene-water { background: url(assets/scene/water.webp) center bottom / cover; }

.grid-items {
  width: 100%; height: 100%;
  display: grid; justify-content: center; align-content: center; place-items: center;
  grid-template-columns: repeat(var(--cols), auto); gap: 8px;
}
.item { position: relative; display: block; line-height: 0; }
.grid-items .item { width: min(calc(100cqw / var(--cols) * .78), calc(100cqh / var(--rows) * .8), 104px); }
.obj { width: 100%; height: auto; display: block; }
/* Ảnh không nhận chạm: chạm vẫn tới nút bên dưới, nhấn giữ không bật menu lưu ảnh trên máy bảng. */
img { pointer-events: none; -webkit-user-drag: none; }
.mascot { height: auto; }

.scatter { position: relative; width: 100%; height: 100%; }
.scattered {
  position: absolute;
  width: min(calc(100cqw / var(--cols) * .72), calc(100cqh / var(--rows) * .72), 96px);
  transform: translate(-50%, -50%) rotate(var(--tilt));
}

.item.counted { animation: pop .24s; }
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 30px; height: 30px; padding: 0 5px; border-radius: 15px;
  display: grid; place-items: center;
  font: 800 19px/1 var(--font-round); font-style: normal;
  background: var(--coral); color: #fff;
}

/* Cờ dây */
.flag-line {
  position: relative; display: flex; gap: clamp(8px, 2vw, 22px); padding-top: 14px;
  background: linear-gradient(var(--ink-soft), var(--ink-soft)) top 4px left 0 / 100% 4px no-repeat;
}
.flag {
  width: clamp(62px, 13vw, 118px); aspect-ratio: 1 / 1.14;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(0 0, 100% 0, 100% 74%, 50% 100%, 0 74%);
  font-family: var(--font-round); font-weight: 800; font-size: clamp(36px, 7vw, 64px); line-height: 1;
  color: #fff;
}
.flag span { transform: translateY(-14%); }
.flag-c0 { background: var(--coral); }
.flag-c1 { background: var(--blue); }
.flag-c2 { background: var(--leaf); }
.flag-c3 { background: #F29A3E; }
.flag.blank { background: #fff; color: #C5B98F; }
.flag.blank.active { background: #FFF1B8; color: var(--sun-deep); animation: breathe 1.3s ease-in-out infinite; }
.flag.filled { animation: pop .24s; }

/* Hai nhóm */
.groups { flex: 1; width: min(100%, 980px); min-height: 150px; display: flex; gap: 16px; }
.group-card {
  flex: 1; min-width: 0; padding: 12px; border: 0; border-radius: var(--radius);
  background: var(--paper); box-shadow: 0 6px 0 var(--line), inset 0 0 0 3px var(--line);
  container-type: size;
  transition: transform .08s;
}
.group-card:active:not(:disabled) { transform: translateY(3px); }
.group-card:disabled { opacity: .55; }
.group-card.right { box-shadow: 0 6px 0 var(--leaf-deep), inset 0 0 0 5px var(--leaf); background: var(--leaf-soft); opacity: 1; }

/* So sánh, tách số */
.num-box, .sign-box {
  display: grid; place-items: center;
  font-family: var(--font-round); font-weight: 800; line-height: 1;
  border-radius: 22px; background: var(--paper);
  box-shadow: 0 6px 0 var(--line);
}
.num-box { width: clamp(84px, 13vw, 124px); height: clamp(84px, 13vw, 124px); font-size: clamp(50px, 8vw, 80px); }
.sign-box { width: clamp(68px, 10vw, 96px); height: clamp(68px, 10vw, 96px); font-size: clamp(44px, 7vw, 66px); color: var(--coral-deep); }
.blank { background: #FFF1B8; color: var(--sun-deep); box-shadow: 0 6px 0 #F3DC8B; }
.filled { animation: pop .24s; }
.num-box.filled, .sign-box.filled { background: var(--leaf-soft); color: var(--leaf-deep); box-shadow: 0 6px 0 #B6E2A6; }

.cmp-line, .split-line { display: flex; align-items: flex-start; justify-content: center; gap: clamp(10px, 2.4vw, 26px); }
.cmp-side, .split-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cmp-line .sign-box { margin-top: clamp(8px, 1.5vw, 14px); }
.split-word { font-family: var(--font-round); font-size: clamp(22px, 3.6vw, 34px); padding-top: clamp(24px, 3.8vw, 40px); }

/* Mấy và mấy: hai đồ chứa ở trên, hàng số ở dưới */
.scene-split { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 0; }
.boxes { flex: 1; min-height: 0; width: 100%; container-type: size; display: flex; justify-content: center; align-items: center; gap: 16px; }
.box { position: relative; flex: none; width: min(calc(50cqw - 8px), calc(100cqh * var(--ar))); aspect-ratio: var(--ar); }
.box-single { width: min(100cqw, calc(100cqh * var(--ar))); }
.box-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.box-item { position: absolute; transform: translate(-50%, -50%); line-height: 0; }
.box-filled .box-item { animation: fade .3s; }
.box-q {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: clamp(52px, 8vw, 72px); height: clamp(52px, 8vw, 72px); border-radius: 50%;
  display: grid; place-items: center;
  font: 800 clamp(34px, 5vw, 46px)/1 var(--font-round);
  background: #FFF1B8; color: var(--sun-deep); box-shadow: 0 4px 0 #F3DC8B;
}
.scene-split .split-line { flex: none; align-items: center; }
.scene-split .num-box { width: clamp(60px, 8vw, 88px); height: clamp(60px, 8vw, 88px); font-size: clamp(38px, 5.2vw, 58px); border-radius: 18px; }
.scene-split .split-word { padding-top: 0; }

.dots { display: inline-grid; grid-template-columns: repeat(5, 18px); gap: 5px; justify-content: center; }
.dots i { width: 18px; height: 18px; border-radius: 50%; background: var(--coral); display: block; }
.dots.c1 i { background: var(--blue); }
.dots.c2 i { background: var(--coral); }

/* Sắp xếp */
.slot-line { display: flex; align-items: center; gap: clamp(8px, 1.6vw, 16px); }
.slot-word { font-family: var(--font-round); font-size: 22px; color: var(--ink-soft); }
.slot {
  width: clamp(72px, 11vw, 110px); height: clamp(72px, 11vw, 110px);
  border: 4px dashed #D9CBA0; border-radius: 22px; background: #FFFBEF;
  font-family: var(--font-round); font-weight: 800; font-size: clamp(44px, 7vw, 66px); line-height: 1;
}
.slot.filled { border: 4px solid var(--blue); background: #fff; }

/* Quy luật */
.pat-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: clamp(4px, 1vw, 10px); max-width: 940px; }
.pat-item { width: clamp(46px, 7.5vw, 80px); line-height: 0; }
.pat-blank {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 18px; border: 4px dashed var(--sun-deep); background: #FFF1B8;
  font: 800 clamp(30px, 5vw, 50px)/1 var(--font-round); color: var(--sun-deep);
}

/* Gợi ý */
.hint-slot { flex: none; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hint-slot:empty { display: none; }
.num-line { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; animation: fade .2s; }
.line-chip {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font: 700 22px/1 var(--font-round); background: #F3EAD2; color: var(--ink-soft);
}
.line-chip.mark { background: var(--blue); color: #fff; }
.pairs { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; border-radius: 16px; background: #fff; animation: fade .2s; }
.pair-row { display: flex; gap: 2px; }
.pair-cell { width: 36px; height: 36px; display: block; border-radius: 10px; }
.pair-cell.extra { background: #FFE6A3; }
.dot-compare { display: flex; flex-direction: column; gap: 6px; padding: 8px 16px; border-radius: 16px; background: #fff; animation: fade .2s; }
.dot-compare > div { display: flex; align-items: center; gap: 10px; }
.dot-compare .dots { display: flex; }
.dot-compare b { font: 800 24px/1 var(--font-round); width: 28px; }
.pat-units { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; animation: fade .2s; }
.pat-unit { display: flex; gap: 2px; padding: 4px 6px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 2px var(--blue); }
.pat-unit .obj { width: 34px; }
.reveal {
  padding: 8px 20px; border-radius: 16px;
  font: 700 26px/1.2 var(--font-round); background: var(--leaf-soft); color: var(--leaf-deep);
}

/* Hình phẳng */
.shape-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.scene-table { background: #F6E3C4 url(assets/scene/table.webp) center / cover; }
.scene-table .obj { filter: drop-shadow(0 3px 2px rgba(92, 60, 20, .32)); }
.solo { height: 100%; max-height: 300px; aspect-ratio: 1; margin: auto; position: relative; top: 50%; transform: translateY(-50%); }
.solo .obj { width: 100%; height: 100%; object-fit: contain; }
.scattered .shape-svg, .scattered .obj { width: 100%; height: auto; aspect-ratio: 1; }
.fig-wrap { width: 100%; height: 100%; }
.scene { position: relative; }
.shape-row { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 2%; }
.shape-cell { flex: none; width: min(100cqh, calc(90cqw / var(--n)), 240px); aspect-ratio: 1; }
.scene-big .scattered { width: min(calc(100cqw / var(--cols) * .72), calc(100cqh / var(--rows) * .72), 128px); }

.opt-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt-card { display: grid; place-items: center; min-height: 0; padding: 8px; position: relative; }
.opt-inner { display: block; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.opt-inner .obj { width: 100%; height: 100%; object-fit: contain; }
.sel-card.on { box-shadow: 0 6px 0 #2B8BD6, inset 0 0 0 5px var(--blue); background: #E6F4FF; }
.sel-card.right { box-shadow: 0 6px 0 var(--leaf-deep), inset 0 0 0 5px var(--leaf); background: var(--leaf-soft); }
.sel-tick {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
  display: none; place-items: center; font-size: 13px; background: var(--blue); color: #fff;
}
.sel-card.on .sel-tick { display: grid; }
.sel-card.right .sel-tick { background: var(--leaf); }

.shape-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 10px; min-height: 0; }
.card-label { flex: none; font: 800 22px/1 var(--font-round); color: var(--ink-soft); }
.card-shapes { flex: 1; min-height: 0; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 4px; place-items: center; }
.card-shape { width: 100%; height: 100%; min-height: 0; }
div.group-card { display: flex; }

.hole-fill { display: none; }

.figure-svg line { fill: none; }
.fig-count {
  position: absolute; top: 10px; right: 12px; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 26px;
  display: grid; place-items: center; font: 800 32px/1 var(--font-round); background: var(--coral); color: #fff;
}
.fig-count[hidden] { display: none; }
.part-badge circle { fill: var(--coral); stroke: #fff; stroke-width: .8; }
.part-badge text { fill: #fff; font: 800 7px var(--font-round); text-anchor: middle; }

.frames { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6%; }
.frame { position: relative; flex: none; height: min(100%, 47cqw); aspect-ratio: 1; }
.frame-shape { position: absolute; inset: 0; }
.frame-item { position: absolute; transform: translate(-50%, -50%); }

.who-wrap { flex: 1; min-height: 150px; width: min(100%, 980px); display: flex; gap: 16px; }
.who-scene { flex: 3 1 0; min-width: 0; }
.who-list { flex: 2 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.who-btn { display: flex; align-items: center; gap: 10px; text-align: left; flex: 1; min-height: 0; }
.who-pic { flex: none; width: min(36%, 76px); line-height: 0; }
.who-say { font-size: clamp(17px, 2vw, 22px); line-height: 1.2; }
.who-say b { font: 800 1.5em/1 var(--font-round); color: var(--coral-deep); }

.pat-item .shape-svg { width: 100%; height: auto; aspect-ratio: 1; }

.fact, .shape-strip { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 16px; border-radius: 16px; background: #fff; font-size: 19px; animation: fade .2s; }
.fact-icon { display: block; width: 36px; height: 36px; flex: none; }
.strip-cell { display: flex; align-items: center; gap: 4px; }
.strip-cell small { font-size: 15px; }
.mini-fig { height: 76px; aspect-ratio: 1.4; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .9); animation: fade .2s; }
.pat-mini { display: block; width: 34px; }
.pat-mini .shape-svg, .pat-mini .obj { width: 100%; height: auto; aspect-ratio: 1; }

/* Trả lời */
.q-input { flex: none; display: flex; justify-content: center; align-items: flex-end; min-height: 92px; padding-bottom: 6px; }
.pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 840px; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 2vw, 20px); }
.key {
  width: 64px; height: 68px; border: 0; border-radius: 18px;
  font: 800 38px/1 var(--font-round);
  background: var(--paper); box-shadow: 0 6px 0 #CBBE97, inset 0 0 0 3px var(--line);
  transition: transform .08s, box-shadow .08s;
}
.key:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #CBBE97, inset 0 0 0 3px var(--line); }
.key:disabled { opacity: .38; }
.key.used { visibility: hidden; }
.key-big { width: clamp(84px, 11vw, 110px); height: clamp(84px, 11vw, 110px); font-size: clamp(46px, 6.4vw, 64px); }
.key-sign { width: clamp(92px, 12vw, 124px); height: clamp(88px, 11vw, 108px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.key-sign b { font-size: 50px; line-height: .95; color: var(--coral-deep); }
.key-sign small { font: 700 15px/1.1 var(--font-body); color: var(--ink-soft); }
.key-wide { width: auto; min-width: 220px; padding: 0 28px; font-size: 28px; }
.key-go { background: var(--coral); color: #fff; box-shadow: 0 6px 0 var(--coral-deep); }
.key-go:active:not(:disabled) { box-shadow: 0 2px 0 var(--coral-deep); }
.key-obj { width: clamp(84px, 11vw, 110px); height: clamp(84px, 11vw, 110px); padding: 12px; }
.key.right { background: var(--leaf); color: #fff; box-shadow: 0 6px 0 var(--leaf-deep); animation: pop .24s; opacity: 1; }
.nudge { animation: wiggle .36s; }

/* Nút trả lời của dạng hình phẳng, đặt sau .key để ghi đè kích thước. */
.key-icon { display: block; width: 38px; height: 38px; flex: none; }
.key-shape { width: clamp(108px, 13vw, 136px); height: auto; min-height: 76px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.key-shape small { font: 700 15px/1.1 var(--font-body); color: var(--ink); }
.key-pair { width: auto; height: 76px; padding: 0 18px; display: flex; align-items: center; gap: 8px; }
.key-pair small { font: 700 18px/1 var(--font-body); color: var(--ink-soft); }
.key-color { width: auto; min-width: 128px; height: 72px; padding: 0 18px; color: #fff; font-size: 26px; background: var(--c); box-shadow: 0 6px 0 var(--e); text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.key-color:active:not(:disabled) { box-shadow: 0 2px 0 var(--e); }
.key-opt .shape-svg { width: 100%; height: 100%; }
.key-opt { padding: 10px; }
.key-opt .obj { width: 100%; height: 100%; object-fit: contain; }
.key-shape.right small, .key-pair.right small { color: #fff; }

/* Cú Tí */
.buddy { position: absolute; left: 8px; bottom: 6px; width: 80px; pointer-events: none; z-index: 3; }
.buddy .mascot { width: 100%; display: block; }
.mascot-happy { animation: hop .6s ease-in-out 2; }
.bubble {
  position: absolute; left: 62px; bottom: 96px; width: max-content; max-width: 280px;
  padding: 8px 16px; border-radius: 18px 18px 18px 4px;
  background: var(--ink); color: #fff; font-size: 19px; line-height: 1.25;
  animation: pop .2s;
}
.bubble[hidden] { display: none; }
/* Màn nhỏ: bóng thoại hẹp lại để không che hàng gợi ý ngay bên cạnh. */
@media (max-width: 1100px) { .bubble { max-width: 165px; } }

/* ---------- Kết quả ---------- */

.result-screen { background: var(--sea); align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.result-card {
  width: min(100%, 560px); padding: 18px 24px 24px; border-radius: 32px;
  background: var(--paper); text-align: center; max-height: 100%; overflow: auto;
}
.result-hero { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.result-hero .mascot { width: 104px; display: block; }
.result-chest { width: 92px; display: block; }
.result-stars { display: flex; justify-content: center; gap: 6px; margin: 2px 0 6px; }
.big-star { font-size: 38px; }
.big-star.on { animation: star-in .42s cubic-bezier(.3, 1.6, .6, 1) both; animation-delay: var(--d); }
.result-card h1 { font-size: 30px; }
.result-score { margin: 6px 0 0; font-size: 20px; color: var(--ink-soft); }
.result-score b { color: var(--ink); font-family: var(--font-round); font-size: 26px; }
.missed { margin-top: 12px; padding: 10px 16px; border-radius: 16px; background: var(--cream); text-align: left; }
.missed h3 { font-size: 18px; color: var(--ink-soft); }
.missed ul { margin: 4px 0 0; padding-left: 20px; font-size: 19px; }

/* ---------- Phụ huynh ---------- */

.parent-screen { background: var(--cream); user-select: text; -webkit-user-select: text; }
.parent-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px 4px; flex: none; }
.parent-top h1 { font-size: 28px; }
.tabs { display: flex; gap: 6px; padding: 6px 16px 0; flex: none; }
.tab {
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 14px 14px 0 0;
  font-family: var(--font-round); font-size: 18px; background: #F1E6C8; color: var(--ink-soft);
}
.tab.on { background: var(--paper); color: var(--ink); }
.parent-body { flex: 1; min-height: 0; overflow: auto; background: var(--paper); padding: 16px 16px 40px; font-weight: 600; }
.parent-body > * { max-width: 800px; margin-left: auto; margin-right: auto; }
.parent-body h2 { font-size: 22px; margin-top: 22px; margin-bottom: 8px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { flex: 1 1 140px; padding: 10px 16px; border-radius: 16px; background: var(--cream); }
.stat b { display: block; font: 800 34px/1.1 var(--font-round); }
.stat span { color: var(--ink-soft); font-size: 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 2px solid #F3ECD7; white-space: nowrap; }
th { color: var(--ink-soft); font-size: 14px; }
td:nth-child(2), td:nth-child(3), td:nth-child(4), th:nth-child(2), th:nth-child(3), th:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
td:first-child { white-space: normal; }
.note { color: var(--ink-soft); font-size: 15px; }
.warn { padding: 10px 14px; border-radius: 12px; background: #FFE9E4; color: var(--coral-deep); }
.bar-row { display: grid; grid-template-columns: minmax(120px, 170px) 1fr 44px 60px; align-items: center; gap: 10px; padding: 5px 0; font-size: 16px; }
.bar { height: 14px; border-radius: 7px; background: #F3ECD7; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 7px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row small { color: var(--ink-soft); }

.voice-summary { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.voice-summary .stat { flex: none; }
.voice-summary p { flex: 1 1 240px; margin: 0; color: var(--ink-soft); font-size: 15px; }
.rec-list { display: flex; flex-direction: column; gap: 6px; }
.rec-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border-radius: 14px; background: var(--cream); }
.rec-row.recording { background: #FFE0D9; }
.rec-row.recording .rec-btn { background: var(--coral); color: #fff; animation: breathe 1s ease-in-out infinite; }
.rec-state { width: 22px; flex: none; color: var(--leaf-deep); font-size: 13px; }
.rec-text { flex: 1; min-width: 0; font-size: 17px; }
.rec-btns { display: flex; gap: 6px; flex: none; }
.rec-btns .round-btn { width: 44px; height: 44px; font-size: 13px; }

.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 4px; border-bottom: 2px solid #F3ECD7; cursor: pointer;
}
.set-row b { display: block; font-size: 17px; }
.set-row small { display: block; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.set-row input[type="checkbox"] { width: 28px; height: 28px; flex: none; accent-color: var(--leaf); }
.set-row select { min-height: 44px; max-width: 46%; font: inherit; color: inherit; padding: 4px 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.set-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Hoạt ảnh ---------- */

@keyframes pop { from { transform: scale(.72); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes hop { 50% { transform: translateY(-9px); } }
@keyframes shake { 25% { transform: translate(-50%, -50%) translateX(-6px); } 75% { transform: translate(-50%, -50%) translateX(6px); } }
@keyframes wiggle { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes star-in { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Máy bảng dọc và điện thoại */
@media (max-width: 820px) {
  .q-screen { padding: 8px 12px 10px; }
  .buddy { width: 58px; left: 6px; bottom: 4px; }
  .bubble { left: 40px; bottom: 60px; font-size: 16px; max-width: 220px; }
  .q-input { padding-left: 34px; padding-right: 34px; min-height: 70px; }
  .groups { flex-direction: column; }
  .key { width: 58px; height: 58px; font-size: 32px; }
  .key-big, .key-obj { width: 76px; height: 76px; font-size: 44px; }
  .key-wide { width: auto; font-size: 24px; }
  .speak-btn { width: 52px; height: 52px; }
  .pip { width: 16px; height: 10px; }
  .pip-review { width: 10px; }
  .brand { font-size: 28px; }
  .node-label { font-size: 14px; }
  .bar-row { grid-template-columns: 110px 1fr 40px; }
  .bar-row small { display: none; }
}

/* Điện thoại dọc: thu nhỏ các ô để hàng số không bị tràn */
@media (max-width: 480px) {
  .num-box { width: 64px; height: 64px; font-size: 40px; border-radius: 16px; }
  .sign-box { width: 54px; height: 54px; font-size: 36px; border-radius: 14px; }
  .split-line, .cmp-line { gap: 6px; }
  .split-word { font-size: 19px; padding-top: 18px; }
  .dots { grid-template-columns: repeat(5, 10px); gap: 3px; }
  .dots i { width: 10px; height: 10px; }
  .slot-line { gap: 5px; }
  .slot { width: 60px; height: 60px; font-size: 36px; border-radius: 14px; }
  .slot-word { font-size: 15px; }
  .q-prompt { gap: 8px; }
  .q-prompt h1 { font-size: 22px; }
  .q-top { gap: 8px; }
  .key-big, .key-obj { width: 70px; height: 70px; font-size: 40px; }
  .key-sign { width: 88px; height: 82px; }
  .line-chip { width: 28px; height: 30px; font-size: 16px; border-radius: 8px; }
  .pair-cell { width: 26px; height: 26px; }
  .reveal { font-size: 20px; padding: 6px 14px; }
}

/* Màn thấp (điện thoại ngang) */
@media (max-height: 520px) {
  .node-label { font-size: 12px; padding: 1px 8px 2px; }
  .node-label b { font-size: 13px; }
  .q-prompt { min-height: 44px; }
  .speak-btn { width: 44px; height: 44px; }
  .round-btn { width: 44px; height: 44px; }
  .q-prompt h1 { font-size: 22px; }
  .key { width: 50px; height: 50px; font-size: 28px; }
  .key-big, .key-obj { width: 64px; height: 64px; font-size: 38px; }
  .scene, .groups { min-height: 90px; }
  .q-input { min-height: 0; padding-left: 0; padding-right: 0; }
  .buddy { display: none; }
}

/* ---------- Phép cộng, phép trừ (Chủ đề 3) ---------- */

.eq-line { flex: none; display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1.2vw, 12px); --eq: clamp(52px, min(7vw, 11vh), 76px); }
.eq-large { --eq: clamp(64px, min(10vw, 16vh), 112px); gap: clamp(8px, 1.6vw, 18px); }
.eq-small { --eq: clamp(40px, min(5vw, 8.4vh), 58px); gap: 6px; }
.eq-given { --eq: clamp(44px, min(6vw, 10vh), 66px); opacity: .85; }
.eq-twin { --eq: clamp(58px, min(8.4vw, 14vh), 96px); }
.eq-box {
  width: var(--eq, 64px); height: var(--eq, 64px); flex: none;
  display: grid; place-items: center;
  font: 800 calc(var(--eq, 64px) * .62)/1 var(--font-round);
  border-radius: calc(var(--eq, 64px) * .22); background: var(--paper);
  box-shadow: 0 5px 0 var(--line);
}
.eq-box.blank { background: #FFF1B8; color: var(--sun-deep); box-shadow: 0 5px 0 #F3DC8B; }
.eq-box.active { outline: 4px solid var(--sun-deep); outline-offset: 1px; animation: breathe 1.3s ease-in-out infinite; }
.eq-box.filled { background: var(--leaf-soft); color: var(--leaf-deep); box-shadow: 0 5px 0 #B6E2A6; animation: pop .24s; }
.eq-sign { flex: none; font: 800 calc(var(--eq, 64px) * .62)/1 var(--font-round); color: var(--coral-deep); }
.eq-fruit { padding: 6px; }
.eq-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2.4vh, 22px); }

/* Chấm tròn của phép tính: cam là số đầu, xanh là số cộng thêm, gạch chéo là số bớt đi, rỗng là phần chưa biết. */
.dot-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.dot-row i { width: 20px; height: 20px; border-radius: 50%; display: block; position: relative; }
.d-a { background: var(--coral); }
.d-b { background: var(--blue); }
.d-o { background: #fff; box-shadow: inset 0 0 0 3px var(--sun-deep); }
.d-x { background: #F3C9C1; }
.d-x::after {
  content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 3px; margin-top: -1.5px;
  background: var(--ink); border-radius: 2px; transform: rotate(-45deg);
}
.dot-card { padding: 10px 18px; border-radius: 18px; background: rgba(255, 255, 255, .92); }
.calc-hint { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 5px 16px; border-radius: 16px; background: #fff; animation: fade .2s; }
.calc-hint b { font: 800 clamp(20px, 3.4vh, 26px)/1.1 var(--font-round); white-space: nowrap; }
.calc-hint .dot-row { flex-wrap: nowrap; }
.calc-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Cảnh thêm vào, bớt đi */
.story { display: flex; align-items: center; justify-content: center; gap: 2%; padding: 8px 12px; }
.story-zone { flex: none; display: grid; grid-template-columns: repeat(var(--cols), auto); place-items: center; gap: 4px; padding: 4px; }
.story-item { width: min(calc(100cqw * var(--share) / var(--cols) * .78), calc(92cqh / var(--rows)), 96px); }
.zone-move { border-radius: 18px; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .26); }
.story-gap { flex: none; width: 3%; }
.story-arrow { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; width: clamp(56px, 8cqw, 76px); color: var(--coral-deep); }
.story-arrow b { padding: 2px 10px; border-radius: 12px; background: #fff; font: 800 clamp(16px, 2.6vh, 22px)/1.1 var(--font-round); }
.story-arrow svg { width: 100%; height: auto; display: block; }
/* Mũi tên "thêm" chỉ về phía nhóm đứng yên, mũi tên "bớt" chỉ ra xa nhóm đứng yên. */
.arrow-in svg { transform: scaleX(-1); }
.arrow-in + .zone-move .mover { animation: drift-in 1.6s ease-in-out infinite alternate; }
.arrow-out + .zone-move .mover { animation: drift-out 1.6s ease-in-out infinite alternate; }
.arrow-out + .zone-move .obj { transform: scaleX(-1); }
@keyframes drift-in { from { translate: 5px 0; } to { translate: -3px 0; } }
@keyframes drift-out { from { translate: -3px 0; } to { translate: 5px 0; } }
@media (prefers-reduced-motion: reduce) { .mover { animation: none !important; } }
.crossed::after {
  content: ''; position: absolute; left: 4%; right: 4%; top: 50%; height: 7%; min-height: 3px; margin-top: -3.5%;
  background: var(--coral-deep); border-radius: 4px; transform: rotate(-45deg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .8);
}
.crossed .obj { opacity: .55; }

/* Bảng cộng, bảng trừ */
.calc-table { border-collapse: separate; border-spacing: 0; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 6px 0 var(--line); font: 800 clamp(24px, min(4vw, 6.4vh), 40px)/1 var(--font-round); --eq: clamp(38px, min(5.4vw, 8.6vh), 56px); }
.calc-table td, .calc-table th { width: clamp(52px, 8vw, 78px); height: clamp(42px, 8.6vh, 62px); padding: 4px; text-align: center; border: 2px solid #E8DDBE; }
.calc-table tr:not(:last-child) td, .calc-sign { background: #E6F4FF; }
.calc-sign { color: var(--coral-deep); font-size: 1.3em; }
.cell-out .eq-box { margin: auto; box-shadow: none; }
.table-rows { display: grid; grid-template-columns: repeat(2, auto); gap: clamp(8px, 2vh, 18px) clamp(16px, 4vw, 40px); }
.table-row { padding: 8px 14px; border-radius: 18px; background: rgba(255, 255, 255, .9); box-shadow: 0 5px 0 var(--line); }

.cmp-calc { align-items: center; }
.cmp-calc .sign-box { margin-top: 0; }
.cmp-chip {
  padding: clamp(12px, 2.8vh, 22px) clamp(16px, 3vw, 30px); border-radius: 22px; background: var(--paper); box-shadow: 0 6px 0 var(--line);
  font: 800 clamp(34px, min(6vw, 10vh), 62px)/1 var(--font-round); white-space: nowrap; text-align: center;
}

/* Thẻ phép tính gắn trên con vật */
.expr-cards { align-items: stretch; }
.expr-card, .match-card { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; min-width: 0; min-height: 0; position: relative; }
.expr-pic { flex: 1 1 0; min-height: 0; display: block; width: 100%; line-height: 0; }
.expr-pic .obj { width: 100%; height: 100%; object-fit: contain; }
.expr-pill { flex: none; padding: 4px 14px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 3px var(--blue); font: 800 clamp(22px, min(3.6vw, 6vh), 36px)/1.1 var(--font-round); white-space: nowrap; }
.expr-dots:empty { display: none; }
.expr-dots { flex: none; animation: fade .2s; }
.expr-dots .dot-row i { width: 14px; height: 14px; }
.expr-dots .dot-row { gap: 3px; max-width: 150px; }
.expr-many { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; }
.expr-many .expr-pill { font-size: clamp(20px, min(3vw, 4.6vh), 30px); }
.match-card { --eq: clamp(38px, 7.4vh, 54px); opacity: .68; }
.match-card.now, .match-card:has(.filled) { opacity: 1; }
.match-card.now { box-shadow: 0 6px 0 var(--sun-deep), inset 0 0 0 5px var(--sun); background: #FFFBE6; }
.key-house { width: clamp(84px, 11vw, 112px); height: clamp(76px, 10vw, 100px); padding: 4px 6px; }
/* Chuồng thỏ: số đặt giữa tấm bảng trống, đo ở [0.17, 0.35, 0.65, 0.44] của ảnh. */
.hutch { position: relative; display: block; width: 100%; max-height: 100%; aspect-ratio: 512 / 457; margin: auto; }
.hutch img { display: block; width: 100%; height: 100%; }
.hutch b { position: absolute; left: 49.5%; top: 57%; transform: translate(-50%, -50%); font: 800 clamp(22px, 3vw, 34px)/1 var(--font-round); color: var(--ink); }
.key-house.right .hutch b { color: var(--leaf-deep); }
.key-eq { font-size: clamp(24px, 3vw, 30px); min-width: 170px; height: 72px; }

/* Mũi tên phép tính, tháp số, ngôi nhà số, sơ đồ tách */
.chain-line { display: flex; align-items: center; justify-content: center; gap: clamp(4px, 1vw, 10px); --eq: clamp(52px, min(8vw, 13vh), 88px); }
.chain-start { background: var(--sun); box-shadow: 0 5px 0 var(--sun-deep); border-radius: 50%; }
.chain-arrow { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; width: clamp(62px, 10vw, 104px); color: var(--blue); }
.chain-arrow b { font: 800 clamp(20px, min(3.4vw, 5vh), 32px)/1 var(--font-round); color: var(--coral-deep); }
.chain-arrow svg { width: 100%; height: auto; display: block; }
.pyramid { display: flex; flex-direction: column; align-items: center; gap: 4px; --eq: clamp(40px, min(7vw, 9.4vh), 68px); }
.pyr-row { display: flex; gap: 4px; }
.brick { box-shadow: none; border: 3px solid #E8B868; background: #FFE9C2; }
.brick.lit { background: #BFE3F7; border-color: var(--blue); }
.num-house { display: flex; flex-direction: column; align-items: center; gap: 4px; --eq: clamp(32px, 6.4vh, 48px); }
.house-roof {
  width: calc(var(--eq) * 3.4); height: calc(var(--eq) * 1.3); display: flex; align-items: flex-end; justify-content: center;
  clip-path: polygon(50% 0, 100% 100%, 0 100%); background: var(--coral);
  font: 800 calc(var(--eq) * .8)/1.1 var(--font-round); color: #fff;
}
.house-row { display: flex; gap: 4px; }
.tree-wrap { display: flex; align-items: center; gap: clamp(16px, 4vw, 44px); --eq: clamp(48px, min(7vw, 11vh), 76px); }
.tree { display: flex; align-items: center; gap: 4px; }
.tree-lines { width: calc(var(--eq) * .7); height: calc(var(--eq) * 2); }
.tree-parts { display: flex; flex-direction: column; gap: clamp(8px, 2vh, 18px); }
.four-wrap { flex: 1; min-height: 0; width: min(100%, 980px); display: flex; gap: 14px; align-items: stretch; }
.four-pic { flex: 1 1 0; min-width: 0; }
.four-lines { flex: none; display: grid; grid-template-columns: repeat(2, auto); align-content: center; gap: clamp(6px, 2vh, 14px) 18px; padding: 10px 14px; border-radius: 20px; background: rgba(255, 255, 255, .9); }

/* Bài toán có lời */
.word-card { display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); padding: 12px clamp(14px, 3vw, 30px); width: min(100%, 900px); }
.word-pic { flex: none; width: clamp(64px, 11vw, 112px); line-height: 0; }
.word-lines p { margin: 0 0 4px; font: 700 clamp(18px, min(3.2vw, 4.8vh), 34px)/1.22 var(--font-round); }

.judge-card { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 3vw, 30px); padding: 10px 16px; width: min(100%, 900px); }
.judge-list { flex: none; display: flex; flex-direction: column; gap: 10px; }
.judge-row { display: flex; align-items: center; gap: 10px; }
.judge-row .cmp-chip { padding: 6px 14px; font-size: clamp(26px, min(4.4vw, 7.4vh), 46px); }
.judge-label { width: clamp(38px, 7.4vh, 52px); height: clamp(38px, 7.4vh, 52px); display: grid; place-items: center; border-radius: 50%; background: var(--sun); font: 800 clamp(22px, 4.4vh, 30px)/1 var(--font-round); }
.judge-say { flex: 1 1 0; min-width: 0; max-width: 360px; display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 18px; background: #FFFBE6; }
.judge-say .mascot { width: 100%; }
.who-expr { display: grid; place-items: center; }
.who-expr .cmp-chip { box-shadow: none; padding: 8px; font-size: clamp(28px, min(4.8vw, 8vh), 50px); }

/* ---------- Ngân hàng Chủ đề 3: dạng mới ---------- */

.key-op { font-size: clamp(54px, 8vw, 76px); color: var(--coral-deep); }
.key-op.right { color: #fff; }
.num-seq { gap: clamp(4px, 1vw, 10px); }
.seq-comma { font: 800 calc(var(--eq) * .5)/1 var(--font-round); color: var(--ink-soft); align-self: flex-end; }
.num-cards { display: flex; gap: clamp(8px, 1.6vw, 16px); align-items: center; justify-content: center; }
.num-card { flex: 0 1 150px; height: min(100%, 180px); display: grid; place-items: center; position: relative; padding: 0; }
.num-face { font: 800 clamp(54px, min(9vw, 15vh), 96px)/1 var(--font-round); color: var(--ink); }
.rings { position: relative; width: min(100%, 520px, 80vh); aspect-ratio: 420 / 250; --eq: clamp(44px, min(6.4vw, 10vh), 64px); }
.rings svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-cell { position: absolute; transform: translate(-50%, -50%); }
.ring-left { left: 23%; top: 56%; }
.ring-mid { left: 50%; top: 56%; }
.ring-right { left: 77%; top: 56%; }
.ring-sum { top: 6%; padding: 2px 14px; border-radius: 14px; font: 800 clamp(24px, 4.4vh, 34px)/1.1 var(--font-round); color: #fff; }
.ring-sum-l { left: 24%; background: var(--coral-deep); }
.ring-sum-r { left: 76%; background: #1B6FB3; }

/* ---------- Ảnh Chủ đề 3: cành cây, cây to, lá súng, vợt ---------- */

/* Cảnh kéo giãn đủ khung để cành cây luôn ở 66–74% chiều cao, tán cây ở 0–70%, mặt cỏ từ 80% trở xuống. */
.scene-c3-branch { background: #BFE3F7 url(assets/c3/scene-branch.webp) center / 100% 100% no-repeat; }
.scene-c3-tree { background: #CDEFC4 url(assets/c3/scene-tree.webp) center / 100% 100% no-repeat; }
.story-perch { align-items: stretch; }
.story-perch .zone-perch { align-self: flex-end; margin-bottom: 25cqh; padding-bottom: 0; }
.story-perch .zone-move { align-self: flex-start; margin-top: 2cqh; }
.story-perch .zone-move .story-item { width: min(calc(100cqw * var(--share) / var(--cols) * .78), calc(56cqh / var(--rows)), 96px); }
.story-perch .story-arrow { align-self: center; }
.zone-pad { background: url(assets/c3/lilypad.webp) center 90% / 100% auto no-repeat; padding: 0 4cqw 9cqh; }
.zone-pad .story-item { width: min(calc(100cqw * var(--share) / var(--cols) * .66), calc(74cqh / var(--rows)), 90px); }
.story-tree { position: relative; padding: 0; }
.story-tree .story-item { width: min(9cqw, 15cqh, 64px); }
.tree-crown { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); }
.tree-fallen { position: absolute; right: 4%; bottom: 3%; }
.story-tree .arrow-down { position: absolute; right: 9%; top: 52%; width: clamp(48px, 7cqw, 64px); }
.arrow-down svg { transform: rotate(90deg); }
.boxes-net .box { width: min(calc(42cqw - 8px), calc(100cqh * var(--ar))); }
