/* Quiz popup + "Подобрать направление" quiz UI. Reuses design-system.css
   tokens and the existing .btn / .trial-form__field / .trial-form__consent /
   .trial-form__message classes so quiz controls look identical to the
   existing trial form; only the modal chrome and question layout are new. */

.quiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 36, 49, .50);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.quiz-overlay[hidden] { display: none; }

.quiz-dialog {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 30px 70px rgba(42, 27, 93, .28);
  max-width: 460px;
  width: 100%;
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  padding: 28px;
}

.quiz-dialog--teaser {
  max-width: 500px;
  padding: 34px 38px 28px;
  border-radius: 20px;
}

.quiz-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-dialog__close:hover { border-color: var(--brand-600); color: var(--brand-600); }

.quiz-teaser__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(110deg, #f0ebff, #f6efff);
  font-size: 15px;
  color: var(--brand-600);
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 18px;
}

.quiz-teaser__eyebrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.quiz-teaser__title {
  max-width: 410px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
  margin: 0 0 12px;
  padding-right: 28px;
}

.quiz-teaser__text {
  max-width: 420px;
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 16px;
  line-height: 1.45;
}

.quiz-teaser__meta {
  font-size: var(--text-small);
  color: var(--muted);
  margin: 0 0 20px;
}

.quiz-teaser__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-teaser__benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.quiz-teaser__benefit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #5f596c;
  font-size: 14px;
  line-height: 1.35;
}

.quiz-teaser__benefit svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  fill: none;
  stroke: var(--brand-600);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quiz-teaser__cta {
  min-height: 54px;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(100deg, #5230dc 0%, #6938e7 100%);
  box-shadow: 0 15px 30px rgba(84, 48, 216, .22);
  font-size: 17px;
  font-weight: 750;
}

.quiz-teaser__cta:hover {
  background: linear-gradient(100deg, #4827cb 0%, #5f30da 100%);
  box-shadow: 0 17px 34px rgba(84, 48, 216, .28);
}

.quiz-teaser__cta span {
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}

.quiz-teaser__secondary {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  text-align: center;
}

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

.quiz-step__progress {
  font-size: var(--text-small);
  color: var(--muted);
  margin: 0 0 6px;
}

.quiz-step__title {
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 16px;
  padding-right: 28px;
}

.quiz-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.quiz-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-card);
  cursor: pointer;
}

.quiz-choice:hover { border-color: var(--brand-500); }

.quiz-choice.is-selected {
  border-color: var(--brand-600);
  background: var(--brand-50);
  font-weight: 600;
}

.quiz-choice__hint {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: var(--text-small);
  margin-top: 3px;
}

.quiz-step__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.quiz-step__back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--text-small);
  cursor: pointer;
  padding: 6px 0;
}

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

