/* Gấu Con Học Chữ — lớp "sống động": Gấu Con biết thở, nhảy, an ủi, chỉ tay; khung cảnh trang chủ biết đùa; hình dán mới hiện thật to.
   Nạp ngay sau css/style.css. Chỉ dùng transform và opacity cho chuyển động (nhẹ máy), không đổi kích thước hay vị trí của bố cục.
   Không đặt --c ở đây để các lớp màu .c-* của style.css vẫn thắng. Phần JS tương ứng: mục "Gấu Con là bạn của bé" trong js/app.js. */

/* ---------- Gấu Con ---------- */
.buddy { position: relative; cursor: pointer; transform-origin: 50% 92%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.buddy .mascot { transform-origin: 50% 100%; animation: bd-breathe 3.6s ease-in-out infinite; }
/* Gấu Con cạnh câu hỏi: to hơn chỗ của mình một chút (phóng bằng transform nên không xô lệch bố cục, không làm trang phải cuộn) */
.ask > .buddy { --bs: 1.22; }
.ask > .buddy .mascot { transform-origin: 34% 58%; }
@media (min-width: 700px) { .ask > .buddy { --bs: 1.4; } }
.buddy[data-mood="happy"] { animation: bd-happy .9s ease-out; }
.buddy[data-mood="oops"] { animation: bd-oops .9s ease-in-out; }
.buddy[data-mood="point"] { animation: bd-point 1s ease-in-out infinite alternate; }
.buddy[data-mood="dance"], .cheer > .buddy { animation: bd-dance .9s ease-in-out infinite; }
.buddy[data-mood="wave"] { animation: bd-wave 1.4s ease-in-out; }
.buddy[data-mood="yawn"] { animation: bd-yawn 2.6s ease-in-out; }
.buddy[data-mood="look"] { animation: bd-look 1.2s ease-in-out; }
.buddy[data-mood="nod"] { animation: bd-nod 1.2s ease-in-out; }
.buddy[data-mood="hop"] { animation: bd-hop .9s ease-out; }
.buddy[data-mood="tickle"] { animation: bd-tickle .8s ease-in-out; }
.buddy[data-mood="spin"] { transform-origin: 50% 55%; animation: bd-spin .9s cubic-bezier(.4, 0, .3, 1); }
.buddy[data-mood="hug"] { animation: bd-hug 1s ease-in-out; }
/* hình nhỏ bay quanh gấu: bàn tay vỗ, tim, zzz… */
.bd-fx { position: absolute; inset: 0; pointer-events: none; font: 400 24px/1 var(--font-emoji); }
.bd-fx > span { position: absolute; opacity: 0; animation: bd-floatup 1s ease-out forwards; }
.bd-fx > .keep { opacity: 1; filter: drop-shadow(0 2px 0 rgba(30, 42, 94, .3)); animation: bd-nudge .7s ease-in-out infinite alternate; }
.buddy[data-mood="wave"] .bd-fx > span { transform-origin: 70% 90%; animation-name: bd-hand; }

/* lời Gấu Con vừa nói: phủ tạm lên ô câu hỏi (trong trò chơi) hoặc nổi phía trên gấu (màn chúc mừng, nghỉ mắt) */
.ask { position: relative; }
.bd-say { position: absolute; z-index: 2; display: grid; place-items: center; padding: 0 10px; overflow: hidden; pointer-events: none; text-align: center;
  border: 4px solid var(--orange); border-radius: 24px; background: #FFF1C9; box-shadow: 0 6px 0 rgba(30, 42, 94, .18);
  font-weight: 800; font-size: clamp(.92rem, min(3.4vw, 3vh), 1.3rem); line-height: 1.15; animation: bd-sayin .32s cubic-bezier(.3, 1.5, .6, 1); }
.bd-pip { position: absolute; z-index: 3; max-width: min(84vw, 360px); padding: 6px 16px; pointer-events: none; text-align: center;
  border: 4px solid var(--orange); border-radius: 22px; background: #FFF1C9; color: var(--navy); box-shadow: 0 6px 0 rgba(30, 42, 94, .18);
  font-weight: 800; font-size: clamp(1rem, 3.6vw, 1.3rem); line-height: 1.2; animation: bd-sayin .32s cubic-bezier(.3, 1.5, .6, 1); }
@media (max-height: 560px) { .bd-say { border-width: 3px; border-radius: 18px; font-size: .92rem; line-height: 1.05; } }

/* ---------- sao bay, mảnh lấp lánh ---------- */
.bd-flystar { position: absolute; z-index: 4; width: 46px; height: 46px; margin: -23px 0 0 -23px; animation: bd-flystar .62s cubic-bezier(.5, -.2, .7, 1) forwards; }
.bd-flystar svg { display: block; width: 100%; height: 100%; }
.bd-bit { position: absolute; margin: -.5em 0 0 -.5em; font-family: var(--font-emoji); font-weight: 400; line-height: 1; opacity: 0; animation: bd-bit .95s ease-out forwards; }
.stars.bump { animation: bd-starbump .5s cubic-bezier(.3, 1.6, .5, 1); }
.stars.bump svg { animation: bd-starspin .6s ease-out; }

/* ---------- hình dán mới ---------- */
.bd-reveal { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 2.4vh, 18px); padding-bottom: 6vh; }
.bd-reveal::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 46%, rgba(255, 246, 176, .96) 0, rgba(255, 210, 63, .7) 24%, rgba(30, 42, 94, .5) 78%); animation: bd-veil 2.75s ease forwards; }
.bd-rays { position: absolute; left: 50%; top: 46%; width: 140vmax; height: 140vmax; margin: -70vmax 0 0 -70vmax; border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(rgba(255, 255, 255, .5) 0 10deg, transparent 10deg 20deg); animation: bd-rays 2.75s linear forwards; }
.bd-prize { position: relative; display: grid; place-items: center; width: clamp(120px, min(46vw, 38vh), 250px); aspect-ratio: 1; border-radius: 26%;
  background: #fff; border: 8px solid var(--yellow); box-shadow: 0 10px 0 rgba(30, 42, 94, .22), 0 0 0 10px rgba(255, 255, 255, .55);
  font-size: clamp(76px, min(30vw, 25vh), 164px); animation: bd-prize 2.75s cubic-bezier(.3, 1.2, .5, 1) forwards; }
