:root {
  --radius: 24px;
  --gold-1: #f9e29c;
  --gold-2: #e6b34a;
  --gold-3: #bd8a2c;
  --gold-grad: linear-gradient(135deg, #fff3cf 0%, #f9d976 35%, #e6b34a 65%, #c8902f 100%);
  --ink: #f4ecd8;
  --ink-soft: #d8cfb8;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(249, 226, 156, 0.35);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.3);
  --serif: "Playfair Display", "Times New Roman", serif;
  --round: "Baloo 2", "Quicksand", system-ui, sans-serif;
  --font: "Quicksand", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  overflow-x: hidden;
  user-select: none;
  background: #15102e;
}

/* Nền gradient sang trọng */
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(124, 92, 255, 0.35), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(230, 179, 74, 0.22), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(189, 138, 44, 0.18), transparent 60%),
    linear-gradient(160deg, #1c1442 0%, #150f33 45%, #0f0b24 100%);
  background-attachment: fixed;
}

/* Hạt sáng lấp lánh nền */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(249, 226, 156, 0.6), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(249, 226, 156, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 85% 25%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(2px 2px at 55% 15%, rgba(249, 226, 156, 0.4), transparent);
  background-repeat: repeat;
  background-size: 600px 600px;
  animation: twinkle 6s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.85; } }

/* ---------- Thanh trên cùng ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(90deg, rgba(28, 20, 66, 0.85), rgba(15, 11, 36, 0.85));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}
#appTitle {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(22px, 5vw, 38px);
  letter-spacing: 0.5px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 14px rgba(230, 179, 74, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.title-crown {
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 2px 6px rgba(230, 179, 74, 0.6));
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.icon-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(8px);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, box-shadow 0.15s;
  color: var(--ink);
}
.icon-btn:hover { box-shadow: 0 0 0 3px rgba(249, 226, 156, 0.25), var(--shadow-soft); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.muted { opacity: 0.45; }

/* ---------- Khu vực màn hình ---------- */
#app { position: relative; z-index: 1; padding: 20px 18px 40px; max-width: 1040px; margin: 0 auto; }
.screen { display: none; animation: pop 0.45s cubic-bezier(.2,.8,.2,1); }
.screen.active { display: block; }
@keyframes pop {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Hero trang chủ ---------- */
.hero { text-align: center; margin: 10px 0 26px; }
.hero-sub {
  margin: 0;
  font-family: var(--round);
  font-size: clamp(13px, 3vw, 16px);
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.8;
}
.hero-title {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 8vw, 64px);
  line-height: 1.1;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 30px rgba(230, 179, 74, 0.35);
  position: relative;
}
.hero-title::after {
  content: "";
  display: block;
  width: 120px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
}
/* Ảnh trung tâm trang chủ */
.hero-photo {
  margin: 22px auto 0;
  width: clamp(150px, 38vw, 240px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  padding: 6px;
  background: var(--gold-grad);
  box-shadow: 0 14px 40px rgba(230, 179, 74, 0.4), var(--shadow);
  animation: heroFloat 4s ease-in-out infinite;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  border: 3px solid rgba(21, 16, 46, 0.6);
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.welcome {
  margin: 16px 0 0;
  font-family: var(--round);
  font-size: clamp(17px, 4vw, 24px);
  font-weight: 600;
  color: var(--gold-1);
}

/* ---------- Menu trang chủ ---------- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 20px;
}
.menu-card {
  position: relative;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 30px 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  min-height: 168px;
  justify-content: center;
  overflow: hidden;
}
.menu-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  opacity: 0.16;
  transition: opacity 0.25s;
}
/* Ánh sáng quét qua khi rê chuột */
.menu-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -120%;
  width: 60%;
  height: 220%;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: rotate(8deg);
  transition: left 0.6s ease;
}
.menu-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold-2);
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(249, 226, 156, 0.4);
}
.menu-card:hover::before { opacity: 0.3; }
.menu-card:hover::after { left: 130%; }
.menu-card:active { transform: scale(0.95); }
.menu-emoji {
  position: relative;
  z-index: 1;
  font-size: 60px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}