.quiz-result__title { font-size: 24px; margin: 0 0 14px; padding-right: 28px; }
.quiz-result__text { color: var(--muted); margin: 0 0 14px; }
.quiz-result__list { margin: 0 0 16px; padding-left: 20px; color: var(--ink); }
.quiz-result__list li { margin-bottom: 4px; }
.quiz-result__missing { color: #795215; }

/* Result + contact form: a wider two-column dialog on desktop (left =
   preliminary result/recommendation, right = the form as its own panel),
   collapsing to one column on narrower screens and on the mobile sheet. */
.quiz-dialog--result {
  max-width: 1120px;
  padding: 32px;
  max-height: calc(100svh - 32px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 30px;
  box-shadow: 0 32px 90px rgba(27, 21, 53, .30);
}

.quiz-dialog--result .quiz-dialog__close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-color: #ded8e9;
  font-size: 25px;
  font-weight: 300;
}

.quiz-dialog--result > .quiz-result__title {
  max-width: 900px;
  margin: 0 58px 18px 0;
  font-size: clamp(30px, 2.7vw, 38px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.quiz-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
  gap: 24px;
  align-items: stretch;
}

.quiz-result-grid__left { min-width: 0; display: flex; flex-direction: column; }
.quiz-result-grid__left > .quiz-result__text {
  max-width: 650px;
  margin: 0 0 18px 2px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

@media (max-width: 940px) {
  .quiz-result-grid { grid-template-columns: 1fr; }
}

.quiz-recommend-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #faf9ff 0%, #f0edff 100%);
  border: 1px solid #ebe6ff;
  border-radius: 24px;
  padding: 24px 26px 26px;
  margin: 0;
}

.quiz-recommend-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.quiz-recommend-card__badge {
  display: inline-block;
  background: #e9e3ff;
  color: var(--brand-600);
  font-size: var(--text-small);
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
  margin: 0 0 12px;
}

.quiz-recommend-card__heading { max-width: 360px; font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.quiz-recommend-card__text { max-width: 410px; color: var(--muted); margin: 12px 0 20px; font-size: 15px; line-height: 1.5; }
.quiz-recommend-card__text--inline { margin-top: 0; }

.quiz-recommend-card__illustration {
  flex: 0 0 auto;
  width: 124px;
  height: 96px;
  margin: -3px -2px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.quiz-recommend-card__illustration svg { width: 100%; height: 100%; }

.quiz-recommend-card__bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-recommend-card__bullets li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.quiz-recommend-card__bullets li > div { display: flex; flex-direction: column; gap: 2px; }
.quiz-recommend-card__bullets strong { font-size: 15px; line-height: 1.35; color: var(--ink); }
.quiz-recommend-card__bullets span { font-size: 13px; line-height: 1.4; color: var(--muted); }

.quiz-recommend-card__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e9e3ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-600);
  font-size: 20px;
}

.quiz-recommend-card__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* .quiz-result-grid__right is a plain grid cell: .trial-form (styles.css)
   already supplies the bordered/shadowed panel look the mockup shows. */

.quiz-result-grid__right .trial-form {
  height: auto;
  min-height: 0;
  padding: 24px;
  border: 1px solid #e4def1;
  border-radius: 24px;
  background: rgba(255, 255, 255, .88);
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.quiz-contact-form__head strong,
.quiz-contact-form__head span { display: block; }
.quiz-contact-form__head strong { color: var(--ink); font-size: 20px; line-height: 1.25; }
.quiz-contact-form__head span { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.quiz-result-grid__right .trial-form__field { margin-top: 14px; }
.quiz-result-grid__right .trial-form__field > span { margin-bottom: 6px; font-size: 14px; line-height: 1.35; font-weight: 500; color: var(--ink); }
.quiz-result-grid__right .trial-form__field input {
  min-height: 48px;
  padding-inline: 15px;
  border: 1px solid #d8d1e6;
  border-radius: 14px;
  font-size: 16px;
}
.quiz-result-grid__right .trial-form__field input::placeholder { color: #aaa3b8; }
.quiz-result-grid__right .trial-form__consent { margin-top: 15px; font-size: 10px; line-height: 1.4; }
.quiz-result-grid__right .trial-form__privacy { margin-top: 8px; font-size: 10px; line-height: 1.4; }
.quiz-result-grid__right .trial-form .btn {
  min-height: 50px;
  margin-top: 18px;
  border-radius: 14px;
  background: linear-gradient(100deg, #5430d8 0%, #6c3ee9 100%);
  box-shadow: 0 12px 24px rgba(91, 54, 217, .18);
  font-size: 16px;
}
.quiz-contact-form__note { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: center; }
.quiz-result-grid__right .trial-form__message:empty { min-height: 0; margin: 0; }

.quiz-age-field {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--line);
  font-size: var(--text-card);
  margin: 0 0 18px;
}

.quiz-age-field:focus { outline: none; border-color: var(--brand-600); }

@media (max-width: 640px) {
  .quiz-overlay { align-items: flex-end; padding: 0; }
  .quiz-dialog {
    max-width: none;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: min(86svh, 640px);
    animation: quiz-sheet-in .22s ease-out;
  }
  .quiz-dialog--teaser {
    max-height: min(86svh, 640px);
    padding: 24px 20px 18px;
  }
  .quiz-dialog--teaser .quiz-dialog__close { top: 16px; right: 16px; }
  .quiz-teaser__eyebrow { margin-bottom: 16px; padding: 7px 12px; font-size: 13px; }
  .quiz-teaser__title { padding-right: 32px; font-size: 20px; }
  .quiz-teaser__text { margin-bottom: 18px; font-size: 15px; line-height: 1.45; }
  .quiz-teaser__benefits { grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
  .quiz-teaser__benefit br { display: none; }
  .quiz-teaser__benefit svg { width: 24px; height: 24px; flex-basis: 24px; }
  .quiz-teaser__cta { min-height: 52px; font-size: 17px; }
  .quiz-dialog--result { max-height: min(94svh, 900px); padding: 24px 18px 28px; }
  .quiz-dialog--result > .quiz-result__title { font-size: 28px; margin-right: 34px; }
  .quiz-result-grid { gap: 20px; }
  .quiz-result-grid__left > .quiz-result__text { font-size: 16px; }
  .quiz-recommend-card { padding: 22px; }
  .quiz-recommend-card__top { gap: 8px; }
  .quiz-recommend-card__heading { font-size: 23px; }
  .quiz-recommend-card__illustration { width: 96px; height: 80px; margin-top: -4px; }
  .quiz-result-grid__right .trial-form { padding: 22px 18px; }
}

@keyframes quiz-sheet-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-dialog { animation: none; }
}

.quiz-inline-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--brand-600);
  text-decoration: none;
}

.quiz-inline-cta:hover { text-decoration: underline; }
