/* «Долговой компас» — лендинг о банкротстве физлиц.
   Визуальный язык взят с sravni.ru: тёплый серый фон, белые карточки с
   крупным скруглением 20px, глубокая сине-зелёная кнопка, голубые акценты,
   пастельные подложки, Open Sans. Логотип, название и иллюстрации — свои.

   Сайт мобильный: на телефоне во весь экран, на десктопе — в корпусе. */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #F6F5F4;          /* фон страницы */
  --card: #FFFFFF;
  --grey: #F5F5F5;        /* вторичная подложка */
  --ink: #171D23;
  --ink-soft: #636F7D;
  --dark: #002A3A;        /* кнопки и акцентные блоки */
  --dark-hover: #013F55;
  --blue: #00AFFF;        /* ссылки и активные состояния */
  --violet: #5047D7;
  --green: #0DD149;
  --orange: #FF9500;

  /* пастельные подложки под иконки и плашки */
  --pastel-blue: #F0FAFF;
  --pastel-violet: #F3F2FC;
  --pastel-green: #EEFCF2;
  --pastel-yellow: #FFF9F0;

  --line: #E8E8E6;
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shell: #0E1526;
  --shell-edge: #30405F;
}

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* --- Сцена и корпус телефона -------------------------------------------- */

.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background: radial-gradient(100% 70% at 50% 0%, #17323F 0%, #0C1A22 55%, #070F14 100%);
}

.device {
  position: relative;
  width: 392px;
  height: min(844px, calc(100dvh - 56px));
  padding: 11px;
  border-radius: 60px;
  background: linear-gradient(155deg, var(--shell-edge) 0%, var(--shell) 46%, #060B15 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .08),
    0 0 0 1px rgba(0, 0, 0, .5),
    0 50px 100px -34px rgba(0, 0, 0, .9);
}

.device::before, .device::after {
  content: '';
  position: absolute;
  left: -3px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(var(--shell-edge), #1A2540);
}

.device::before { top: 172px; height: 34px; }
.device::after  { top: 218px; height: 60px; }

.device-screen {
  position: relative;
  height: 100%;
  border-radius: 49px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.device-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 29px;
  border-radius: 18px;
  background: #04070E;
  z-index: 6;
}

.device-bar {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 5px;
  border-radius: 3px;
  background: var(--ink);
  opacity: .18;
  z-index: 6;
}

@media (max-width: 560px) {
  .stage { padding: 0; background: var(--bg); display: block; }
  .device {
    width: 100%;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .device::before, .device::after { display: none; }
  .device-screen { border-radius: 0; }
  .device-island, .device-bar { display: none; }
}

/* --- Каркас воронки ------------------------------------------------------ */

.app {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg);
}

@media (min-width: 561px) {
  .app { padding-top: 50px; }
}

.top { flex: 0 0 auto; padding-bottom: 14px; }

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--dark);
  color: #fff;
  display: grid;
  place-items: center;
}

.brand-mark svg { width: 16px; height: 16px; display: block; }