.menu-label {
  position: relative;
  z-index: 1;
  font-family: var(--round);
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.3px;
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.tab {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--gold-1);
  font-family: var(--round);
  font-weight: 700;
  font-size: 18px;
  padding: 11px 26px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.2s;
}
.tab:hover { border-color: var(--gold-2); }
.tab.active {
  background: var(--gold-grad);
  color: #3a2a08;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(230, 179, 74, 0.4);
}

/* ---------- Sân khấu hiển thị lớn ---------- */
.stage {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  padding: 22px;
  text-align: center;
}
.stage .big-letter {
  font-family: var(--round);
  font-size: clamp(96px, 27vw, 190px);
  font-weight: 800;
  line-height: 1;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(230, 179, 74, 0.3);
}
.stage .big-emoji { font-size: clamp(74px, 20vw, 150px); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); }
.stage .stage-word {
  font-family: var(--round);
  font-size: clamp(26px, 6vw, 44px);
  font-weight: 700;
  margin-top: 8px;
  color: var(--ink);
}

/* ---------- Lưới chip nhỏ để chọn ---------- */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 12px;
}
.chip {
  border: 1px solid var(--glass-border);
  cursor: pointer;
  aspect-ratio: 1;
  border-radius: 18px;
  font-family: var(--round);
  font-size: 27px;
  font-weight: 800;
  background: var(--glass-strong);
  backdrop-filter: blur(6px);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, box-shadow 0.2s, border-color 0.2s;
}
.chip:hover { border-color: var(--gold-2); transform: translateY(-2px); }
.chip:active { transform: scale(0.88); }
.chip.active {
  border-color: transparent;
  outline: 3px solid var(--gold-2);
  box-shadow: 0 0 0 4px rgba(249, 226, 156, 0.25), var(--shadow-soft);
}

/* ---------- Thanh công cụ ---------- */
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-bottom: 16px; }
.pill {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  padding: 9px 18px;
  border-radius: 999px;
  font-family: var(--round);
  font-weight: 700;
  color: var(--gold-1);
  box-shadow: var(--shadow-soft);
}
.btn-mini {
  border: 1px solid rgba(249, 226, 156, 0.4);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(108, 99, 255, 0.9));
  color: #fff;
  font-family: var(--round);
  font-weight: 700;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, box-shadow 0.2s;
}
.btn-mini:hover { box-shadow: 0 0 0 3px rgba(249, 226, 156, 0.25), var(--shadow-soft); }
.btn-mini:active { transform: scale(0.92); }

/* ---------- Trò chơi trí nhớ ---------- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 540px;
  margin: 0 auto;
}
.card {
  aspect-ratio: 1;
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s;
  box-shadow: var(--shadow-soft);
}
.card.flipped, .card.matched { transform: rotateY(180deg); }
.card .face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  font-size: clamp(32px, 9vw, 56px);
  border: 1px solid var(--glass-border);
}
.card .front {
  background: linear-gradient(145deg, #2a2056, #1a1340);
  color: var(--gold-1);
}
.card .back {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  backdrop-filter: blur(6px);
  transform: rotateY(180deg);
}
.card.matched { animation: matched 0.6s ease; }
.card.matched .face { border-color: var(--gold-2); box-shadow: 0 0 18px rgba(249, 226, 156, 0.5) inset; }
@keyframes matched { 0%,100% { transform: rotateY(180deg) scale(1);} 50% { transform: rotateY(180deg) scale(1.12);} }

/* ---------- Tô màu ---------- */
.palette { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; border: 3px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-soft);
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { outline: 3px solid var(--gold-2); transform: scale(1.12); }
.coloring-stage {
  background: linear-gradient(160deg, rgba(255,255,255,0.96), rgba(245,240,255,0.96));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; justify-content: center;
}
.coloring-stage svg { width: 100%; max-width: 470px; height: auto; }
.coloring-stage svg .region { cursor: pointer; transition: fill 0.15s; }

