/* ====== Sân khấu trò chơi dùng chung (máy trẻ + máy giáo viên) ====== */
.kg-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1000px;
  height: 625px;
  transform-origin: 0 0;
  overflow: hidden;
  border-radius: 28px;
  background: radial-gradient(circle at 15% 10%, #fff7d6 0, transparent 40%), radial-gradient(circle at 90% 90%, #ffe1ef 0, transparent 45%), linear-gradient(160deg, #e9f6ff, #f3fbf3);
  font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  color: #23314f;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.kg-root {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.kg-stage button {
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.kg-head {
  height: 76px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  gap: 16px;
}
.kg-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.kg-stats {
  display: flex;
  gap: 10px;
}
.pill {
  background: #fff;
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(35, 49, 79, 0.08);
}
@keyframes kg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(7px); }
}
@keyframes kg-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes kg-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 0 #e0a800, 0 0 0 0 rgba(255, 138, 61, 0.6); }
  50% { transform: scale(1.1); box-shadow: 0 6px 0 #e0a800, 0 0 0 14px rgba(255, 138, 61, 0); }
}
.shake { animation: kg-shake 0.45s; }

/* ---------- con trỏ từ xa ---------- */
.kg-pointer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 70ms linear;
}
.kg-pointer.show { opacity: 1; }
.kg-pointer::before {
  content: '';
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}
.kg-pointer.down::before { transform: scale(0.7); }
.kg-pointer-label {
  position: absolute;
  left: 18px;
  top: 12px;
  white-space: nowrap;
  font: 700 18px 'Baloo 2', system-ui, sans-serif;
  color: #fff;
  padding: 0 10px;
  border-radius: 10px;
}
.kg-pointer-teacher::before { background: rgba(255, 64, 129, 0.85); animation: kg-ring 1.4s infinite; }
.kg-pointer-teacher .kg-pointer-label { background: #ff4081; }
.kg-pointer-child::before { background: rgba(61, 139, 255, 0.85); }
.kg-pointer-child .kg-pointer-label { background: #3d8bff; }
@keyframes kg-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 64, 129, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3); }
  100% { box-shadow: 0 0 0 26px rgba(255, 64, 129, 0), 0 2px 8px rgba(0, 0, 0, 0.3); }
}
.kg-confetti {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}