.stepper {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.progress {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: var(--blue);
  transition: width .4s cubic-bezier(.22, 1, .36, 1);
}

.stage-screens { position: relative; flex: 1 1 auto; min-height: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.screen.is-active { display: flex; }

.screen.is-active .screen-body > *,
.screen.is-active .screen-foot {
  animation: rise .3s cubic-bezier(.22, 1, .36, 1) both;
}

.screen.is-active .screen-body > *:nth-child(2) { animation-delay: .04s; }
.screen.is-active .screen-body > *:nth-child(3) { animation-delay: .08s; }
.screen.is-active .screen-body > *:nth-child(4) { animation-delay: .12s; }
.screen.is-active .screen-foot { animation-delay: .1s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.screen-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.screen-foot { flex: 0 0 auto; padding-top: 14px; }

/* --- Типографика --------------------------------------------------------- */

h1 {
  font-size: clamp(26px, 7.6vw, 32px);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(22px, 6.2vw, 26px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sub {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

.note {
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* --- Экран 1: что человек получает --------------------------------------- */

/* Пять пунктов с иконками. Список плотный: на первом экране кроме него есть
   картинка, подзаголовок и две кнопки, и всё это должно помещаться. */
.facts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 8px 14px;
}

.facts li {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 11px;
  padding: 6px 0;
  font-size: 14.5px;
  line-height: 1.3;
  font-weight: 600;
}

.facts li + li { border-top: 1px solid var(--line); }

/* Круглая тёмная плашка под иконкой — как на образце заказчика. */
.fact-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  display: grid;
  place-items: center;
}

.fact-mark svg { width: 17px; height: 17px; display: block; }

/* Галочка осталась в разметке экрана «спасибо» и в вариантах ответа. */
.check {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--pastel-green);
  color: var(--green);
  display: grid;
  place-items: center;
}

.check svg { width: 15px; height: 15px; display: block; }

/* --- Картинка первого экрана --------------------------------------------- */

/* Картинка забирает себе нехватку места: сжиматься ей можно (flex-shrink: 1),
   растягиваться — нет. Когда высоты не хватает, коробка становится ниже и
   подрезает картинку снизу, а заголовок, впечатанный вверху, остаётся виден.
   Сама картинка не сплющивается: height: auto держит пропорцию, лишнее
   срезает overflow. Так первый экран укладывается без прокрутки. */
.hero {
  flex: 0 1 auto;
  min-height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--dark);
  line-height: 0;
}

.hero img { width: 100%; height: auto; display: block; }

/* Ужимается только картинка. Текстовым блокам сжатие запрещено: иначе flex
   отнимает высоту и у них, и строки обрезаются. */
.screen-body > *:not(.hero) { flex-shrink: 0; }

/* Заголовок первого экрана виден на самой картинке, в вёрстке он скрыт —
   но остаётся в разметке для программ чтения с экрана. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Варианты ответа ------------------------------------------------------ */

.pick-note {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-top: -2px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 11px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .1s ease;
}

.option:hover { border-color: var(--blue); }
.option:active { transform: scale(.995); }

/* галочка появляется только у выбранного: пустой кружок не отвлекает */
.option-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  color: transparent;
}

.option-mark svg { width: 13px; height: 13px; display: block; }

.option.is-on { border-color: var(--dark); background: var(--pastel-blue); }
.option.is-on .option-mark { background: var(--dark); border-color: var(--dark); color: #fff; }

.options.has-error .option { border-color: var(--orange); }

/* Компактные варианты — для контактного шага, где они соседствуют с полями.
   Сетка в две равные колонки, а не свободный перенос: варианты разной длины
   при переносе встают рвано, и шаг выглядит неаккуратно. */
.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;   /* длинный вариант переносится — ряды всё равно ровные */
  gap: 7px;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 42px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}

.chip:hover { border-color: var(--blue); }
.chip.is-on { background: var(--dark); border-color: var(--dark); color: #fff; }

/* Блок с вариантами внутри анкеты — всегда во всю строку: половина строки
   ломает сетку и оставляет пустое место справа. */
.field-block {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-title { font-size: 13.5px; color: var(--ink-soft); }

.field-block.has-error .chip { border-color: var(--orange); }

/* Подсказки про часовой пояс: город → пояс и пересчёт окна звонка в московское. */
.tz-note {
  grid-column: 1 / -1;
  margin-top: -2px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.35;
}

.tz-note[hidden] { display: none; }

/* Поле даты: подпись обычная, поэтому и высота меньше, чем у полей с
   всплывающей подписью. */
.field-date input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  appearance: none;
}

.field-date input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 175, 255, .18);
}

.field-date.has-error input { border-color: var(--orange); }

/* --- Анкета -------------------------------------------------------------- */

/* Анкета: поля в одну колонку, парные (телефон и возраст, просрочка и
   кредиторы) — по половине строки. */
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field { position: relative; grid-column: 1 / -1; }
.field.is-half { grid-column: span 1; }

.field-hint {
  display: block;
  margin: 4px 0 0 4px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  height: 58px;
  padding: 22px 16px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 175, 255, .18);
}