/* ---------- Vòng quay ---------- */
.wheel-wrap { position: relative; width: 360px; max-width: 92vw; margin: 0 auto 18px; }
#wheelCanvas { width: 100%; height: auto; display: block; filter: drop-shadow(0 12px 26px rgba(0,0,0,0.5)); }
.wheel-pointer { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font-size: 44px; color: var(--gold-2); z-index: 5; text-shadow: 0 3px 6px rgba(0,0,0,0.4); }
.spin-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 100px; height: 100px; border-radius: 50%; border: 5px solid #fff8e6;
  background: var(--gold-grad); color: #3a2a08; font-family: var(--round); font-weight: 800; font-size: 19px; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45), 0 0 0 6px rgba(249, 226, 156, 0.25);
}
.spin-btn:active { transform: translate(-50%, -50%) scale(0.92); }
.wheel-result {
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 700;
  min-height: 48px;
  margin-bottom: 12px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.name-input {
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--glass-border);
  background: var(--glass-strong); color: var(--ink); font-family: var(--round); font-size: 16px; min-width: 200px;
}
.name-input::placeholder { color: var(--ink-soft); opacity: 0.6; }
.name-input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(249, 226, 156, 0.2); }
.name-list { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.name-tag {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 7px 14px; font-family: var(--round); font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 7px;
}
.name-tag b { font-size: 15px; }
.name-tag .del { color: #ff7a9c; cursor: pointer; font-weight: 900; }

/* ---------- Khen thưởng ---------- */
.praise {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%) scale(0);
  font-family: var(--serif);
  font-size: clamp(42px, 12vw, 96px); font-weight: 700;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
  pointer-events: none; z-index: 100; opacity: 0;
}
.praise.show { animation: praise 1.3s ease forwards; }
@keyframes praise {
  0% { transform: translate(-50%,-50%) scale(0) rotate(-12deg); opacity: 0; }
  30% { transform: translate(-50%,-50%) scale(1.2) rotate(6deg); opacity: 1; }
  70% { transform: translate(-50%,-50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%,-55%) scale(1); opacity: 0; }
}

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti-piece { position: absolute; width: 12px; height: 12px; top: -20px; opacity: 0.9; will-change: transform; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ========================================================= */
/* ============= NÂNG CẤP GIAO DIỆN ĐÁNG YÊU =============== */
/* ========================================================= */

/* Tên cô + biểu tượng nhún nhảy */
.title-name {
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title-deco {
  -webkit-text-fill-color: initial;
  font-size: 0.7em;
  animation: wiggle 2.2s ease-in-out infinite;
  display: inline-block;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.15); }
}

/* Dải biểu tượng đáng yêu trên hero */
.hero-icons {
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: clamp(26px, 6vw, 38px);
  margin-bottom: 6px;
}
.hero-icons span {
  display: inline-block;
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}
.hero-icons span:nth-child(1) { animation-delay: 0s; }
.hero-icons span:nth-child(2) { animation-delay: 0.2s; }
.hero-icons span:nth-child(3) { animation-delay: 0.4s; }
.hero-icons span:nth-child(4) { animation-delay: 0.6s; }
.hero-icons span:nth-child(5) { animation-delay: 0.8s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-12px) rotate(-6deg); }
}

/* Trái tim bay lơ lửng nền (dễ thương) */
.floaty {
  position: fixed;
  bottom: -40px;
  z-index: 0;
  pointer-events: none;
  font-size: 26px;
  opacity: 0.5;
  animation: floatUp linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-115vh) rotate(40deg); opacity: 0; }
}

/* Menu emoji nhún nhẹ khi rê chuột */
.menu-card:hover .menu-emoji { animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.18) rotate(-6deg); }
}

