/* ============================================================
   FunTuk (ফানটুক) — shared design system
   Kid-first: huge touch targets, bright colors, rounded shapes.
   ============================================================ */

:root {
  --font-title: 'Baloo 2', cursive;
  --font-bangla: 'Hind Siliguri', sans-serif;
  --brand-purple: #7c3aed;
  --brand-pink: #ec4899;
  --sun: #fbbf24;
  --sky: #38bdf8;
  --mint: #34d399;
  --coral: #fb7185;
  --app-max-width: 720px;
  --tab-height: 76px;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-title);
  background:
    radial-gradient(circle at 15% 20%, rgba(251, 191, 36, 0.18) 0%, transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(236, 72, 153, 0.15) 0%, transparent 32%),
    radial-gradient(circle at 80% 80%, rgba(56, 189, 248, 0.18) 0%, transparent 35%),
    linear-gradient(160deg, #fdf4ff 0%, #f0f9ff 45%, #fefce8 100%);
  background-attachment: fixed;
  color: #334155;
  overflow-x: hidden;
  touch-action: manipulation;
  min-height: 100vh;
  min-height: 100dvh;
}

.bangla-text { font-family: var(--font-bangla); }
.fw-black { font-weight: 800; }

/* ---------- App shell ---------- */
.app-shell {
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .app-shell {
    margin: 18px auto;
    min-height: calc(100vh - 36px);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(6px);
    border-radius: 42px;
    border: 6px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 30px 80px rgba(124, 58, 237, 0.18);
    overflow: hidden;
  }
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-pink));
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

.brand-lockup { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mascot { font-size: 32px; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.brand-words { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; font-size: 21px; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.brand-tag { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.9); }

@keyframes bob {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(8deg) translateY(-4px); }
}

.star-pill {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border-radius: 999px; padding: 5px 14px 5px 9px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  text-decoration: none;
}
.star-pill-icon { font-size: 18px; animation: twinkle 1.8s ease-in-out infinite; }
.star-pill-count { font-weight: 800; font-size: 18px; color: #92400e; }
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.22) rotate(15deg); }
}

.app-content { flex: 1; padding: 20px 16px 40px; }
.app-content.has-tabbar { padding-bottom: calc(var(--tab-height) + 28px); }

/* Round icon button (back, parents corner) */
.icon-btn {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.25); color: #fff;
  font-size: 22px; line-height: 1; text-decoration: none;
  transition: transform 0.15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.4); color: #fff; transform: scale(1.08); }

/* ---------- Cards, buttons ---------- */
.kids-card {
  background: white;
  border-radius: 36px;
  padding: 1.6rem;
  border: 6px solid white;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.07);
}

