/* «Конец игры» — стили сайта по макету в Figma (страница «сайт финалим») */

/* ---------- Токены ---------- */
:root {
  --bg-page: #f4f3ef;
  --bg-surface: #ffffff;
  --bg-inverse: #231f20;
  --text-primary: #231f20;
  --text-secondary: #6e6a6b;
  --text-on-dark: #ffffff;
  --text-on-dark-secondary: #9b9799;

  --lime-500: #c8d888;
  --lime-200: #dbe6ac;
  --pink-500: #edaaae;
  --pink-200: #f8d7d9;
  --blue-500: #92b2ce;
  --blue-200: #c7daec;
  --peach-500: #eba36c;
  --peach-200: #f9c8a2;

  --radius-s: 12px;
  --radius-m: 16px;
  --radius-l: 36px;
  --radius-full: 999px;

  --container: 1200px;
  --header-width: 1320px;
  --section-gap: 120px;

  --font-heading: "Unbounded", system-ui, sans-serif;
  --font-text: "Onest", system-ui, sans-serif;
}

/* ---------- База ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.3;
}

/* Иллюстрации-коллажи выходят за край макета — обрезаем по ширине окна */
main { overflow-x: clip; }

h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: none; }

/* Картинка ещё не выгружена — не показываем значок битого файла */
img.is-missing { visibility: hidden; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 40px);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Типографика ---------- */
.h1 { font: 500 60px/68px var(--font-heading); }
.h2 { font: 500 36px/42px var(--font-heading); }
.h3 { font: 500 26px/32px var(--font-heading); }
.h4 { font: 500 22px/28px var(--font-heading); }
.number { font: 800 52px/52px var(--font-heading); color: var(--lime-500); }
.lead { font: 400 22px/30px var(--font-text); }
.body { font: 400 18px/1.3 var(--font-text); }
.body-s { font: 400 16px/22px var(--font-text); }
.label { font: 600 16px/22px var(--font-text); }
.eyebrow {
  font: 600 16px/20px var(--font-text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--peach-500);
}
.center { text-align: center; }

.section { margin-top: var(--section-gap); }
.section__title { margin-bottom: 48px; text-align: center; }

/* ---------- Кнопки и чипы ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--lime-500);
  color: var(--text-primary);
  font: 500 20px/24px var(--font-text);
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible,
.chip:focus-visible,
.nav-item:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
.btn--pink { background: var(--pink-500); }
.btn--white { background: var(--bg-surface); }
.btn--s { padding: 12px 16px; font-size: 16px; line-height: 20px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  background: var(--bg-surface);
  font: 500 16px/20px var(--font-text);
  white-space: nowrap;
}
.chip:hover { background: var(--bg-page); }

/* ---------- Логотип ---------- */
.logo {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  padding: 9px 12px 10.5px;
  border-radius: 12px;
  background: var(--peach-500);
  color: #fff;
  font: 500 19.5px/23.5px var(--font-heading);
  text-transform: lowercase;
  white-space: nowrap;
  transform: rotate(-3.92deg);
}
.logo::after {
  content: "";
  position: absolute;
  inset: 2.6px 3.1px;
  border: 3px solid #fff;
  border-radius: 12px;
  pointer-events: none;
}
.logo--footer {
  padding: 12px 16px 14px;
  background: transparent;
  font-size: 26px;
  line-height: 31.4px;
  transform: rotate(-3.9deg);
}
.logo--footer::after { inset: 3.4px 4.2px; border-width: 4px; border-radius: 16px; }

/* Плашка «история Вани» в шапке истории */
.logo-story { position: relative; display: inline-block; width: 199px; height: 68px; }
.logo-story .logo { position: absolute; left: 1px; top: 1px; transform: rotate(1.08deg); }
.logo-story__tag {
  position: absolute;
  left: 80px;
  top: 32px;
  padding: 7.4px 7.2px 8.3px;
  border-radius: 7.2px;
  background: var(--blue-500);
  color: #fff;
  font: 500 11.75px/10px var(--font-heading);
  white-space: nowrap;
  transform: rotate(-4.37deg);
}

/* ---------- Шапка ---------- */
.header {
  position: absolute;
  z-index: 20;
  top: 24px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--header-width), calc(100% - 40px));
  height: 68px;
  padding: 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
}
.header__menu { display: flex; gap: 12px; }
.header__logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }

.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  background: var(--bg-page);
  font: 500 16px/20px var(--font-text);
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-surface); }
.nav-item.is-active { background: var(--lime-500); }
.nav-item--surface { background: var(--bg-surface); color: var(--text-secondary); }
.nav-item--surface:hover { color: var(--text-primary); }

/* Шапка истории: лого слева, прогресс по центру, выход справа */
.header--story { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 12px 0; }
.header--story .header__side { flex: 1 0 0; display: flex; }
.header--story .header__side--end { justify-content: flex-end; }
.header--story .logo-story { position: absolute; left: 0; top: 10px; }

.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 330px;
  height: 42px;
  padding: 11.6px;
  border-radius: 16px;
  background: var(--bg-surface);
  font: 400 18.5px/25.5px var(--font-text);
}
.progress__bars { display: flex; gap: 7px; }
.progress__bar { width: 32.4px; height: 9.3px; border-radius: 4px; background: var(--bg-page); }
.progress__bar.is-done { background: var(--lime-500); }
.progress--pink .progress__bar.is-done { background: var(--pink-500); }

/* ---------- Подвал ---------- */
.footer {
  margin-top: var(--section-gap);
  padding: 64px 0;
  background: var(--bg-inverse);
  color: var(--text-on-dark-secondary);
}
.footer__inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 40px; }
.footer__about { display: flex; flex-direction: column; gap: 20px; }
.footer__about .logo { align-self: flex-start; margin: 7px 0 0 2px; }
.footer__nav { display: flex; gap: 80px; font: 400 16px/22px var(--font-text); }
.footer__col { display: flex; flex-direction: column; gap: 12px; }
.footer__col-title { font-weight: 600; color: var(--text-on-dark); }
.footer__col a:hover { color: var(--text-on-dark); }
.hotline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  border-radius: var(--radius-l);
  background: var(--lime-500);
  color: var(--text-primary);
  white-space: nowrap;
}
.hotline__title { font: 400 22px/30px var(--font-text); }
.hotline__phone { font: 500 22px/28px var(--font-heading); }

/* Абсолютно позиционированные иллюстрации (координаты из макета) */
.deco { position: absolute; pointer-events: none; user-select: none; }
.age-bubble img { position: absolute; inset: 0; width: 100%; height: 100%; }
.circle { position: absolute; border-radius: 50%; }

/* =========================================================
   Главная
   ========================================================= */
.hero {
  --dx: 0px;
  position: relative;
  width: 1440px;
  overflow: hidden;
  height: 1435px;
  margin: 0 auto;
}
.hero [data-a="right"] { translate: var(--dx) 0; }
.hero [data-a="center"] { translate: calc(var(--dx) / 2) 0; }
.hero__glow {
  position: absolute;
  left: 230px;
  top: 150px;
  width: 980px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--bg-page) 55%, rgba(244, 243, 239, 0) 100%);
  filter: blur(40px);
}
.hero__title {
  position: absolute;
  left: 293px;
  top: 261px;
  width: 855px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  text-align: center;
}
.hero__title .lead { width: 495px; }
.hero__intro {
  position: absolute;
  left: 842px;
  top: 975px;
  width: 478px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 40px;
}