/* Sân khấu emoji "thở" nhẹ cho sinh động */
.stage .big-emoji { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* ---------- Bé tập đếm ---------- */
.count-items {
  font-size: clamp(34px, 9vw, 56px);
  line-height: 1.5;
  letter-spacing: 6px;
  max-width: 520px;
}
.count-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.count-opt {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(6px);
  color: var(--gold-1);
  font-family: var(--round);
  font-size: 40px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.count-opt:hover { transform: translateY(-4px); border-color: var(--gold-2); }
.count-opt:active { transform: scale(0.9); }
.count-opt.right {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  color: #08351f;
  animation: matched 0.5s ease;
}
.count-opt.wrong {
  background: linear-gradient(135deg, #ff6a88, #ff99ac);
  color: #fff;
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

/* ---------- Đố vui bé chọn ---------- */
.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 480px;
  margin: 0 auto;
}
.quiz-opt {
  aspect-ratio: 1.4;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(6px);
  font-size: clamp(48px, 14vw, 80px);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.quiz-opt:hover { transform: translateY(-5px) scale(1.03); border-color: var(--gold-2); }
.quiz-opt:active { transform: scale(0.9); }
.quiz-opt.right {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  animation: matched 0.5s ease;
}
.quiz-opt.wrong {
  background: linear-gradient(135deg, #ff6a88, #ff99ac);
  animation: shake 0.4s;
}

/* ========================================================= */
/* ========= KHUNG TRANG TRÍ RỰC RỠ QUANH MÀN HÌNH ========= */
/* ========================================================= */

/* Viền cầu vồng nhấp nháy bao quanh toàn màn hình */
.deco-frame {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  border: 10px solid transparent;
  border-image: linear-gradient(120deg,
    #ff6a88, #ffb347, #ffe66d, #6bcB77, #4d96ff, #b15cff, #ff6a88) 1;
  animation: rainbowGlow 4s linear infinite;
  box-shadow:
    inset 0 0 30px rgba(249, 226, 156, 0.4),
    inset 0 0 60px rgba(124, 92, 255, 0.25);
}
@keyframes rainbowGlow {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* Biểu tượng ở 4 góc + 2 cạnh */
.deco-corner, .deco-side {
  position: fixed;
  z-index: 41;
  pointer-events: none;
  font-size: clamp(30px, 6vw, 52px);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}
.deco-corner.tl { top: 8px; left: 10px; animation: spinPop 3s ease-in-out infinite; }
.deco-corner.tr { top: 8px; right: 10px; animation: bob 2.6s ease-in-out infinite; }
.deco-corner.bl { bottom: 8px; left: 10px; animation: bob 3s ease-in-out infinite; }
.deco-corner.br { bottom: 8px; right: 10px; animation: spinPop 3.4s ease-in-out infinite; }
.deco-side.left { top: 50%; left: 6px; transform: translateY(-50%); animation: sideFloat 3.2s ease-in-out infinite; }
.deco-side.right { top: 50%; right: 6px; transform: translateY(-50%); animation: sideFloat 2.8s ease-in-out infinite; }
@keyframes spinPop {
  0%, 100% { transform: rotate(-12deg) scale(1); }
  50% { transform: rotate(12deg) scale(1.2); }
}
@keyframes sideFloat {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-65%) scale(1.18); }
}

/* Trên màn hình nhỏ thì ẩn biểu tượng cạnh cho gọn */
@media (max-width: 520px) {
  .deco-side { display: none; }
  .deco-frame { border-width: 7px; }
}

/* ---------- Dải hình minh hoạ các bé ---------- */
.kids-band {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 3vw, 28px);
  margin: 6px auto 24px;
  max-width: 640px;
  flex-wrap: nowrap;
}
.kids-band .kid {
  width: clamp(58px, 18vw, 110px);
  height: auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
  transform-origin: bottom center;
  animation: kidJump 2.4s ease-in-out infinite;
}
.kids-band .kid:nth-child(1) { animation-delay: 0s; }
.kids-band .kid:nth-child(2) { animation-delay: 0.3s; }
.kids-band .kid:nth-child(3) { animation-delay: 0.6s; }
.kids-band .kid:nth-child(4) { animation-delay: 0.9s; }
@keyframes kidJump {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-16px) rotate(2deg); }
}

/* ========================================================= */
/* ================= DÒNG TÁC GIẢ (CREDIT) ================= */
/* ========================================================= */
#credit {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  font-family: var(--round);
  font-size: clamp(12px, 3vw, 15px);
  letter-spacing: 0.3px;
  color: var(--ink-soft);
}
#credit span {
  display: inline-block;
  padding: 7px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-soft);
}
#credit b {
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* ========================================================= */
/* ================ MÀN HÌNH CHÀO MỪNG ===================== */
/* ========================================================= */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 600px at 50% 20%, rgba(124, 92, 255, 0.45), transparent 60%),
    linear-gradient(160deg, #1c1442 0%, #150f33 50%, #0f0b24 100%);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.5s ease;
}
.welcome-overlay.hide {
  animation: fadeOut 0.6s ease forwards;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }

