@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --coral:   #FF6B6B;
  --teal:    #4ECDC4;
  --yellow:  #FFE66D;
  --green:   #6BCB77;
  --purple:  #A78BFA;
  --orange:  #FB923C;
  --pink:    #F9A8D4;
  --sky:     #7DD3FC;
  --dark:    #1A202C;
  --mid:     #4A5568;
  --white:   #FFFFFF;
  --r:       24px;
  --r-lg:    32px;
  --shadow:  0 8px 32px rgba(0,0,0,.12);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.2);
}

html, body {
  height: 100%;
  font-family: 'Nunito', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--dark);
  display: flex;
  flex-direction: column;
}

/* ── Back button ─────────────────────────────────────────────────── */
.nav-back {
  position: fixed; top: 16px; left: 16px; z-index: 200;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.25); backdrop-filter: blur(12px);
  font-size: 26px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transition: transform .12s;
}
.nav-back:active { transform: scale(.88); }

/* ── Headings ────────────────────────────────────────────────────── */
.page-title {
  text-align: center; color: white;
  font-size: clamp(28px, 5.5vw, 52px); font-weight: 900;
  text-shadow: 0 3px 12px rgba(0,0,0,.25);
  padding: 24px 16px 8px; line-height: 1.15;
}
.page-subtitle {
  text-align: center; color: rgba(255,255,255,.8);
  font-size: clamp(14px, 2.8vw, 20px); font-weight: 700;
  padding: 0 16px 16px;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--r);
  padding: 28px 20px; text-align: center;
  cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .15s;
  border: none; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.card:active { transform: scale(.94); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.card-icon  { font-size: clamp(44px, 8vw, 72px); line-height: 1; }
.card-title { font-size: clamp(18px, 3.5vw, 28px); font-weight: 900; color: var(--dark); }
.card-desc  { font-size: clamp(12px, 2.2vw, 16px); color: var(--mid); font-weight: 700; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 4px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 800;
}
.badge-4   { background: #FEF3C7; color: #B45309; }
.badge-6   { background: #DBEAFE; color: #1E40AF; }
.badge-all { background: #D1FAE5; color: #065F46; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: block; padding: 18px 32px; border-radius: 16px; border: none;
  font-family: inherit; font-weight: 800; font-size: clamp(18px,3vw,24px);
  cursor: pointer; text-align: center; width: 100%;
  transition: transform .1s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.95); }
.btn-primary   { background: var(--coral); color: white; box-shadow: 0 6px 20px rgba(255,107,107,.4); }
.btn-secondary { background: #EDF2F7; color: var(--mid); }
.btn-success   { background: var(--green); color: white; box-shadow: 0 6px 20px rgba(107,203,119,.4); }
.btn-teal      { background: var(--teal); color: white; }

/* ── Progress dots ───────────────────────────────────────────────── */
.progress-dots { display: flex; gap: 10px; justify-content: center; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,.3);
  transition: background .2s, transform .2s;
}
.dot.done    { background: var(--yellow); transform: scale(1.1); }
.dot.current { background: white; transform: scale(1.25); }

/* ── Game shell ──────────────────────────────────────────────────── */
.game-page {
  height: 100dvh; display: flex; flex-direction: column;
  align-items: center; overflow: hidden;
}
.game-header {
  width: 100%; padding: 72px 20px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}
.game-content {
  flex: 1; width: 100%; max-width: 720px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 20px 24px; gap: 16px; overflow: hidden;
}

/* ── Letter tile colours (cyclic) ────────────────────────────────── */
.tc0 { background: #FF6B6B; color: white; }
.tc1 { background: #4ECDC4; color: white; }
.tc2 { background: #FFE66D; color: #333; }
.tc3 { background: #6BCB77; color: white; }
.tc4 { background: #A78BFA; color: white; }
.tc5 { background: #FB923C; color: white; }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes pop-in {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes bounce-in {
  0%   { transform: scale(.3); }
  55%  { transform: scale(1.08); }
  75%  { transform: scale(.95); }
  100% { transform: scale(1); }
}
@keyframes kg-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
@keyframes hint-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
  50%     { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}

.anim-pop-in    { animation: pop-in .3s cubic-bezier(.34,1.56,.64,1); }
.anim-bounce-in { animation: bounce-in .45s cubic-bezier(.34,1.56,.64,1); }
.kg-shake       { animation: kg-shake .3s ease; }
.kg-hint        { animation: hint-pulse .8s ease infinite; }

/* ── KidsGame overlays (injected by framework) ───────────────────── */
.kg-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.kg-overlay-card {
  background: white; border-radius: var(--r-lg); padding: 40px 32px;
  text-align: center; max-width: 380px; width: 90%;
  box-shadow: var(--shadow-lg);
  animation: bounce-in .4s cubic-bezier(.34,1.56,.64,1);
}
.kg-overlay-emoji { font-size: 56px; margin-bottom: 8px; }
.kg-overlay-title { font-size: clamp(24px,5vw,32px); font-weight: 900; color: var(--dark); margin: 0 0 24px; }

/* ── Utility ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