/* Реплика героя поверх облачка-картинки */
.bubble-text {
  position: absolute;
  font: 500 31px/1.1 var(--font-text);
}

/* Карточки возрастов */
.ages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.age-card {
  position: relative;
  height: 436px;
  padding: 32px 30px;
  border-radius: var(--radius-l);
  background: var(--bg-surface);
  overflow: hidden;
}
.age-card--lime { background: var(--lime-200); }
.age-card__text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; width: 243px; }
.age-card .btn { position: absolute; left: 15px; right: 15px; bottom: 16px; }
.age-card__snippet { position: absolute; font: 400 18px/1.3 var(--font-text); white-space: nowrap; }
.age-card__snippet--code { font-size: 22px; line-height: 30px; }

/* Карточки этапов */
.stages { display: grid; grid-template-columns: 740px 1fr; gap: 20px; }
.stages > :nth-child(3) { grid-column: auto; }
.stages--bottom { grid-template-columns: 440px 1fr; margin-top: 20px; }
.stage-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 300px;
  padding: 32px 30px 30px;
  border-radius: var(--radius-l);
  overflow: hidden;
}
.stage-card__text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; max-width: 440px; }
.stage-card__step { position: relative; z-index: 1; font: 600 16px/22px var(--font-text); }
.stage-card--lime { background: var(--lime-200); }
.stage-card--pink { background: var(--pink-200); }
.stage-card--blue { background: var(--blue-200); }
.stage-card--peach { background: var(--peach-200); }
.stage-card__chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }

/* Как устроена история */
.how { position: relative; height: 618px; }
.how__title { position: relative; z-index: 1; }
.how__list { position: absolute; left: 120px; top: 147px; width: 525px; display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-l);
  background: var(--bg-surface);
}
.option-card .number { flex: 0 0 48px; text-align: center; }
.option-card .lead { flex: 1; }
.how__art { position: absolute; left: 814px; top: 74px; width: 544px; height: 544px; }

/* Если уже случилось — аккордеон */
.steps { display: flex; flex-direction: column; gap: 20px; }
.step {
  border-radius: var(--radius-l);
  background: var(--bg-surface);
  transition: background .2s ease;
}
.step[open] { background: var(--lime-500); }
.step__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  cursor: pointer;
  list-style: none;
}
.step__head::-webkit-details-marker { display: none; }
.step__title { display: flex; align-items: baseline; gap: 24px; font-family: var(--font-heading); font-weight: 500; }
.step__num { font-size: 26px; line-height: 32px; white-space: nowrap; }
.step__name { font-size: 22px; line-height: 28px; }
.step[open] .step__name { font-size: 26px; line-height: 32px; }
.step__chevron { flex: 0 0 24px; width: 24px; height: 24px; transition: transform .2s ease; }
.step[open] .step__chevron { transform: rotate(90deg); }
.step__body { display: flex; flex-direction: column; gap: 20px; padding: 0 32px 32px; }
.step__body li::before { content: "•"; margin-right: 12px; }

/* Финальный призыв */
.final { position: relative; margin-top: 85px; overflow: hidden; }
.final__stage { position: relative; width: 1440px; height: 381px; margin: 0 auto; }
/* Ваня стоит прямо на подвале, без отступа */
main:has(> .final:last-child) + .footer { margin-top: 0; }

/* =========================================================
   Экраны истории
   ========================================================= */