.welcome-box {
  text-align: center;
  max-width: 540px;
  padding: 40px 28px;
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(249, 226, 156, 0.3);
  animation: pop 0.6s cubic-bezier(.2,.8,.2,1);
}
.welcome-emoji {
  font-size: clamp(44px, 12vw, 72px);
  animation: float 3s ease-in-out infinite;
}
.welcome-heading {
  margin: 10px 0 4px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 7vw, 44px);
  line-height: 1.2;
  color: var(--ink-soft);
}
.welcome-heading span {
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(230, 179, 74, 0.4);
}
.welcome-text {
  font-family: var(--round);
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 600;
  color: var(--gold-1);
  margin: 16px 0 26px;
  line-height: 1.6;
}
.welcome-btn {
  border: none;
  cursor: pointer;
  font-family: var(--round);
  font-weight: 800;
  font-size: clamp(17px, 4.5vw, 24px);
  color: #3a2a08;
  padding: 16px 34px;
  border-radius: 999px;
  background: var(--gold-grad);
  box-shadow: 0 12px 30px rgba(230, 179, 74, 0.5), 0 0 0 6px rgba(249, 226, 156, 0.2);
  animation: btnPulse 1.6s ease-in-out infinite;
}
.welcome-btn:active { transform: scale(0.94); }
@keyframes btnPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 30px rgba(230, 179, 74, 0.5), 0 0 0 6px rgba(249, 226, 156, 0.2); }
  50% { transform: scale(1.05); box-shadow: 0 16px 38px rgba(230, 179, 74, 0.65), 0 0 0 10px rgba(249, 226, 156, 0.28); }
}

/* ========================================================= */
/* ============ RESPONSIVE: CÂN ĐỐI MỌI THIẾT BỊ =========== */
/* ========================================================= */

/* Chừa khoảng an toàn cho viền trang trí + tai thỏ điện thoại */
#app {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}
#topbar {
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* Máy tính bảng & màn hình vừa */
@media (max-width: 900px) {
  .menu-grid { gap: 16px; }
}

/* Điện thoại (đứng) */
@media (max-width: 600px) {
  #app { padding: 14px 14px 24px; }
  #appTitle { font-size: clamp(18px, 5.5vw, 26px); }
  .title-deco { display: none; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .menu-card { min-height: 124px; padding: 18px 8px; gap: 8px; border-radius: 20px; }
  .menu-emoji { font-size: 42px; }
  .menu-label { font-size: 14px; }
  .hero-icons { gap: 8px; }
  .memory-grid { gap: 8px; }
  .chip-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
  .chip { font-size: 22px; border-radius: 14px; }
  .count-opt { width: 70px; height: 70px; font-size: 32px; }
  .tab { font-size: 16px; padding: 9px 18px; }
  .stage { min-height: 200px; padding: 16px; }
}

/* Điện thoại nhỏ */
@media (max-width: 380px) {
  .menu-card { min-height: 110px; }
  .menu-emoji { font-size: 36px; }
  .menu-label { font-size: 13px; }
  .kids-band .kid { width: 52px; }
  .count-options { gap: 10px; }
  .count-opt { width: 60px; height: 60px; font-size: 26px; border-radius: 18px; }
}

/* Điện thoại nằm ngang (thấp) */
@media (max-height: 480px) and (orientation: landscape) {
  .kids-band { display: none; }
  .hero { margin: 4px 0 14px; }
  .hero-icons { margin-bottom: 2px; }
  .stage { min-height: 150px; }
  .menu-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .menu-card { min-height: 100px; }
}

/* Màn hình lớn / TV: phóng to cho dễ nhìn từ xa */
@media (min-width: 1400px) {
  #app { max-width: 1280px; }
  .menu-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 26px; }
  .menu-emoji { font-size: 72px; }
  .menu-label { font-size: 22px; }
  .chip { font-size: 32px; }
  .stage { min-height: 320px; }
}

/* Màn hình rất lớn (TV 4K) */
@media (min-width: 1900px) {
  #app { max-width: 1500px; }
  .menu-emoji { font-size: 84px; }
  .menu-label { font-size: 26px; }
}

/* Tôn trọng người dùng muốn giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body::before, .deco-frame { animation: none !important; }
}

/* Thiết bị cảm ứng: bỏ hiệu ứng hover gây kẹt trạng thái */
@media (hover: none) {
  .menu-card:hover { transform: none; }
  .menu-card:hover .menu-emoji { animation: none; }
  .chip:hover, .quiz-opt:hover, .count-opt:hover, .swatch:hover { transform: none; }
}

