/*
 * FLYER Kids — lớp giao diện dùng chung cho bé 3,5–6 tuổi.
 * Nguyên tắc: bé chưa đọc được, nên mọi thao tác phải hiểu được bằng hình,
 * tiếng và chuyển động; chữ chỉ còn để bố mẹ đọc kèm, luôn nhỏ và phụ.
 */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
:root {
  --k-ink: #2A2A3C;
  --k-ink-soft: #5A5F6E;
  --k-yellow: #FFD84D;
  --k-yellow-2: #FFC72C;
  --k-green: #7EC24C;
  --k-green-dark: #3E8E2E;
  --k-pink: #FF8DB8;
  --k-cream: #FFFBF2;
}

/* ---------- Nút tròn to (≥ 56px: ngón tay bé chưa khéo) ---------- */
.k-btn {
  flex: none; display: grid; place-items: center; position: relative;
  width: 58px; height: 58px; border-radius: 50%;
  background: #fff; border: 4px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink);
  cursor: pointer; text-decoration: none; color: var(--k-ink); padding: 0;
  transition: transform .12s; -webkit-tap-highlight-color: transparent;
}
.k-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--k-ink); }
.k-btn svg { width: 34px; height: 34px; }
.k-btn.gold { background: linear-gradient(180deg, #FFE27A, var(--k-yellow-2)); }
.k-btn.pink { background: linear-gradient(180deg, #FFC4DC, #FF8DB8); }
.k-btn.mint { background: linear-gradient(180deg, #B8F3E6, #5FD1C4); }
.k-btn.small { width: 44px; height: 44px; border-width: 3px; box-shadow: 0 3px 0 var(--k-ink); }
.k-btn.small svg { width: 24px; height: 24px; }
.k-btn .dot { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: #FF5A5F; border: 3px solid var(--k-ink); }
.k-btn.bounce { animation: k-bounce 1.6s ease-in-out infinite; }

/* Bingo làm avatar: bấm vào mở tủ đồ */
.k-bingo-btn { width: 64px; height: 64px; background: #FFE3EE; overflow: hidden; }
.k-bingo-btn svg { width: 74px; height: 74px; margin-top: 12px; }

/* Ô sao: con số duy nhất bé cần thấy */
.k-stars {
  flex: none; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 16px 0 8px;
  background: #fff; border: 4px solid var(--k-ink); border-radius: 999px; box-shadow: 0 5px 0 var(--k-ink);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 24px; line-height: 1;
}
.k-stars svg { width: 36px; height: 36px; }
.k-stars.pop { animation: k-pop .5s cubic-bezier(.2,1.6,.4,1); }

/* ---------- Chuyển động dùng chung ---------- */
.k-wiggle { animation: k-wiggle .5s; }
@keyframes k-wiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-9deg) scale(1.06); } 45% { transform: rotate(8deg) scale(1.06); } 70% { transform: rotate(-4deg); } }
@keyframes k-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes k-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes k-spin { to { transform: rotate(360deg); } }
@keyframes k-rise { from { opacity: 0; transform: translateY(40px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes k-shake-box { 0%,100% { transform: rotate(0); } 15% { transform: rotate(-8deg); } 30% { transform: rotate(8deg); } 45% { transform: rotate(-6deg); } 60% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } }

/* ---------- Hộp thoại to ---------- */
.k-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgba(28, 24, 48, .55); opacity: 0; transition: opacity .2s; }
.k-modal.show { opacity: 1; }
.k-card {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--k-cream); border: 5px solid var(--k-ink); border-radius: 36px;
  box-shadow: 0 10px 0 var(--k-ink), 0 30px 60px rgba(0,0,0,.35);
  padding: 26px 22px 24px; text-align: center;
  animation: k-rise .4s cubic-bezier(.2,1.3,.35,1);
}
.k-close { position: absolute; top: 12px; right: 12px; z-index: 5; }
.k-title { position: relative; z-index: 2; margin: 0 0 4px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 28px; line-height: 1.1; color: var(--k-ink); }
.k-sub { position: relative; z-index: 2; margin: 0; font-family: 'Open Sans', sans-serif; font-size: 13px; font-weight: 700; color: var(--k-ink-soft); }
.k-go {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 200px; height: 64px; padding: 0 28px;
  border-radius: 999px; border: 5px solid var(--k-ink); box-shadow: 0 7px 0 var(--k-ink);
  background: linear-gradient(180deg, #A8E27A, #5FA430); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.k-go:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--k-ink); }
.k-go svg { width: 30px; height: 30px; }

/* Tủ đồ */
.k-preview { width: 170px; height: 170px; margin: -6px auto 6px; display: block; }
.k-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 10px; }
.k-item {
  position: relative; aspect-ratio: 1; border-radius: 22px; border: 4px solid var(--k-ink); background: #fff;
  box-shadow: 0 5px 0 var(--k-ink); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.k-item svg { width: 86%; height: 86%; }
.k-item.worn { background: #FFF3C2; border-color: #E0A000; box-shadow: 0 5px 0 #E0A000; }
.k-item.worn::after { content: ''; position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; border-radius: 50%;
  background: #5FA430 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 12 l4 4 8-9' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/80% no-repeat;
  border: 3px solid var(--k-ink); }
.k-item.locked { background: #EEF0F5; cursor: default; }
.k-item.locked svg { filter: grayscale(1) brightness(.4); opacity: .35; }
.k-need { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px;
  background: #fff; border: 3px solid var(--k-ink); border-radius: 999px; padding: 1px 8px 1px 4px;
  font-family: 'Baloo 2'; font-weight: 800; font-size: 14px; white-space: nowrap; }
.k-need svg { width: 18px !important; height: 18px !important; filter: none !important; opacity: 1 !important; }

/* Màn chúc mừng có đồ mới / mở rương / quà */
.k-reveal { position: relative; width: 220px; height: 220px; margin: 0 auto 26px; }
.k-reveal .rays { position: absolute; inset: -40px; animation: k-spin 12s linear infinite; }
.k-reveal .hero { position: absolute; inset: 14px; overflow: visible; }
.k-gift-box { width: 190px; height: 190px; margin: 0 auto; display: block; cursor: pointer; }
.k-gift-box.shake { animation: k-shake-box .7s; }
.k-flystar { position: fixed; z-index: 95; width: 54px; height: 54px; pointer-events: none;
  transition: transform .9s cubic-bezier(.5,-0.2,.6,1), opacity .9s; }

/* Chọn thế giới bằng hình */
.k-worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.k-world { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--k-ink); }
.k-world .pic { width: 100%; aspect-ratio: 1; border-radius: 28px; border: 5px solid var(--k-ink); box-shadow: 0 6px 0 var(--k-ink); display: grid; place-items: center; overflow: hidden; }
.k-world .pic svg { width: 78%; height: 78%; }
.k-world.here .pic { outline: 5px solid var(--k-yellow); outline-offset: 3px; }
.k-world b { font-family: 'Baloo 2'; font-weight: 800; font-size: 15px; line-height: 1.1; }

/* Góc phụ huynh */
.k-parent-q { font-family: 'Open Sans'; font-weight: 800; font-size: 18px; margin: 14px 0 12px; }
.k-parent-nums { display: flex; gap: 12px; justify-content: center; }
.k-parent-nums button { width: 76px; height: 64px; border-radius: 18px; border: 4px solid var(--k-ink); background: #fff; box-shadow: 0 5px 0 var(--k-ink); font-family: 'Baloo 2'; font-weight: 800; font-size: 26px; cursor: pointer; }
.k-parent { text-align: left; }
.k-parent h4 { margin: 18px 0 8px; font-family: 'Open Sans'; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--k-ink-soft); }
.k-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-family: 'Open Sans'; font-size: 14px; }
.k-kv b { font-weight: 800; }
.k-links { display: flex; flex-wrap: wrap; gap: 8px; }
.k-links a, .k-links button { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px; border: 3px solid var(--k-ink); background: #fff; font-family: 'Open Sans'; font-weight: 800; font-size: 13px; color: var(--k-ink); text-decoration: none; cursor: pointer; }
.k-links button.danger { color: #B3261E; border-color: #B3261E; }
.k-toggle { display: flex; align-items: center; justify-content: space-between; font-family: 'Open Sans'; font-weight: 700; font-size: 14px; padding: 4px 0; }
.k-toggle input { width: 22px; height: 22px; }

.k-parent-btn { position: fixed; z-index: 40; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); opacity: .9; }

/* Bàn tay chỉ dẫn: trẻ làm theo hình mẫu tốt hơn nghe hướng dẫn */
.k-hand { position: fixed; z-index: 80; width: 64px; height: 64px; pointer-events: none; filter: drop-shadow(0 4px 4px rgba(0,0,0,.3));
  animation: k-tap 1.2s ease-in-out infinite; transform-origin: 30% 10%; }
@keyframes k-tap { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-6px,-10px) scale(.9); } }

@media (max-width: 520px) {
  .k-btn { width: 50px; height: 50px; }
  .k-btn svg { width: 28px; height: 28px; }
  .k-bingo-btn { width: 54px; height: 54px; }
  .k-bingo-btn svg { width: 62px; height: 62px; margin-top: 10px; }
  .k-stars { height: 48px; font-size: 21px; padding-right: 12px; }
  .k-stars svg { width: 30px; height: 30px; }
  .k-grid { grid-template-columns: repeat(4, 1fr); gap: 9px; }
  .k-title { font-size: 24px; }
  .k-go { min-width: 0; padding: 0 20px; font-size: 19px; height: 58px; }
}
@media (prefers-reduced-motion: reduce) { .k-btn.bounce, .k-reveal .rays, .k-hand { animation: none !important; } }

/* Công tắc ngôn ngữ VI / EN (thanh trên + Góc phụ huynh) */
.k-lang { flex: none; display: inline-flex; padding: 3px; gap: 2px; background: #fff; border: 4px solid var(--k-ink); border-radius: 999px; box-shadow: 0 5px 0 var(--k-ink); }
.k-lang button { min-width: 42px; height: 38px; padding: 0 10px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 16px; color: var(--k-ink-soft); }
.k-lang button[aria-pressed="true"] { background: var(--k-ink); color: #fff; }
.k-lang.wide { box-shadow: none; border-width: 3px; }
.k-lang.wide button { height: 40px; padding: 0 16px; font-family: 'Open Sans', sans-serif; font-size: 14px; }
@media (max-width: 520px) { .k-lang button { min-width: 36px; height: 32px; font-size: 14px; padding: 0 8px; } }
