/* Giáo trình trẻ em – "Gia đình Nốt Nhạc". Chỉ áp dụng khi <html class="is-kids">. */
.is-kids {
  --k-red: #FF4B4B; --k-orange: #FF9A2E; --k-yellow: #FFC93C; --k-green: #36C26B;
  --k-blue: #2F9BFF; --k-indigo: #5B5BE6; --k-violet: #A45BE6; --k-pink: #FF6FA8;
  --k-ink: #2A2140; --k-sky: #EAF6FF; --k-sun: #FFF6D6;
  --rainbow: linear-gradient(90deg, var(--k-red), var(--k-orange), var(--k-yellow), var(--k-green), var(--k-blue), var(--k-indigo), var(--k-violet));
}
.is-kids body {
  color: var(--k-ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 201, 60, .22) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 30%, rgba(47, 155, 255, .14) 0 160px, transparent 161px),
    radial-gradient(circle at 12% 70%, rgba(54, 194, 107, .14) 0 140px, transparent 141px),
    radial-gradient(circle at 88% 88%, rgba(255, 111, 168, .14) 0 150px, transparent 151px),
    linear-gradient(180deg, #F2FAFF 0%, #FFFBF0 100%);
  background-attachment: fixed;
}
.is-kids .topbar { background: rgba(255, 255, 255, .9); border-bottom: 4px solid transparent; border-image: var(--rainbow) 1; }

