/* ------------------------------------------------------------------
   Hero: сценарий телефона (Figma 151:10099) и подписи-фичи.
   Сцены переключает script.js классами .s1…s4 на .screen:
   S0 приветствие → S1 голосовое → S2 разбор ошибок →
   S3 карточка «Грамматика» → S4 карточка «Произношение».
   Размеры — десктопные px; на планшете и телефоне новые блоки
   ужимаются через zoom: var(--k).
   ------------------------------------------------------------------ */

.hero { --k: 1; }

.msgs { overflow: hidden; }

.dz,
.l-ava { zoom: var(--k); }

/* ---------- Сообщение Лексы: аватар + пузырь/карточка ---------- */

.msg.msg--lexa {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: calc(8px * var(--k));
  align-items: end;
}
.msg__col { display: contents; }
.msg--lexa > .l-ava,
.msg--lexa .bubble,
.msg--lexa .card { grid-row: 1; }
.msg--lexa .bubble,
.msg--lexa .card,
.msg--lexa .msg__tools { grid-column: 2; }
.msg--lexa .msg__tools { grid-row: 2; margin-top: calc(8px * var(--k)); }

.l-ava {
  display: block;
  width: 40px;
  height: 40px;
  padding: 1.4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8a38f5 0%, #d4baff 55%, #e5f974 100%);
}
.l-ava img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Голосовое пользователя ---------- */

.msg.msg--user {
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
}

.ubub {
  position: relative;
  width: 321px;
  padding: 16px 14px 14px;
  border-radius: 32px 32px 4px 32px;
  background: linear-gradient(116deg, #8c65cc 45%, #a791cc 100%);
}

.ubub__text {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  width: 271px;
  font: 500 16px/24px var(--font-text);
  color: #fff;
}
.m-err,
.m-mark {
  transition: color .35s, background-color .35s, box-shadow .35s;
}
.m-mark {
  margin: 0 -5px;
  padding: 0 5px;
  border-radius: 10.5px;
}
.s2 .m-err { color: #ff9d9d; }
.s2 .m-mark {
  color: var(--c-lime);
  background: rgba(255, 157, 157, 0.12);
  box-shadow: inset 0 0 0 1px #ff9d9d;
}

.player {
  display: flex;
  align-items: center;
  width: 271px;
  height: 58px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 29px;
  background: rgba(255, 255, 255, 0.1);
}
.player__play {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  color: #8c65cc;
}
.player__play svg { width: 20px; height: 20px; margin-left: 3px; }
.player__wave {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 14px;
}
.player__wave i {
  display: block;
  width: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.4);
}
.player__time {
  margin-left: auto;
  padding-right: 11px;
  font: 500 13px/1 var(--font-text);
  color: rgba(255, 255, 255, 0.8);
}

.ubub__check {
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 18px;
  height: 11px;
}

.react {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1f1c29;
}
.react img { width: 28.6px; height: 28.6px; }

/* ---------- Чипы под голосовым ---------- */

.chips {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  width: 321px;
  margin-top: -4px;
}
.dchip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px 0 8px;
  border-radius: 20px;
  background: rgba(229, 249, 116, 0.1);
  font: 500 14px/1 var(--font-text);
  color: var(--c-lime);
}
.dchip__i {
  display: flex;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.dchip__i svg { width: 24px; height: 24px; }

/* ---------- Карточки ---------- */

.card {
  width: 321px;
  border-radius: 32px;
  color: #fff;
}
.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 24px;
  font: 600 17px/1 var(--font-text);
  color: var(--c-lime);
}
.card__i { flex: none; width: 22px; height: 22px; }

.card--gram {
  padding: 12px 16px;
  background: url("../assets/hero/card-gram.webp") center / cover, #14111c;
  border: 1px solid rgba(212, 186, 255, 0.2);
}