.story-page { min-height: 100vh; }
.scene {
  position: relative;
  width: 1440px;
  height: 720px;
  margin: 0 auto;
  overflow: hidden;
}
.scene__art {
  position: absolute;
  left: -174px;
  top: 0;
  width: 1010px;
  height: 721px;
  object-fit: cover;
  object-position: bottom;
  /* круглая маска из макета: круг 1068 со смещением −120/−77 от картинки */
  -webkit-mask: radial-gradient(circle 534px at 654px 457px, #000 99.8%, transparent 100%);
  mask: radial-gradient(circle 534px at 654px 457px, #000 99.8%, transparent 100%);
}
.scene__text {
  position: absolute;
  left: 827px;
  top: 145px;
  width: 560px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
}
.scene__content { display: flex; flex-direction: column; gap: 20px; }

/* =========================================================
   Послесловие
   ========================================================= */
.after-hero { padding-top: 172px; padding-bottom: 64px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.after-hero .h2 { max-width: 876px; }
.trap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.trap-card { display: flex; flex-direction: column; gap: 16px; padding: 32px; border-radius: var(--radius-l); background: var(--bg-surface); }
.trap-card__top { display: flex; flex-direction: column; gap: 12px; }

.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.help-card { display: flex; flex-direction: column; border-radius: var(--radius-l); background: var(--bg-surface); overflow: hidden; }
.help-card__pic { position: relative; height: 223px; overflow: hidden; }
.help-card__pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: bottom; }
.help-card__pic--blue { background: var(--blue-200); }
.help-card__pic--peach { background: var(--peach-200); }
.help-card__pic--lime { background: var(--lime-200); }
.help-card__text { display: flex; flex-direction: column; gap: 16px; padding: 32px; }

.agree { display: flex; align-items: center; gap: 64px; padding-top: 80px; padding-bottom: 80px; }
.agree__text { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.agree__text .h2 { max-width: 520px; }
.agree__text .body-s { max-width: 483px; }
.agree__actions { display: flex; flex-wrap: wrap; gap: 20px; }
.agree__quote { flex: 0 0 590px; margin: 0; display: flex; flex-direction: column; gap: 16px; padding: 40px 40px 48px; border-radius: var(--radius-l); background: var(--lime-500); }

.links-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.link-card { display: flex; flex-direction: column; align-items: flex-start; gap: 48px; padding: 40px; border-radius: var(--radius-l); background: var(--bg-surface); }
.link-card__text { display: flex; flex-direction: column; gap: 12px; }

/* =========================================================
   Адаптив: «коллажные» блоки свёрстаны в координатах макета 1440
   и на узких экранах масштабируются целиком (js/fit.js, атрибут
   data-fit); сетки и карточки перестраиваются медиазапросами
   ========================================================= */

@media (max-width: 1240px) {
  .stages, .stages--bottom { grid-template-columns: 1fr 1fr; }
  .ages { grid-template-columns: repeat(2, 1fr); }
  .trap-grid { grid-template-columns: repeat(2, 1fr); }
  .help-grid { grid-template-columns: 1fr; }
  .agree { flex-direction: column; align-items: stretch; }
  .agree__quote { flex-basis: auto; }
  /* Карточки этапов в две равные колонки: настольные картинки рассчитаны
     на другую ширину и обрезались, ставим угловые картинки из мобильного макета */
  .stage-card .deco { display: none; }
  .stage-card .stage-card__m-art { display: block; position: absolute; height: auto; pointer-events: none; }
  .stage-card--lime .stage-card__text, .stage-card--peach .stage-card__text { max-width: calc(100% - 120px); }
}

@media (max-width: 760px) {
  :root { --section-gap: 64px; }
  .h1 { font-size: 32px; line-height: 38px; }
  .h2 { font-size: 26px; line-height: 32px; }
  .h3 { font-size: 20px; line-height: 26px; }
  .h4, .step__num, .step__name, .step[open] .step__name { font-size: 18px; line-height: 24px; }
  .number { font-size: 40px; line-height: 40px; }
  .lead { font-size: 18px; line-height: 26px; }
  .body { font-size: 16px; line-height: 24px; }
  .eyebrow { font-size: 14px; line-height: 18px; }
  .section__title { margin-bottom: 32px; }

  .header { top: 12px; }
  .header__menu .nav-item:not(:first-child),
  .header > .nav-item { display: none; }
  .header__logo { left: 24px; transform: translateY(-50%); }
  .header { justify-content: flex-end; }

  .ages, .stages, .stages--bottom, .trap-grid, .links-grid { grid-template-columns: 1fr; }
  .stage-card { height: auto; min-height: 260px; gap: 32px; }
  .step__head { padding: 24px; }
  .step__title { flex-direction: column; gap: 4px; }
  .step__body { padding: 0 24px 24px; }
  .footer__inner, .footer__nav { flex-direction: column; gap: 32px; }
  .agree__quote { padding: 28px; }
  .link-card { padding: 28px; gap: 28px; }
}

/* =========================================================
   История: сцена 1440×720, экраны переключаются js/story.js
   ========================================================= */
.story-body { overflow: hidden; background: var(--bg-page); transition: background .3s ease; }
.story-body.is-pink { background: var(--pink-200); }
/* Сцена занимает всё окно. Внутри — координаты макета 1440×720, которые
   js/story-layout.js масштабирует под высоту или ширину окна. Лишнее место
   отдают сдвигом: data-a="right" прижат к правому краю, "center" — к центру,
   "left" — к левому; все три центрируются по вертикали. Иллюстрация (.art)
   растягивается во всю высоту окна и прижата к левому краю, как в Фигме. */
.story-stage {
  --dx: 0px;
  --dy: 0px;
  --a: 1;
  position: relative;
  width: 1440px;
  height: 720px;
  overflow: hidden;
}
.story-stage .header--story { position: absolute; z-index: 30; top: 24px; left: 60px; width: calc(100% - 120px); transform: none; }
.screen [data-a="left"] { translate: 0 var(--dy); }
.screen [data-a="right"] { translate: var(--dx) var(--dy); }
.screen [data-a="center"] { translate: calc(var(--dx) / 2) var(--dy); }
.art {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 720px;
  transform-origin: 0 0;
  transform: translateX(var(--ax, 0px)) scale(var(--a));
  pointer-events: none;
}
.art--center {
  transform-origin: 50% 100%;
  transform: translate(calc(var(--dx) / 2), calc(var(--dy) * 2)) scale(var(--a-center, 1));
}
.screen { position: absolute; inset: 0; display: none; }
.screen.is-active { display: block; animation: screen-in .35s ease; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .screen.is-active { animation: none; } }
.screen > * { position: absolute; }
.screen__text { display: flex; flex-direction: column; align-items: flex-start; gap: 32px; }
.screen__content { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }

/* Список правил с галочками */
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule { display: flex; align-items: center; gap: 16px; padding: 12px 24px 12px 20px; border-radius: var(--radius-l); background: var(--bg-surface); }
.rule svg { flex: 0 0 28px; }

/* Карточка-подпись поверх сцены */
.caption-card { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; width: 360px; padding: 24px; border-radius: var(--radius-l); background: var(--bg-surface); }
.caption-card__text { display: flex; flex-direction: column; gap: 8px; }

.tip { width: 360px; padding: 16px 20px; border-radius: var(--radius-m); background: var(--bg-surface); }

/* Чаты: голубая шапка, белый фон, входящие #f4f3ef, исходящие #c7daec */
.chat { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-l); background: var(--bg-surface); }
.chat__head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--blue-200); }
.chat__avatar { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.chat__avatar--text { display: flex; align-items: center; justify-content: center; background: var(--lime-500); font: 500 14px/1 var(--font-heading); color: #000; }
.chat__name { font: 600 16px/22px var(--font-text); }
.chat__status { font: 500 13px/18px var(--font-text); }
.chat__body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; }
.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 15px 15px 15px 4px;
  background: var(--bg-page);
  font: 400 13px/18px var(--font-text);
}
.msg--out { align-self: flex-end; border-radius: 15px 15px 4px 15px; background: var(--blue-200); }
.msg__author { font-weight: 600; }
.msg__time { font-weight: 500; color: var(--text-secondary); }
.msg--out .msg__time { opacity: .7; }
.typing { align-self: flex-end; padding: 8px 12px; border-radius: var(--radius-full); background: var(--blue-200); font: 500 13px/18px var(--font-text); }

/* Крупный чат «службы безопасности» (масштаб 1.26 от базового) */
.chat--large { border-radius: 45px; }
.chat--large .chat__head { gap: 10px; padding: 15px; }
.chat--large .chat__avatar { width: 41px; height: 41px; }
.chat--large .chat__name,
.chat--large .chat__status { font: 500 16.4px/22.7px var(--font-text); }
.chat--large .chat__body { gap: 10px; padding: 15px 15px 20px; }
.chat--large .msg { max-width: none; gap: 5px; padding: 10px 15px; border-radius: 19px 19px 19px 5px; font-size: 16.4px; line-height: 22.7px; }
.chat--large .msg:not(.msg--out) { width: 247px; }
.chat--large .msg--out { border-radius: 19px 19px 5px 19px; }
.chat--large .msg__time { opacity: .7; }

/* Угрозы поверх чата */
.shout { display: flex; flex-direction: column; gap: 8px; padding: 20px 24px; border-radius: 32.5px 32.5px 32.5px 9.7px; background: var(--pink-500); }
.shout__text { font: 400 23.8px/35.7px var(--font-text); text-transform: uppercase; }
.shout__time { font: 500 21.4px/29.2px var(--font-text); opacity: .7; }

.timer { padding: 4px 8px; border-radius: var(--radius-s); background: var(--pink-500); font: 500 13px/18px var(--font-text); }

/* Пуш от мамы на краю экрана */
.push { display: flex; gap: 12px; width: 300px; padding: 16px; border-radius: var(--radius-s); background: var(--bg-page); opacity: .45; filter: blur(1px); }
.push__avatar { flex: 0 0 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--lime-500); font: 500 22px/28px var(--font-heading); }
.push__body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.push__top { display: flex; justify-content: space-between; }

/* Профиль игрока */
.player { display: flex; align-items: center; gap: 8px; }
.player__avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--peach-200); object-fit: cover; object-position: bottom; }
.player__info { display: flex; flex-direction: column; gap: 6px; width: 170px; }
.player__row { display: flex; align-items: center; gap: 8px; }
.player__name { font: 600 16px/22px var(--font-text); color: var(--text-secondary); }
.player__lvl { padding: 2px 8px; border-radius: 999px; background: var(--bg-surface); font: 500 13px/18px var(--font-text); color: var(--text-secondary); }
.player__xp { width: 152px; height: 10px; border-radius: 999px; background: var(--bg-surface); overflow: hidden; }
.player__xp span { display: block; width: 100px; height: 100%; border-radius: 999px; background: var(--lime-500); }