/* thẻ tiêu đề trạm */
.is-kids .lesson-head, .is-kids .title-card {
  background:
    radial-gradient(circle at 90% 20%, rgba(255, 255, 255, .5) 0 60px, transparent 61px),
    radial-gradient(circle at 78% 90%, rgba(255, 255, 255, .35) 0 40px, transparent 41px),
    linear-gradient(135deg, #FFFFFF 0%, #FFE6F0 38%, #FFB8D3 100%);
  border-radius: 32px; border: 4px solid #fff; box-shadow: 0 18px 40px -22px rgba(255, 111, 168, .7);
}
.is-kids .lesson-head::after, .is-kids .title-card::after { opacity: .1; }
.is-kids .lh__meta { color: #B03A6A; }
.is-kids .lh__badge { background: var(--k-ink); color: #FFD3E4; font-size: 15px; padding: .3em 1em; }
.is-kids .lh__title { color: var(--k-ink); font-size: clamp(32px, 5vw, 48px); }
.is-kids .lh__goal { color: #5A3A55; font-size: 18px; }
.is-kids .lh__num { display: none; } /* số trạm đã có ở nhãn "Trạm N"; số lớn đè lên hình tròn trang trí */

/* tiêu đề mục: dải ruy băng */
.is-kids .blk-heading {
  display: inline-flex; align-items: center; gap: 12px; margin: 48px 0 18px; padding: 10px 26px 10px 18px;
  font-size: 26px; color: #fff; background: var(--k-blue); border-radius: 999px; box-shadow: 0 6px 0 rgba(0, 0, 0, .12);
}
.is-kids .blk-heading::before { content: "🎵"; width: auto !important; height: auto !important; background: none !important; font-size: 24px; }
.is-kids .slide:nth-of-type(3n+1) .blk-heading { background: var(--k-green); }
.is-kids .slide:nth-of-type(3n+2) .blk-heading { background: var(--k-pink); }
.is-kids .blk-text p { font-size: 19px; }
.is-kids .blk-text .em, .is-kids mark.em { background: linear-gradient(transparent 55%, #FFE27A 55%); color: inherit; padding: 0 2px; }
.is-kids .blk-callout--remember {
  background: #fff; border: 4px dashed var(--k-yellow); border-left-width: 4px; border-radius: 28px; position: relative; padding-top: 26px;
}
.is-kids .blk-callout--remember h4 { font-size: 22px; }
.is-kids .blk-callout--remember h4::before { content: "💡 "; }
.is-kids .blk-callout li { font-size: 18px; display: block; padding-left: 28px; position: relative; }
.is-kids .blk-callout li::before { content: "⭐"; font-size: 15px; position: absolute; left: 0; top: .15em; }
.is-kids .blk-keyboard, .is-kids .kd-game, .is-kids .kd-friend, .is-kids .kd-family, .is-kids .kd-hands { border-radius: 28px; }
.is-kids .blk-keyboard { background: #fff; padding: 18px; border: 4px solid #fff; box-shadow: 0 14px 30px -20px rgba(47, 155, 255, .7); }
.is-kids .blk-keyboard figcaption, .is-kids .kd-family figcaption, .is-kids .kd-hands figcaption { font-size: 17px; margin-top: 12px; color: #4A4060; }

/* phím đàn: phím trắng đang vang mang màu của bạn nốt */
.is-kids .kb { height: 120px; }
.is-kids .kb__white { border-radius: 0 0 10px 10px; }
.is-kids .kb__white.is-rh, .is-kids .kb__white.is-lh { background: var(--kc, var(--rh-soft)); box-shadow: inset 0 6px 8px -4px rgba(0, 0, 0, .3); }
.is-kids .kb__white.is-mark-mark { background: #FFE1E1; }
.is-kids .kb__white.is-found { background: #FFE1E1; animation: kd-pop .4s; }
.is-kids .kb__black.is-found { background: var(--k-orange); animation: kd-pop .4s; }

/* ---------- nhân vật ---------- */
.ch { overflow: visible; display: block; }
.ch .ch__body { transform-origin: 60px 130px; }
.ch .ch__eye { transform-box: fill-box; transform-origin: center; animation: kd-blink 4.5s infinite; }
.ch--cat .cat__tail { transform-origin: 96px 104px; animation: kd-tail 2.4s ease-in-out infinite; }
.ch.is-jump .ch__body { animation: kd-jump .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes kd-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes kd-tail { 50% { transform: rotate(-14deg); } }
@keyframes kd-jump { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-22px) scale(1.04, .96); } 60% { transform: translateY(0) scale(1.08, .9); } 100% { transform: none; } }
@keyframes kd-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes kd-float { 50% { transform: translateY(-6px); } }

/* lời nhân vật */
.kd-story { display: flex; align-items: flex-end; gap: 14px; margin: 28px 0; }
.kd-story--right { flex-direction: row-reverse; }
.kd-story__who { flex: none; cursor: pointer; animation: kd-float 3s ease-in-out infinite; }
.kd-story__bubble {
  position: relative; background: #fff; border-radius: 28px; padding: 18px 24px; font-size: 19px; line-height: 1.6;
  border: 3px solid var(--k-ink); box-shadow: 6px 6px 0 rgba(42, 33, 64, .15); margin-bottom: 40px;
}
.kd-story__bubble p { margin: 0 0 .4em; } .kd-story__bubble p:last-child { margin: 0; }
.kd-story__bubble b { display: block; font-size: 22px; margin-bottom: 4px; color: var(--k-pink); }
.kd-story__bubble::before, .kd-story__bubble::after { content: ""; position: absolute; bottom: 18px; border: 14px solid transparent; }
.kd-story--left .kd-story__bubble::before { left: -31px; border-right-color: var(--k-ink); }
.kd-story--left .kd-story__bubble::after { left: -24px; border-right-color: #fff; }
.kd-story--right .kd-story__bubble::before { right: -31px; border-left-color: var(--k-ink); }
.kd-story--right .kd-story__bubble::after { right: -24px; border-left-color: #fff; }

/* gia đình nốt nhạc */
.kd-family { margin: 20px 0; padding: 22px 16px 18px; background: #fff; text-align: center; box-shadow: 0 14px 30px -20px rgba(164, 91, 230, .7); }
.kd-family__row { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 2px; }
.kd-family__item { border: 0; background: none; cursor: pointer; padding: 6px 4px 8px; border-radius: 20px; display: grid; justify-items: center; transition: background .2s; }
.kd-family__item:hover { background: color-mix(in srgb, var(--nc) 14%, transparent); }
.kd-family__item b { font-size: 20px; color: var(--nc); line-height: 1.1; margin-top: 2px; }
.kd-family__item small { font-size: 13px; color: #7A7090; font-weight: 700; }
.kd-family__item:nth-child(odd) .ch { animation: kd-float 3s ease-in-out infinite; }
.kd-family__item:nth-child(even) .ch { animation: kd-float 3s ease-in-out 1.5s infinite; }

/* chào bạn nốt mới */
.kd-friend { margin: 20px 0; padding: 26px; background: var(--nl); border: 4px solid #fff; box-shadow: 0 14px 30px -20px var(--nc); }
.kd-friend__hero { display: flex; gap: 22px; align-items: center; }
.kd-friend__ch { flex: none; animation: kd-float 3s ease-in-out infinite; }
.kd-friend__hi { display: inline-block; background: var(--nc); color: #fff; font-weight: 700; padding: 3px 14px; border-radius: 999px; font-size: 15px; }
.kd-friend__intro h3 { font-size: 36px; margin: 6px 0; color: var(--k-ink); }
.kd-friend__intro h3 small { font-size: 22px; color: var(--nc); }
.kd-friend__intro p { font-size: 18px; }
.kd-friend__where { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.kd-friend__staff { background: #fff; border-radius: 20px; padding: 10px 12px 4px; text-align: center; }
.kd-friend__staff span { font-weight: 700; font-size: 15px; color: #7A7090; }
.kd-friend__staff svg { width: 100%; height: auto; max-width: 240px; }
.kd-friend__kb { grid-column: 1 / -1; background: #fff; border-radius: 20px; padding: 12px; }
.kd-friend__kb.kb { height: 130px; }

.kd-staff line { stroke: var(--k-ink); stroke-width: 2; }
.kd-staff .kd-ledger { stroke-width: 2.4; }
.kd-glyph { font-family: "Bravura"; fill: var(--k-ink); }

/* nút */
.kd-btn {
  border: 0; cursor: pointer; font-weight: 700; font-size: 17px; padding: 10px 20px; border-radius: 999px;
  background: var(--k-ink); color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .25); transition: transform .1s, box-shadow .1s;
}
.kd-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.kd-btn--ghost { background: #fff; color: var(--k-ink); border: 2px solid var(--k-ink); box-shadow: 0 4px 0 rgba(42, 33, 64, .2); }

/* trò chơi */
.kd-game { margin: 24px 0; padding: 22px 24px 18px; background: #fff; border: 4px solid var(--k-yellow); box-shadow: 0 8px 0 #F2B41C; position: relative; }
.kd-game.is-won { border-color: var(--k-green); box-shadow: 0 8px 0 #20A052; }
.kd-game__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kd-game__tag { background: var(--k-yellow); color: var(--k-ink); font-weight: 700; font-size: 14px; padding: 3px 12px; border-radius: 999px; }
.kd-game.is-won .kd-game__tag { background: var(--k-green); color: #fff; }
.kd-game__head h3 { font-size: 24px; }
.kd-game__prompt { font-size: 19px; margin: 10px 0 14px; }
.kd-game__kb.kb { height: 130px; }
.kd-game__kb.is-shake { animation: kd-shake .4s; }
@keyframes kd-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.kd-game__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.kd-game__progress { font-weight: 700; font-size: 18px; }
.kd-quiz__visual { display: flex; justify-content: center; margin-bottom: 10px; }
.kd-quiz__visual svg { max-width: 280px; width: 100%; height: auto; }
.kd-quiz__opts { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.kd-quiz__opt {
  display: grid; justify-items: center; gap: 4px; min-width: 130px; padding: 12px 16px; cursor: pointer;
  background: #fff; border: 3px solid color-mix(in srgb, var(--nc, #ccc) 50%, #fff); border-radius: 22px; font-weight: 700; font-size: 18px;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--nc, #ccc) 60%, #fff); transition: transform .1s;
}
.kd-quiz__opt:hover { transform: translateY(-3px); }
.kd-quiz__opt.is-right { background: #DBF6E5; border-color: var(--k-green); animation: kd-pop .5s; }
.kd-quiz__opt.is-right .ch .ch__body { animation: kd-jump .6s 2; }
.kd-quiz__opt.is-wrong { animation: kd-shake .4s; background: #FFF0F0; }

/* bàn tay */
.kd-hands { margin: 20px 0; padding: 18px; background: #fff; text-align: center; box-shadow: 0 14px 30px -20px rgba(255, 154, 46, .8); }
.kd-hands__svg { width: 100%; max-width: 520px; height: auto; }
.kd-finger { cursor: pointer; transform-box: view-box; }
.kd-finger rect { transition: fill .2s; }
.kd-finger.is-on rect { fill: #FFE27A; }
.kd-finger.is-tap rect { fill: #FFF1A8; }
.kd-finger__n { font-family: Quicksand; font-weight: 700; font-size: 17px; fill: #fff; }
.kd-hands__lbl { font-family: Quicksand; font-weight: 700; font-size: 18px; fill: #7A7090; text-anchor: middle; }
.kd-hands__say { font-size: 19px; font-weight: 600; margin: 6px 0 0; min-height: 1.6em; }

/* ---------- thành tích & nút khen ---------- */
.kd-hud { display: flex; gap: 8px; margin-left: auto; font-weight: 700; }
.kd-hud span { background: #fff; border: 2px solid var(--k-yellow); border-radius: 999px; padding: 2px 12px; white-space: nowrap; font-size: 15px; }
.kd-hud.is-pop span { animation: kd-pop .4s; }
.kd-hud--head { margin: 16px 0 0; }
.is-kids .view-toggle { margin-left: 0; }
.kd-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }

.kd-toast { position: fixed; left: 50%; top: 90px; transform: translateX(-50%); background: var(--k-ink); color: #fff; padding: 12px 24px; border-radius: 999px; font-weight: 700; font-size: 19px; z-index: 210; animation: kd-pop .4s; }

/* ---------- nhân vật nhảy theo bản nhạc ---------- */
.kd-dance { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px 0; background: linear-gradient(180deg, var(--k-sky), #fff); border-bottom: 1px dashed rgba(42, 33, 64, .15); overflow: hidden; }
.kd-dance__notes { display: flex; gap: 2px; flex: 1; justify-content: center; }
.kd-dance__n { opacity: .35; filter: saturate(.4); transition: opacity .25s, filter .25s; }
.kd-dance__n.is-on { opacity: 1; filter: none; }
.kd-dance__n.is-on .ch__body { animation: kd-hop .6s cubic-bezier(.3, 1.6, .5, 1) infinite; }
.kd-dance__n.is-on .ch__arm--l { animation: kd-wave-l .6s infinite; transform-origin: 20px 72px; }
.kd-dance__n.is-on .ch__arm--r { animation: kd-wave-r .6s infinite; transform-origin: 100px 72px; }
@keyframes kd-hop { 0% { transform: none; } 35% { transform: translateY(-26px) rotate(-6deg); } 70% { transform: translateY(0) scale(1.1, .9); } 100% { transform: none; } }
@keyframes kd-wave-l { 50% { transform: rotate(40deg); } }
@keyframes kd-wave-r { 50% { transform: rotate(-40deg); } }
.kd-dance__cat .ch__body { transition: transform .35s ease; transform-origin: 60px 130px; }
.kd-dance.is-playing .kd-dance__cat .ch__body { transform: rotate(-8deg); }
.kd-dance.is-playing .kd-dance__cat.is-sway-l .ch__body { transform: rotate(8deg); }
.kd-dance.is-bow .kd-dance__n .ch__body { animation: kd-bow 1.1s ease; opacity: 1; }
.kd-dance.is-bow .kd-dance__n { opacity: 1; filter: none; }
@keyframes kd-bow { 40%, 60% { transform: rotate(16deg) translateY(6px); } }

/* ---------- bản đồ phiêu lưu ---------- */
.kd-map { margin: 24px 0; background: linear-gradient(180deg, #D8F1FF 0%, #E6F9E9 60%, #FFF5D9 100%); border-radius: 36px; border: 5px solid #fff; box-shadow: 0 20px 50px -30px rgba(47, 155, 255, .9); overflow: hidden; }
.kd-map__svg { display: block; width: 100%; height: auto; }
.kd-map__road { fill: none; stroke: #F5D9A6; stroke-width: 34; stroke-linecap: round; stroke-linejoin: round; }
.kd-map__dash { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 2 18; stroke-linecap: round; }
.kd-map__deco { font-size: 34px; opacity: .55; }
.kd-map__st { cursor: pointer; }
.kd-map__st .kd-map__ring { fill: #fff; stroke: var(--nc); stroke-width: 9; transition: transform .2s; transform-box: fill-box; transform-origin: center; }
.kd-map__st:hover .kd-map__ring { transform: scale(1.1); }
.kd-map__st.is-soon { cursor: default; opacity: .6; }
.kd-map__st.is-soon .kd-map__ring { stroke: #C9C3D6; }
.kd-map__num { font-family: Quicksand; font-weight: 700; font-size: 36px; fill: var(--k-ink); text-anchor: middle; }
.kd-map__title { font-family: Quicksand; font-weight: 700; font-size: 19px; fill: var(--k-ink); text-anchor: middle; paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 5px; }
.kd-map__stars { font-size: 18px; text-anchor: middle; fill: #E8A70C; }

/* chuyển trạm */
.is-kids .lnav__item, .is-kids .lnav__all { border-radius: 24px; }

/* trình chiếu */
.is-kids body.is-presenting .kd-story__bubble { font-size: 26px; }
.is-kids body.is-presenting .kd-game__prompt, .is-kids body.is-presenting .blk-text p { font-size: 26px; }
.is-kids body.is-presenting .slide .blk-heading { font-size: 34px; }

@media (max-width: 640px) {
  .kd-friend__hero { flex-direction: column; text-align: center; }
  .kd-friend__where { grid-template-columns: 1fr; }
  .kd-story .ch { width: 70px; height: auto; }
  .kd-story__bubble { font-size: 17px; padding: 14px 16px; }
  .kd-hud span { padding: 2px 8px; font-size: 13px; }
  .kd-dance { padding: 8px 8px 0; gap: 4px; }
  .kd-dance__notes { gap: 0; min-width: 0; }
  .kd-dance__n .ch { width: 34px; height: auto; }
  .kd-dance__cat .ch { width: 44px; height: auto; }
  .topbar .kd-hud span:not(:nth-of-type(1)) { display: none; }
  .is-kids .lh__meta { flex-wrap: wrap; row-gap: 6px; }
  .is-kids .lh__badge { white-space: nowrap; }
  .kd-map__deco { display: none; }
  .is-kids .topbar__inner { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .is-kids *, .ch * { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}

/* ---------- nút khen: hộp quà nổi, kéo được ---------- */
.kd-gift { position: fixed; left: 24px; bottom: 24px; z-index: 72; width: 64px; height: 64px; }
.kd-gift__fab {
  width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 10px; cursor: grab; touch-action: none; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #FFF6D6, #FFE27A 70%, #FFC93C);
  box-shadow: 0 10px 26px -8px rgba(255, 111, 168, .8), 0 0 0 3px #fff, 0 0 0 6px var(--k-pink);
  animation: kd-gift-idle 3.2s ease-in-out infinite;
}
.kd-gift__fab:active { cursor: grabbing; }
.kd-gift__fab svg { width: 100%; height: 100%; display: block; }
.kd-gift.is-open .kd-gift__fab { animation: none; box-shadow: 0 10px 26px -8px rgba(255, 111, 168, .8), 0 0 0 3px #fff, 0 0 0 6px var(--k-orange); }
.kd-gift__fab.is-shake { animation: kd-gift-shake .5s; }
@keyframes kd-gift-idle { 0%, 86%, 100% { transform: none; } 90% { transform: rotate(-10deg) scale(1.06); } 95% { transform: rotate(10deg) scale(1.06); } }
@keyframes kd-gift-shake { 25% { transform: rotate(-14deg) scale(1.1); } 50% { transform: rotate(12deg) scale(1.12); } 75% { transform: rotate(-6deg); } }
.kd-gift__menu {
  position: absolute; bottom: calc(100% + 14px); left: 0; display: flex; gap: 8px; background: #fff; padding: 10px; border-radius: 26px;
  box-shadow: 0 16px 40px -14px rgba(42, 33, 64, .5); border: 3px solid var(--k-yellow); animation: kd-pop .25s;
}
.kd-gift.is-right .kd-gift__menu { left: auto; right: 0; }
.kd-gift.is-below .kd-gift__menu { bottom: auto; top: calc(100% + 14px); }
.kd-gift__menu button { border: 0; background: var(--k-sun); border-radius: 18px; cursor: pointer; width: 74px; padding: 8px 4px 6px; display: grid; justify-items: center; transition: transform .12s; }
.kd-gift__menu button:hover { transform: translateY(-4px) scale(1.06); }
.kd-gift__menu button.is-pop { animation: kd-pop .35s; }
.kd-gift__menu span { font-size: 32px; line-height: 1.1; }
.kd-gift__menu small { font-size: 12px; font-weight: 700; white-space: nowrap; }
body.is-presenting .kd-gift { bottom: 84px; }
@media (max-width: 640px) { .kd-gift__menu { flex-wrap: wrap; width: 262px; justify-content: center; } }

/* ---------- tên học viên ---------- */
.kd-hud__name { border: 2px solid var(--k-pink); background: #fff; border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.kd-hud__name:hover { background: #FFF0F6; }
.kd-hello { font-size: 22px; font-weight: 700; color: #B03A6A; margin: 12px 0 -6px; }
.kd-name { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 16px; background: rgba(42, 33, 64, .45); backdrop-filter: blur(4px); }
.kd-name__card {
  width: min(100%, 460px); background: linear-gradient(180deg, #FFF6D6, #fff 45%); border: 4px solid #fff; border-radius: 32px; padding: 22px 26px 24px;
  box-shadow: 0 30px 60px -20px rgba(42, 33, 64, .6); text-align: center; animation: kd-pop .35s;
}
.kd-name__cast { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin-top: -60px; }
.kd-name__cast .ch:nth-child(n+2) { animation: kd-float 2.6s ease-in-out infinite; }
.kd-name__cast .ch:nth-child(3) { animation-delay: .4s; } .kd-name__cast .ch:nth-child(4) { animation-delay: .8s; }
.kd-name__card h2 { font-size: 24px; margin: 10px 0 14px; color: var(--k-ink); }
.kd-name__card label { display: block; font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.kd-name__card input {
  width: 100%; font-size: 22px; font-weight: 700; text-align: center; padding: 12px 16px; border-radius: 18px;
  border: 3px solid var(--k-yellow); background: #fff; outline: none; color: var(--k-ink);
}
.kd-name__card input:focus { border-color: var(--k-pink); }
.kd-name__act { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
@media (max-width: 640px) { .topbar .kd-hud__name { max-width: 150px; min-width: 0; flex: 0 1 auto; } .topbar .kd-hud { min-width: 0; } }
.is-kids .crumbs > a:first-child { display: none; }
.is-kids .crumbs > a:first-child + *::before { content: none; }

/* ---------- cười bò ---------- */
.kd-laugh { position: fixed; inset: 0; z-index: 205; pointer-events: none; overflow: hidden; }
.kd-laugh__actor { position: absolute; left: 0; top: 0; will-change: transform; }
.kd-laugh__roll { transform-origin: 50% 60%; }
.kd-laugh .ch { width: 100%; height: auto; filter: drop-shadow(0 10px 12px rgba(42, 33, 64, .25)); }
.ch.is-laugh .ch__body { animation: kd-giggle .16s ease-in-out infinite alternate; }
.ch.is-laugh .ch__arm--l { animation: kd-belly-l .32s ease-in-out infinite alternate; transform-origin: 20px 72px; }
.ch.is-laugh .ch__arm--r { animation: kd-belly-r .32s ease-in-out infinite alternate; transform-origin: 100px 72px; }
.ch.is-laugh .ch__tear { animation: kd-tear .6s ease-in infinite; }
.ch.is-laugh .ch__tear--r { animation-delay: .3s; }
@keyframes kd-giggle { from { transform: translateY(0) scale(1, 1); } to { transform: translateY(-3px) scale(1.04, .96); } }
@keyframes kd-belly-l { to { transform: rotate(-70deg); } }
@keyframes kd-belly-r { to { transform: rotate(70deg); } }
@keyframes kd-tear { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(0, 14px); opacity: 0; } }
.kd-laugh__ha {
  position: absolute; font-weight: 700; font-size: clamp(18px, 2.4vw, 28px); color: var(--k-ink); background: #fff; padding: 4px 14px;
  border-radius: 999px; border: 3px solid var(--k-yellow); white-space: nowrap; box-shadow: 0 8px 20px -8px rgba(42, 33, 64, .4);
  animation: kd-ha 1.6s ease-out forwards;
}
@keyframes kd-ha { 0% { transform: translateY(0) scale(.4) rotate(-8deg); opacity: 0; } 15% { transform: translateY(-20px) scale(1.1) rotate(4deg); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-90px) scale(1) rotate(-4deg); opacity: 0; } }

/* ---------- giấy chứng nhận ---------- */
.kd-cert-wrap { margin: 28px 0; }
.kd-cert {
  position: relative; overflow: hidden; isolation: isolate; text-align: center; padding: 34px 40px 26px; border-radius: 28px;
  /* khung: viền vàng thật + viền trong mảnh (box-shadow inset) – góc bo đều, không bị lẹm */
  background: radial-gradient(circle at 50% 0%, #FFF6D6 0, #fff 60%); border: 5px solid #FFC93C;
  box-shadow: inset 0 0 0 10px #fff, inset 0 0 0 12px #FFE39A, 0 24px 50px -24px rgba(232, 167, 12, .9);
  display: flex; flex-direction: column; justify-content: center;
}
/* dải 7 màu ngắn, bo tròn – điểm nhấn dưới chữ "Giấy chứng nhận" */
.kd-cert__ribbon { display: block; margin: 6px auto 6px; border-radius: 999px; overflow: hidden; }
.kd-cert > * { flex-shrink: 0; } /* khung in có chiều cao cố định: không cho phần tử nào bị co mất */
.kd-cert__wm { position: absolute; left: 50%; top: 52%; width: 58%; max-width: 420px; transform: translate(-50%, -50%); opacity: .05; z-index: -1; pointer-events: none; }
.kd-cert__hl {
  display: inline-block; margin: 2px auto 10px; padding: 6px 18px; border-radius: 999px; font-weight: 700; font-size: 18px;
  color: #B03A6A; background: linear-gradient(90deg, #FFE6F0, #FFF3C9); text-wrap: balance;
}
.kd-cert__cast { display: flex; justify-content: center; gap: 4px; margin-top: 14px; }
.kd-cert__cast .ch { width: 46px; height: auto; }
.kd-cert__brand { display: flex; flex-direction: column; align-items: center; margin: 0 auto 8px; }
.kd-cert__logo { height: 28px; width: auto; }
.kd-cert__by { font-size: 13px; font-weight: 700; color: #7A7090; margin-top: 2px; }
.kd-cert__kicker { margin: 0; font-size: 18px; font-weight: 700; color: #E8A70C; text-transform: uppercase; }
.kd-cert__title { font-size: clamp(24px, 3.6vw, 38px); margin: 4px 0 12px; color: var(--k-ink); text-wrap: balance; }
.kd-cert__title span { display: block; }
.kd-cert__title-sub { font-size: .72em; color: #B03A6A; margin-top: 2px; }
.kd-cert__to { margin: 0; color: #7A7090; }
.kd-cert__name { font-size: clamp(32px, 5vw, 52px); font-weight: 700; margin: 0 0 6px; color: var(--k-pink); line-height: 1.2; }
.kd-cert__blank { color: #C9C3D6; }
.kd-cert__text { max-width: 560px; margin: 0 auto 10px; font-size: 17px; }
.kd-cert__stars { font-weight: 700; margin: 0 0 14px; }
.kd-cert__foot { display: flex; justify-content: center; align-items: flex-end; gap: 40px; font-size: 15px; color: #4A4060; }
.kd-cert__sign { display: grid; justify-items: center; text-align: center; }
.kd-cert__sign i { display: block; width: 190px; height: 74px; border-bottom: 2px dotted #4A4060; } /* chỗ trống để giáo viên ký */
.kd-cert__date { font-style: italic; margin-bottom: 2px; }
.kd-cert__sign b { font-weight: 700; color: var(--k-ink); }
.kd-cert__sign small { font-size: 12px; color: #7A7090; margin-top: 4px; }
.kd-cert__act { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 640px) { .kd-cert { aspect-ratio: auto; padding: 24px 16px; } .kd-cert__foot { flex-direction: column; gap: 10px; align-items: center; } }
@media print {
  /* in giấy chứng nhận khổ A4 DỌC – mở PDF xem được ngay, không phải xoay */
  body.is-printing-cert > *:not(main), body.is-printing-cert .lesson-head, body.is-printing-cert .lnav { display: none !important; }
  body.is-printing-cert { background: #fff !important; }
  body.is-printing-cert main.wrap { width: 100%; margin: 0; }
  body.is-printing-cert .lesson > * { display: none !important; }
  body.is-printing-cert .slide:has(.kd-cert-wrap.is-print) { display: block !important; }
  body.is-printing-cert .slide:has(.kd-cert-wrap.is-print) .slide__inner > :not(.kd-cert-wrap) { display: none !important; }
  body.is-printing-cert .kd-cert-wrap { margin: 0; }
  body.is-printing-cert main.wrap, body.is-printing-cert .lesson, body.is-printing-cert .slide, body.is-printing-cert .slide__inner { margin: 0 !important; padding: 0 !important; }
  body.is-printing-cert .kd-cert__act { display: none; }
  body.is-printing-cert .kd-cert {
    aspect-ratio: auto; height: 255mm; padding: 20mm 16mm 14mm; justify-content: center; break-inside: avoid;
    box-shadow: inset 0 0 0 10px #fff, inset 0 0 0 12px #FFE39A; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  body.is-printing-cert .kd-cert__title { font-size: 34px; }
  body.is-printing-cert .kd-cert__name { font-size: 52px; margin: 6mm 0; }
  body.is-printing-cert .kd-cert__text { font-size: 17px; max-width: 150mm; }
  body.is-printing-cert .kd-cert__foot { margin-top: 8mm; }
  body.is-printing-cert .kd-cert__sign i { width: 60mm; height: 30mm; }
  body.is-printing-cert .kd-cert__cast { margin-top: 8mm; }
  body.is-printing-cert .kd-cert__cast .ch { width: 60px; }
  @page { size: A4 portrait; margin: 10mm; }
}


/* ---------- thanh 4 chặng ---------- */
.kd-chapters { display: flex; align-items: stretch; gap: 6px; margin: 24px 0 0; overflow-x: auto; padding-bottom: 4px; }
.kd-chapters__arrow { align-self: center; font-size: 26px; font-weight: 700; color: #C9A2B8; }
.kd-chapter {
  flex: 1; min-width: 150px; display: grid; gap: 2px; padding: 12px 16px; border-radius: 22px; text-decoration: none; color: var(--k-ink);
  background: #fff; border: 3px solid #FFE0EC; transition: transform .15s;
}
.kd-chapter:hover { transform: translateY(-3px); }
.kd-chapter__n { font-size: 13px; font-weight: 700; color: #B03A6A; }
.kd-chapter b { font-size: 17px; line-height: 1.25; }
.kd-chapter small { font-size: 12px; color: #7A7090; }
.kd-chapter.is-current { background: linear-gradient(135deg, #fff, #FFD3E4); border-color: var(--k-pink); box-shadow: 0 10px 24px -16px rgba(255, 111, 168, .9); }

/* tiêu đề cân dòng – không để một chữ rớt xuống dòng dưới */
.is-kids .lh__title, .is-kids .blk-heading, .is-kids .kd-friend__intro h3, .is-kids .kd-game__head h3, .kd-name__card h2, .kd-cert__title, .kd-cert__text, .is-kids .lh__goal, .kd-story__bubble b { text-wrap: balance; }
.is-kids .blk-text p, .kd-story__bubble p, .is-kids .blk-callout li, .kd-game__prompt { text-wrap: pretty; }
.kd-quiz__opt span.is-big { font-size: 34px; line-height: 1.1; } /* lựa chọn chỉ là ký hiệu: ♯ ♭ ♮ */
.kd-friend__where > .kb-scroll { grid-column: 1 / -1; border-radius: 20px; }
.kd-map.is-narrow .kd-map__title { font-size: 25px; }
.kd-map.is-narrow .kd-map__num { font-size: 40px; }
.kd-map.is-narrow .kd-map__stars { font-size: 22px; }