.gram__ok {
  display: flex;
  gap: 12px;
  margin-top: 19px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  font: 600 16px/22px var(--font-text);
}
.gram__lbl {
  flex: none;
  width: 49px;
  font: 500 13px/22px var(--font-text);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.gram__ok b,
.gram__fix b { font-weight: 600; color: var(--c-lime); }

.gram__fix {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  font: 500 16px/22px var(--font-text);
}
.gram__fix s { color: #ff9d9d; }

.gram__foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}
.gram__topic {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font: 500 14px/1 var(--font-text);
  color: rgba(229, 249, 116, 0.9);
}
.gram__topic-i { width: 24px; height: 24px; }
.gram__go {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 9.5px;
  border-radius: 20px;
  background: var(--c-lime);
  font: 400 15px/1 var(--font-display);
  color: var(--c-ink);
}

.card--pron {
  padding: 12px 13px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)),
    url("../assets/hero/card-pron.webp") center / cover, #14111c;
  border: 1px solid rgba(230, 250, 115, 0.2);
}
.card--pron .card__i { width: 26px; height: 24px; }

.pron__score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  margin-top: 20px;
  padding: 0 2px;
}
.pron__num {
  font: 400 28px/1 var(--font-display);
  color: var(--c-lime);
}
.pron__num small,
.tile__val small {
  margin-left: 6px;
  font: 500 13px/1 var(--font-text);
  color: rgba(255, 255, 255, 0.5);
}
.pron__grade { font: 400 16px/1 var(--font-display); color: var(--c-lime); }

.pron__tiles {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}
.tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 93px;
  height: 92px;
  padding-top: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  --c: #d4baff;
}
.tile--b { --c: #e6fa73; }
.tile--c { --c: #ffc96b; }
.tile::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: -34px;
  width: 80px;
  height: 50px;
  margin-left: -40px;
  border-radius: 50%;
  background: var(--c);
  opacity: .45;
  filter: blur(28px);
}
.tile { isolation: isolate; }
.tile__lbl { font: 500 13px/18px var(--font-text); color: rgba(255, 255, 255, 0.5); }
.tile__val {
  margin-top: 12px;
  font: 400 24px/1 var(--font-display);
  color: var(--c);
}
.tile__val small { margin-left: 4px; }
.tile__bar {
  position: absolute;
  left: 12px;
  bottom: 10px;
  width: 69px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
}
.tile__bar i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--c);
  animation: d-fill 1s .25s cubic-bezier(.2, .7, .2, 1) both;
}

/* ---------- Сцены ---------- */

.screen [data-m="user"],
.screen [data-m="chips"],
.screen [data-m="gram"],
.screen [data-m="pron"] { display: none; }

.screen.s1 [data-m="user"] { display: flex; }
.screen.s2 [data-m="chips"] { display: flex; }
.screen.s3 [data-m="gram"] { display: grid; }
.screen.s4 [data-m="gram"] { display: none; }
.screen.s4 [data-m="pron"] { display: grid; }

/* каждое новое сообщение выезжает снизу и подталкивает прошлые вверх (FLIP в script.js) */
.s1 [data-m="user"],
.s2 [data-m="chips"],
.s3 [data-m="gram"],
.s4 [data-m="pron"] { animation: d-up .5s cubic-bezier(.2, .8, .2, 1) both; }

.screen.is-out .msgs > :not([data-m="hi"]) {
  opacity: 0;
  transition: opacity .3s;
}

@keyframes d-up { from { opacity: 0; transform: translateY(48px) scale(.96); } }

/* появление телефона при загрузке */
.phone { animation: phone-in 1.1s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes phone-in { from { opacity: 0; transform: translateY(140px) scale(.96); } }
/* левая часть: строки заголовка, подзаголовок, бегущая строка и кнопки — по очереди */
.h1__line,
.h-sub,
.h-left > .mq,
.h-left > .cta { animation: hero-in .8s cubic-bezier(.2, .8, .2, 1) both; }
.h1__line:nth-child(2) { animation-delay: .08s; }
.h1__line:nth-child(3) { animation-delay: .16s; }
.h-sub { animation-delay: .26s; }
.h-left > .mq { animation-delay: .36s; }
.h-left > .cta { animation-delay: .46s; }
@keyframes hero-in { from { opacity: 0; transform: translateY(36px); } }
@keyframes d-fill { from { width: 0; } }

.phone { pointer-events: auto; }

@media (max-width: 1023px) {
  .hero { --k: .945; }
}

@media (max-width: 767px) {
  .hero { --k: .76; }
}

@media (prefers-reduced-motion: reduce) {
  .phone,
  .h1__line,
  .h-sub,
  .h-left > .mq,
  .h-left > .cta,
  .msgs > *,
  .tile__bar i { animation: none !important; }
}
