/* ============================================================
   БУКВАРЬ ОНЛАЙН — детский яркий дизайн
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --yellow: #FFD93D;
  --orange: #FF9A3D;
  --pink: #FF6B9D;
  --blue: #4D96FF;
  --teal: #2EC4B6;
  --green: #6BCB77;
  --purple: #9B5DE5;
  --ink: #2D2A4A;
  --paper: #FFFBF0;
}

html, body {
  font-family: 'Rubik', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #FFE9B8 0%, #C9E7FF 50%, #E8D5FF 100%);
  min-height: 100vh;
  color: var(--ink);
}

#app { max-width: 900px; margin: 0 auto; padding: 16px 16px 40px; }

.screen { animation: pop .35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- ГЛАВНАЯ ---------- */
.hero { text-align: center; padding: 30px 0 10px; }
.hero-pushok { font-size: 84px; animation: bounce 2.2s infinite; display: inline-block; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

h1 { font-size: 44px; font-weight: 900; letter-spacing: .5px; }
h1 span { color: var(--pink); }
.hero-sub { font-size: 20px; margin-top: 4px; color: #55507a; }

.bubble {
  background: #fff;
  border-radius: 24px;
  padding: 16px 20px;
  margin: 18px auto;
  max-width: 620px;
  font-size: 19px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(45,42,74,.12);
  border: 3px solid var(--yellow);
  position: relative;
}
.bubble::before {
  content: '';
  position: absolute;
  left: 30px; top: -18px;
  border: 10px solid transparent;
  border-bottom-color: var(--yellow);
}

.home-btns { display: flex; flex-direction: column; gap: 14px; max-width: 420px; margin: 24px auto; }

/* ---------- КНОПКИ ---------- */
.btn {
  font: inherit; font-size: 19px; font-weight: 700;
  padding: 14px 22px;
  border: none; border-radius: 18px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(45,42,74,.15), 0 8px 20px rgba(45,42,74,.1);
  transition: transform .1s, box-shadow .1s;
  user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(45,42,74,.15); }
.btn-big { background: linear-gradient(135deg, var(--orange), var(--pink)); color: #fff; font-size: 24px; padding: 18px; }
.btn-next { background: linear-gradient(135deg, var(--teal), var(--green)); color: #fff; font-size: 20px; }
.btn-round { width: 52px; height: 52px; padding: 0; font-size: 22px; border-radius: 50%; }
.btn-ghost { background: transparent; box-shadow: none; border: 3px dashed #aaa4cc; color: #6b6590; }
.btn-hint { background: linear-gradient(135deg, var(--purple), var(--blue)); color: #fff; }

/* ---------- ПРОГРЕСС ---------- */
.progress-bar { background: #e8e2f5; height: 18px; border-radius: 20px; overflow: hidden; max-width: 420px; margin: 10px auto; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 20px; transition: width .5s; }
.progress-text { text-align: center; color: #6b6590; font-weight: 600; }

/* ---------- ШАПКА ЭКРАНОВ ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.topbar h2 { font-size: 24px; }
.subtitle { text-align: center; color: #6b6590; font-weight: 600; margin-bottom: 14px; }

/* ---------- КАРТА ---------- */
.map { display: flex; flex-direction: column; gap: 16px; padding: 10px 0; }
.map-node {
  background: #fff; border-radius: 22px; padding: 16px 20px;
  cursor: pointer; border: 3px solid #ddd6f0;
  transition: transform .15s, border-color .15s;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.map-node:hover { transform: scale(1.02); border-color: var(--blue); }
.map-node.done { border-color: var(--green); background: #f2fff4; }
.node-emoji { font-size: 44px; }
.node-title { font-weight: 800; font-size: 20px; flex: 1; min-width: 180px; }
.node-goal { color: #6b6590; font-size: 15px; width: 100%; }
.node-stars { font-size: 20px; letter-spacing: 3px; }

/* ---------- АЗБУКА ---------- */
.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.letter-card {
  background: #fff; border-radius: 18px; padding: 12px 8px;
  text-align: center; cursor: pointer; border: 3px solid #e3dcf5;
  transition: transform .12s;
}
.letter-card:hover { transform: scale(1.06); }
.letter-ch { font-size: 34px; font-weight: 900; color: var(--pink); }
.letter-emoji { font-size: 28px; }
.letter-word { font-weight: 700; font-size: 14px; color: #6b6590; }

/* ---------- УРОК ---------- */
.lesson-progress { height: 12px; background: #e8e2f5; border-radius: 20px; overflow: hidden; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

.sound-card {
  background: #fff; border-radius: 20px; padding: 16px;
  text-align: center; cursor: pointer;
  border: 4px solid var(--yellow); transition: transform .12s;
}
.sound-card:hover { transform: scale(1.04); }
.sound-ch { font-size: 52px; font-weight: 900; color: var(--pink); }
.sound-words { font-size: 18px; font-weight: 700; margin-top: 6px; }
.tap-hint { font-size: 13px; color: #aaa4cc; margin-top: 8px; font-weight: 600; }

.syllable-card {
  background: linear-gradient(135deg, #fff, #eaf6ff);
  border: 3px solid var(--blue);
  border-radius: 18px; padding: 22px 10px;
  text-align: center; font-size: 32px; font-weight: 900; color: var(--blue);
  cursor: pointer; transition: transform .12s;
}
.syllable-card:hover { transform: scale(1.08); }

.word-card {
  background: #fff; border-radius: 20px; padding: 14px;
  text-align: center; cursor: pointer; border: 3px solid #ddd6f0;
  transition: transform .12s;
}
.word-card:hover { transform: scale(1.04); }
.word-emoji { font-size: 44px; display: block; }
.word-text { font-size: 24px; font-weight: 800; display: block; margin-top: 4px; }
.word-hint { font-size: 13px; color: #aaa4cc; margin-top: 4px; }

.sentence-card {
  background: #fff; border-radius: 16px; padding: 14px 18px;
  font-size: 22px; font-weight: 700; cursor: pointer;
  border: 3px solid var(--teal); margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.sentence-card:hover { background: #f0fffb; }

/* ---------- ЗАДАНИЯ ---------- */
.practice-grid { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 20px 0; }
.practice-letter {
  font: inherit; font-size: 64px; font-weight: 900;
  width: 110px; height: 110px; border-radius: 24px;
  border: 4px solid #ddd6f0; background: #fff; color: var(--ink);
  cursor: pointer; transition: transform .12s;
}
.practice-letter:hover { transform: scale(1.08); }
.practice-letter.correct { background: var(--green); border-color: var(--green); color: #fff; animation: win .5s; }
.practice-letter.wrong { background: #ff6b6b; border-color: #ff6b6b; color: #fff; animation: shake .4s; }
@keyframes win { 0%,100% { transform: scale(1);} 50% { transform: scale(1.25);} }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-8px);} 75% { transform: translateX(8px);} }

.build-slot {
  min-height: 74px; background: #fff; border: 4px dashed var(--blue);
  border-radius: 20px; padding: 12px; margin: 10px 0;
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.slot-chip {
  background: var(--blue); color: #fff; font-size: 28px; font-weight: 800;
  padding: 8px 18px; border-radius: 14px; animation: pop .25s;
}
.chips { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 30px; font-weight: 900;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  border: none; border-radius: 16px; padding: 12px 22px; cursor: pointer;
  box-shadow: 0 5px 0 rgba(45,42,74,.2);
  transition: transform .1s;
}
.chip:active { transform: translateY(3px); }
.chip.used { opacity: .4; transform: scale(.9); }

.which-card {
  font: inherit; background: #fff; border: 4px solid #ddd6f0;
  border-radius: 20px; padding: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .12s;
}
.which-card:hover { transform: scale(1.05); }
.which-card.correct { background: var(--green); border-color: var(--green); animation: win .5s; }
.which-card.wrong { background: #ff6b6b; border-color: #ff6b6b; animation: shake .4s; }

.big-emoji { font-size: 48px; }
.feedback { text-align: center; min-height: 44px; margin-top: 12px; }
.fb-good { font-size: 20px; font-weight: 800; color: #1e9e4a; animation: pop .3s; }
.fb-bad { font-size: 18px; font-weight: 700; color: #d64545; }

.read-sentence {
  font-size: 30px; font-weight: 800; text-align: center;
  background: #fff; border-radius: 20px; padding: 20px; margin: 12px 0;
  border: 3px solid var(--teal); line-height: 1.8;
}
.rword { cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.rword:hover { background: var(--yellow); }

.hint-glow { animation: hintGlow 1s infinite; }
@keyframes hintGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,157,0,.7); }
  50% { box-shadow: 0 0 0 16px rgba(255,157,0,0); }
}

/* ---------- НАВИГАЦИЯ УРОКА ---------- */
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- СКАЗКА-КАРАОКЕ ---------- */
.story-karaoke {
  background: #fff; border-radius: 22px; padding: 22px;
  font-size: 24px; line-height: 2.1; border: 3px solid var(--purple);
  min-height: 180px; margin: 10px 0;
}
.kword { cursor: pointer; border-radius: 8px; padding: 2px 4px; transition: background .15s, font-size .15s; }
.kword.active { background: var(--yellow); font-size: 30px; font-weight: 800; }
.story-emoji { font-size: 60px; text-align: center; margin: 8px 0; }

.story-card {
  background: #fff; border: 3px solid var(--purple); border-radius: 20px;
  padding: 18px; text-align: center; cursor: pointer; transition: transform .12s;
}
.story-card:hover { transform: scale(1.04); }
.story-title { font-size: 20px; font-weight: 800; margin-top: 6px; }

/* ---------- НАГРАДА ---------- */
.done-screen { text-align: center; padding-top: 40px; }
.done-emoji { font-size: 96px; animation: bounce 1.2s infinite; }
.done-stars { font-size: 56px; letter-spacing: 10px; margin: 10px 0; }
.done-screen .lesson-nav { justify-content: center; gap: 14px; }

/* ---------- МЕТОДИКА «НУЛЕВОЙ УРОВЕНЬ» ---------- */
/* Рука-указатель (демо) */
.guide-finger {
  position: fixed;
  z-index: 9999;
  font-size: 44px;
  pointer-events: none;
  animation: fingerBounce .5s infinite alternate;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.3));
}
@keyframes fingerBounce { from { transform: translateY(0) scale(1); } to { transform: translateY(-10px) scale(1.1); } }
.guide-target { animation: targetPulse .6s infinite alternate; border-radius: 14px; }
@keyframes targetPulse { from { box-shadow: 0 0 0 0 rgba(255,157,0,.9); } to { box-shadow: 0 0 0 14px rgba(255,157,0,0); } }

/* Образец буквы (find-letter) */
.sample-box { text-align: center; margin: 6px 0 10px; }
.sample-label { font-size: 17px; font-weight: 700; color: #6b6590; }
.sample-letter {
  display: inline-block;
  font-size: 84px; font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  border-radius: 26px;
  padding: 6px 30px;
  margin: 8px auto;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(45,42,74,.2);
  animation: pop .4s;
}

/* Ключ (which-word) */
.key-box {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: #fff; border: 4px solid var(--yellow);
  border-radius: 22px; padding: 12px 24px; margin: 6px auto 10px;
  max-width: 340px; animation: pop .4s;
}
.key-emoji { font-size: 48px; }
.key-word { font-size: 34px; font-weight: 900; color: var(--pink); }

/* Сборка слова: картинка + слово */
.build-emoji { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0; }
.build-word-hint { font-size: 30px; font-weight: 900; color: var(--blue); background: #eaf6ff; padding: 6px 18px; border-radius: 16px; }

/* Демо-подтверждение */
.demo-ok { outline: 6px solid var(--green); outline-offset: 3px; border-radius: 14px; animation: win .6s; }

/* ---------- ОТМЕТКА «ПРОСЛУШАНО» ---------- */
.played {
  position: relative;
  border-color: var(--green) !important;
  background: #f0fff4 !important;
  opacity: .92;
}
.played::after {
  content: '✓';
  position: absolute;
  top: -10px; right: -10px;
  width: 32px; height: 32px;
  background: var(--green);
  color: #fff;
  font-size: 20px; font-weight: 900;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
  animation: pop .3s;
}
/* звуковые/словесные карточки — галочка в углу не режет */
.sound-card.played::after, .word-card.played::after, .letter-card.played::after,
.syllable-card.played::after, .sentence-card.played::after, .story-card.played::after {
  content: '✓';
  position: absolute;
  top: -10px; right: -10px;
  width: 30px; height: 30px;
  background: var(--green);
  color: #fff; font-size: 18px; font-weight: 900;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
/* караоке-слова: прослушанные — приглушённые */
.kword.played { color: #9a94b8; }
.kword.active.played { color: var(--ink); }

/* облачко Пушка кликабельно */
.bubble.clickable { cursor: pointer; transition: transform .1s; }
.bubble.clickable:hover { transform: scale(1.02); }
.bubble.clickable::after {
  content: '🔊 повторить';
  display: block;
  font-size: 13px; font-weight: 700; color: #aaa4cc;
  text-align: right; margin-top: 4px;
}

/* ============================================================
   МОБИЛЬНАЯ ВЁРСТКА (телефоны ≤480px)
   ============================================================ */
@media (max-width: 480px) {
  #app { padding: 10px 10px 30px; }

  h1 { font-size: 32px; }
  .hero { padding: 16px 0 6px; }
  .hero-pushok { font-size: 64px; }
  .hero-sub { font-size: 17px; }
  .bubble { font-size: 16px; padding: 13px 15px; margin: 12px auto; }

  .btn { font-size: 16px; padding: 12px 16px; border-radius: 15px; }
  .btn-big { font-size: 20px; padding: 15px; }
  .btn-next { font-size: 18px; }
  .btn-round { width: 46px; height: 46px; font-size: 19px; }

  .topbar h2 { font-size: 18px; }
  .subtitle { font-size: 14px; }

  /* буквы в задании — главная проблема мобильных */
  .practice-letter { width: 84px; height: 84px; font-size: 46px; border-radius: 18px; }
  .practice-grid { gap: 10px; padding: 14px 0; }
  .sample-letter { font-size: 62px; padding: 4px 22px; }
  .sample-label { font-size: 15px; }

  .sound-ch { font-size: 42px; }
  .sound-words { font-size: 15px; }
  .grid2, .grid3 { gap: 10px; }
  .grid2 { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .grid3 { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  .syllable-card { font-size: 26px; padding: 15px 8px; border-radius: 14px; }
  .word-emoji { font-size: 36px; }
  .word-text { font-size: 19px; }
  .word-hint { font-size: 12px; }

  .sentence-card { font-size: 18px; padding: 11px 13px; }

  /* сборка слова */
  .chip { font-size: 24px; padding: 10px 16px; }
  .slot-chip { font-size: 23px; padding: 6px 14px; }
  .build-slot { min-height: 60px; padding: 9px; }
  .build-word-hint { font-size: 24px; }
  .key-word { font-size: 27px; }
  .key-emoji { font-size: 38px; }

  .which-card { padding: 12px; border-width: 3px; }
  .which-card .word-text { font-size: 18px; }
  .which-card .word-emoji { font-size: 34px; }

  .read-sentence { font-size: 23px; padding: 15px; line-height: 1.7; }
  .story-karaoke { font-size: 19px; padding: 15px; line-height: 1.9; }
  .kword.active { font-size: 23px; }

  .letter-ch { font-size: 27px; }
  .letter-emoji { font-size: 24px; }
  .letter-card { padding: 9px 6px; }

  .map-node { padding: 12px 14px; gap: 10px; }
  .node-emoji { font-size: 34px; }
  .node-title { font-size: 17px; min-width: 130px; }
  .node-goal { font-size: 13px; }
  .node-stars { font-size: 16px; }

  /* навигация урока: кнопки ровно, без разъезжания */
  .lesson-nav { gap: 8px; }
  .lesson-nav .btn-next { flex: 1 1 100%; order: 10; }
  .lesson-nav .btn-hint { flex: 1 1 auto; }

  .done-emoji { font-size: 72px; }
  .done-stars { font-size: 42px; }
}

/* очень узкие экраны (≤360px) */
@media (max-width: 360px) {
  .practice-letter { width: 76px; height: 76px; font-size: 40px; }
  .grid3 { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .topbar h2 { font-size: 16px; }
  .btn-round { width: 42px; height: 42px; }
}
