/* ============================================================
   Базовое
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;                 /* ребёнок не должен «уронить» страницу свайпом */
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Мягкий фон без узоров: он не должен соперничать с заданием */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120vmax 90vmax at 15% -10%, var(--bg-glow) 0%, transparent 60%),
    radial-gradient(100vmax 80vmax at 95% 110%, var(--bg-deep) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; height: 100%; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* ============================================================
   Каркас экрана
   ============================================================ */

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  animation: screen-in .32s var(--ease) both;
  /* Та же страховка, что и у .screen__body: если на конкретном экране
     содержимое всё же не влезло по высоте (например, полоска с буквами —
     теперь прямой потомок .screen, а не .screen__body), лучше прокрутка,
     чем обрезание невидимой границей. */
  overflow-y: auto;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.screen__top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.screen__top .spacer { flex: 1; }

.screen__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 34px);
  min-height: 0;
  /* Подстраховка от обрезания на невысоких экранах телефона: если контенту
     всё же не хватает места, он прокручивается внутри самого экрана,
     а не срезается невидимой границей (html/body закрыты на overflow:hidden
     специально, чтобы страница не «убегала» свайпом целиком). */
  overflow-y: auto;
}

.screen__bottom {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  min-height: 96px;
  padding-top: 8px;
}

/* ============================================================
   Кнопки
   ============================================================ */

.icon-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease);
}
.icon-btn svg { width: 32px; height: 32px; fill: none; stroke: var(--ink-soft); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(120,96,56,.13); }

/* Главная кнопка «послушать ещё раз» — самая крупная и заметная,
   ребёнок должен находить её не глядя */
.speak-btn {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  box-shadow: 0 6px 0 var(--accent-dark), 0 16px 30px rgba(120, 90, 30, .26);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.speak-btn svg { width: 52px; height: 52px; fill: #fff; }
.speak-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-dark); }
.speak-btn.is-speaking { animation: pulse-soft 1.1s var(--ease) infinite; }

@keyframes pulse-soft {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* Кнопка «дальше» появляется только когда шаг пройден */
.next-btn {
  min-width: 132px;
  height: 108px;
  padding: 0 30px;
  border-radius: 54px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--ok-light), var(--ok));
  box-shadow: 0 6px 0 var(--ok-dark), 0 16px 30px rgba(50, 110, 70, .26);
  animation: pop-in .34s var(--ease) both;
}
.next-btn svg { width: 48px; height: 48px; fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.next-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ok-dark); }

@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.6); }
  70%  { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   Буквы
   ============================================================ */

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 5vw, 56px);
  flex-wrap: wrap;
}

.hero-letter {
  font-family: var(--font-letter);
  font-size: clamp(96px, 30vmin, 250px);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.01em;
  color: var(--cons);
  animation: pop-in .4s var(--ease) both;
}
.hero-letter .lower { opacity: .55; font-size: .62em; margin-left: .1em; }

.hero-pic {
  font-size: clamp(80px, 24vmin, 190px);
  line-height: 1;
  animation: pop-in .4s .1s var(--ease) both;
}

/* Плитка-вариант выбора */
.tile {
  width: clamp(var(--tap), 26vmin, 190px);
  height: clamp(var(--tap), 26vmin, 190px);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(46px, 13vmin, 104px);
  line-height: 1;
  color: var(--ink);
  transition: transform .14s var(--ease), opacity .3s var(--ease), box-shadow .14s var(--ease);
  animation: pop-in .34s var(--ease) both;
}
.tile:active { transform: translateY(4px) scale(.97); }

.tile--pic { font-size: clamp(44px, 13vmin, 100px); }

/* Цветовой код. Плитка остаётся белой — цветом окрашены только буква
   и тонкая рамка. Пастельные заливки делали интерфейс приторным. */
.t-vowel { color: var(--vowel); }
.t-cons  { color: var(--cons); }
.t-soft  { color: var(--soft); }
.t-sign  { color: var(--sign); }

.tile.t-vowel, .syllable.t-vowel { box-shadow: inset 0 0 0 5px var(--vowel-line), var(--shadow); }
.tile.t-cons,  .syllable.t-cons  { box-shadow: inset 0 0 0 5px var(--cons-line),  var(--shadow); }
.tile.t-soft,  .syllable.t-soft  { box-shadow: inset 0 0 0 5px var(--soft-line),  var(--shadow); }
.tile.t-sign,  .syllable.t-sign  { box-shadow: inset 0 0 0 5px var(--sign-line),  var(--shadow); }

