/* Тест «В чём сила?» — вёрстка по макету 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%; }
/* Быстрые тапы по ответам iPhone принимает за двойной тап и увеличивает страницу — отключаем
   увеличение двойным тапом (щипок двумя пальцами работает как обычно) */
html, body, button, a { touch-action: manipulation; }
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: "Unbounded", Arial, sans-serif; font-weight: 900;
  font-size: 80px; line-height: 80px; color: var(--white);
  text-shadow: 5px 5px 0 var(--navy);
  white-space: pre-line;
}
.d .start-title { white-space: nowrap; } /* отдельная рамка заголовка в новом макете шире content (660px) */
.start-sub {
  margin: 0; font-family: "Unbounded", Arial, sans-serif; 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: 22px;
  color: var(--white); white-space: pre-line;
}
.start-clip { position: absolute; overflow: hidden; pointer-events: none; }
.start .pic { position: absolute; pointer-events: none; }
.start .btn { position: relative; overflow: visible; }
.start-cursor {
  top: calc(100% - 12px); right: -18px;
  width: 52px; height: 64px; z-index: 1;
  animation: poke 1.6s ease-in-out infinite; transform-origin: 30% 10%;
}
.m .start-cursor { width: 39px; height: 48px; right: -12px; }
@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 {
  min-width: 60px; /* как в макете: плашка не уже 60px при любой цифре */
  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: "Unbounded", 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; }
.answer-t { display: block; }
.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: 22px;
  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: 808px; 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: "Unbounded", Arial, sans-serif; font-weight: 900; font-size: 14px; line-height: 14px;
  color: var(--green); text-transform: uppercase;
}
.res-h1 { width: 808px; margin: 22px 0 25px; display: flex; flex-direction: column; gap: 8px; text-align: center; text-transform: uppercase; font-family: "Unbounded", Arial, sans-serif; font-weight: 700; }
.res-h1 h1 { margin: 0; font: inherit; font-size: 26px; line-height: 34px; color: var(--white); }
.res-h1 p { margin: 0; font-size: 16px; line-height: 21px; color: var(--navy); }
.res-h1 h1, .res-h1 p { white-space: pre-line; } /* ручные переносы из мобильного макета */
.res-img { position: relative; width: 100%; height: 266px; }
.res-img img { position: absolute; object-fit: contain; }
.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: 22px; }
.h-blue { white-space: pre-line; margin: 0; font-weight: 700; font-size: 20px; line-height: 24px; color: var(--blue); text-transform: uppercase; }
.prof-carousel { position: relative; display: flow-root; width: 100%; --prof-controls-space: 72px; --prof-arrow-inset: 32px; }
.m .prof-carousel { --prof-arrow-inset: 12px; }
.prof-next {
  position: absolute; z-index: 4; bottom: 24px; transform: translateX(-50%);
  left: clamp(var(--prof-arrow-inset), var(--prof-arrow-x, 50%), 100% - var(--prof-arrow-inset));
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; border: 0;
  background: transparent; cursor: pointer;
}
.prof-next img { height: 28px; width: auto; transform: rotate(90deg); }
.prof-next:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .prof-next:hover { background: rgb(0 0 0 / 14%); } }

