:root {
  /* СвайСтрой: фирменный жёлтый доведён до спокойного золота, чёрный — до тёплого ink.
     Committed color strategy: один акцент несёт смысловую нагрузку (скидка, CTA, выбор),
     всё остальное — чистые нейтрали без "кремового ИИ-дефолта". */
  --ink: oklch(20% 0.014 55);
  --ink-soft: oklch(46% 0.014 55);
  --ink-faint: oklch(62% 0.01 55);

  --surface: oklch(99.2% 0.002 90);
  --surface-muted: oklch(96.3% 0.006 80);
  --surface-card: oklch(100% 0 0);

  --accent: oklch(80% 0.14 83);
  --accent-strong: oklch(72% 0.15 78);
  --accent-ink: oklch(24% 0.03 70);
  --accent-wash: oklch(95.5% 0.035 83);

  --line: oklch(90% 0.006 80);
  --line-strong: oklch(83% 0.008 80);

  --danger: oklch(55% 0.17 25);

  --shadow-1: 0 1px 2px oklch(30% 0.02 60 / 0.06);
  --shadow-2: 0 10px 30px oklch(30% 0.02 60 / 0.10);
  --shadow-3: 0 24px 60px oklch(30% 0.02 60 / 0.12);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Единая, сдержанная шкала скруглений — без «бабл»-пилюль на кнопках. */
  --r-card: 14px;
  --r-panel: 10px;
  --r-btn: 9px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--surface-muted);
  -webkit-font-smoothing: antialiased;
}

/* Без vh-единиц: страница живёт внутри iframe с авторесайзом высоты
   (см. initAutoResize в script.js) — 100vh здесь создал бы петлю роста,
   так как высота iframe снаружи зависит от высоты контента внутри. */
.quiz-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.quiz-page__footnote {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
  max-width: 640px;
}

/* Card */
.quiz-card {
  width: 100%;
  max-width: 860px;
  background: var(--surface-card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1), var(--shadow-2), var(--shadow-3);
  overflow: hidden;
}

/* Progress */
.quiz-progress {
  padding: 20px 32px 0;
}

.quiz-title {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.quiz-progress__row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quiz-progress__track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.quiz-progress__fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 380ms var(--ease-in-out);
}

.quiz-progress__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Body layout */
.quiz-body {
  display: grid;
  grid-template-columns: 1fr 248px;
}

.quiz-main {
  padding: 26px 32px 32px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.quiz-side {
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface-muted);
  border-left: 1px solid var(--line);
}

/* Question */
.quiz-question {
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), filter 220ms var(--ease-out);
}

.quiz-question.is-transitioning {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(2px);
}

.quiz-question__title {
  font-size: 23px;
  font-weight: 750;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.28;
  margin: 4px 0 20px;
  text-wrap: balance;
}

.quiz-options {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.quiz-options--image {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.quiz-option {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-panel);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.quiz-option:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1), 0 6px 16px oklch(30% 0.02 60 / 0.08);
  transform: translateY(-1px);
}

.quiz-option:active {
  transform: translateY(0) scale(0.985);
}

.quiz-option[aria-pressed="true"] {
  background: var(--accent-wash);
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px oklch(80% 0.14 83 / 0.18);
}

.quiz-option:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.quiz-option__check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
}

.quiz-option[aria-pressed="true"] .quiz-option__check {
  opacity: 1;
  transform: scale(1);
}

.quiz-options--image .quiz-option {
  padding: 10px;
  text-align: center;
}

.quiz-option__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 10px;
}

.quiz-option__label {
  display: block;
  padding: 0 2px;
}

/* Back row */
.quiz-back-row {
  margin-top: auto;
  padding-top: 18px;
}

.quiz-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  border: none;
  border-radius: var(--r-btn);
  padding: 13px 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out), opacity 150ms var(--ease-out);
}

.quiz-btn:active {
  transform: scale(0.97);
}

.quiz-btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.quiz-btn--primary:hover {
  background: var(--accent-strong);
}