/* ---------- Lật hình ---------- */
.mem-grid {
  flex: 1;
  display: grid;
  justify-content: center;
  align-content: center;
  padding-bottom: 24px;
}
.mem-card {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
}
.mem-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.6, 1);
  transform-style: preserve-3d;
}
.mem-card.up .mem-inner { transform: rotateY(180deg); }
.mem-back,
.mem-front {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mem-back {
  background: repeating-linear-gradient(45deg, #ff9a52 0 14px, #ff8a3d 14px 28px);
  color: #fff;
  font-size: 54px;
  font-weight: 800;
  box-shadow: 0 6px 0 #d96a22;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}
.mem-card:hover .mem-back { filter: brightness(1.06); }
.mem-front {
  background: #fff;
  transform: rotateY(180deg);
  box-shadow: 0 6px 0 #d8e0ec;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  padding: 6px;
  word-break: break-all;
}
.mem-front.text { color: #3d5afe; white-space: normal; word-break: keep-all; overflow-wrap: normal; letter-spacing: 0.5px; }
.mem-front.pic { padding: 8px; }
.mem-front.pic .kg-img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.mem-front.many { line-height: 1.15; }
.mem-card.ok .mem-front {
  background: #e7faef;
  box-shadow: 0 6px 0 #2fbf71, inset 0 0 0 4px #2fbf71;
}
.mem-card.ok { animation: kg-pop 0.4s; }

/* ---------- Bắt bóng ---------- */
.catch-canvas {
  position: absolute;
  inset: 0;
  width: 1000px;
  height: 625px;
  cursor: none;
}
.kg-stage.kg-control .catch-canvas { cursor: ew-resize; }

/* ---------- Tìm từ ---------- */
.ws-body {
  flex: 1;
  display: flex;
  gap: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 30px 26px;
}
.ws-grid {
  display: grid;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 0 #d8e0ec;
  touch-action: none;
}
.ws-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #eef2f7;
  cursor: pointer;
  transition: background 0.15s;
}
.ws-cell.sel { box-shadow: inset 0 0 0 100px rgba(77, 150, 255, 0.35); }
.ws-cell.start { box-shadow: inset 0 0 0 100px #ffd84d, inset 0 0 0 3px #ff8a3d; }
.ws-cell.found { font-weight: 800; }
.ws-list {
  width: 270px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ws-list-title {
  font-size: 20px;
  font-weight: 800;
  color: #6b7a99;
  margin-bottom: 2px;
}
.ws-word {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 800;
  background: #fff;
  border-radius: 14px;
  padding: 2px 12px;
  letter-spacing: 1px;
}
.ws-word.found .ws-text { text-decoration: line-through; text-decoration-thickness: 3px; }
.ws-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-emoji { font-size: 28px; flex: none; }
img.ws-emoji { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; }
.ws-check { margin-left: auto; color: #1b8a4f; }

/* ---------- Toán vui ---------- */
.mt-dots { display: flex; gap: 8px; }
.mt-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dbe3ee;
}
.mt-dot.cur { background: #fff; box-shadow: inset 0 0 0 4px #ff8a3d; }
.mt-dot.ok { background: #2fbf71; }
.mt-dot.bad { background: #ff5c5c; }
.mt-card {
  margin: 4px auto 0;
  width: 800px;
  height: 290px;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 8px 0 #d8e0ec;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mt-pics {
  display: grid;
  grid-template-columns: repeat(5, 84px);
  justify-items: center;
  font-size: 64px;
  line-height: 1.15;
}
.mt-pics.two { font-size: 56px; }
.mt-pics span { animation: kg-pop 0.35s both; }
.mt-q { font-size: 84px; font-weight: 800; line-height: 1.1; }
.mt-q.small { font-size: 36px; }
.mt-choices {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 26px;
}
.mt-choice {
  min-width: 160px;
  height: 116px;
  padding: 0 20px;
  border: 0;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 7px 0 #cfd8e6;
  font-size: 60px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
.mt-choice:active { transform: translateY(4px); box-shadow: 0 3px 0 #cfd8e6; }
.mt-choice.ok { background: #2fbf71; color: #fff; box-shadow: 0 7px 0 #1f9255; animation: kg-pop 0.35s; }
.mt-choice.bad { background: #ff5c5c; color: #fff; box-shadow: 0 7px 0 #c93c3c; animation: kg-shake 0.45s; }
.mt-choice.dim { opacity: 0.35; }
.mt-feedback { text-align: center; font-size: 32px; margin-top: 16px; min-height: 44px; }
.mt-feedback .good { color: #1b8a4f; }
.mt-feedback .bad { color: #d83a3a; }
.mt-done { text-align: center; padding: 0 30px; }
.mt-done .mt-q { font-size: 54px; }
.mt-stars { font-size: 96px; color: #ffb300; letter-spacing: 8px; animation: kg-pop 0.5s; }

/* ---------- Ghép chữ ---------- */
.sp-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 44px;
  padding: 0 54px 30px;
}
.sp-pic {
  flex: none;
  width: 320px;
  height: 320px;
  border-radius: 44px;
  background: #fff;
  box-shadow: 0 10px 0 #d8e0ec;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 200px;
  line-height: 1;
  overflow: hidden;
}
.sp-pic .kg-img { width: 100%; height: 100%; object-fit: cover; }
.sp-pic.pop { animation: kg-pop 0.5s; }
.sp-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
}
.sp-slots { display: flex; gap: 10px; min-height: 104px; align-items: center; }
.sp-slot {
  width: var(--sz, 82px);
  height: calc(var(--sz, 82px) * 1.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 7px solid #c3cddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--sz, 82px) * 0.75);
  font-weight: 800;
}
.sp-gap { width: calc(var(--sz, 82px) * 0.4); }
.sp-slot.on { background: #fff; border-color: #4d96ff; animation: kg-pop 0.3s; }
.sp-slot.win { border-color: #2fbf71; color: #1b8a4f; }
.sp-done { font-size: 40px; font-weight: 800; text-align: center; }
.sp-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 560px;
}
.sp-tile {
  width: var(--tz, 86px);
  height: var(--tz, 86px);
  border: 0;
  border-radius: 22px;
  background: #ffc93c;
  box-shadow: 0 6px 0 #e0a800;
  font-size: calc(var(--tz, 86px) * 0.6);
  font-weight: 800;
  cursor: pointer;
}
.sp-tile:active { transform: translateY(3px); box-shadow: 0 3px 0 #e0a800; }
.sp-tile.used { visibility: hidden; }
.sp-tile.hint { animation: kg-pulse 0.9s infinite; background: #ffe08a; }
.sp-tools { display: flex; gap: 14px; }
.sp-tool {
  border: 0;
  background: #fff;
  border-radius: 999px;
  padding: 6px 22px;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 4px 0 #d8e0ec;
  cursor: pointer;
}

/* ---------- hình dùng chung ---------- */
.kg-img { display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.kg-emo { line-height: 1; }

/* ---------- Nghe và chọn ---------- */
.ls-prompt {
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  background: #fff;
  border-radius: 28px;
  padding: 10px 34px 10px 14px;
  box-shadow: 0 6px 0 #d8e0ec;
  min-width: 420px;
}
.ls-say {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 0;
  background: #00a6a6;
  color: #fff;
  font-size: 46px;
  box-shadow: 0 6px 0 #007a7a;
  cursor: pointer;
  flex: none;
}
.ls-say:active { transform: translateY(3px); box-shadow: 0 3px 0 #007a7a; }
.ls-word { font-size: 56px; font-weight: 800; line-height: 1.1; letter-spacing: 1px; }
.ls-word.hidden-word { color: #c3cddd; letter-spacing: 8px; }
.ls-note { font-size: 20px; color: #6b7a99; font-weight: 600; }
.ls-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 22px;
  padding: 10px 40px 0;
}
.ls-card {
  width: 190px;
  height: 190px;
  border: 0;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 7px 0 #cfd8e6;
  font-size: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  padding: 10px;
  transition: opacity 0.2s, transform 0.1s;
}
.ls-grid.n6 .ls-card { width: 160px; height: 160px; font-size: 100px; }
.ls-card .kg-img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.ls-card:active { transform: translateY(4px); }
.ls-card.ok { box-shadow: 0 0 0 7px #2fbf71, 0 7px 0 #1f9255; animation: kg-pop 0.35s; }
.ls-card.bad { box-shadow: 0 0 0 7px #ff5c5c, 0 7px 0 #c93c3c; animation: kg-shake 0.45s; }
.ls-card.dim, .qz-ans.dim { opacity: 0.35; }

/* ---------- Đố vui ---------- */
.qz-card {
  margin: 0 auto;
  width: 860px;
  min-height: 150px;
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 8px 0 #d8e0ec;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 16px 30px;
}
.qz-card.has-pic { justify-content: flex-start; }
.qz-pic {
  width: 170px;
  height: 170px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 110px;
  border-radius: 22px;
  overflow: hidden;
  background: #f4f7fb;
  line-height: 1;
}
.qz-pic .kg-img { width: 100%; height: 100%; object-fit: cover; }
.qz-q { font-size: 44px; font-weight: 800; line-height: 1.2; }
.qz-q.long { font-size: 32px; }
.qz-answers {
  flex: 1;
  display: grid;
  gap: 18px;
  padding: 22px 70px 0;
  align-content: start;
  justify-content: center;
}
.qz-answers.texts { grid-template-columns: repeat(2, 400px); }
.qz-answers.texts.n3 { grid-template-columns: repeat(3, 270px); }
.qz-answers.pics { grid-template-columns: repeat(var(--cols, 3), 170px); }
.qz-answers.pics.n4 { --cols: 4; }
.qz-answers.pics.n2 { --cols: 2; }
.qz-ans {
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 #cfd8e6;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  font-size: 30px;
  font-weight: 700;
  text-align: left;
  min-height: 92px;
  transition: opacity 0.2s, transform 0.1s;
  overflow: hidden;
}
.qz-answers.pics .qz-ans { height: 170px; justify-content: center; font-size: 110px; padding: 10px; }
.qz-ans .kg-img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; }
.qz-answers.texts .qz-ans .kg-img { width: 64px; height: 64px; }
.qz-letter {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #eef2f8;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #6b7a99;
}
.qz-ans:active { transform: translateY(4px); }
.qz-ans.ok { background: #2fbf71; color: #fff; box-shadow: 0 6px 0 #1f9255; animation: kg-pop 0.35s; }
.qz-ans.bad { background: #ff5c5c; color: #fff; box-shadow: 0 6px 0 #c93c3c; animation: kg-shake 0.45s; }
.qz-answers.pics .qz-ans.ok { background: #e7faef; box-shadow: 0 0 0 7px #2fbf71; }
.qz-answers.pics .qz-ans.bad { background: #ffecec; box-shadow: 0 0 0 7px #ff5c5c; }

/* ---------- Nối hình – chữ ---------- */
.mc-area {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 260px;
  padding: 0 40px 24px;
}
.mc-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.mc-col { display: flex; flex-direction: column; justify-content: center; gap: 14px; z-index: 2; }
.mc-item {
  --h: min(96px, calc((500px - (var(--n) - 1) * 14px) / var(--n)));
  border: 0;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 6px 0 #cfd8e6;
  cursor: pointer;
  height: var(--h);
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.mc-pic {
  width: var(--h);
  font-size: calc(var(--h) * 0.68);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 6px;
}
.mc-pic .kg-img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.mc-word { min-width: 240px; padding: 0 22px; font-size: 36px; font-weight: 800; }
.mc-item.sel { transform: scale(1.06); box-shadow: 0 0 0 6px #ffc93c, 0 6px 0 #e0a800; }
.mc-item.done { box-shadow: 0 0 0 5px var(--c), 0 6px 0 #cfd8e6; background: #fbfdff; }

/* ---------- Xếp vào giỏ ---------- */
.so-tray {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 14px;
  padding: 0 30px;
  touch-action: none;
}
.so-item {
  width: 112px;
  height: 128px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 #cfd8e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 60px;
  cursor: grab;
  position: relative;
  z-index: 2;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.25s;
  overflow: hidden;
  padding: 6px;
}
.so-item .kg-img { width: 92px; height: 82px; object-fit: cover; border-radius: 14px; }
.so-label { font-size: 18px; font-weight: 800; line-height: 1.45; padding-top: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.so-item.sel { transform: translateY(-8px) scale(1.06); box-shadow: 0 0 0 6px #ffc93c, 0 10px 0 #e0a800; }
.so-item.dragging { transition: none; z-index: 30; box-shadow: 0 18px 30px rgba(0, 0, 0, 0.2); cursor: grabbing; }
.so-item.placed { opacity: 0; pointer-events: none; transform: scale(0.4); }
.so-baskets {
  flex: none;
  height: 200px;
  display: grid;
  grid-template-columns: repeat(var(--g), 1fr);
  gap: 18px;
  padding: 0 30px 22px;
}
.so-basket {
  border: 4px dashed var(--c);
  background: color-mix(in srgb, var(--c) 10%, white);
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  overflow: hidden;
}
.so-basket.ready { border-style: solid; }
.so-basket.hover { transform: scale(1.04); background: color-mix(in srgb, var(--c) 25%, white); }
.so-bname { font-size: 30px; font-weight: 800; color: var(--c); line-height: 1.1; }
.so-inside { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; font-size: 40px; line-height: 1; }
.so-mini { width: 48px; height: 48px; display: grid; place-items: center; animation: kg-pop 0.35s; }
.so-mini .kg-img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; }

/* ---------- Ghép tranh ---------- */
.pz-main { flex: 1; display: flex; align-items: center; justify-content: center; gap: 46px; padding-bottom: 24px; }
.pz-board {
  position: relative;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 0 #d8e0ec;
  overflow: hidden;
  cursor: pointer;
}
.pz-tile {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.3, 1.2, 0.5, 1);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}
.pz-full { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; background: #fff8e8; pointer-events: none; }
.pz-full img { width: 100%; height: 100%; object-fit: cover; }
.pz-full span { line-height: 1; }
.pz-tile::after { content: ''; position: absolute; inset: 0; pointer-events: none; transition: box-shadow 0.2s; }
.pz-tile.sel { z-index: 3; }
.pz-tile.sel::after { box-shadow: inset 0 0 0 6px #ffc93c; background: rgba(255, 201, 60, 0.15); }
.pz-board.solved .pz-tile { box-shadow: none; }
.pz-board.solved { box-shadow: 0 0 0 8px #2fbf71, 0 8px 0 #d8e0ec; }
.pz-side { width: 230px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pz-preview {
  width: 210px;
  height: 210px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 #d8e0ec;
  display: grid;
  place-items: center;
  font-size: 150px;
  overflow: hidden;
  line-height: 1;
}
.pz-preview .kg-img { width: 100%; height: 100%; object-fit: cover; }
.pz-preview.hidden > * { visibility: hidden; }
.pz-preview.hidden::after { content: '?'; font-size: 120px; color: #c3cddd; font-weight: 800; position: absolute; }
.pz-preview.hidden { position: relative; }
.pz-word { font-size: 40px; font-weight: 800; text-align: center; line-height: 1.1; }

/* ---------- hiệu ứng chúc mừng ---------- */
.fx-layer { position: absolute; inset: 0; width: 1000px; height: 625px; pointer-events: none; z-index: 58; overflow: hidden; }
.fx-balloon { position: absolute; bottom: -120px; animation: fx-rise 3.6s ease-in forwards; }
@keyframes fx-rise {
  0% { transform: translate(0, 0) rotate(-6deg); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(30px, -380px) rotate(6deg); }
  100% { transform: translate(-20px, -800px) rotate(-4deg); opacity: 1; }
}
.fx-star { position: absolute; transform: translate(-50%, -50%); animation: fx-burst 1.6s cubic-bezier(0.15, 0.8, 0.3, 1) forwards; opacity: 0; }
@keyframes fx-burst {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(240deg); opacity: 0; }
}
.fx-drop { position: absolute; top: -70px; animation: fx-fall 2.4s linear forwards; opacity: 0; }
@keyframes fx-fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(760px) rotate(300deg); opacity: 0.9; }
}
.fx-rainbow {
  background: radial-gradient(circle at 50% 110%, transparent 34%, #ff4d6d55 34%, #ff4d6d55 38%, #ff9f1c55 38%, #ff9f1c55 42%, #ffd23f55 42%, #ffd23f55 46%, #3bceac55 46%, #3bceac55 50%, #4d96ff55 50%, #4d96ff55 54%, #b066ff55 54%, #b066ff55 58%, transparent 58%);
  z-index: 31;
  animation: fx-fade 4.2s ease forwards;
}
@keyframes fx-fade { 0% { opacity: 0; transform: scale(0.8); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Chọn con vật ---------- */
.an-head { height: 96px; gap: 14px; }
.an-title { font-size: 22px; flex: none; color: #6b7a99; }
.an-prompt {
  flex: 1;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 999px;
  padding: 8px 26px 8px 10px;
  box-shadow: 0 6px 0 #d8e0ec;
  min-height: 70px;
}
.an-prompt.asking { box-shadow: 0 0 0 5px #ffb703, 0 6px 0 #e09a00; }
.an-prompt.pop { animation: kg-pop 0.45s; }
.an-say {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: #c2410c;
  color: #fff;
  font-size: 28px;
  flex: none;
  cursor: pointer;
  box-shadow: 0 4px 0 #8a2e08;
}
.an-ptext { font-size: 34px; font-weight: 700; line-height: 1.15; }
.an-ptext b { color: #c2410c; font-weight: 800; }
.an-wait { color: #6b7a99; font-size: 30px; }
.an-grid { flex: 1; display: grid; justify-content: center; align-content: center; padding-bottom: 18px; }
.an-card {
  position: relative;
  border: 0;
  padding: 7px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 7px 0 #cfd8e6, 0 10px 24px rgba(35, 49, 79, 0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.3, 1.3, 0.5, 1), box-shadow 0.2s;
}
.an-card:hover { transform: translateY(-3px); }
.an-card:active { transform: translateY(3px); }
.an-photo {
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #eef3f8;
  display: grid;
  place-items: center;
}
.an-photo .kg-img { width: 100%; height: 100%; object-fit: cover; }
.an-photo .kg-emo { font-size: 110px; }
.an-word { font-size: 34px; font-weight: 800; padding: 8px; text-align: center; }
.an-name { height: var(--nh, 0px); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; }
.an-mark { position: absolute; inset: 0; border-radius: 24px; pointer-events: none; display: grid; place-items: center; font-size: 110px; }
.an-card.wrong .an-mark { background: rgba(255, 77, 77, 0.35); box-shadow: inset 0 0 0 7px #ff4d4d; }
.an-card.wrong .an-mark::after { content: '✖'; color: #fff; text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.an-card.nudge { animation: an-nudge 0.5s; }
@keyframes an-nudge { 30% { transform: translateY(-14px); } 60% { transform: translateY(2px); } }
.an-card.hint { animation: an-hint 1.3s ease-in-out infinite; }
@keyframes an-hint { 50% { box-shadow: 0 0 0 9px rgba(255, 183, 3, 0.75), 0 7px 0 #cfd8e6; } }
.an-card.win { box-shadow: 0 0 0 8px #2fbf71, 0 7px 0 #1f9255; }
.an-win {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(70, 45, 120, 0.55), rgba(12, 16, 40, 0.86));
  animation: ov-fadein 0.3s;
}
@keyframes ov-fadein { from { opacity: 0; } }
.an-win.out { opacity: 0; transition: opacity 0.35s; }
.an-rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 1100px;
  height: 1100px;
  margin: -550px 0 0 -550px;
  background: repeating-conic-gradient(rgba(255, 220, 90, 0.45) 0 9deg, transparent 9deg 22deg);
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 62%);
  mask: radial-gradient(circle, #000 20%, transparent 62%);
  animation: an-spin 8s linear infinite;
}
@keyframes an-spin { to { transform: rotate(360deg); } }
.an-win-photo {
  position: relative;
  width: 330px;
  height: 330px;
  border-radius: 40px;
  overflow: hidden;
  background: #fff;
  border: 10px solid #fff;
  box-shadow: 0 0 0 8px #ffd23f, 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: an-zoom 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both;
  display: grid;
  place-items: center;
}
.an-win-photo .kg-img { width: 100%; height: 100%; object-fit: cover; }
.an-win-photo .kg-emo { font-size: 220px; }
@keyframes an-zoom { 0% { transform: scale(0.2) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }
.an-praise {
  position: relative;
  margin-top: 14px;
  font-size: 76px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 3px #c2410c;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #c2410c, 0 10px 24px rgba(0, 0, 0, 0.35);
  animation: an-bounce 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) 0.15s both;
}
.an-win-name {
  position: relative;
  margin-top: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 2px 28px;
  font-size: 36px;
  font-weight: 800;
  color: #23314f;
  animation: kg-pop 0.5s 0.4s both;
}
@keyframes an-bounce { 0% { transform: scale(0) translateY(40px); } 100% { transform: scale(1) translateY(0); } }

/* Chọn con vật – hỏi nhiều con cùng lúc */
.an-ptext.n2 { font-size: 28px; }
.an-ptext.n3 { font-size: 23px; }
.an-ptext b.got { color: #1f9255; }
.an-card.got { box-shadow: 0 0 0 7px #2fbf71, 0 7px 0 #1f9255; }
.an-card.got .an-mark { background: rgba(47, 191, 113, 0.28); }
.an-card.got .an-mark::after { content: '✔'; color: #fff; text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.an-card.yes { animation: an-yes 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes an-yes { 0% { transform: scale(0.9); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.an-win-photos { position: relative; display: flex; gap: 34px; align-items: center; justify-content: center; }
.an-win-photos.n2 .an-win-photo { width: 290px; height: 290px; }
.an-win-photos.n3 .an-win-photo { width: 240px; height: 240px; border-radius: 32px; }
.an-win-photos.n2 .kg-emo, .an-win-photos.n3 .kg-emo { font-size: 170px; }
