:root {
  --blue: #008dff;
  --navy: #000048;
  --title: #212121;
  --text: #333;
  --muted: #75757d;
  --bg: #f7f8fb;
  --card: #fff;
  --danger: #e03939;
  --radius: 16px;
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  height: auto;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sheet {
  flex: 1 0 auto;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wrap {
  width: 100%;
  max-width: 490px;
  min-width: 0;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 60;
  background: #fff;
  padding: calc(8px + var(--safe-t)) 0 8px;
  border-bottom: 1px solid #eef0f4;
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 490px;
  height: 36px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.logo {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 18px;
  line-height: 24px;
  letter-spacing: -0.04em;
  color: var(--title);
  text-decoration: none;
}

.header__avg {
  --avg-scale: 1;
  margin: 0 0 0 auto;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  font-size: calc(12px * var(--avg-scale));
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.header__avg strong { color: var(--blue); font-weight: 700; }

body.is-quiz .header__avg { display: none; }

.main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main.doc {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.legal, .site-footer {
  flex: 0 0 auto;
}

.site-footer {
  background: #0e1323;
  color: #9aa3b8;
  padding: 16px 0 calc(14px + var(--safe-b));
}

.site-footer__copy {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.site-footer h3 {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.site-footer ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

.site-footer a {
  color: #c5cde0;
  text-decoration: none;
}

.site-footer a:hover { color: #fff; }

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding-bottom: 16px;
  border-bottom: 1px solid #232a3d;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  font-size: 11px;
  font-weight: 600;
}

.pay-marks {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pay-mark {
  display: inline-grid;
  place-items: center;
  height: 22px;
  min-width: 38px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: #2a3348;
}

.pay-mark--mir { background: #1a9f4a; }
.pay-mark--visa { background: #1a1f71; font-style: italic; }
.pay-mark--sbp { background: #5b2d8e; }

.pay-mark--mc {
  position: relative;
  width: 38px;
  min-width: 38px;
  background: #1b1f2a;
  overflow: hidden;
}

.pay-mark--mc::before,
.pay-mark--mc::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.pay-mark--mc::before { left: 6px; background: #eb001b; }
.pay-mark--mc::after { right: 6px; background: #f79e1b; }

body.is-quiz .site-footer { display: none; }

html:has(body.is-quiz),
body.is-quiz {
  height: 100%;
  overflow: hidden;
}

body.is-quiz .page,
body.is-quiz .sheet {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.is-quiz .main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.doc {
  overflow: visible;
  padding-top: 18px;
  padding-bottom: 28px;
}

.doc__back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.doc h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--title);
  margin-bottom: 12px;
}

.doc p, .doc li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 10px;
}

.doc ul { padding-left: 18px; margin-bottom: 12px; }

.home {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 18px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.home h1 {
  --hero-scale: 1;
  flex: 0 0 auto;
  font-size: calc(28px * var(--hero-scale));
  font-weight: 800;
  line-height: 1.15;
  color: var(--title);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.home h1 span { color: var(--blue); }

.home__descr {
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.4;
}

.home__descr span {
  color: var(--blue);
  font-weight: 700;
}

.home__preview {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 10px;
  margin-bottom: 14px;
  box-shadow: 0 0 32px rgba(33, 38, 52, 0.05);
  overflow: hidden;
}

.home__preview svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-width: 0;
  margin: 0 auto;
}

.home__body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.home__fit {
  --home-scale: 1;
  zoom: var(--home-scale);
}

.home__steps {
  flex: 0 0 auto;
  list-style: none;
  display: grid;
  gap: 8px;
}

.home__steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}

.home__steps span {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e8f4ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.home__steps b {
  display: block;
  font-size: 14px;
  color: var(--title);
}

.home__steps p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.anketa {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 18px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.anketa h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--title);
  margin-bottom: 10px;
}

.anketa__lead {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 18px;
}

.anketa__note {
  margin: 18px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #d07070;
  line-height: 1.4;
  text-align: center;
}

.anketa__label {
  font-size: 14px;
  font-weight: 800;
  color: var(--title);
  margin: 14px 0 8px;
}

.chips {
  display: grid;
  grid-template-columns: repeat(var(--chips-n, 3), minmax(0, 1fr));
  gap: 5px;
}

.chips[data-chips="gender"] { --chips-n: 2; }
.chips[data-chips="age"] { --chips-n: 4; }

.chip {
  appearance: none;
  border: 1.5px solid #e8ebf1;
  background: #fff;
  color: var(--title);
  border-radius: 10px;
  padding: 8px 2px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip.is-on {
  border-color: var(--blue);
  background: #eef7ff;
  color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 141, 255, 0.12);
}

.chips[data-chips="age"] .chip {
  font-size: 13px;
  padding: 10px 4px;
}

.anketa__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.screen-actions {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  touch-action: pan-y;
}

.quiz__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quiz__timer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 64px;
  margin: 0 0 0 auto;
  padding: 0 12px;
  flex: 0 0 auto;
  border: 1px dashed var(--blue);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--title);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quiz__timer .timer.is-warn { color: #e67a00; }
.quiz__timer .timer.is-hot { color: var(--danger); }

.progress { display: grid; gap: 10px; margin-bottom: 16px; flex: 0 0 auto; }

.progress__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.progress__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #212121;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.progress__track {
  height: 4px;
  background: #e4e7ee;
  border-radius: 99px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 4%;
  background: var(--blue);
  transition: width 0.25s ease;
}

.stage {
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border-radius: 24px;
  padding: 18px 14px 16px;
  box-shadow: 0 0 48px rgba(33, 38, 52, 0.06);
  overflow: hidden;
}

.stage h2 {
  --prompt-scale: 1;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  font-size: calc(18px * var(--prompt-scale));
  font-weight: 600;
  text-align: center;
  color: var(--title);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.quiz .btn-back {
  display: none !important;
}

.pick-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 12px 0 8px;
  text-align: center;
}

.stem {
  --stem-scale: 1;
  flex: 0 0 auto;
  width: 100%;
  margin: 8px 0 4px;
  overflow: hidden;
  line-height: 0;
  background: #fff;
}

.stem svg,
.stem .stem-photo {
  display: block;
  width: calc(100% * var(--stem-scale));
  height: auto;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.answers {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 320px);
  margin: 0 auto 8px;
}

.answer {
  appearance: none;
  border: 2px solid #e8ebf1;
  background: #fff;
  padding: 2px;
  border-radius: 10px;
  cursor: pointer;
  aspect-ratio: 1;
  width: 100%;
  max-width: 96px;
  position: relative;
  justify-self: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.answer svg,
.answer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.answer.is-on {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 141, 255, 0.16);
}

.answer:disabled { opacity: 1; }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
}

.btn-next {
  width: 100%;
  color: #fff;
  background: var(--blue);
}

.btn-next:disabled {
  opacity: 1;
  background: #cfd4de;
  color: #fff;
  cursor: default;
}

.btn-back {
  width: 100%;
  height: 40px;
  color: var(--title);
  background: #eceff4;
}

.result {
  display: none;
  padding-top: 28px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  text-align: center;
  overflow: hidden;
}

.result.is-on {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.result__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}

.result__kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.result h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--title);
  margin-bottom: 10px;
}

.result__score strong {
  display: block;
  font-size: 56px;
  line-height: 1;
  color: var(--blue);
}

.result__score span { color: var(--muted); font-size: 13px; font-weight: 700; }

.result__text {
  margin: 12px auto 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.result__review {
  margin: 16px 0 0;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
  text-align: left;
}

.result__review-kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result__bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.result__bars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 1.2fr) 36px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.result__bars span:first-child {
  font-weight: 700;
  color: var(--title);
  min-width: 0;
}

.result__bars b {
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.result__bar {
  height: 6px;
  background: #eceff4;
  border-radius: 99px;
  overflow: hidden;
}

.result__bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--blue);
}

.result__bar.is-weak i { background: #c5cad3; }
.result__bar.is-mid i { background: #7ab8ff; }
.result__bar.is-strong i { background: var(--blue); }

.result__review-copy {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.result__review-copy p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.result__meta {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  margin: 18px 0;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
}

.result__meta span { display: block; color: var(--muted); font-size: 12px; }
.result__meta b { font-size: 16px; color: var(--title); }
.result__meta.has-group #meta-all-row { grid-column: 1 / -1; }

.result__note { font-size: 12px; color: var(--muted); margin-bottom: 16px; }

.result__guest {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: #000048;
  color: #fff;
  border-radius: 99px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.result__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.result__fit {
  --result-scale: 1;
  zoom: var(--result-scale);
}

.pay {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 22px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.pay h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--title);
  margin-bottom: 8px;
}

.pay h1 span { color: var(--blue); }

.pay__kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pay__lead {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 16px;
}

.pay__price {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--title);
  line-height: 1.3;
}

.pay__price strong {
  color: var(--blue);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.pay__price-note {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}

.pay__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 10px;
  cursor: pointer;
}

.pay__consent input {
  appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 2px solid #cfd4de;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.pay__consent input:checked {
  border-color: var(--blue);
  background: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.2 6.6 11.2 12.5 4.8'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.pay__consent input:focus-visible {
  outline: 2px solid rgba(0, 141, 255, 0.35);
  outline-offset: 2px;
}

.pay__consent span {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--muted);
}

.pay__consent a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pay__field {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.pay__field span {
  font-size: 14px;
  font-weight: 700;
  color: var(--title);
}

.pay__field input {
  width: 100%;
  height: 48px;
  border: 2px solid #e8ebf1;
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  color: var(--title);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}

.pay__field input:focus {
  outline: none;
  border-color: var(--blue);
}

.pay__mail-note {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
}

.pay__seller {
  font-size: 13px;
  font-weight: 600;
  color: var(--title);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.pay__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.pay__error {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff5f5;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.pay__error.is-on { display: block; }

#yookassa-widget {
  margin-bottom: 12px;
}

.pay__test {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.pay__test b { color: var(--title); }

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.loading[hidden] { display: none; }

.loading p {
  max-width: 24ch;
  font-size: 18px;
  font-weight: 800;
  color: var(--title);
  line-height: 1.3;
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid #e4e7ee;
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