/* Верный ответ — радостно, но коротко */
.tile.is-right {
  animation: right-pop .55s var(--ease) both;
  box-shadow: 0 0 0 6px rgba(90,164,105,.35), var(--shadow);
}
@keyframes right-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.14) rotate(-2deg); }
  100% { transform: scale(1); }
}

/* Неверный ответ — вариант тихо гаснет. Никакого красного,
   никакого резкого звука, никакого наказания. */
.tile.is-wrong {
  animation: wrong-fade .5s var(--ease) both;
  pointer-events: none;
}
@keyframes wrong-fade {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-6px); }
  50%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  100% { transform: translateX(0); opacity: .22; filter: grayscale(1); }
}

/* Подсказка после второй ошибки: приложение само показывает ответ */
.tile.is-hint { animation: hint-glow 1.2s var(--ease) infinite; }
@keyframes hint-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,162,58,0), var(--shadow); }
  50%      { box-shadow: 0 0 0 12px rgba(239,162,58,.32), var(--shadow); }
}

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  max-width: 100%;
}

/* ============================================================
   Маскот
   ============================================================ */

.mascot {
  width: clamp(84px, 17vmin, 150px);
  height: auto;
  flex: 0 0 auto;
  animation: float 3.6s ease-in-out infinite;
}

/* Растёт вместе с кнопкой «играть» на высоких экранах — см. .play-btn */
.hero--map .mascot {
  width: clamp(84px, 7vw + 8vh, 170px);
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.mascot.is-happy { animation: cheer .6s var(--ease) 2; }
@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0); }
  30%      { transform: translateY(-16px) rotate(-7deg); }
  65%      { transform: translateY(-4px) rotate(6deg); }
}

/* ============================================================
   Профили
   ============================================================ */

.profiles {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 40px);
  align-items: center;
  justify-content: center;
}

