/* Тест «В чём сила?» — вёрстка по макету Figma (десктоп 1280×832, мобайл 390).
   Все размеры — в пикселях макета; масштаб под экран задаёт переменная --z (через zoom). */

:root {
  --blue: #2b99ff;
  --blue-start: #1980ef;
  --blue-text: #1980ef;
  --navy: #0000dc;
  --purple: #9747ff;
  --green: #55e26a;
  --white: #fff;
  --z: 1;
  --ease-out: cubic-bezier(.22, .8, .3, 1);
  --ease-in: cubic-bezier(.55, 0, .75, .2);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--blue);
  color: var(--white);
  font-family: "Roboto", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s ease;
}
body.bg-start { background: var(--blue-start); }
body.is-fixed { overflow: hidden; height: 100%; }
button { font: inherit; color: inherit; }
img { display: block; user-select: none; -webkit-user-drag: none; }
.noscript { padding: 24px; text-align: center; }

/* Декор выходит за края экрана — обрезаем, иначе мобильный браузер расширит страницу и уменьшит масштаб */
.app { position: relative; min-height: 100vh; min-height: 100svh; overflow-x: hidden; }
@supports (overflow: clip) { .app { overflow-x: clip; } }

/* ---------- Экраны и сцена ---------- */
.screen { position: relative; width: 100%; }
.screen.is-fixed { height: 100vh; height: 100svh; overflow: hidden; }
.fade-out { animation: fadeOut .22s ease forwards; }
.fade-in { animation: fadeIn .3s ease both; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Сцена фиксированного размера (десктоп 1280×832), масштабируется целиком */
.stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1280px; height: 832px;
  zoom: var(--z);
  transform: translate(-50%, -50%);
}
@supports not (zoom: 1) { .stage { transform: translate(-50%, -50%) scale(var(--z)); } }
/* Старт прижат к низу экрана: трава и герои стоят на нижнем крае при любых пропорциях */
.stage.stage-bottom { top: auto; bottom: 0; transform: translate(-50%, 0); }

.abs, .pic { position: absolute; }
.decor { position: absolute; pointer-events: none; will-change: transform; }
.decor img, .pic img { width: 100%; height: 100%; }
.decor.anim { transition: transform .7s var(--ease-out); }
.decor.anim-out { transition: transform .45s var(--ease-in); }

/* ---------- Кнопка (компонент button) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 54px; padding: 16px 24px;
  background: var(--purple);
  box-shadow: inset 0 0 0 3px var(--navy);
  border: 0; border-radius: 0;
  color: var(--white);
  font-family: "Roboto", Arial, sans-serif; font-weight: 900; font-size: 16px; line-height: 16px;
  letter-spacing: .32px; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .btn:hover { background: var(--navy); box-shadow: inset 0 0 0 3px var(--purple); } }
.btn:active, .btn.is-pressed { background: var(--navy); box-shadow: inset 0 0 0 3px var(--purple); }
.btn:focus-visible, .answer:focus-visible, .share a:focus-visible, .link:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

/* ---------- Старт ---------- */
.start-content {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center; z-index: 20;
}
.start-title {
  margin: 0;
  font-family: "Montserrat", Arial, sans-serif; font-weight: 900;
  font-size: 84px; line-height: 84px; color: var(--white);
  text-shadow: 5px 5px 0 var(--navy);
  white-space: pre-line;
}
.start-sub {
  margin: 0; font-weight: 700; font-size: 20px; line-height: 28px;
  color: var(--navy); text-transform: uppercase;
}
.start-text {
  margin: 0; font-weight: 300; font-size: 16px; line-height: 22.4px;
  color: var(--white); white-space: pre-line;
}
.start-clip { position: absolute; overflow: hidden; pointer-events: none; }
.start .pic { position: absolute; pointer-events: none; }
.start-cursor { animation: poke 1.6s ease-in-out infinite; transform-origin: 30% 10%; }
@keyframes poke { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-6px, -6px); } }

/* ---------- Вопрос ---------- */
.q-col { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.counter {
  display: flex; align-items: center; justify-content: center;
  height: 42px; padding: 16px; background: var(--white);
  font-weight: 900; font-size: 14px; line-height: 14px; color: var(--green);
}
.counter b { font-weight: 900; color: var(--purple); }
.q-box {
  width: 100%; padding: 16px 8px; background: var(--white);
  font-family: "Montserrat", Arial, sans-serif; font-weight: 700; font-size: 20px; line-height: 26px;
  color: var(--blue-text); text-transform: uppercase; text-align: center;
}
.q-box h2 { margin: 0; font: inherit; white-space: pre-line; }
.answer { white-space: pre-line; }
.q-list { position: absolute; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.answer {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 58px; padding: 18px 23px; /* в макете текст 540 из 586 */
  background: var(--blue);
  border: 0; box-shadow: inset 0 0 0 2px var(--white);
  color: var(--white); text-align: center;
  font-family: "Roboto", Arial, sans-serif; font-weight: 400; font-size: 16px; line-height: 22.4px;
  cursor: pointer;
  transition: background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .answer:hover { background: var(--purple); } }
.answer.is-picked { background: var(--purple); }
.q-gif { position: absolute; overflow: hidden; background: rgba(255, 255, 255, .15); }
.q-gif img { width: 100%; height: 100%; object-fit: cover; }
.q-gif::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--white); pointer-events: none; }
.q-content { transition: opacity .22s ease; }
.q-content.is-hidden { opacity: 0; }
.is-busy .answer { pointer-events: none; }