/* Карусель профессий */
.prof {
  position: relative; width: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-top: 64px; margin-top: -64px; /* место под фигурки, выступающие над карточками */
  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-grab, .prof.is-drag { cursor: grabbing; }
/* На компьютере прилипание к карточкам делает app.js (CSS-прилипание конфликтует с перетаскиванием мышью) */
@media (hover: hover) and (pointer: fine) { .prof { scroll-snap-type: none; } }
.prof-list { display: flex; width: max-content; }
.prof-card {
  --prof-card-padding-x: 18px;
  --prof-card-padding-top: 24px;
  --prof-card-gap: 22px;
  --prof-title-line-height: 28px;
  position: relative; flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: var(--prof-card-gap);
  padding: var(--prof-card-padding-top) var(--prof-card-padding-x) var(--prof-controls-space);
  text-align: center; color: var(--white); /* в макете текст 392 из 428 (моб. 284 из 320) */
  box-shadow: inset 0 0 0 2px var(--white);
}
.prof-card h3 {
  margin: 0; font-weight: 700; font-size: 20px; line-height: var(--prof-title-line-height); text-transform: uppercase;
  /* волнистое подчёркивание названия убрано по просьбе «Ножа» (23.11) */
  position: relative; z-index: 2;
}
.prof-card p { margin: 0; font-weight: 300; font-size: 16px; line-height: 22px; position: relative; z-index: 2; }
.prof-card p.has-figure-wrap { width: 100%; }
.prof-card p.has-figure-wrap::before {
  content: ""; float: var(--figure-side);
  width: var(--figure-wrap-width); height: var(--figure-wrap-height);
}
.prof-card.centered-description p { max-width: 338px; }
.m .prof-card.centered-description p { max-width: 268px; }
.prof-card .pic { position: absolute; pointer-events: none; z-index: 1; }
.prof-card .pic.icon { bottom: calc(var(--icon-bottom) + var(--prof-controls-space)); }
.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; }
/* эмодзи в конце ответа: не отрывается от последнего слова; ширина как у эмодзи в макете (Apple), а не шире (Windows) */
.emoji { display: inline-block; width: 1em; text-align: center; 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: 22px; text-align: left; }
.quote .author, .quote em { font-style: italic; }
.quote .pic { position: absolute; pointer-events: none; }
.quote-row { display: none; }
.quote + .quote { margin-top: 8px; }
.employee-quote {
  width: 100%; margin: 0; padding: 18px;
  background: var(--white); color: var(--blue);
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.employee-quote + .employee-quote { margin-top: 8px; }
.employee-quote blockquote {
  width: 100%; margin: 0; font-size: 16px; line-height: 22px;
  font-weight: 300; font-style: italic; text-align: center;
}
.employee-quote strong { font-weight: 500; }
.employee-footer { position: relative; width: 550px; height: 216px; flex: 0 0 auto; }
.employee-photo { position: absolute; left: 0; top: 0; width: 278px; height: 216px; object-fit: contain; }
.employee-mark { position: absolute; left: 304px; top: 5px; width: 123px; height: 112px; object-fit: contain; }
.employee-author { position: absolute; left: 308px; bottom: 4px; width: 219px; margin: 0; font-size: 16px; line-height: 22px; font-weight: 300; font-style: italic; text-align: left; }
.employee-author .employee-name { font-weight: 700; text-transform: uppercase; }
.prof-card p { white-space: pre-line; }

.res-start { margin-top: 8px; gap: 8px; }
.career-start, .career-static { width: 100%; margin: 8px 0; color: var(--white); background: #f6865d; }
.career-static { border: 2px solid var(--white); }
.career-static > h2 { margin: 0; padding: 24px 16px 0; text-align: center; font: 700 20px/24px "Unbounded", Arial, sans-serif; text-transform: uppercase; }
.career-static .career-panel { border: 0; padding-top: 18px; }
.career-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 106px; border: 2px solid var(--white);
  list-style: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: "Unbounded", Arial, sans-serif; font-size: 20px;
  font-weight: 700; line-height: 24px; text-transform: uppercase;
}
.career-toggle::-webkit-details-marker { display: none; }
.career-toggle::marker { content: ''; }
.career-toggle > span:first-child { padding: 24px 32px 24px 68px; }
.career-toggle:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }
.career-arrow { display: flex; align-items: center; justify-content: center; flex: 0 0 104px; align-self: stretch; border-left: 2px solid var(--white); }
.career-arrow img { width: 33px; height: 40px; transform: rotate(180deg); }
.career-start[open] .career-arrow img { transform: rotate(0); }
.career-panel {
  position: relative; min-height: 280px; padding: 24px 40px 32px;
  border: 2px solid var(--white); border-top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  text-align: center;
}
.career-panel strong { color: var(--blue); font-weight: 500; }
.career-link { position: relative; z-index: 1; height: 42px; padding: 8px 24px; line-height: 22px; text-decoration: none; background: var(--blue); box-shadow: inset 0 0 0 2px var(--white); }
.career-link:hover { background: var(--navy); box-shadow: inset 0 0 0 2px var(--purple); } 
.career-link:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }

.career-coins { position: absolute; left: 0; bottom: 0; width: 156px; height: 90px; pointer-events: none; }
.link { color: var(--blue-text); text-decoration: none; }
.link span { text-decoration: underline wavy currentColor; text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (hover: hover) { .link:hover { color: #0b5cc0; } } /* при наведении — темнее синий (раньше был фиолетовый) */

.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%; }
/* пометка о рекламе — внизу последнего экрана, мелко и приглушённо (как у спецпроектов «Ножа»).
   Нижний отступ экрана тот же, что в макете: метка занимает часть его, а не удлиняет страницу */
.legal-note { margin: 40px 0 -56px; font-weight: 400; font-size: 13px; line-height: 16px; color: rgba(255, 255, 255, .75); text-align: center; }
.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); }
.start .btn { min-width: 164px; } /* в макете 164: Figma рисует «НАЧАТЬ ТЕСТ» на 6px шире браузера */
.m .start-title { font-size: 38px; line-height: 44px; }
.m .start-sub { font-size: 16px; line-height: 23px; }
.m .q-box { font-size: 16px; line-height: 21px; }
.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%; }
/* на мобильном колонка лежит внутри .stage-m, который уже масштабирован, — второй zoom раздувал её (z²) */
.m .res-col { width: 358px; padding-top: 27px; zoom: 1; }
.m .res-h1 { width: 358px; margin: 22px 0 16px; }
.m .res-h1 h1 { font-size: 20px; line-height: 27px; }
.m .res-h1 p { font-size: 14px; line-height: 20px; }
.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 .employee-quote { padding: 16px; gap: 16px; }
.m .employee-footer { width: 333px; height: 306px; align-self: flex-start; }
.m .employee-photo { width: 326px; height: 216px; }
.m .employee-mark { left: 0; top: 178px; width: 117px; height: 106px; }
.m .employee-author { left: 127px; top: 218px; bottom: auto; width: 206px; }
.m .res-bottom { padding-bottom: 75px; }
.m .career-toggle { min-height: 106px; font-size: 18px; line-height: 22px; }
.m .career-toggle > span:first-child { padding: 24px 0 24px 28px; }
.m .career-arrow { flex-basis: 104px; }
.m .career-arrow img { width: 33px; height: 40px; }
.m .career-panel { padding: 24px 40px 94px; }
.m .career-static > h2 { font-size: 18px; line-height: 22px; }
.m .career-static .career-panel { padding-top: 18px; padding-bottom: 88px; }
.m .career-link { width: 263px; max-width: 100%; font-size: 16px; padding: 8px 24px; }
.m .career-coins { width: 108px; height: auto; }
.m .career-static .career-coins { width: 156px; height: 90px; }

/* Курсор из исходного прозрачного ассета Figma; на сенсорных устройствах не нужен. */
@media (hover: hover) and (pointer: fine) {
  body, .app, .app *, .app .prof.is-grab, .app .prof.is-drag { cursor: url('../assets/cursor-hand.png') 6 2, pointer; }
}

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