/* Bé Học Vui — style.css */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Baloo 2", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  background: linear-gradient(180deg, #aee7ff 0%, #d8f7e5 45%, #fff6c9 100%);
  min-height: 100vh;
  color: #33302e;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- phông nền bay ---------- */
.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.float-el {
  position: absolute; left: var(--x); top: var(--y); font-size: var(--s);
  opacity: .55; animation: floaty var(--d) ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.12));
}
@keyframes floaty {
  from { transform: translateY(-14px) rotate(-4deg); }
  to   { transform: translateY(16px) rotate(5deg); }
}

/* ---------- thanh trên ---------- */
.topbar {
  position: relative; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1020px; margin: 0 auto; padding: 14px 18px 0;
}
.stars-pill {
  background: #fff; border: 3px solid #ffd93d; border-radius: 999px;
  font-size: 24px; font-weight: 800; padding: 6px 18px;
  box-shadow: 0 4px 0 rgba(0,0,0,.08); display: flex; align-items: center; gap: 6px;
}
.stars-pill.bump { animation: bump .45s ease; }
@keyframes bump { 0%{transform:scale(1)} 40%{transform:scale(1.25) rotate(-3deg)} 100%{transform:scale(1)} }
.top-actions { display: flex; gap: 10px; }
.icon-btn {
  width: 54px; height: 54px; border-radius: 50%; background: #fff;
  font-size: 26px; border: 3px solid #e8e2d9; box-shadow: 0 4px 0 rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn.off { opacity: .45; filter: grayscale(1); }

/* ---------- màn hình ---------- */
main { position: relative; z-index: 2; max-width: 1020px; margin: 0 auto; padding: 6px 18px 40px; }
.screen { display: none; }
.screen.active { display: block; animation: screenIn .35s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- trang chủ ---------- */
.mascot {
  font-size: 92px; text-align: center; line-height: 1.1; cursor: pointer;
  animation: mascotBounce 1.6s ease-in-out infinite;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.15)); width: max-content; margin: 6px auto 0;
}
@keyframes mascotBounce {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50%     { transform: translateY(-16px) rotate(3deg); }
}
.mascot.wave { animation: wave .6s ease; }
@keyframes wave { 0%{transform:rotate(0)} 25%{transform:rotate(-14deg) translateY(-8px)} 60%{transform:rotate(12deg)} 100%{transform:rotate(0)} }
.app-title {
  text-align: center; font-size: clamp(44px, 8vw, 72px); font-weight: 800; margin: 2px 0 0;
  color: #ff6b9d; letter-spacing: 1px;
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(255,107,157,.25);
}
.app-subtitle { text-align: center; font-size: clamp(20px, 3.4vw, 28px); font-weight: 700; color: #5b7fa6; margin: 0 0 18px; }
.cat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
@media (max-width: 640px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
.cat-card {
  border-radius: 28px; padding: 20px 10px 16px; min-height: 168px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 8px 0 rgba(0,0,0,.10), 0 14px 24px rgba(0,0,0,.10);
  transition: transform .15s ease, box-shadow .15s ease;
  animation: cardBob 2.6s ease-in-out infinite;
}
.cat-card:nth-child(2) { animation-delay: .25s; }
.cat-card:nth-child(3) { animation-delay: .5s; }
.cat-card:nth-child(4) { animation-delay: .15s; }
.cat-card:nth-child(5) { animation-delay: .4s; }
.cat-card:nth-child(6) { animation-delay: .6s; }
@keyframes cardBob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
.cat-card:active { transform: scale(.94); box-shadow: 0 3px 0 rgba(0,0,0,.10); }
.cat-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.18)); }
.cat-name { font-size: clamp(22px, 3.6vw, 30px); font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.cat-hint { font-size: 16px; font-weight: 700; color: rgba(255,255,255,.92); }
.c-colors { background: linear-gradient(160deg, #ff8a7a, #ff5e7a); }
.c-shapes { background: linear-gradient(160deg, #6ec6ff, #4a7dff); }
.c-numbers { background: linear-gradient(160deg, #ffc93d, #ff9f1c); }
.c-letters { background: linear-gradient(160deg, #b388ff, #7c4dff); }
.c-animals { background: linear-gradient(160deg, #7ee081, #2fbf71); }
.c-fruits { background: linear-gradient(160deg, #ff9ff3, #f368e0); }
.home-tip { text-align: center; font-size: 19px; font-weight: 700; color: #6b7280; margin: 20px 0 0; }

/* ---------- trang chủ đề ---------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.back-btn {
  background: #fff; border: 3px solid #e8e2d9; border-radius: 999px;
  font-size: 20px; font-weight: 800; padding: 8px 18px; box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.back-btn:active { transform: scale(.94); }
#sectionTitle { flex: 1; text-align: center; font-size: clamp(30px, 5vw, 44px); font-weight: 800; margin: 0; color: #ff6b9d; text-shadow: 0 2px 0 #fff; }
.section-stars { background: #fff; border: 3px solid #ffd93d; border-radius: 999px; font-size: 20px; font-weight: 800; padding: 6px 14px; }
.mode-tabs { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.mode-tab {
  font-size: 22px; font-weight: 800; padding: 12px 28px; border-radius: 999px;
  background: #fff; border: 3px solid #e8e2d9; color: #6b7280; box-shadow: 0 4px 0 rgba(0,0,0,.06);
}
.mode-tab.active { background: #ffd93d; border-color: #f5b301; color: #5b3a00; }
.mode-tab:active { transform: scale(.95); }

/* ---------- lưới học ---------- */
.learn-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 760px) { .learn-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 430px) { .learn-grid { grid-template-columns: repeat(2, 1fr); } }
.learn-card {
  background: #fff; border-radius: 24px; padding: 16px 8px 12px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 6px 0 rgba(0,0,0,.07), 0 10px 18px rgba(0,0,0,.08);
  transition: transform .15s ease;
}
.learn-card:active { transform: scale(.93); }
.learn-card.pop { animation: pop .5s ease; }
@keyframes pop { 0%{transform:scale(1)} 35%{transform:scale(1.18) rotate(-3deg)} 70%{transform:scale(.96)} 100%{transform:scale(1)} }
.learn-visual { font-size: 64px; line-height: 1.1; display: flex; align-items: center; justify-content: center; min-height: 72px; }
.learn-visual .swatch { width: 72px; height: 72px; border-radius: 50%; border: 4px solid rgba(0,0,0,.12); box-shadow: inset 0 -8px 0 rgba(0,0,0,.12); }
.learn-visual .shape { width: 72px; height: 72px; }
.learn-visual .big-letter { font-size: 64px; font-weight: 800; color: #ff6b9d; line-height: 1; }
.learn-visual .big-num { font-size: 64px; font-weight: 800; color: #4a7dff; line-height: 1; }
.learn-name { font-size: 22px; font-weight: 800; text-align: center; }
.learn-sub { font-size: 16px; font-weight: 700; color: #8a8f98; text-align: center; line-height: 1.25; }
.learn-count { font-size: 15px; letter-spacing: 2px; line-height: 1.4; text-align: center; }
.shape-circle { border-radius: 50%; }
.shape-square { border-radius: 14px; }
.shape-triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.shape-rect { border-radius: 12px; height: 48px !important; margin-top: 12px; }
.shape-oval { border-radius: 50%; height: 52px !important; margin-top: 10px; }
.shape-diamond { transform: rotate(45deg); border-radius: 12px; width: 56px !important; height: 56px !important; }
.shape-star, .shape-heart { font-size: 64px !important; }

/* ---------- đố vui ---------- */
.hidden { display: none !important; }
.quiz-area { text-align: center; }
.quiz-progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.quiz-progress .dot {
  width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #d8d2c8;
}
.quiz-progress .dot.done { background: #ffd93d; border-color: #f5b301; }
.quiz-progress .dot.now { background: #ff6b9d; border-color: #e14e83; animation: pulseDot 1s ease infinite; }
@keyframes pulseDot { 0%,100%{transform:scale(1)} 50%{transform:scale(1.3)} }
.quiz-prompt {
  font-size: clamp(26px, 4.6vw, 38px); font-weight: 800; color: #33302e;
  background: #fff; border-radius: 24px; padding: 18px 20px; margin: 0 auto 12px; max-width: 720px;
  box-shadow: 0 6px 0 rgba(0,0,0,.07); line-height: 1.3;
}
.quiz-prompt .q-objects { font-size: clamp(34px, 6vw, 52px); letter-spacing: 6px; display: block; margin-top: 8px; }
.repeat-btn {
  font-size: 19px; font-weight: 800; background: #e8f7ff; border: 3px solid #9ed8ff; color: #2b6cb0;
  border-radius: 999px; padding: 8px 20px; margin-bottom: 16px;
}
.repeat-btn:active { transform: scale(.94); }
.quiz-options {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 680px; margin: 0 auto;
}
@media (min-width: 700px) { .quiz-options.four { grid-template-columns: repeat(4, 1fr); } }
.quiz-opt {
  background: #fff; border-radius: 24px; padding: 18px 10px; min-height: 132px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 6px 0 rgba(0,0,0,.07), 0 10px 18px rgba(0,0,0,.08);
  font-size: 22px; font-weight: 800;
  transition: transform .15s ease;
}
.quiz-opt:active { transform: scale(.93); }
.quiz-opt .opt-visual { font-size: 62px; line-height: 1; display: flex; align-items: center; justify-content: center; min-height: 70px; }
.quiz-opt .opt-visual .swatch { width: 66px; height: 66px; border-radius: 50%; border: 4px solid rgba(0,0,0,.12); }
.quiz-opt .opt-visual .big-letter, .quiz-opt .opt-visual .big-num { font-size: 58px; font-weight: 800; }
.quiz-opt .opt-visual .big-num { color: #4a7dff; }
.quiz-opt .opt-visual .big-letter { color: #ff6b9d; }
.quiz-opt.correct { background: #d9f9d4; border: 4px solid #2fbf71; animation: pop .5s ease; }
.quiz-opt.wrong { background: #ffe3e3; border: 4px solid #ff6b6b; animation: shake .45s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(9px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.quiz-feedback { font-size: 26px; font-weight: 800; min-height: 40px; margin-top: 14px; color: #2fbf71; }

/* ---------- ăn mừng ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 30, 50, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: screenIn .3s ease;
}
.celebrate-card {
  background: linear-gradient(180deg, #fffbe6, #fff); border-radius: 32px; padding: 30px 26px;
  max-width: 440px; width: 100%; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: pop .5s ease;
}
.celebrate-emoji { font-size: 84px; animation: mascotBounce 1.4s ease-in-out infinite; }
.celebrate-card h2 { font-size: 38px; margin: 6px 0; color: #ff6b9d; }
.celebrate-card p { font-size: 22px; font-weight: 700; color: #5b7fa6; margin: 0 0 8px; }
.celebrate-stars { font-size: 40px; letter-spacing: 4px; margin: 6px 0 18px; animation: bump .5s ease; }
.celebrate-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.big-btn {
  font-size: 22px; font-weight: 800; padding: 14px 26px; border-radius: 999px;
  background: #fff; border: 3px solid #e8e2d9; box-shadow: 0 5px 0 rgba(0,0,0,.08);
}
.big-btn.primary { background: #ffd93d; border-color: #f5b301; color: #5b3a00; }
.big-btn:active { transform: scale(.94); }

/* ---------- pháo giấy ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; top: -16px; width: 12px; height: 18px; border-radius: 3px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}
.star-fly {
  position: fixed; z-index: 70; font-size: 40px; pointer-events: none;
  animation: starFly .9s ease forwards;
}
@keyframes starFly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; }
}