/* ---------- Результат ---------- */
.res-decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.res-decor .stage { position: absolute; }
.res-col {
  position: relative; z-index: 1;
  width: 586px; margin: 0 auto;
  zoom: var(--z);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 64px;
}
.tag {
  display: flex; align-items: center; justify-content: center;
  height: 42px; padding: 16px; background: var(--white);
  font-family: "Montserrat", Arial, sans-serif; font-weight: 900; font-size: 14px; line-height: 14px;
  color: var(--green); text-transform: uppercase;
}
.res-h1 { width: 570px; margin: 22px 0 25px; display: flex; flex-direction: column; gap: 8px; text-align: center; text-transform: uppercase; font-family: "Montserrat", Arial, sans-serif; font-weight: 700; }
.res-h1 h1 { margin: 0; font: inherit; font-size: 20px; line-height: 26px; color: var(--white); }
.res-h1 p { margin: 0; font-size: 14px; line-height: 18.2px; color: var(--navy); }
.res-img { position: relative; width: 100%; height: 260px; }
.res-img img { position: absolute; }
.card-white {
  width: 100%; background: var(--white); color: #000;
  padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.res-text { gap: 24px; }
.body-text { margin: 0; font-weight: 300; font-size: 16px; line-height: 22.4px; }
.h-blue { white-space: pre-line; margin: 0; font-weight: 700; font-size: 20px; line-height: 24px; color: var(--blue); text-transform: uppercase; }

/* Карусель профессий */
.prof {
  position: relative; width: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-top: 40px; margin-top: -40px; /* место под фигурки, торчащие над карточками */
  cursor: grab; touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}
.prof::-webkit-scrollbar { display: none; }
.prof { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.prof.is-drag { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.prof-list { display: flex; width: max-content; }
.prof-card {
  position: relative; flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 24px 16px; text-align: center; color: var(--white);
  box-shadow: inset 0 0 0 2px var(--white);
}
.prof-card h3 {
  margin: 0; font-weight: 700; font-size: 20px; line-height: 28px; text-transform: uppercase;
  text-decoration: underline wavy #ffb800; text-decoration-thickness: 1.5px; text-underline-offset: 5px;
  position: relative; z-index: 2;
}
.prof-card p { margin: 0; font-weight: 300; font-size: 16px; line-height: 22.4px; position: relative; z-index: 2; }
.prof-card .pic { position: absolute; pointer-events: none; z-index: 1; }
.prof-card .pic.fig { z-index: 3; }
.m .prof-card .pic.fig { z-index: 1; } /* на мобильном в макете фигурка под текстом */
.prof-card h3 { white-space: pre-line; }
.nowrap { white-space: nowrap; }

/* Цитата */
.quote { position: relative; width: 100%; margin-top: 0; background: var(--white); color: var(--blue); padding: 16px 16px 16px 100px; display: flex; flex-direction: column; gap: 24px; }
.quote p { margin: 0; font-weight: 300; font-size: 16px; line-height: 22.4px; text-align: left; }
.quote .author { font-style: italic; }
.quote .pic { position: absolute; pointer-events: none; }
.quote-row { display: none; }
.quote + .quote { margin-top: 8px; }
.prof-card p { white-space: pre-line; }

.res-start { margin-top: 8px; gap: 8px; }
.link { color: inherit; text-decoration: none; }
.link span { text-decoration: underline wavy #ff5a1f; text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (hover: hover) { .link:hover { color: var(--purple); } }

.res-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 22px 0 83px; margin-top: 8px; }
.share { display: flex; gap: 16px; margin: 0 0 30px; padding: 0; list-style: none; }
.share a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; outline: 2px solid var(--white); outline-offset: 0;
  transition: background-color .15s ease;
}
.share a img { width: auto; height: auto; }
@media (hover: hover) { .share a:hover { background: var(--purple); } }
.res-bottom .btn { width: 100%; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--navy); color: var(--white); padding: 12px 16px; font-size: 14px; z-index: 100;
  animation: fadeIn .2s ease both;
}

/* ================= МОБИЛЬНАЯ ВЁРСТКА (макет 390) ================= */
.m .stage-m { position: relative; width: 390px; margin: 0 auto; zoom: var(--z); }
.m .start-title { font-size: 44px; line-height: 44px; }
.m .start-sub { font-size: 18px; line-height: 25.2px; }
.m .q-box { font-size: 16px; line-height: 20.8px; }
.m .answer { padding: 18px 12px; } /* в макете текст 334 из 358 */
.m .q-col, .m .q-list, .m .q-gif { position: relative; left: auto; top: auto; }
.m .q-flow { position: relative; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 38px; }
.m .q-flow .q-col { width: 100%; }
.m .q-flow .q-list { width: 100%; }
.m .res-col { width: 358px; padding-top: 27px; }
.m .res-h1 { width: 358px; margin: 22px 0 16px; }
.m .res-img { height: 159px; }
.m .prof { width: 390px; margin-left: -16px; margin-right: -16px; padding-left: 16px; scroll-padding-left: 16px; }
.m .prof-list { padding-right: 16px; }
.m .quote { padding: 16px; gap: 0; }
.m .quote .q-desk { display: none; }
.m .quote-row { display: flex; flex-direction: column; position: relative; padding-left: 86px; }
.m .quote-row .author { margin-top: auto; padding-top: 16px; }
.m .res-bottom { padding-bottom: 75px; }

@media (prefers-reduced-motion: reduce) {
  .decor.anim, .decor.anim-out { transition-duration: .01s; }
  .start-cursor { animation: none; }
  .fade-in, .fade-out { animation-duration: .01s; }
}