.avatar-btn {
  width: clamp(120px, 24vmin, 190px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: pop-in .36s var(--ease) both;
}
.avatar {
  width: clamp(112px, 22vmin, 176px);
  height: clamp(112px, 22vmin, 176px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(56px, 12vmin, 92px);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .14s var(--ease);
}
.avatar-btn:active .avatar { transform: translateY(4px) scale(.96); }
.avatar--add { background: var(--accent-bg); border: 4px dashed var(--accent); box-shadow: none; }
.avatar-name {
  font-size: clamp(17px, 2.6vmin, 22px);
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Карта прогресса — без цифр и процентов
   ============================================================ */

.map-scroll {
  width: 100%;
  /* Отдельная полоса сразу под шапкой, а не часть центрируемой группы —
     см. пояснение в map.js. flex:0 0 auto: своя высота по содержимому,
     не участвует в центрировании кнопки ниже. */
  flex: 0 0 auto;
  max-height: 34vh;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  /* Верхний отступ больше нижнего: аватар «ты здесь» всплывает над текущей
     буквой (.path__here), а полоска теперь узкая и обрезает по overflow-y
     всё, что торчит выше своих же границ. У текущей буквы ещё и анимация
     transform:scale(1.28) — аватар её дочерний элемент, поэтому смещение
     -46px тоже масштабируется и реально поднимается почти на 70px, а не
     46. Значение подобрано по факту измерений, не по формуле. */
  padding: 78px 6vw 20px;
  scrollbar-width: none;
  /* Лёгкое затухание по краям — единственная подсказка, что дорожку можно
     пролистать: скроллбар нарочно скрыт (правило ниже), а свайп ребёнку
     и родителю иначе не заметен. Маска привязана к рамке самого элемента,
     а не к прокручиваемому содержимому, поэтому подсказка видна одинаково
     при любой позиции прокрутки. */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.map-scroll::-webkit-scrollbar { display: none; }

.path {
  display: flex;
  align-items: center;
  gap: 0;
  margin: auto;
}

.path__node {
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: 34px;
  background: var(--surface);
  color: var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.path__node.is-done  { color: #fff; background: var(--ok); box-shadow: 0 4px 0 var(--ok-dark); }
.path__node.is-learning { color: #fff; background: var(--accent); box-shadow: 0 4px 0 var(--accent-dark); }
.path__node.is-current {
  transform: scale(1.28);
  z-index: 2;
  animation: hint-glow 2s var(--ease) infinite;
}
.path__node.is-tappable { cursor: pointer; }
.path__node.is-tappable:active { transform: scale(0.92); }
.path__node.is-current.is-tappable:active { transform: scale(1.18); }
.path__link { width: 34px; height: 8px; flex: 0 0 auto; background: var(--line); border-radius: 4px; }
.path__link.is-done { background: var(--ok); }

.path__here {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  animation: float 2.4s ease-in-out infinite;
}

/* Большая круглая кнопка «играть» */
.play-btn {
  /* Раньше 30vmin — на узком, но высоком телефоне vmin равен ширине,
     и лишняя высота экрана никак не увеличивала кнопку: она застревала
     на минимуме и «терялась» в пустом пространстве вокруг. Формула ниже
     учитывает и ширину, и высоту, так что на высоких экранах кнопка
     сама становится заметно крупнее. */
  width: clamp(150px, 15vw + 16vh, 260px);
  height: clamp(150px, 15vw + 16vh, 260px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--ok-light), var(--ok));
  box-shadow: 0 9px 0 var(--ok-dark), 0 22px 44px rgba(50, 110, 70, .28);
  animation: breathe 2.8s ease-in-out infinite;
}
.play-btn svg { width: 42%; height: 42%; fill: #fff; margin-left: 8%; }
.play-btn:active { transform: translateY(7px); box-shadow: 0 2px 0 var(--ok-dark); animation: none; }

/* Занятия на сегодня закончились: кнопка на месте, но спит */
.play-btn.is-asleep {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 6px var(--line), var(--shadow-sm);
  animation: none;
}
.play-zzz { font-size: 40%; line-height: 1; filter: grayscale(.3); opacity: .8; }
.play-btn.is-asleep:active { transform: translateY(3px); }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* ============================================================
   Наклейки и награда
   ============================================================ */

.sticker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  max-width: min(720px, 92vw);
  max-height: 42vh;
  overflow-y: auto;
  padding: 6px;
}
.sticker {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 40px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.sticker--new { animation: sticker-land .7s var(--ease) both; }
@keyframes sticker-land {
  0%   { opacity: 0; transform: scale(2.4) rotate(-18deg); }
  60%  { opacity: 1; transform: scale(.92) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

.reward-big {
  font-size: clamp(96px, 26vmin, 210px);
  animation: sticker-land .8s var(--ease) both;
}

/* Прогресс занятия — точки, а не проценты */
.steps {
  display: flex;
  gap: 10px;
  align-items: center;
}
.steps i {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--line);
  display: block;
  transition: background .3s var(--ease), transform .3s var(--ease);
}
.steps i.is-done { background: var(--ok); }
.steps i.is-now  { background: var(--accent); transform: scale(1.45); }

/* ============================================================
   Слияние букв — ключевой экран
   ============================================================ */

.blend {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: clamp(10px, 3vw, 40px);
  min-height: clamp(140px, 34vmin, 280px);
}
.blend__letter {
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(80px, 24vmin, 200px);
  line-height: 1;
  transition: transform .2s var(--ease);
}
.blend__letter.is-active { animation: blend-stretch .5s var(--ease) both; }
@keyframes blend-stretch {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* Бегунок «добегает» от первой буквы до второй, пока тянется первый звук.
   Ребёнок одновременно слышит и видит, как звуки соединяются. */
.blend { transition: gap .55s var(--ease); }
.blend.is-merged { gap: 2px; }

.blend__runner {
  position: absolute;
  top: 0;
  left: 0;
  font-size: clamp(28px, 6vmin, 44px);
  opacity: 0;
  pointer-events: none;
  transition: transform 1.35s linear, opacity .25s var(--ease);
}
.blend__runner.is-on { opacity: 1; }

/* Мягкая дорожка, по которой бежит бегунок */
.blend__trail {
  position: absolute;
  top: 50%;
  height: 8px;
  border-radius: 4px;
  background: var(--accent);
  opacity: .28;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 1.35s linear;
  pointer-events: none;
}
.blend__trail.is-on { transform: scaleX(1); }

/* Слоги и слова */
.syllable {
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(44px, 12vmin, 96px);
  padding: 0 clamp(16px, 3vw, 30px);
  height: clamp(88px, 20vmin, 150px);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .14s var(--ease), opacity .3s var(--ease);
  animation: pop-in .34s var(--ease) both;
}
.syllable:active { transform: translateY(4px) scale(.97); }
.syllable.is-right { animation: right-pop .55s var(--ease) both; }
.syllable.is-wrong { animation: wrong-fade .5s var(--ease) both; pointer-events: none; }

.word-slots {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.slot {
  min-width: clamp(88px, 20vmin, 150px);
  height: clamp(88px, 20vmin, 150px);
  border-radius: var(--radius);
  border: 5px dashed var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(44px, 12vmin, 96px);
  color: var(--ink);
  padding: 0 clamp(10px, 2vw, 20px);
}
.slot.is-filled { border-style: solid; border-color: transparent; background: var(--surface); box-shadow: var(--shadow); animation: right-pop .5s var(--ease) both; }
.slot.is-next   { border-color: var(--accent); animation: hint-glow 1.6s var(--ease) infinite; }

.word-read {
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(52px, 15vmin, 130px);
  letter-spacing: .04em;
  color: var(--ink);
  display: flex;
  gap: .06em;
}
.word-read .syl-a { color: var(--cons); }
.word-read .syl-b { color: var(--vowel); }

/* Предложение. Слова разделены широким промежутком: начинающему читателю
   тяжелее всего понять, где кончается одно слово и начинается другое. */
.sentence-read {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: clamp(14px, 3vw, 32px);
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: clamp(34px, 8.5vmin, 82px);
  letter-spacing: .03em;
  line-height: 1.25;
  max-width: min(92vw, 900px);
}
.sentence-read .sr-word { display: inline-flex; }
.sentence-read span { background: none !important; box-shadow: none !important; }

/* ============================================================
   Обводка буквы
   ============================================================ */

.trace-wrap {
  position: relative;
  width: min(72vmin, 460px);
  height: min(72vmin, 460px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
}
.trace-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.trace-col { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* Сколько ещё осталось закрасить. Без этой полоски требование
   «закрась целиком» превращается в непонятное «почему не засчитывает» */
.trace-fill {
  width: min(72vmin, 460px);
  height: 14px;
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}
.trace-fill i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--accent-light), var(--ok));
  transition: width .2s var(--ease);
}

/* ============================================================
   Эффекты
   ============================================================ */

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 4px;
  will-change: transform, opacity;
  animation: fall var(--dur, 2s) linear forwards;
}
@keyframes fall {
  0%   { opacity: 1; transform: translateY(-8vh) rotate(0deg); }
  100% { opacity: 0; transform: translateY(108vh) rotate(var(--spin, 540deg)); }
}

/* ============================================================
   Родительский раздел — единственное место с текстом
   ============================================================ */

.parent {
  height: 100%;
  overflow-y: auto;
  padding: var(--safe-t) 20px 48px;
  -webkit-user-select: text;
  user-select: text;
}
.parent-inner { max-width: 720px; margin: 0 auto; }
.parent-close {
  position: fixed;
  top: calc(var(--safe-t) + 12px);
  left: 16px;
  z-index: 50;
}
.parent h1 { font-size: 26px; margin: 8px 0 4px; }
.parent h2 { font-size: 19px; margin: 30px 0 10px; color: var(--ink); }
.parent p  { color: var(--ink-soft); font-size: 15.5px; margin: 6px 0; }
.parent .card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin: 12px 0;
}
.parent label { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.parent select,
.parent input[type=text],
.parent input[type=number] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  font-size: 16px;
  color: var(--ink);
}
.parent input[type=range] { width: 100%; accent-color: var(--accent); height: 34px; }
.parent .row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.parent .row > * { flex: 1 1 180px; }
.parent .btn {
  padding: 13px 20px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15.5px;
  box-shadow: 0 3px 0 var(--accent-dark);
  flex: 0 0 auto;
}
.parent .btn--ghost { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.parent .btn--danger { background: #C9564F; box-shadow: 0 3px 0 #93372F; }
.parent .btn:active { transform: translateY(3px); box-shadow: none; }
.parent .note {
  background: var(--accent-bg);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--ink);
  margin: 12px 0;
}
.parent .note b { color: var(--accent-dark); }
.parent .say-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.parent .say-row .ch {
  width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px currentColor;
  font-family: var(--font-letter); font-weight: 700; font-size: 24px;
}
.parent .say-row input { flex: 1 1 auto; }
.parent .say-row .mini {
  width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-bg); font-size: 20px;
}
.parent .muted { font-size: 13.5px; color: var(--ink-soft); }
.parent h3 { font-size: 16px; margin: 22px 0 8px; color: var(--ink); }

/* Буквы, на которых ребёнок спотыкается */
.hard-letters { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.hard-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px currentColor;
  font-family: var(--font-letter);
  font-size: 20px;
}
.hard-chip b { font-weight: 700; }
.hard-chip i { font-style: normal; font-size: 13px; opacity: .7; }
.hard-chip:active { transform: translateY(2px); }

/* В какие дни занимались */
.days-row { display: flex; gap: 5px; margin: 10px 0 4px; }
.days-row i {
  flex: 1 1 0;
  height: 30px;
  border-radius: 6px;
  background: var(--line);
  display: block;
}
.days-row i.is-on { background: var(--ok); }
.parent .kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.parent .kv:last-child { border-bottom: 0; }
.parent .kv b { font-weight: 700; }

.parent code {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .93em;
  font-family: Consolas, "Courier New", monospace;
}

/* Выбор темы */
.theme-pick { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.theme-btn {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: 14.5px;
  font-weight: 600;
}
.theme-btn.is-on { box-shadow: inset 0 0 0 3px var(--accent); background: var(--accent-bg); }
.theme-swatch { display: flex; border-radius: 9px; overflow: hidden; width: 100%; height: 34px; }
.theme-swatch i { flex: 1; display: block; }
.theme-btn[data-preview="neutral"] .sw-bg { background: #EFF0EC; }
.theme-btn[data-preview="neutral"] .sw-a  { background: #E9BE74; }
.theme-btn[data-preview="neutral"] .sw-b  { background: #4F9A63; }
.theme-btn[data-preview="forest"]  .sw-bg { background: #ECEFE7; }
.theme-btn[data-preview="forest"]  .sw-a  { background: #CFC08A; }
.theme-btn[data-preview="forest"]  .sw-b  { background: #4F9A63; }
.theme-btn[data-preview="sky"]     .sw-bg { background: #EAEFF3; }
.theme-btn[data-preview="sky"]     .sw-a  { background: #9CBCD2; }
.theme-btn[data-preview="sky"]     .sw-b  { background: #4F9A63; }

/* Настройка одной буквы: звук + фраза */
.letter-tune {
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}
.letter-tune:last-child { border-bottom: 0; }
.parent .say-row--phrase { margin-left: 0; }
.parent .say-row--phrase input { font-size: 14.5px; }
.parent .mini--flat { background: transparent; box-shadow: none; font-size: 22px; }

/* Список картинок. В ячейке показывается ровно то, что увидит ребёнок:
   своя картинка, если она есть, иначе эмодзи. */
.pic-thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}
.pic-thumb .pic-img { height: 100%; width: 100%; object-fit: contain; padding: 3px; }

.pic-row { align-items: center; }
.pic-row.is-custom { background: rgba(79, 154, 99, .07); border-radius: 10px; }
.pic-name { flex: 1 1 auto; font-size: 15.5px; }
.pic-weak { color: var(--accent-dark); }
.pic-status { flex: 0 0 auto; font-size: 13px; color: var(--ink-soft); }
.pic-status.is-custom { color: var(--ok); font-weight: 700; }

/* ============================================================
   Экран записи голоса
   ============================================================ */

.rec-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 12px; }
.rec-tab {
  padding: 9px 15px;
  border-radius: 11px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.rec-tab.is-on { background: var(--accent); color: #fff; box-shadow: none; }

.rec-progress { font-size: 15px; margin: 6px 0 10px; }

/* Индикатор уровня: без него можно наговорить весь алфавит
   в выключенный микрофон и не заметить */
.rec-level {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 14px;
}
.rec-level i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  transition: width .06s linear;
}

.rec-adv { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; }
.rec-adv input { width: 18px; height: 18px; accent-color: var(--accent); }

.rec-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 12px;
  border-bottom: 1px solid var(--line);
}
.rec-row.is-done { background: rgba(79, 154, 99, .07); }
.rec-row.is-next { box-shadow: inset 0 0 0 2px var(--accent); }

.rec-title {
  width: 48px; height: 48px; flex: 0 0 auto;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-2);
  font-family: var(--font-letter);
  font-weight: 700;
  font-size: 22px;
}
.rec-body { flex: 1 1 auto; min-width: 0; }
.rec-say { font-size: 16px; font-weight: 600; }
.rec-hint { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.rec-status { font-size: 13px; color: var(--ink-soft); display: block; margin-top: 2px; }
.rec-status.is-good { color: var(--ok); font-weight: 700; }
.rec-status.is-bad  { color: #C24B44; font-weight: 700; }
.rec-status.is-live { color: var(--accent-dark); font-weight: 700; }

.rec-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.rec-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #C24B44;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 3px 0 #8E332E;
}
.rec-btn.is-rec { animation: rec-pulse 1s ease-in-out infinite; }
.rec-btn:active { transform: translateY(3px); box-shadow: none; }
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 3px 0 #8E332E, 0 0 0 0 rgba(194, 75, 68, .5); }
  50%      { box-shadow: 0 3px 0 #8E332E, 0 0 0 12px rgba(194, 75, 68, 0); }
}

/* Подсказку не прячем даже на узком экране: именно она удерживает
   родителя от записи «эм» вместо звука [м] — это главная ошибка,
   которую потом долго переучивать */
@media (max-width: 560px) {
  .rec-hint { font-size: 12px; }
  .rec-title { width: 40px; height: 40px; font-size: 19px; }
  .rec-btn { width: 44px; height: 44px; }
  .rec-actions { gap: 6px; }
  .rec-row { gap: 8px; padding: 10px 6px; }
}

/* Замок родительского раздела */
.lock {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(58, 53, 46, .72);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: screen-in .2s var(--ease) both;
}
.lock__box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 420px;
  width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  box-shadow: var(--shadow);
}
.lock__box p { color: var(--ink-soft); margin: 0 0 18px; }
.lock__digits { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lock__digits button {
  width: 68px; height: 68px;
  border-radius: 18px;
  font-size: 26px; font-weight: 700;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--line);
}
.lock__digits button:active { transform: translateY(3px); }

/* ============================================================
   Тихая техподсказка (только для взрослого, мелко и внизу)
   ============================================================ */

.hint-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  text-align: center;
  z-index: 40;
  animation: screen-in .3s var(--ease) both;
}
.hint-bar button { text-decoration: underline; font-weight: 700; margin-left: 10px; }

/* ============================================================
   Мелочи
   ============================================================ */

.mascot-slot { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.hero-pic { display: block; }

/* Своя картинка подменяет эмодзи и занимает столько же места */
.pic-img {
  display: block;
  height: 1.12em;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
}

.word-read span { background: none !important; box-shadow: none !important; }

.lock__box h2 { margin: 0 0 10px; font-size: 22px; }
.lock__box input[type=text] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  font-size: 17px;
  color: var(--ink);
  text-align: center;
}
.lock__box .row { display: flex; gap: 12px; justify-content: center; }
.lock__box .btn {
  padding: 13px 22px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--accent-dark);
}
.lock__box .btn--ghost { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.lock__box .btn:active { transform: translateY(3px); box-shadow: none; }

.emoji-pick button { font-size: 30px; }
.emoji-pick button.is-on { box-shadow: inset 0 0 0 4px var(--accent); background: var(--accent-bg); }

.lock__digits.shake { animation: wrong-shake .38s var(--ease); }
@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* Узкие экраны */
@media (max-width: 560px) {
  :root { --gap: 16px; --tap: 84px; }
  .screen__top { min-height: 60px; }
  .icon-btn { width: 58px; height: 58px; }
  .icon-btn svg { width: 27px; height: 27px; }
  .speak-btn { width: 92px; height: 92px; }
  .speak-btn svg { width: 44px; height: 44px; }
  .next-btn { height: 92px; min-width: 112px; }
}

/* Низкие экраны — телефон в горизонтали */
@media (max-height: 520px) {
  .screen__body { gap: 12px; }
  .screen__bottom { min-height: 78px; }
  .hero-letter { font-size: clamp(70px, 26vmin, 150px); }
  .speak-btn { width: 84px; height: 84px; }
  .speak-btn svg { width: 40px; height: 40px; }
  .next-btn { height: 84px; }
  .play-btn { width: clamp(110px, 22vmin, 160px); height: clamp(110px, 22vmin, 160px); }
  .map-scroll { padding: 62px 6vw 10px; max-height: 26vh; }
  .path__node { width: 58px; height: 58px; font-size: 26px; }
  .path__link { width: 24px; }
  .path__here { top: -36px; font-size: 28px; }
}