/* Запрос в друзья */
.friend { display: flex; align-items: center; gap: 16px; padding: 24px; border-radius: var(--radius-l); background: var(--bg-surface); }
.friend__text { width: 345px; display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); }
.friend__actions { display: flex; gap: 12px; }
.btn--blue { background: #a1bed8; }
.btn--muted { background: var(--bg-page); }

/* Окна переписки с мамой */
.mom-chat { width: 352px; }
.mom-chat .chat__head { gap: 12px; padding: 12px 20px; }
.mom-chat .chat__avatar { width: 48px; height: 48px; }
.mom-chat .chat__body { gap: 16px; padding: 20px; }
.mom-chat .msg { padding: 12px 16px; border-radius: 20px 20px 20px 6px; font-size: 16px; line-height: 22px; }
.mom-chat .msg--out { border-radius: 20px 20px 6px 20px; }
.mom-chat .msg__time { font-size: 13px; line-height: 18px; }
/* Место под ответ «Да» занято заранее, чтобы окно не прыгало, когда он появится */
.mom-chat__slot { display: flex; justify-content: flex-end; align-self: stretch; min-height: 66px; }
.mom-chat [data-reply].is-hidden { visibility: hidden; }
.mom-chat [data-reply].is-sent { animation: msg-in .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.composer__placeholder { color: var(--text-secondary); }
.composer { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 8px 8px 20px; border-radius: var(--radius-full); background: var(--bg-page); }
.composer__input { flex: 1; font: 400 18px/1.3 var(--font-text); }
.composer__input--empty { color: var(--text-secondary); }
.composer__send { flex: 0 0 36px; height: 36px; border-radius: 50%; background: var(--blue-500); display: flex; align-items: center; justify-content: center; }
.caret { animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* Варианты ответа */
.choice { display: flex; align-items: center; gap: 16px; width: 462px; padding: 16px 20px; border: 0; border-radius: var(--radius-l); background: var(--bg-surface); font: 400 16px/22px var(--font-text); color: inherit; text-align: left; cursor: pointer; transition: background .15s ease; }
.choice:hover { background: var(--lime-200); }
.badge { flex: 0 0 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-s); background: var(--lime-500); color: #fff; font: 500 22px/28px var(--font-heading); }
.badge--s { flex-basis: 32px; height: 32px; font: 600 16px/22px var(--font-text); }

.todo { display: flex; flex-direction: column; gap: 16px; width: 510px; padding: 24px; border-radius: var(--radius-l); background: var(--bg-surface); }
.todo__item { display: flex; align-items: flex-start; gap: 16px; }

.art > * { position: absolute; }
/* Мысль мамы на экране 11 не уезжает за левый край, когда иллюстрация сдвинута */
.screen[aria-label="Экран 11"] .art > :not(img[src*="story-11"]) { translate: calc(var(--ax, 0px) * -1 / var(--a, 1)) 0; }
.bubble-thought { font: 400 16px/22px var(--font-text); }

/* =========================================================
   Анимации первого экрана главной
   Появление: фигуры прилетают из-за краёв окна, заголовок проявляется.
   Потом фигуры медленно «дышат» и плавают, а при движении мыши
   слегка смещаются на разную глубину (параллакс, js/hero-motion.js).
   ========================================================= */
.hero { --mx: 0px; --my: 0px; }
/* Фигуры у краёв окна обрезаны по краю картинки: их край не двигаем
   (--dh / --dv — глубина параллакса по горизонтали и вертикали) */
.hero [data-m] { translate: calc(var(--mx) * var(--dh, var(--d, 0))) calc(var(--my) * var(--dv, var(--d, 0))); }
.hero [data-m][data-a="right"] { translate: calc(var(--dx) + var(--mx) * var(--dh, var(--d, 0))) calc(var(--my) * var(--dv, var(--d, 0))); }
.hero [data-m="phone"]    { --dh: 0; --dv: 0; }
.hero [data-m="book"]     { --d: 1.4; }
.hero [data-m="heart"]    { --dh: 0; --dv: 2; }
.hero [data-m="cloud"]    { --dh: 0; --dv: 0; }
.hero [data-m="bubble"]   { --dh: 0; --dv: 1.2; }
.hero [data-m="question"] { --d: 2.2; }

@media (prefers-reduced-motion: no-preference) {
  .hero [data-m="phone"]    { animation: grow 1s cubic-bezier(.2, .9, .3, 1.15) .1s both, float 7s ease-in-out 1.1s infinite; transform-origin: 0 0; }
  .hero [data-m="book"]     { animation: from-top 1s cubic-bezier(.2, .9, .3, 1.2) .35s both, float 5.5s ease-in-out 1.35s infinite reverse; --r: 4deg; }
  .hero [data-m="heart"]    { animation: pop .9s cubic-bezier(.3, 1.6, .5, 1) .6s both, beat 2.6s ease-in-out 1.5s infinite; transform-origin: 0 60%; }
  .hero [data-m="cloud"]    { animation: grow 1s cubic-bezier(.2, .9, .3, 1.15) .2s both, float 8s ease-in-out 1.2s infinite; transform-origin: 100% 0; }
  .hero [data-m="bubble"]   { animation: grow 1s cubic-bezier(.2, .9, .3, 1.15) .4s both, float 6.5s ease-in-out 1.4s infinite reverse; transform-origin: 100% 50%; }
  .hero [data-m="question"] { animation: drop 1.1s cubic-bezier(.3, 1.5, .5, 1) .7s both, swing 4s ease-in-out 1.8s infinite; transform-origin: 55% 85%; }

  .hero__title .h1   { animation: rise .9s cubic-bezier(.2, .8, .2, 1) .3s both; }
  .hero__title .lead { animation: rise .9s cubic-bezier(.2, .8, .2, 1) .55s both; }

  /* Ваня появляется, когда до него докрутили */
  .hero.motion-ready [data-m^="vanya"],
  .hero.motion-ready [data-m^="hello"],
  .hero.motion-ready .hero__intro { opacity: 0; }
  .hero.motion-ready.vanya-in [data-m="vanya-circle"] { animation: pop .8s cubic-bezier(.3, 1.4, .5, 1) both; }
  .hero.motion-ready.vanya-in [data-m="vanya"]        { animation: rise .8s cubic-bezier(.2, .9, .3, 1.2) .15s both; }
  .hero.motion-ready.vanya-in [data-m="hello"],
  .hero.motion-ready.vanya-in [data-m="hello-text"]   { animation: pop .6s cubic-bezier(.3, 1.8, .5, 1) .6s both; transform-origin: 15% 90%; }
  .hero.motion-ready.vanya-in .hero__intro            { animation: rise .8s cubic-bezier(.2, .8, .2, 1) .4s both; }

  .hero .btn:hover { animation: nudge .6s ease-in-out; }
}

@keyframes grow       { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes from-left  { from { opacity: 0; transform: translateX(-60%) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes from-right { from { opacity: 0; transform: translateX(60%) rotate(12deg); } to { opacity: 1; transform: none; } }
@keyframes from-top   { from { opacity: 0; transform: translateY(-80%) rotate(-20deg); } to { opacity: 1; transform: none; } }
@keyframes drop       { from { opacity: 0; transform: translateY(-120px) rotate(18deg) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes pop        { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes rise       { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes float      { 0%, 100% { transform: none; } 50% { transform: translateY(-14px) rotate(var(--r, 0deg)); } }
@keyframes beat       { 0%, 60%, 100% { transform: none; } 15% { transform: scale(1.06); } 30% { transform: scale(.98); } 45% { transform: scale(1.04); } }
@keyframes swing      { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg) translateY(-6px); } }
@keyframes nudge      { 0%, 100% { transform: none; } 30% { transform: translateX(4px); } 60% { transform: translateX(-2px); } }

/* =========================================================
   Анимации главной ниже первого экрана (метки ставит js/page-motion.js)
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  .motion [data-reveal] { opacity: 0; }
  .motion [data-reveal].is-in {
    animation:
      var(--reveal, rise) .8s cubic-bezier(.2, .9, .3, 1.15) var(--delay, 0s) both,
      var(--idle, none) var(--idle-time, 6s) ease-in-out calc(var(--delay, 0s) + .8s) infinite;
  }
  .motion [data-reveal="pop"] { --reveal: pop; }
  .motion [data-reveal="from-left-soft"] { --reveal: from-left-soft; }
  .motion [data-reveal="from-right-soft"] { --reveal: from-right-soft; }

  /* Картинки в карточках потом живут своей жизнью */
  .age-card:nth-child(2) .deco { --idle: float; --idle-time: 4.5s; }
  .age-card:nth-child(1) .deco { --idle: wiggle; --idle-time: 3.5s; }
  .age-card:nth-child(3) .deco { --idle: wiggle; --idle-time: 4s; transform-origin: 50% 30%; }
  .age-card:nth-child(4) .deco { --idle: beat; --idle-time: 3s; }
  .stage-card .deco[src*="heart"] { --idle: beat; --idle-time: 2.8s; transform-origin: 50% 60%; }
  .stage-card .deco[src*="star"] { --idle: twinkle; --idle-time: 3.2s; }
  .stage-card .deco[src*="star-2"] { --idle-time: 2.6s; }
  .how__art .deco { --idle: float; --idle-time: 5s; }
  .final .deco[src*="bubble"], .final .bubble-text { --idle: float; --idle-time: 4.5s; transform-origin: 10% 90%; }
  .final .btn { --idle: breathe; --idle-time: 2.4s; }

  /* Наведение: карточка приподнимается, картинка подпрыгивает */
  .age-card, .stage-card, .option-card { transition: translate .3s ease, box-shadow .3s ease; }
  .age-card:hover, .stage-card:hover { translate: 0 -6px; box-shadow: 0 16px 32px rgba(29, 27, 26, .08); }
  /* Подпрыгивание через translate/rotate, чтобы не перезапускать анимацию появления */
  .age-card .deco { transition: translate .35s cubic-bezier(.3, 1.6, .5, 1), rotate .35s ease; }
  .age-card:hover .deco { translate: 0 -10px; rotate: -4deg; }
  .option-card:hover { translate: 6px 0; }
  .chip { transition: translate .2s ease; }
  .chip:hover { translate: 3px 0; }

  /* Аккордеон: текст этапа мягко выезжает при раскрытии */
  .step[open] .step__body { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
}

@keyframes from-right-soft { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes from-left-soft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }
@keyframes wiggle  { 0%, 70%, 100% { transform: none; } 76% { transform: rotate(-7deg); } 82% { transform: rotate(6deg); } 88% { transform: rotate(-4deg); } 94% { transform: rotate(2deg); } }
@keyframes twinkle { 0%, 100% { transform: none; } 50% { transform: scale(1.08) rotate(8deg); } }
@keyframes breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.05); } }
@keyframes hop     { 0%, 100% { transform: none; } 40% { transform: translateY(-12px) rotate(-4deg); } 70% { transform: translateY(2px); } }

/* =========================================================
   Анимации экранов истории. Экран скрыт через display: none,
   поэтому при каждом переходе анимации проигрываются заново.
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* Текст: заголовок, абзацы и кнопка поднимаются по очереди */
  .screen.is-active .screen__content > :not(.screen__content):not(.screen__text),
  .screen.is-active .screen__text > :not(.screen__content) { animation: rise .7s cubic-bezier(.2, .8, .2, 1) var(--t, .2s) both; }
  .screen.is-active .screen__content > :nth-child(2) { --t: .32s; }
  .screen.is-active .screen__content > :nth-child(3) { --t: .44s; }
  .screen.is-active .screen__content > :nth-child(4) { --t: .56s; }
  .screen.is-active .screen__text > .btn,
  .screen.is-active .screen__text > .todo { --t: .6s; }
  .screen.is-active .screen__text .screen__text > .btn { --t: 1.1s; }

  /* Иллюстрации: круг раскрывается, картинка проявляется чуть крупнее и «садится».
     Только увеличение: обрезанные края картинок уходят за край окна, а не внутрь */
  .screen.is-active .art .circle { animation: grow .9s cubic-bezier(.2, .9, .3, 1.1) both; }
  .screen.is-active .art > img.deco { animation: settle .9s cubic-bezier(.2, .8, .2, 1) .1s both; }

  /* Чаты: сообщения приходят по одному, как в настоящей переписке */
  .screen.is-active .chat:not(.mom-chat) .chat__body > * { animation: msg-in .45s cubic-bezier(.2, .9, .3, 1.2) var(--t, .5s) both; }
  .screen.is-active .chat__body > :nth-child(2) { --t: 1.1s; }
  .screen.is-active .chat__body > :nth-child(3) { --t: 1.7s; }
  .screen.is-active .chat__body > :nth-child(4) { --t: 2.3s; }
  .screen.is-active .chat__body > :nth-child(5) { --t: 2.9s; }
  .screen.is-active .chat__body > :nth-child(6) { --t: 3.5s; }
  .screen.is-active[aria-label="Экран 9"] .chat .chat__body > * { animation: none; }
  .typing { animation: breathe 1.2s ease-in-out infinite; }

  /* 2. Правила появляются по одному */
  .screen.is-active .rule { animation: from-left-soft .6s cubic-bezier(.2, .9, .3, 1.15) var(--t, .5s) both; }
  .screen.is-active .rule:nth-child(2) { --t: .65s; }
  .screen.is-active .rule:nth-child(3) { --t: .8s; }

  /* 3. Игра: панель игрока и чат выезжают слева, полоска опыта заполняется,
     запрос в друзья приходит после переписки и привлекает внимание */
  .screen.is-active .player { animation: from-left-soft .6s ease-out .1s both; }
  .screen.is-active .player__xp span { animation: xp 1.2s ease-out .6s both; }
  .screen.is-active .chat { animation: from-left-soft .6s ease-out .2s both; }
  .screen.is-active .friend { animation: rise .6s cubic-bezier(.2, .9, .3, 1.3) 2.8s both, nudge-y .6s ease-in-out 3.6s 2; }
  .screen.is-active .caption-card { animation: from-right-soft .7s cubic-bezier(.2, .8, .2, 1) .4s both; }

  /* 4. Мысль Вани появляется, когда он дочитал переписку */
  .screen.is-active .art > .deco[src*="thought"],
  .screen.is-active .art > .bubble-thought,
  .screen.is-active .art > .h4 { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) var(--t, 3.8s) both, float 5s ease-in-out calc(var(--t, 3.8s) + .6s) infinite; transform-origin: 20% 90%; }
  .screen.is-active[aria-label="Экран 11"] .art > * { --t: .7s; }

  /* 5. Звёзды выскакивают вокруг телефона и мерцают */
  .screen.is-active .art > .deco[src*="star"] { animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) var(--t, .5s) both, twinkle 3.4s ease-in-out calc(var(--t, .5s) + .7s) infinite; }
  .screen.is-active .art > .deco[src*="star-left"] { --t: .7s; transform-origin: 0 50%; animation-name: pop, float; }
  .screen.is-active .art > .deco[src*="star-bottom"] { --t: .9s; }

  /* 6–7. Подарок подрагивает, потом крышка слетает */
  .screen.is-active .deco[src*="gift-closed"] { animation: pop .7s cubic-bezier(.3, 1.5, .5, 1) .1s both, wiggle 2.4s ease-in-out .8s infinite; }
  .screen.is-active .deco[src*="gift-open"] { animation: pop .7s cubic-bezier(.3, 1.5, .5, 1) .1s both, float 4s ease-in-out .8s infinite; }

  /* 8–9. Давление: чат «службы» въезжает справа, таймер тикает, мама пишет поверх */
  .screen.is-active .chat--large { animation: from-right-soft .6s ease-out .1s both; }
  .screen.is-active[aria-label="Экран 9"] .chat--large { animation: none; }
  .screen.is-active .timer { animation: pop .4s ease-out .3s both, pulse 1s ease-in-out 1s infinite; }
  .screen.is-active .push { animation: from-right-soft .6s ease-out 3.4s both; }
  .screen.is-active[aria-label="Экран 9"] .push { --t: 0s; animation-delay: .2s; }
  .screen.is-active .shout { animation: slam .45s cubic-bezier(.3, 1.4, .5, 1) var(--t, .3s) both, shake .5s ease-in-out calc(var(--t, .3s) + .45s); }
  .screen.is-active .shout:nth-child(5) { --t: .9s; }
  .screen.is-active .shout:nth-child(6) { --t: 1.5s; }

  /* 10. Три окна переписки с мамой по очереди: пишет, стирает, отвечает «Да» */
  .screen.is-active .mom-chat { animation: rise .6s cubic-bezier(.2, .8, .2, 1) var(--t, .1s) both; }
  .screen.is-active[aria-label="Экран 10"] .screen__content > * { --t: 6.4s; }
  .screen.is-active[aria-label="Экран 10"] .screen__content > :nth-child(2) { --t: 6.55s; }
  .screen.is-active[aria-label="Экран 10"] .screen__text > .btn { --t: 6.7s; }

  /* 11–12. Варианты ответа и план действий по одному */
  .choice { transition: background .15s ease, translate .2s ease; }
  .choice:hover { translate: 6px 0; }
  .screen.is-active .todo__item { animation: rise .5s ease-out var(--t, .8s) both; }
  .screen.is-active .todo__item:nth-of-type(2) { --t: .95s; }
  .screen.is-active .todo__item:nth-of-type(3) { --t: 1.1s; }
}

@keyframes settle          { from { opacity: 0; transform: scale(1.06); } }
@keyframes msg-in          { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes from-right-soft { from { opacity: 0; transform: translateX(60px); } }
@keyframes xp              { from { width: 0; } }
@keyframes nudge-y         { 0%, 100% { transform: none; } 30% { transform: translateY(-6px); } 60% { transform: translateY(2px); } }
@keyframes lid-off         { from { opacity: 0; transform: translate(-40px, 160px) rotate(-14deg); } }
@keyframes slam            { from { opacity: 0; transform: scale(1.5); } }
@keyframes shake           { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes pulse           { 0%, 100% { transform: none; } 50% { transform: scale(1.1); } }

/* Чат «службы безопасности» — окно фиксированной высоты, лента внутри
   прокручивается к новым сообщениям (js/chat-scroll.js) */
.chat--large { height: 560px; }
.chat--large .chat__body { flex: 1; min-height: 0; overflow: hidden; }

/* =========================================================
   Мобильная версия (макеты 390 в Фигме: «главная · mobile»,
   «история · mobile», «история - послесловие · mobile»).
   Коллажи в координатах 1440 на телефоне раскладываются в колонку,
   js/fit.js их не масштабирует. Картинки, скомпонованные для телефона,
   лежат в assets/m/ и показываются только здесь (.m-only).
   ========================================================= */
.m-only { display: none; }
.header__burger { display: none; }
/* Обёртки для телефона; на компьютере не влияют на раскладку */
.hero__shapes, .hero__vanya, .final__vanya, .final__bubble { display: contents; }

@media (max-width: 900px), (max-width: 1100px) and (max-height: 500px) {
  .m-only { display: block; }
  .d-only { display: none !important; }

  /* Шапка: лого слева, кнопка меню справа */
  .header { top: 12px; height: 56px; padding: 0 6px 0 12px; justify-content: space-between; background: rgba(255, 255, 255, .7); }
  .header > .nav-item { display: none; }
  .header__logo { position: static; transform: none; }
  .header .logo { font-size: 16px; line-height: 20px; padding: 7px 10px 8px; }
  .header__burger {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg-surface); cursor: pointer;
  }
  .header__burger span, .header__burger span::before, .header__burger span::after {
    display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text-primary); transition: transform .2s ease, opacity .2s ease;
  }
  .header__burger span { position: relative; }
  .header__burger span::before, .header__burger span::after { content: ""; position: absolute; left: 0; }
  .header__burger span::before { top: -6px; }
  .header__burger span::after { top: 6px; }
  .header.is-open .header__burger span { background: transparent; }
  .header.is-open .header__burger span::before { transform: translateY(6px) rotate(45deg); }
  .header.is-open .header__burger span::after { transform: translateY(-6px) rotate(-45deg); }
  .header__menu {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    display: none; flex-direction: column; gap: 8px; padding: 12px;
    border-radius: var(--radius-l); background: var(--bg-surface); box-shadow: 0 12px 32px rgba(29, 27, 26, .12);
  }
  .header.is-open .header__menu { display: flex; }
  .header__menu .nav-item:not(:first-child) { display: inline-flex; }
  .header__menu .nav-item { justify-content: flex-start; padding: 14px 16px; font-size: 18px; }

  /* Первый экран: картинка, заголовок, Ваня, вступление — в колонку */
  .hero { width: auto !important; height: auto; zoom: 1 !important; display: flex; flex-direction: column; padding: 84px 0 0; }
  .hero__shapes, .hero__glow { display: none; }
  .hero__m-art { position: relative; width: calc(100% * 432 / 390); max-width: none; height: auto; margin-left: calc(-100% * 21 / 390); }
  .hero__title { position: relative; left: auto; top: auto; width: auto; margin-top: -16px; padding: 0 20px; gap: 32px; translate: none; }
  .hero__title .lead { width: auto; font: 500 18px/24px var(--font-heading); }
  .hero__vanya { display: block; position: relative; margin-top: 96px; width: 100%; aspect-ratio: 390 / 324; }
  .hero__vanya > * { translate: none !important; }
  .hero__vanya [data-m="vanya-circle"] { left: 6.65% !important; top: 7.37% !important; width: 70.93% !important; height: auto !important; aspect-ratio: 1; }
  .hero__vanya [data-m="vanya"] { left: 0 !important; top: 0 !important; width: 80.44% !important; height: 100% !important; object-fit: contain; object-position: left bottom; }
  .hero__vanya [data-m="hello"] { left: 58.15% !important; top: 2.98% !important; width: 41.85% !important; height: auto !important; }
  .hero__vanya [data-m="hello-text"] { left: 65.7% !important; top: 11.45% !important; width: 30% !important; font-size: calc(100vw * 15.76 / 390); }
  .hero__intro { position: relative; left: auto; top: auto; width: auto; margin-top: 64px; padding: 0 20px; gap: 40px; translate: none; }

  /* Возраст: карусель карточек с прокруткой вбок */
  .section__title { padding: 0 0; }
  .ages {
    display: flex; gap: 12px; margin: 0 -20px; padding: 0 20px;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .ages::-webkit-scrollbar { display: none; }
  .age-card { flex: 0 0 285px; scroll-snap-align: start; scroll-margin-left: 20px; }

  /* Почему правил недостаточно */
  .stages, .stages--bottom { gap: 12px; }
  .stages--bottom { margin-top: 12px; }
  .stage-card { min-height: 0; height: auto; padding: 24px; gap: 24px; }
  .stage-card .deco { display: none; }
  .stage-card__m-art { position: absolute; height: auto; pointer-events: none; }
  .stage-card__text { max-width: none; }
  .stage-card--peach .h3 { max-width: 236px !important; }
  .stage-card--peach .body { max-width: none !important; }
  .stage-card--lime .h3 { max-width: 220px; }

  /* Как устроена история */
  .how { width: auto !important; height: auto; zoom: 1 !important; padding: 0 20px; }
  .how__title { margin-bottom: 32px; }
  .how__list { position: static; width: auto; gap: 16px; }
  .option-card .lead { font-size: 18px; line-height: 26px; }
  .option-card .number { font-size: 40px; line-height: 48px; }
  .how__art { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: 1; margin-top: 32px; }
  .how__art .deco { left: .74% !important; top: 10.66% !important; width: 94.3% !important; height: auto !important; }

  /* Если это уже случилось */
  .step__head { padding: 32px; }
  .step__body { padding: 0 32px 32px; }
  .step__chevron { flex-basis: 36px; width: 36px; height: 36px; }

  /* Финал: облачко, кнопка, Ваня стоит на подвале */
  .final { margin-top: 64px; }
  .final__stage { width: auto !important; height: auto; zoom: 1 !important; display: flex; flex-direction: column; align-items: center; padding: 0 20px; }
  .final__bubble { display: block; position: relative; width: 100%; max-width: 340px; aspect-ratio: 492 / 306; margin-left: 10px; }
  .final__bubble .deco { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
  .final__bubble .bubble-text { left: 16% !important; top: 22% !important; width: 76% !important; font-size: 20px; line-height: 26px; }
  .final__bubble { order: 1; }
  .final__btn { order: 2; position: relative !important; left: auto !important; top: auto !important; margin-top: 8px; }
  .final__vanya { order: 3; display: block; position: relative; width: 350px; max-width: 100%; height: 230px; margin-top: 4px; overflow: hidden; }
  .final__vanya .circle { left: 24.3% !important; top: 75px !important; width: 235px !important; height: 235px !important; }
  .final__vanya .deco { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; object-fit: contain; }

  /* Подвал */
  .footer { padding: 40px 0; }
  .footer__inner { gap: 32px; }
  .footer__nav { flex-direction: row !important; gap: 40px !important; }
  .footer__col { gap: 16px; }
  .hotline { align-self: stretch; white-space: normal; padding: 20px 24px !important; }
  .hotline__title { font-size: 20px; line-height: 28px; }
  .hotline__phone { font-size: 24px; line-height: 30px; }
}

/* ---------- Мобильная история: экран — длинная страница с прокруткой ---------- */
@media (max-width: 900px), (max-height: 500px), (orientation: portrait) {
  .story-body { overflow: auto; }
  .story-stage { width: auto; height: auto; min-height: 100vh; overflow: visible; zoom: 1 !important; }

  /* Шапка: лого и крестик в белой плашке, прогресс отдельной строкой ниже */
  .story-stage .header--story {
    position: absolute; top: 12px; left: 20px; width: calc(100% - 40px); height: 56px;
    padding: 0 6px 0 12px; border-radius: var(--radius-full); background: rgba(255, 255, 255, .7);
  }
  .header--story .logo-story { position: relative; top: 0; left: 0; width: 132px; height: 45px; transform: scale(.66); transform-origin: 0 50%; }
  .header--story .header__side:not(.header__side--end) { display: none; }
  .header--story .progress { position: absolute; top: 72px; left: 0; width: 100%; height: 42px; font-size: 18px; }
  .header--story .nav-item--surface { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 0; color: var(--text-primary); }
  .header--story .nav-item--surface::before { content: "✕"; font-size: 20px; line-height: 1; }

  .screen.is-active { display: flex; flex-direction: column; gap: 16px; padding: 142px 20px 40px; }
  .screen { position: relative; inset: auto; }
  .screen > * { position: relative !important; left: auto !important; top: auto !important; translate: none !important; }
  .screen > .art, .screen > .deco { display: none; }
  .screen .m-scene { display: block; }
  .m-scene { width: calc(100% + 40px); max-width: none; height: auto; margin: 0 -20px; order: -1; }
  .screen[aria-label="Экран 3"] .m-scene, .screen[aria-label="Экран 4"] .m-scene { order: 0; }
  .screen[aria-label="Экран 3"] .player { order: -2; }

  .screen__text { width: auto !important; gap: 32px; }
  .screen__text .lead, .screen__text .body, .screen__text .body-s, .screen__text .tip { width: auto !important; }
  .screen__text br { display: none; }
  .screen__text .h2 { font-size: 26px; line-height: 32px; }

  .chat { width: auto !important; }
  .chat--large { height: auto; border-radius: 36px; }
  .chat--large .chat__body { overflow: visible; }
  .chat--large .msg:not(.msg--out) { width: auto; max-width: 88%; }
  .friend { flex-direction: column; align-items: flex-start; }
  .friend__text { width: auto; }
  .caption-card { width: auto; }
  .push { width: auto; }
  .choice { width: auto; }
  .todo { width: auto; }
  .todo br { display: none; }

  /* 8–9: текст сверху, потом таймер и чат */
  .screen[data-pink] .screen__text { order: -3; }
  .timer { align-self: flex-end; order: -2; }
  .screen[aria-label="Экран 9"] .chat, .screen[aria-label="Экран 9"] .push { display: none; }
  .shout { width: auto !important; max-width: 88%; }
  .shout:nth-child(5) { align-self: flex-end; }
  .shout__text { font-size: 18px; line-height: 26px; }
  .shout__time { font-size: 16px; line-height: 22px; }

  /* 10: заголовок по центру, чат, кнопка внизу */
  .screen[aria-label="Экран 10"] .screen__text { display: contents; }
  .screen[aria-label="Экран 10"] .screen__content { order: -1; text-align: center; }
  .screen[aria-label="Экран 10"] .mom-chat { width: 100% !important; }
  .screen[aria-label="Экран 10"] .btn { order: 2; align-self: flex-start; }
}
@media (max-width: 900px), (max-height: 500px), (orientation: portrait) {
  .screen[data-pink] .m-scene { order: -4; }
  .rule { width: auto !important; }
}

/* ---------- Мобильное послесловие ---------- */
@media (max-width: 900px), (max-width: 1100px) and (max-height: 500px) {
  .after-hero { padding: 112px 20px 40px; gap: 16px; }
  .trap-grid { padding: 0; margin: 0; gap: 12px; list-style: none; }
  .trap-card { padding: 24px; }
  .trap-card__top { flex-direction: column; align-items: flex-start; gap: 16px; }
  .help-grid { gap: 12px; }
  .agree { padding: 64px 20px; gap: 32px; }
  .agree__actions { flex-direction: column; align-items: flex-start; gap: 12px; }
  .agree__quote { margin: 0; padding: 28px 24px; }
  .links-grid { gap: 12px; }
  .link-card { padding: 28px 24px; gap: 28px; }
}
@media (max-width: 900px), (max-height: 500px), (orientation: portrait) {
  /* Въезд карточек сбоку не должен давать горизонтальную прокрутку */
  .screen.is-active, main { overflow-x: clip; }
}


/* =========================================================
   Разделы «Материалы» и «Куда обратиться» (макеты «материалы»,
   «куда обратиться» и их mobile-версии). Финальный призыв — как на главной.
   ========================================================= */
.page { padding-top: 172px; }
.page .final { margin-top: var(--section-gap); }
.btn--dark { background: var(--bg-inverse); color: var(--text-on-dark); }
.btn--dark:hover { filter: none; background: #3a3536; }

/* Материалы */
.page-head { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.page-head .lead { max-width: 760px; }
.memo {
  display: flex; align-items: flex-end; gap: 40px; margin-top: 48px; min-height: 480px;
  border-radius: var(--radius-l); background: var(--peach-200); overflow: hidden;
}
.memo__text { flex: 1 1 0; align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; padding: 64px 0 64px 64px; }
.memo__top { display: flex; flex-direction: column; gap: 16px; }
.memo__tag { font: 600 16px/20px var(--font-text); letter-spacing: 0.08em; text-transform: uppercase; }
.memo .lead { max-width: 482px; }
.memo .btn { align-self: flex-start; }
.memo__art { flex: 0 0 522px; width: 522px; height: 480px; object-fit: cover; object-position: left bottom; }

/* Куда обратиться */
.help-head { display: flex; align-items: center; gap: 40px; }
.help-head__text { flex: 1 1 0; display: flex; flex-direction: column; gap: 24px; }
.emergency {
  flex: 0 0 590px; display: flex; flex-direction: column; gap: 16px; padding: 40px;
  border-radius: var(--radius-l); background: var(--lime-500);
}
.emergency__number { font: 800 120px/120px var(--font-heading); letter-spacing: -0.02em; }
.help-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.help-step { display: flex; flex-direction: column; gap: 12px; min-height: 368px; padding: 32px; border-radius: var(--radius-l); background: var(--bg-surface); }
.help-step .body-s { margin-top: 12px; }
.contacts { display: flex; flex-direction: column; gap: 20px; }
.contact-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 40px; padding: 32px 32px 32px 40px;
  border-radius: var(--radius-l); background: var(--bg-surface);
}
.contact-row__name { flex: 0 0 420px; display: flex; flex-direction: column; gap: 8px; }
.contact-row__name .body-s { color: var(--text-secondary); }
.contact-row > .body { flex: 1 1 0; min-width: 0; }
/* «Подробнее» раскрывает пояснение под строкой (js/more.js) */
.contact-row__more { flex: 0 0 100%; max-width: 680px; margin: 20px 0 0 460px; color: var(--text-secondary); }
.contact-row [data-more][aria-expanded="true"] { background: var(--lime-200); }

@media (prefers-reduced-motion: no-preference) {
  .help-step, .contact-row { transition: translate .3s ease, box-shadow .3s ease; }
  .help-step:hover { translate: 0 -6px; box-shadow: 0 16px 32px rgba(29, 27, 26, .08); }
  .contact-row:hover { translate: 6px 0; }
  .help-step .number { transition: scale .35s cubic-bezier(.3, 1.6, .5, 1); transform-origin: left bottom; }
  .help-step:hover .number { scale: 1.15; }
  .memo__art { --idle: float; --idle-time: 5s; }
  .emergency__number { --idle: breathe; --idle-time: 2.6s; transform-origin: left center; }
  .contact-row__more:not([hidden]) { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
}

/* Узкий компьютер: две колонки шагов, экстренный блок ýже */
@media (max-width: 1240px) {
  .help-steps { grid-template-columns: repeat(2, 1fr); }
  .help-step { min-height: 0; }
  .emergency { flex-basis: 46%; }
  .emergency__number { font-size: 96px; line-height: 100px; }
  .memo__art { flex-basis: 44%; width: 44%; height: auto; }
  .contact-row__name { flex-basis: 340px; }
  .contact-row__more { margin-left: 380px; }
}

@media (max-width: 900px), (max-width: 1100px) and (max-height: 500px) {
  .page { padding-top: 112px; }
  .page .final { margin-top: 64px; }
  .page-head { gap: 16px; }
  .page-head .h1, .help-head .h1 { font-size: 36px; line-height: 42px; }
  .page-head .lead, .help-head .lead { font-size: 18px; line-height: 24px; }
  .memo { flex-direction: column; align-items: stretch; gap: 0; margin-top: 32px; min-height: 0; border-radius: 28px; }
  .memo__text { padding: 24px 20px 0; gap: 24px; }
  .memo__top { gap: 12px; }
  .memo__tag { font-size: 14px; line-height: 18px; }
  .memo .h2 { font-size: 26px; line-height: 32px; }
  .memo .lead { font-size: 18px; line-height: 24px; }
  .memo__art { flex: none; align-self: center; width: min(100%, 360px); height: auto; margin-top: 8px; }
  .help-head { flex-direction: column; align-items: stretch; gap: 24px; }
  .help-head__text { gap: 16px; }
  .emergency { flex: none; padding: 24px; gap: 12px; border-radius: 28px; }
  .emergency .lead { font-size: 18px; line-height: 24px; }
  .emergency__number { font-size: 80px; line-height: 84px; }
  .page .section { margin-top: 64px; }
  .page .section__title { margin-bottom: 24px; }
  .help-steps { grid-template-columns: 1fr; gap: 12px; }
  .help-step { padding: 24px; gap: 8px; border-radius: 28px; }
  .contacts { gap: 12px; }
  .contact-row { flex-direction: column; align-items: flex-start; gap: 16px; padding: 24px; border-radius: 28px; }
  .contact-row__name { flex: none; }
  .contact-row > .body { flex: none; font-size: 16px; line-height: 22px; }
  .contact-row__more { flex: none; margin: 0; }
}

/* ---------- Планшеты и широкие окна в раскладке колонкой ----------
   Колонка не растягивается на всю ширину: держим ширину телефона-«плюс» по центру */
@media (min-width: 601px) and (max-width: 900px), (min-width: 601px) and (max-width: 1100px) and (max-height: 500px) {
  .hero__m-art { width: 600px; margin: 0 auto; }
  .hero__title, .hero__intro { width: 100%; max-width: 600px; margin-left: auto; margin-right: auto; }
  .hero__title { margin-top: -16px; }
  .hero__vanya { width: 460px; margin-left: auto; margin-right: auto; }
  .hero__vanya [data-m="hello-text"] { font-size: 18.5px; }
  .stages, .stages--bottom { grid-template-columns: 1fr 1fr; }
  .how__list, .how__title { max-width: 600px; margin-left: auto; margin-right: auto; }
  .how__art { width: 420px; margin-left: auto; margin-right: auto; }
  .steps { max-width: 700px; margin: 0 auto; }
  .trap-grid { grid-template-columns: 1fr 1fr; }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .after-hero .h2 { max-width: 600px; }
  .page-head, .memo, .help-head, .contacts { max-width: 640px; margin-left: auto; margin-right: auto; }
  .memo { margin-top: 32px; }
  .help-steps { grid-template-columns: 1fr 1fr; max-width: 640px; margin: 0 auto; }
}
@media (min-width: 601px) and (max-width: 900px), (min-width: 601px) and (max-height: 500px), (min-width: 601px) and (orientation: portrait) {
  .screen.is-active { max-width: 640px; margin: 0 auto; }
  .story-stage .header--story { max-width: 600px; left: 50%; transform: translateX(-50%); }
}