.quiz-btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  padding-left: 4px;
}

.quiz-btn--ghost:hover {
  color: var(--ink);
}

.quiz-btn--wide {
  width: 100%;
  justify-content: center;
  padding: 15px 24px;
  font-size: 14.5px;
}

.quiz-btn--small {
  font-size: 12.5px;
  padding: 8px 10px;
}

/* Form */
.quiz-form {
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}

.quiz-form__title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 4px 0 4px;
  text-wrap: balance;
}

.quiz-form__subtitle {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.quiz-field {
  display: block;
  margin-bottom: 14px;
}

.quiz-field__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.quiz-field__optional {
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: none;
}

.quiz-field__required {
  color: var(--danger);
}

.quiz-field input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--surface-card);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.quiz-field input::placeholder {
  color: var(--ink-faint);
}

.quiz-field input:focus-visible {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px oklch(80% 0.14 83 / 0.22);
}

.quiz-field__error {
  display: block;
  min-height: 16px;
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  font-weight: 600;
}

.quiz-form__error {
  display: block;
  min-height: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
  text-align: center;
  margin: 10px 0 0;
}

.quiz-form__error:empty {
  margin: 0;
}

.quiz-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-top: 14px;
}

.quiz-consent input {
  margin-top: 2px;
  accent-color: var(--accent-strong);
}

.quiz-consent a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.quiz-consent a:hover {
  color: var(--ink);
}

/* Отдельная ошибка под чекбоксом согласия — не резервирует место, когда пусто */
[data-error-for="applicantConsent"] {
  display: block;
  min-height: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--danger);
  margin-top: 4px;
}

[data-error-for="applicantConsent"]:empty {
  margin-top: 0;
}

/* Success */
.quiz-success {
  text-align: center;
  padding: 8px 0 4px;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}

.quiz-success__icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-strong);
  margin: 0 auto 16px;
}

.quiz-success__title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.quiz-success__text {
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-size: 14px;
  max-width: 42ch;
  margin-inline: auto;
}

.quiz-success__lead {
  text-align: left;
  background: var(--surface-muted);
  border-radius: var(--r-panel);
  padding: 6px 18px;
  font-size: 13.5px;
}

.quiz-success__lead div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
}

.quiz-success__lead div + div {
  border-top: 1px solid var(--line);
}

.quiz-success__lead dt {
  color: var(--ink-soft);
  font-weight: 600;
}

.quiz-success__lead dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

/* Side */
.quiz-discount {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-panel);
  padding: 16px 18px;
  text-align: center;
}

.quiz-discount__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.75;
  margin-bottom: 4px;
}

.quiz-discount__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-block;
  transition: transform 260ms var(--ease-out);
}

.quiz-discount__value.is-bumped {
  transform: scale(1.1);
}

.quiz-discount__percent {
  font-size: 18px;
}

.quiz-bonuses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-bonuses li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 9px 14px;
}

.quiz-bonuses li svg {
  flex-shrink: 0;
  color: var(--accent-strong);
}

.quiz-assistant {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 14px;
}

.quiz-assistant__photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--surface-card), 0 0 0 3.5px var(--accent);
}

.quiz-assistant__name {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
}

.quiz-assistant__role {
  margin: 0;
  font-size: 11px;
  color: var(--ink-faint);
}

.quiz-assistant__tip {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 10px 12px;
}

/* Responsive */
@media (max-width: 720px) {
  .quiz-body {
    grid-template-columns: 1fr;
  }
  .quiz-side {
    border-left: none;
    border-top: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
  }
  .quiz-discount {
    flex: 1 1 140px;
  }
  .quiz-bonuses {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .quiz-assistant {
    flex: 1 1 100%;
  }
  .quiz-main {
    padding: 22px 20px 24px;
  }
  .quiz-progress {
    padding: 18px 20px 0;
  }
  .quiz-question__title {
    font-size: 20px;
  }
}

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