/* =========================================================
   AI Kids Teacher — Alphabet module
   Builds on the tokens, buttons, header and footer in style.css.
   ========================================================= */

.abc { padding-top: 28px; padding-bottom: 40px; }

/* ---------- Header: home button ---------- */
.btn--home {
  text-decoration: none;
  background: linear-gradient(180deg, var(--yellow-300), var(--yellow-400));
  color: #713f12;
  box-shadow: 0 5px 0 #ca8a04, 0 10px 20px rgba(202, 138, 4, .25);
}
.btn--home:active { transform: translateY(3px); box-shadow: 0 2px 0 #ca8a04; }

/* ---------- Title strip ---------- */
.abc-hero {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  background: linear-gradient(120deg, rgba(255,255,255,.9), rgba(237,233,254,.85));
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  box-shadow: var(--shadow);
}
.abc-hero__count {
  display: inline-block;
  background: var(--blue-100); color: var(--blue-700);
  padding: 6px 14px; border-radius: 999px;
  font-weight: 900; font-size: .9rem;
}
.abc-hero__title {
  margin-top: 6px;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  background: linear-gradient(90deg, var(--blue-700), var(--purple-500) 60%, #ec4899);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.abc-hero__subtitle { font-weight: 800; color: var(--ink-soft); font-size: 1.1rem; }

/* ---------- Buddy robot ---------- */
.buddy { position: relative; display: flex; align-items: center; gap: 12px; }
.buddy__bot { width: 104px; height: auto; animation: hover-bob 3.5s ease-in-out infinite; overflow: visible; }
.buddy__bubble {
  max-width: 230px;
  background: var(--white);
  border-radius: 22px 22px 6px 22px;
  padding: 12px 16px;
  font-weight: 800; color: var(--blue-900);
  box-shadow: var(--shadow-sm);
}
.buddy__bubble.is-bump { animation: pop-in .45s cubic-bezier(.34,1.56,.64,1); }
.buddy__antenna { transform-origin: 60px 24px; animation: wiggle 3s ease-in-out infinite; }
.buddy__eye { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.buddy__mouth { transition: opacity .2s; }
.buddy__mouth--oops { opacity: 0; }
.buddy.is-oops .buddy__mouth--happy { opacity: 0; }
.buddy.is-oops .buddy__mouth--oops { opacity: 1; }
.buddy.is-oops .buddy__bot { animation: tilt .6s ease-in-out; }
.buddy.is-happy .buddy__bot { animation: jump .7s cubic-bezier(.34,1.56,.64,1); }
.buddy.is-talking .buddy__mouth--happy { animation: talk .26s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center top; }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-10deg); } 60% { transform: rotate(8deg); } }

/* ---------- Star score ---------- */
.score {
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, var(--yellow-100), #fde68a);
  border-radius: 24px; padding: 10px 18px; min-width: 96px;
  box-shadow: 0 5px 0 #f6d365;
}
.score__star { font-size: 1.8rem; line-height: 1; }
.score b { font-family: var(--font-display); font-size: 1.8rem; color: #a16207; line-height: 1.1; }
.score__label { font-size: .8rem; font-weight: 900; color: #a16207; }
.score.is-bump { animation: pop-in .5s cubic-bezier(.34,1.56,.64,1); }

/* ---------- Tabs ---------- */
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.tab {
  border: 0; border-radius: 999px;
  padding: 14px 26px; min-height: 60px;
  font-weight: 900; font-size: 1.15rem;
  background: rgba(255,255,255,.75); color: var(--ink-soft);
  box-shadow: 0 5px 0 #dbe4f7;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .2s, color .2s;
}
.tab:hover { transform: translateY(-3px); }
.tab.is-active {
  background: linear-gradient(180deg, #4f8bff, var(--blue-600)); color: var(--white);
  box-shadow: 0 6px 0 var(--blue-900), 0 12px 24px rgba(37,99,235,.3);
}
.panel { animation: fade .3s ease; }
.panel[hidden], .game[hidden], .game-menu[hidden] { display: none !important; }

/* ---------- Round icon buttons ---------- */
.round-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: 0; background: var(--white); color: var(--blue-600);
  font-size: 1.4rem; font-weight: 900;
  box-shadow: 0 5px 0 #c7dbfb, var(--shadow-sm);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.round-btn:hover { transform: scale(1.08); }
.round-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c7dbfb; }
.round-btn--sm { width: 52px; height: 52px; font-size: 1.1rem; }

/* ---------- Letters panel ---------- */
.panel--letters { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 24px; align-items: start; }

.viewer { position: sticky; top: calc(var(--header-h) + 16px); }
.viewer__card {
  position: relative;
  background: linear-gradient(180deg, #fff 0%, var(--blue-50) 100%);
  border-radius: var(--radius-lg);
  padding: 22px 20px 26px;
  box-shadow: 0 10px 0 #c7dbfb, var(--shadow-lg);
  text-align: center;
  overflow: hidden;
}
.viewer__card::before {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  top: -110px; right: -80px; background: var(--purple-100); opacity: .8;
}
.viewer__card.is-pop { animation: card-pop .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes card-pop { 0% { transform: scale(.9) rotate(-2deg); } 100% { transform: scale(1) rotate(0); } }
.viewer__letter { position: relative; font-family: var(--font-display); font-weight: 800; line-height: 1; }
.viewer__upper { font-size: clamp(5rem, 11vw, 7.5rem); color: var(--blue-600); text-shadow: 0 6px 0 var(--blue-100); }
.viewer__lower { font-size: clamp(3.4rem, 7vw, 5rem); color: var(--purple-500); margin-left: 8px; text-shadow: 0 5px 0 var(--purple-100); }
.viewer__pic {
  font-size: 5.5rem; line-height: 1;
  width: 150px; height: 150px; margin: 10px auto 6px;
  display: grid; place-items: center;
  background: var(--white); border-radius: 50%;
  box-shadow: inset 0 -6px 0 var(--blue-100), var(--shadow-sm);
  animation: floaty 4s ease-in-out infinite;
}
.viewer__word { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--blue-900); letter-spacing: .02em; }
.viewer__word mark, .first__word mark { background: none; color: #ec4899; }
.viewer__note { margin-top: 6px; font-weight: 800; font-size: .95rem; color: var(--purple-500); }
.viewer__controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; }
.btn--listen { min-height: 64px; font-size: 1.2rem; padding: 12px 26px; }

.letters {
  background: rgba(255,255,255,.8);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.letters__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.letters__head h2 { font-size: 1.6rem; color: var(--blue-900); }
.letters__progress { font-weight: 900; color: var(--ink-soft); white-space: nowrap; }
.letters__bar { height: 12px; border-radius: 999px; background: var(--purple-100); margin: 12px 0 18px; overflow: hidden; }
.letters__bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow-400), var(--pink-400), var(--purple-500));
  transition: width .5s cubic-bezier(.34,1.56,.64,1);
}

.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px; }
.letter-tile {
  --tile: var(--blue-600); --tile-bg: var(--blue-100); --tile-sh: #bcd4fb;
  position: relative;
  aspect-ratio: 1;
  border: 0; border-radius: 22px;
  background: linear-gradient(180deg, #fff, var(--tile-bg));
  box-shadow: 0 5px 0 var(--tile-sh);
  font-family: var(--font-display); font-weight: 800; font-size: 2.3rem; line-height: 1;
  color: var(--tile);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
.letter-tile:hover { transform: translateY(-4px) rotate(-3deg) scale(1.06); }
.letter-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--tile-sh); }
.letter-tile.is-active { outline: 4px solid var(--tile); outline-offset: 2px; }
.letter-tile.is-learned::after {
  content: "⭐"; position: absolute; top: -8px; right: -6px; font-size: .95rem;
  animation: pop-in .4s cubic-bezier(.34,1.56,.64,1);
}
.c0 { --tile: #2563eb; --tile-bg: #dbeafe; --tile-sh: #bcd4fb; }
.c1 { --tile: #8b5cf6; --tile-bg: #ede9fe; --tile-sh: #d9cffd; }
.c2 { --tile: #db2777; --tile-bg: #fce7f3; --tile-sh: #f9cfe4; }
.c3 { --tile: #ca8a04; --tile-bg: #fef9c3; --tile-sh: #f6e7a1; }
.c4 { --tile: #059669; --tile-bg: #d1fae5; --tile-sh: #b4ecd6; }
.c5 { --tile: #ea580c; --tile-bg: #ffedd5; --tile-sh: #fed7aa; }

/* ---------- Exercises ---------- */
.panel--exercises:not([hidden]) { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.ex {
  background: rgba(255,255,255,.9);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}
.ex__title { font-size: 1.7rem; color: var(--blue-900); }
.ex__text { margin-top: 4px; font-weight: 800; color: var(--ink-soft); }
.ex__actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.trace__nav { display: flex; align-items: center; gap: 18px; }
.trace__letter { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--purple-500); min-width: 64px; }
.trace__pad {
  position: relative;
  width: min(380px, 100%);
  aspect-ratio: 1;
  border-radius: 28px;
  background:
    linear-gradient(var(--blue-50) 2px, transparent 2px) 0 0 / 100% 25%,
    #fff;
  box-shadow: inset 0 0 0 4px var(--blue-100);
  touch-action: none;
  overflow: hidden;
}
.trace__pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.trace__ink { cursor: crosshair; }
.trace__pad.is-done { box-shadow: inset 0 0 0 5px var(--green-400); }

.case__target {
  width: 150px; height: 150px; border-radius: 40px;
  border: 0;
  font-family: var(--font-display); font-size: 5.5rem; font-weight: 800; line-height: 1;
  color: var(--white);
  background: linear-gradient(145deg, var(--blue-400), var(--purple-500));
  box-shadow: 0 8px 0 #5b3fc4, var(--shadow);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.case__target:hover { transform: scale(1.05) rotate(-3deg); }
.case__target.is-bump { animation: card-pop .5s cubic-bezier(.34,1.56,.64,1); }

/* ---------- Shared answer buttons ---------- */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.choice {
  min-width: 96px; height: 96px; padding: 0 14px;
  border: 0; border-radius: 26px;
  background: var(--white);
  font-family: var(--font-display); font-size: 3rem; font-weight: 800; line-height: 1;
  color: var(--blue-700);
  box-shadow: 0 6px 0 #c7dbfb, var(--shadow-sm);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .2s, color .2s;
}
.choice:hover { transform: translateY(-4px) scale(1.05); }
.choice:active { transform: translateY(3px); }
.choice.is-right { background: var(--green-400); color: var(--white); box-shadow: 0 6px 0 #059669; animation: card-pop .5s cubic-bezier(.34,1.56,.64,1); }
.choice.is-wrong { animation: shake .45s ease-in-out; background: #fee2e2; color: #dc2626; box-shadow: 0 6px 0 #fca5a5; }
.choice:disabled { cursor: default; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

/* Star burst over a right answer */
.burst { position: fixed; pointer-events: none; z-index: 120; font-size: 1.6rem; animation: burst .9s ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 0; } }

/* ---------- Games ---------- */
.game-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.game-card {
  --g: var(--blue-600); --g-bg: var(--blue-100); --g-sh: #bcd4fb;
  border: 0; border-radius: var(--radius-lg);
  padding: 30px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  background: linear-gradient(180deg, #fff, var(--g-bg));
  box-shadow: 0 8px 0 var(--g-sh), var(--shadow);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.game-card:hover { transform: translateY(-8px) rotate(-1deg); }
.game-card:active { transform: translateY(3px); }
.game-card__icon {
  font-size: 3.4rem; width: 104px; height: 104px; display: grid; place-items: center;
  background: var(--white); border-radius: 32px; box-shadow: var(--shadow-sm);
}
.game-card__title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--g); }
.game-card__text { font-weight: 700; color: var(--ink-soft); }
.game-card--blue   { --g: var(--blue-600); --g-bg: var(--blue-100); --g-sh: #bcd4fb; }
.game-card--pink   { --g: #db2777; --g-bg: var(--pink-100); --g-sh: #f9cfe4; }
.game-card--yellow { --g: #ca8a04; --g-bg: var(--yellow-100); --g-sh: #f6e7a1; }

.game {
  background: rgba(255,255,255,.9);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.game__top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.game__title { text-align: center; font-size: 1.8rem; color: var(--blue-900); }
.game__dots { display: flex; gap: 6px; }
.game__dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--purple-100); transition: background .3s, transform .3s; }
.game__dots i.is-done { background: var(--yellow-400); transform: scale(1.15); }
.game__dots i.is-now { background: var(--blue-400); }
.game__text { text-align: center; margin: 10px 0 20px; font-weight: 800; color: var(--ink-soft); font-size: 1.1rem; }
.game__stage { display: flex; flex-direction: column; align-items: center; gap: 22px; min-height: 260px; }

/* Find the letter */
.listen-big {
  width: 128px; height: 128px; border-radius: 50%; border: 0;
  font-size: 3.4rem;
  background: linear-gradient(180deg, #4f8bff, var(--blue-600));
  box-shadow: 0 8px 0 var(--blue-900), var(--shadow);
  animation: pulse-ring 2s ease-out infinite;
}
.listen-big:active { transform: translateY(4px); }
@keyframes pulse-ring { 0% { box-shadow: 0 8px 0 var(--blue-900), 0 0 0 0 rgba(96,165,250,.6); } 100% { box-shadow: 0 8px 0 var(--blue-900), 0 0 0 26px rgba(96,165,250,0); } }
.find__hint { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--purple-500); min-height: 1.4em; }

/* Match letters with pictures */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; width: min(560px, 100%); }
.match__col { display: grid; gap: 14px; }
.match__item {
  height: 88px; border: 0; border-radius: 24px;
  background: var(--white);
  box-shadow: 0 6px 0 #c7dbfb, var(--shadow-sm);
  font-family: var(--font-display); font-size: 2.8rem; font-weight: 800; color: var(--blue-700);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .2s, box-shadow .2s;
}
.match__item--pic { font-size: 3rem; }
.match__item:hover { transform: scale(1.04); }
.match__item.is-selected { background: var(--yellow-100); box-shadow: 0 6px 0 var(--yellow-400), 0 0 0 4px var(--yellow-400); transform: scale(1.06); }
.match__item.is-matched { background: var(--green-100); box-shadow: 0 6px 0 #6ee7b7; color: #059669; opacity: .85; }
.match__item.is-wrong { animation: shake .45s ease-in-out; background: #fee2e2; }

/* First letter of the word */
.first__pic {
  font-size: 6rem; width: 170px; height: 170px; display: grid; place-items: center;
  background: var(--white); border-radius: 50%; box-shadow: inset 0 -6px 0 var(--blue-100), var(--shadow);
  animation: floaty 4s ease-in-out infinite;
}
.first__word { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; color: var(--blue-900); letter-spacing: .03em; }
.first__blank {
  display: inline-block; min-width: 1.1em; text-align: center;
  color: #ec4899;
  border-bottom: 5px dashed var(--pink-400);
  margin-right: 2px;
}
.first__blank.is-filled { border-bottom-color: transparent; animation: pop-in .5s cubic-bezier(.34,1.56,.64,1); }

/* Result screen */
.result { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.result__trophy { font-size: 6rem; line-height: 1; animation: jump 1s cubic-bezier(.34,1.56,.64,1) infinite alternate; }
.result__title { font-size: 2rem; color: var(--blue-900); }
.result__stars { font-size: 2.6rem; letter-spacing: 6px; }
.result__stars .off { filter: grayscale(1); opacity: .3; }
.result__actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- Mini footer ---------- */
.footer--mini { padding: 0 0 24px; border-radius: 40px 40px 0 0; }
.footer--mini .footer__bottom { margin-top: 0; border-top: 0; align-items: center; }
.footer__home { color: var(--white); text-decoration: none; font-weight: 900; font-size: 1.1rem; }
.footer__home:hover { color: var(--yellow-400); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .abc-hero { grid-template-columns: 1fr auto; }
  .buddy { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .panel--letters { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .panel--exercises:not([hidden]) { grid-template-columns: 1fr; }
  .game-menu { grid-template-columns: 1fr; }
  .game-card { flex-direction: row; text-align: left; padding: 18px; }
  .game-card__icon { width: 80px; height: 80px; font-size: 2.6rem; flex: 0 0 auto; border-radius: 24px; }
  .game-card { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; row-gap: 2px; }
  .game-card__icon { grid-row: span 2; }
}

@media (max-width: 640px) {
  .abc { padding-top: 16px; }
  .abc-hero { padding: 18px; gap: 14px; }
  .btn--home__label { display: none; }
  .btn--home { padding: 10px 14px; }
  .buddy__bot { width: 84px; }
  .buddy__bubble { font-size: .95rem; }
  .tab { padding: 12px 16px; font-size: 1rem; min-height: 54px; }
  .letter-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
  .letter-tile { font-size: 1.9rem; border-radius: 18px; }
  .viewer__pic { width: 120px; height: 120px; font-size: 4.4rem; }
  .viewer__word { font-size: 1.8rem; }
  .round-btn { width: 56px; height: 56px; }
  .btn--listen { padding: 12px 18px; }
  .game { padding: 16px; }
  .game__top { grid-template-columns: auto 1fr; }
  .game__dots { grid-column: 1 / -1; justify-content: center; }
  .game__title { font-size: 1.4rem; text-align: right; }
  .choice { min-width: 76px; height: 76px; font-size: 2.4rem; border-radius: 22px; }
  .match { gap: 16px; }
  .match__item { height: 76px; font-size: 2.3rem; }
  .first__pic { width: 140px; height: 140px; font-size: 4.8rem; }
  .first__word { font-size: 2.1rem; }
}

@media (max-width: 400px) {
  .lang__btn { padding: 8px 8px; }
}