/* Подпись лежит поверх поля, поэтому её ширину надо ограничить руками:
   иначе длинная подпись (а её задаёт клиент в админке) переносится на вторую
   строку и вылезает из рамки, ломая соседнее поле в паре. Не влезло —
   обрезаем многоточием, вёрстка при этом остаётся целой. */
.field label {
  position: absolute;
  left: 17px;
  top: 18px;
  max-width: calc(100% - 33px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-soft);
  font-size: 15px;
  pointer-events: none;
  transition: top .14s ease, font-size .14s ease;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 9px;
  font-size: 11.5px;
}

.field.has-error input { border-color: var(--orange); }

.form-error {
  font-size: 14px;
  background: var(--pastel-yellow);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.form-error[hidden] { display: none; }

/* --- Экран связи --------------------------------------------------------- */

.done-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--pastel-green);
  color: var(--green);
  display: grid;
  place-items: center;
}

.done-mark svg { width: 28px; height: 28px; display: block; }

/* --- Кнопка -------------------------------------------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--dark);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 15px 24px;
  cursor: pointer;
  appearance: none;
  transition: background .15s ease, transform .1s ease;
}

.btn:hover { background: var(--dark-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.btn:focus-visible, .btn-plain:focus-visible, .option:focus-visible,
.chip:focus-visible, .back:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* Второстепенное действие: «пока просто смотрю» не должно спорить с основной
   кнопкой, но и прятать его нечестно. */
.btn-plain {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.btn-plain:hover { color: var(--ink); background: var(--grey); }

/* --- Кнопка «назад» ------------------------------------------------------- */

.back {
  width: 28px;
  height: 28px;
  padding: 5px;
  margin-right: 6px;
  border: 0;
  border-radius: 50%;
  background: var(--grey);
  color: var(--ink-soft);
  cursor: pointer;
  flex: 0 0 auto;
}

.back[hidden] { display: none; }
.back:hover { color: var(--ink); }
.back svg { width: 100%; height: 100%; display: block; }

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

.consent { font-size: 11.5px; line-height: 1.35; color: var(--ink-soft); text-align: center; margin-top: 10px; }

@media (max-height: 720px) {
  .screen-body { gap: 10px; justify-content: flex-start; }
  .facts { padding: 13px; }
  .fields { gap: 8px; }
  .field-hint { display: none; }
  .options { gap: 7px; }
  .option { padding: 11px 12px; font-size: 14.5px; }
  .facts { padding: 5px 12px; }
  .facts li { padding: 4px 0; gap: 10px; font-size: 14px; grid-template-columns: 26px 1fr; }
  .fact-mark { width: 26px; height: 26px; }
  .fact-mark svg { width: 15px; height: 15px; }
  h1 { font-size: 25px; }
  h2 { font-size: 21px; }
  .field input { height: 52px; padding-top: 20px; }
  .field label { top: 15px; }
  .done-mark { width: 46px; height: 46px; border-radius: 14px; }
  .done-mark svg { width: 23px; height: 23px; }
  .btn { min-height: 50px; font-size: 15.5px; padding: 13px 20px; }
}

@media (max-height: 600px) {
  .facts li { font-size: 14px; }
  .check { width: 28px; height: 28px; border-radius: 9px; }
  .fields { gap: 7px; }
  .field input { height: 48px; padding-top: 18px; font-size: 15px; }
  .field label { top: 14px; font-size: 14px; }
  .note, .consent { margin-top: 7px; }
  .chip { min-height: 38px; }
}

/* На низком экране одной подрезки картинки не хватает: пять пунктов, две
   кнопки и сноска занимают своё. Убираем подзаголовок первого экрана — то
   же самое сказано пунктами ниже. На остальных экранах подзаголовок нужен:
   там это пояснение к вопросу. */
@media (max-height: 700px) {
  .screen[data-screen="s1"] .sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