.btn-kids {
  border-radius: 25px;
  padding: 0.9rem 1.8rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  border: none;
  box-shadow: 0 7px 0 rgba(0,0,0,0.12);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  min-height: 56px; /* comfortable touch target */
}
.btn-kids:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.btn-purple-kids { background: var(--brand-purple); color: #fff; box-shadow: 0 7px 0 #5b21b6; }
.btn-purple-kids:hover { color: #fff; }
.btn-sky-kids { background: var(--sky); color: #fff; box-shadow: 0 7px 0 #0284c7; }
.btn-sky-kids:hover { color: #fff; }
.btn-mint-kids { background: var(--mint); color: #fff; box-shadow: 0 7px 0 #059669; }
.btn-mint-kids:hover { color: #fff; }
.btn-sun-kids { background: var(--sun); color: #78350f; box-shadow: 0 7px 0 #d97706; }
.btn-coral-kids { background: var(--coral); color: #fff; box-shadow: 0 7px 0 #e11d48; }
.btn-coral-kids:hover { color: #fff; }

/* ---------- Forms (parent pages) ---------- */
.kg-input {
  width: 100%;
  border: 3px solid #e9d5ff;
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 700;
  color: #334155;
  background: #fff;
  outline: none;
}
.kg-input:focus { border-color: var(--brand-purple); }
label { font-weight: 800; color: #64748b; font-size: 14px; }

/* ---------- Game tiles (kid home) ---------- */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 520px) { .game-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

.game-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-decoration: none;
  padding: 22px 10px 16px;
  border-radius: 30px;
  border: 5px solid #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.09);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-height: 130px;
}
.game-tile:hover { transform: translateY(-6px) rotate(-1.5deg) scale(1.03); }
.game-tile:active { transform: scale(0.96); }
.tile-emoji { font-size: 44px; line-height: 1.15; animation: floaty 3.5s ease-in-out infinite; }
.game-tile:nth-child(2n) .tile-emoji { animation-delay: 0.8s; }
.game-tile:nth-child(3n) .tile-emoji { animation-delay: 1.6s; }
.tile-name { font-weight: 800; font-size: 15px; color: #1e293b; text-align: center; line-height: 1.15; }
.tile-bangla { font-size: 13px; font-weight: 700; opacity: 0.75; color: #334155; }

.game-tile.locked { filter: saturate(0.35); }
.tile-plays {
  position: absolute; top: 10px; right: 12px;
  font-size: 12px; font-weight: 800;
  background: #fff; color: #7c3aed;
  border-radius: 999px; padding: 4px 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.tile-lock {
  position: absolute; top: 10px; right: 12px;
  font-size: 20px;
  background: #fff;
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.tile-c1 { background: linear-gradient(150deg, #e0f2fe, #bae6fd); }
.tile-c2 { background: linear-gradient(150deg, #ffe4e6, #fecdd3); }
.tile-c3 { background: linear-gradient(150deg, #fef3c7, #fde68a); }
.tile-c4 { background: linear-gradient(150deg, #d1fae5, #a7f3d0); }
.tile-c5 { background: linear-gradient(150deg, #ede9fe, #ddd6fe); }
.tile-c6 { background: linear-gradient(150deg, #fce7f3, #fbcfe8); }
.tile-c7 { background: linear-gradient(150deg, #ffedd5, #fed7aa); }
.tile-c8 { background: linear-gradient(150deg, #fef9c3, #fde047); }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* ---------- FunTuk wordmark: bouncing candy letters ---------- */
.funtuk-logo {
  display: inline-flex;
  align-items: baseline;
  position: relative;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(46px, 13vw, 72px);
  line-height: 1;
  letter-spacing: 1px;
  user-select: none;
}
.funtuk-logo span {
  display: inline-block;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.9), 0 9px 18px rgba(124, 58, 237, 0.25);
  animation: fl-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             fl-bounce 2.6s ease-in-out infinite;
}
.fl-1 { color: #fb7185; transform: rotate(-7deg); animation-delay: 0.05s, 0.7s; }
.fl-2 { color: #fbbf24; transform: rotate(5deg);  animation-delay: 0.12s, 0.9s; }
.fl-3 { color: #34d399; transform: rotate(-4deg); animation-delay: 0.19s, 1.1s; }
.fl-4 { color: #38bdf8; transform: rotate(6deg);  animation-delay: 0.26s, 1.3s; margin-left: 6px; }
.fl-5 { color: #a855f7; transform: rotate(-6deg); animation-delay: 0.33s, 1.5s; }
.fl-6 { color: #ec4899; transform: rotate(7deg);  animation-delay: 0.40s, 1.7s; }
.funtuk-spark {
  position: absolute;
  top: -14px; right: -26px;
  font-size: 0.45em;
  animation: fl-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s both,
             twinkle 1.8s ease-in-out 1s infinite;
}
.funtuk-logo-bn {
  font-size: 17px;
  font-weight: 700;
  color: #8b83a5;
  letter-spacing: 5px;
  margin-top: 2px;
}
@keyframes fl-pop {
  0% { scale: 0; opacity: 0; }
  100% { scale: 1; opacity: 1; }
}
@keyframes fl-bounce {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}
@media (prefers-reduced-motion: reduce) {
  .funtuk-logo span, .funtuk-spark { animation: none; }
}

/* ---------- Floating background doodles ---------- */
.doodle-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.doodle {
  position: absolute;
  font-size: 34px;
  opacity: 0.5;
  animation: floaty 6s ease-in-out infinite;
}

/* ---------- Avatar picker ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.avatar-option input { position: absolute; opacity: 0; }
.avatar-option .avatar-face {
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  background: #fff;
  border: 4px solid #e2e8f0;
  border-radius: 22px;
  aspect-ratio: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.avatar-option input:checked + .avatar-face {
  border-color: var(--brand-purple);
  background: #f5f0ff;
  transform: scale(1.08);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.25);
}

/* ---------- Games shared ---------- */
.game-stage {
  background: #fff;
  border-radius: 32px;
  border: 6px solid #fff;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  padding: 16px;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.big-choice {
  border: 6px solid #fff;
  border-radius: 28px;
  min-height: 96px;
  font-size: 3rem;
  background: #f8fafc;
  box-shadow: 0 10px 22px rgba(0,0,0,0.09);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.big-choice:active { transform: scale(0.93); }

.speak-fab {
  width: 58px; height: 58px;
  border: 4px solid #fff; border-radius: 50%;
  background: linear-gradient(135deg, var(--sun), #f97316);
  font-size: 26px; line-height: 1;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.4);
}
.speak-fab:active { transform: scale(0.9); }

.shake { animation: kg-shake 0.4s ease-in-out; }
@keyframes kg-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.pop-in { animation: kg-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes kg-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

[data-animate] { animation: kg-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }

.wiggle { animation: kg-wiggle 0.7s ease-in-out; }
@keyframes kg-wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg) scale(1.1); }
  75% { transform: rotate(12deg) scale(1.1); }
}

/* Success overlay */
.win-overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  text-align: center;
}
.win-overlay .win-emoji { font-size: 90px; animation: bob 1.2s ease-in-out infinite; }
.win-overlay h1 { font-weight: 800; color: var(--coral); font-size: 3rem; }
.win-stars { font-size: 44px; letter-spacing: 6px; }

.confetti-piece {
  position: absolute;
  width: 12px; height: 12px; border-radius: 3px;
  animation: confettiFall 2.2s ease-out forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}

/* ---------- Parent pages ---------- */
.parent-page { max-width: 520px; margin: 0 auto; }
.report-card { background: #fff; border-radius: 28px; padding: 20px; box-shadow: 0 12px 28px rgba(0,0,0,0.07); }
.skill-chip {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #ede9fe; color: var(--brand-purple);
  font-weight: 800; font-size: 13px; margin: 2px;
}
.banner-warning {
  background: #fef3c7; border: 3px solid var(--sun);
  border-radius: 20px; padding: 12px 16px; font-weight: 700; color: #92400e;
}