.bd-reveal > b { position: relative; font-weight: 800; font-size: clamp(1.5rem, min(7.4vw, 9vh), 3.2rem); line-height: 1.1; white-space: nowrap; animation: bd-prizetext 2.75s ease forwards; }
.praise.bd-quiet { visibility: hidden; }
#btnHome { position: relative; }
#btnHome.bd-new::after { content: ""; position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; background: var(--red); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(30, 42, 94, .25); animation: pulse .9s ease-in-out infinite; }

/* dải hình dán cạnh Gấu Con ở trang chủ */
.bd-strip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px; border-radius: 999px; background: linear-gradient(#fff, #FFF1C2); border: 3px solid #fff;
  box-shadow: 0 5px 0 rgba(30, 42, 94, .2); font-size: clamp(26px, 7vw, 34px); transition: transform .22s cubic-bezier(.3, 1.7, .5, 1); }
.bd-strip:active { transform: translateY(3px) scale(.96); transition-duration: .06s; }
.pips { display: flex; gap: 1px; }
.pips svg { width: clamp(18px, 5vw, 24px); height: clamp(18px, 5vw, 24px); fill: #E9EEF9; stroke: #B9C6EA; }
.pips svg.on { fill: var(--yellow); stroke: var(--navy); }
.nextq { position: relative; display: grid; place-items: center; }
.nextq .emo, .slots > .lock .emo { filter: brightness(0); opacity: .17; }
.nextq b, .slots > .lock b { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; }
.nextq b { font-size: .62em; color: var(--pink); animation: pulse 1.4s ease-in-out infinite; }
.bd-strip.fresh .last { animation: bd-fresh 1.1s cubic-bezier(.3, 1.5, .6, 1) .45s both; }

/* sổ hình dán: hình chưa có hiện bóng mờ với dấu hỏi, hình sắp được nhấp nháy mời gọi */
.slots > button { position: relative; width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; font-size: 38px;
  background: linear-gradient(135deg, #FFF0F7, #EAF6FF); border: 3px dashed #B9C6EA; transition: transform .22s cubic-bezier(.3, 1.7, .5, 1); }
.slots > button:active { transform: scale(.9); transition-duration: .06s; }
.slots > .got { background: linear-gradient(#FFFBE0, #FFEFA8); border: 3px solid var(--yellow); font-size: 42px; box-shadow: 0 4px 0 rgba(30, 42, 94, .16); }
.slots > .lock b { font-size: 24px; color: #8E9CCB; }
.slots > .next { border-color: var(--pink); animation: bd-invite 1.5s ease-in-out infinite; }
.slots > .next b { color: var(--pink); }
.slots > .new { animation: bd-fresh 1s cubic-bezier(.3, 1.5, .6, 1) .5s both; }
.slots > .bd-boing { animation: bd-boing .65s ease-out; }
.slots > .bd-shy { animation: wobble .45s; }
.bd-count { display: inline-block; margin-left: 6px; padding: 0 12px; border-radius: 999px; background: var(--yellow); font-size: .8em; vertical-align: 2px; }
.shelf.bd-glow { animation: bd-starbump .6s cubic-bezier(.3, 1.6, .5, 1) .35s; }
@media (min-width: 720px) { .slots > button { width: 72px; height: 72px; font-size: 44px; } .slots > .got { font-size: 50px; } }

/* ---------- nút bấm nảy như lò xo khi thả tay ---------- */
.btn, .round, .plain, button.block, .card, .crayon { transition: transform .22s cubic-bezier(.3, 1.7, .5, 1), box-shadow .12s; }
.btn:active, .round:active, .plain:active, button.block:active, .card:active, .crayon:active { transition-duration: .06s; }

@keyframes bd-breathe { 0%, 100% { transform: scale(var(--bs, 1)); } 50% { transform: scale(calc(var(--bs, 1) * 1.035), calc(var(--bs, 1) * .968)); } }
@keyframes bd-happy { 0% { transform: none; } 12% { transform: scale(1.1, .84); } 32% { transform: translateY(-30%) scale(.94, 1.08); } 50% { transform: scale(1.08, .9); } 66% { transform: translateY(-16%) rotate(4deg); } 82% { transform: scale(1.04, .95); } 100% { transform: none; } }
@keyframes bd-oops { 0%, 100% { transform: none; } 18% { transform: rotate(-11deg) translateX(-3%); } 34% { transform: rotate(-7deg) translateX(-1%); } 50% { transform: rotate(-12deg) translateX(-3%); } 66% { transform: rotate(-7deg) translateX(-1%); } 82% { transform: rotate(-10deg) translateX(-2%); } }
@keyframes bd-point { from { transform: rotate(calc(var(--lean, 1) * 5deg)) translateX(calc(var(--lean, 1) * 2%)); } to { transform: rotate(calc(var(--lean, 1) * 14deg)) translateX(calc(var(--lean, 1) * 8%)); } }
@keyframes bd-dance { 0%, 100% { transform: rotate(-9deg); } 25% { transform: translateY(-13%) rotate(0deg) scale(.97, 1.04); } 50% { transform: rotate(9deg); } 75% { transform: translateY(-13%) rotate(0deg) scale(.97, 1.04); } }
@keyframes bd-wave { 0%, 100% { transform: none; } 20% { transform: rotate(7deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(3deg); } }
@keyframes bd-yawn { 0%, 100% { transform: none; } 30% { transform: rotate(-5deg) scale(1.07, 1.1); } 62% { transform: rotate(-6deg) scale(1.09, 1.12); } 82% { transform: rotate(2deg) scale(1.03, .95); } }
@keyframes bd-look { 0%, 100% { transform: none; } 22%, 40% { transform: translateX(-5%) rotate(-7deg); } 62%, 80% { transform: translateX(5%) rotate(7deg); } }
@keyframes bd-nod { 0%, 100% { transform: none; } 20% { transform: scale(1.03, .93); } 40% { transform: none; } 60% { transform: scale(1.03, .93); } 80% { transform: none; } }
@keyframes bd-hop { 0%, 100% { transform: none; } 15% { transform: scale(1.08, .88); } 42% { transform: translateY(-22%) scale(.95, 1.07); } 68% { transform: scale(1.06, .92); } 84% { transform: translateY(-6%); } }
@keyframes bd-tickle { 0%, 100% { transform: none; } 12% { transform: rotate(-9deg) scale(1.06); } 25% { transform: rotate(9deg) scale(1.06); } 38% { transform: rotate(-8deg) scale(1.08); } 52% { transform: rotate(8deg) scale(1.08); } 66% { transform: rotate(-6deg) scale(1.05); } 82% { transform: rotate(5deg); } }
@keyframes bd-spin { 0% { transform: none; } 50% { transform: translateY(-14%) rotate(200deg) scale(1.08); } 100% { transform: rotate(360deg); } }
@keyframes bd-hug { 0%, 100% { transform: none; } 25% { transform: scale(1.2); } 45% { transform: scale(1.1); } 65% { transform: scale(1.2); } }
@keyframes bd-floatup { 0% { opacity: 0; transform: translateY(30%) scale(.4); } 20% { opacity: 1; transform: translateY(0) scale(1.2); } 70% { opacity: 1; transform: translateY(-35%) scale(1); } 100% { opacity: 0; transform: translateY(-70%) scale(1); } }
@keyframes bd-hand { 0% { opacity: 0; transform: scale(.4); } 12% { opacity: 1; transform: scale(1.1) rotate(-18deg); } 30% { transform: rotate(18deg); } 48% { transform: rotate(-18deg); } 66% { transform: rotate(18deg); } 84% { opacity: 1; transform: rotate(-10deg); } 100% { opacity: 0; transform: scale(.8); } }
@keyframes bd-nudge { from { transform: translate(0, 0); } to { transform: translate(calc(var(--lean, 1) * 18%), 12%); } }
@keyframes bd-sayin { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bd-flystar { 0% { transform: translate(0, 0) scale(.3); opacity: 0; } 22% { transform: translate(0, -22px) scale(1.35) rotate(-20deg); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.6) rotate(200deg); opacity: 1; } }
@keyframes bd-bit { 0% { opacity: 0; transform: translate(0, 0) scale(.3); } 18% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(50deg); } }
@keyframes bd-starbump { 0% { transform: scale(1); } 35% { transform: scale(1.28) rotate(-4deg); } 65% { transform: scale(.96) rotate(2deg); } 100% { transform: scale(1); } }
@keyframes bd-starspin { from { transform: rotate(0); } to { transform: rotate(144deg); } }
@keyframes bd-veil { 0% { opacity: 0; } 9% { opacity: 1; } 76% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bd-rays { 0% { opacity: 0; transform: rotate(0); } 9% { opacity: 1; } 74% { opacity: 1; } 90%, 100% { opacity: 0; transform: rotate(70deg); } }
@keyframes bd-prize { 0% { transform: scale(0) rotate(-200deg); } 15% { transform: scale(1.2) rotate(8deg); } 22% { transform: scale(.96) rotate(-5deg); } 29% { transform: scale(1.04) rotate(3deg); } 36% { transform: scale(1) rotate(0); } 55% { transform: scale(1.07) rotate(-3deg); } 74% { transform: scale(1) rotate(2deg); opacity: 1; } 96% { transform: translate(var(--fx, 0), var(--fy, -40vh)) scale(.2) rotate(18deg); opacity: 1; } 100% { transform: translate(var(--fx, 0), var(--fy, -40vh)) scale(.1); opacity: 0; } }
@keyframes bd-prizetext { 0%, 12% { transform: scale(.4); opacity: 0; } 24% { transform: scale(1.1); opacity: 1; } 30%, 72% { transform: scale(1); opacity: 1; } 84%, 100% { transform: scale(.9); opacity: 0; } }
@keyframes bd-fresh { 0% { transform: scale(0) rotate(-140deg); } 60% { transform: scale(1.5) rotate(10deg); } 80% { transform: scale(.9) rotate(-4deg); } 100% { transform: none; } }
@keyframes bd-invite { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09) rotate(-3deg); } }
@keyframes bd-boing { 0% { transform: scale(1); } 25% { transform: translateY(-14px) scale(1.25) rotate(-8deg); } 50% { transform: scale(.92) rotate(6deg); } 75% { transform: translateY(-5px) scale(1.08) rotate(-3deg); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ask > .buddy .mascot { transform: scale(var(--bs, 1)); }
  .buddy, .buddy .mascot, .cheer > .buddy, .bd-fx > span, .slots > button, .nextq b, .bd-strip .last, .stars.bump, .stars.bump svg, #btnHome.bd-new::after { animation: none !important; }
  .btn, .round, .plain, button.block, .card, .crayon, .bd-strip, .slots > button { transition: none; }
  .bd-rays, .bd-flystar, .bd-bit { display: none; }
  .bd-prize, .bd-reveal > b, .bd-reveal::before { animation: bd-veil 2.75s ease forwards; }
}
