:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-page:   #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --series-1:       #2a78d6; /* blue — основной акцент */
  --series-1-soft:  #cde2fb;
  --status-good:    #0ca30c;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-page:   #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);
    --series-1:       #3987e5;
    --series-1-soft:  #184f95;
    --status-good:    #0ca30c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface-page);
  color: var(--text-primary);
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--series-1); }

.badge-demo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a5a00;
  background: #fff2d6;
  border: 1px solid #f0d090;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge-demo.inline { display: inline-block; margin-bottom: 16px; }

.stage {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 60px;
}

.screen { width: 100%; max-width: 560px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.hero h1 { font-size: 28px; margin: 0 0 12px; line-height: 1.25; }
.lead { font-size: 16px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 24px; }
.fine-print { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 16px; }

.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--series-1); color: #ffffff; }
.btn-primary:not(:disabled):hover { opacity: 0.92; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.progress-wrap { margin-bottom: 14px; }
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--gridline);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--series-1);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.progress-label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.question-category {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--series-1);
  margin-bottom: 10px;
}
.question-prompt { font-size: 20px; line-height: 1.4; margin: 0 0 22px; }

.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option:hover { border-color: var(--series-1); }
.option.selected {
  border-color: var(--series-1);
  background: var(--series-1-soft);
  color: var(--text-primary);
}
.option .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--baseline);
  flex: none;
}
.option.selected .dot { border-color: var(--series-1); background: var(--series-1); }

/* ---------- Визуальные матрицы (тест) ---------- */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 0 auto 22px;
}
.matrix-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-page);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
.matrix-cell-missing {
  background: var(--series-1-soft);
  border-color: var(--series-1);
  color: var(--series-1);
}
.matrix-svg { width: 100%; height: 100%; display: block; }

.matrix-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 420px) {
  .matrix-options { grid-template-columns: repeat(2, 1fr); }
}
.matrix-option {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.matrix-option:hover { border-color: var(--series-1); }
.matrix-option.selected {
  border-color: var(--series-1);
  background: var(--series-1-soft);
}

.nav-row { display: flex; gap: 10px; }
.nav-row .btn { width: auto; flex: 1; margin-top: 0; }

.lock-icon { font-size: 40px; margin-bottom: 8px; }
.price-tag {
  font-size: 32px;
  font-weight: 700;
  color: var(--series-1);
  margin: 8px 0 24px;
}

.pay-card h2 { margin-top: 0; }
.pay-amount { font-size: 28px; font-weight: 700; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-page);
  color: var(--text-primary);
  font-size: 15px;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.result-hero { text-align: center; margin-bottom: 28px; }
.iq-label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.iq-value { font-size: 56px; font-weight: 700; color: var(--series-1); line-height: 1.1; margin: 4px 0; }
.iq-percentile { font-size: 15px; color: var(--text-secondary); }

.chart-wrap { margin-bottom: 20px; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.category-chart { width: 100%; height: auto; display: block; }

.result-footer { margin-top: 8px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.result-actions .btn { flex: 1 1 auto; min-width: 160px; }

.referral-credit-box {
  background: var(--series-1-soft);
  border: 1px solid var(--series-1);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.referral-credit-box p { margin: 0 0 12px; font-size: 14px; color: var(--text-primary); }
.referral-credit-box .btn { width: auto; }

.referral-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.referral-box h3 { margin: 0 0 6px; font-size: 15px; }
.referral-link-row { display: flex; gap: 8px; margin-top: 10px; }
.referral-link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-page);
  color: var(--text-secondary);
  font-size: 13px;
}
.referral-link-row .btn { width: auto; margin-top: 0; padding: 10px 16px; white-space: nowrap; }

.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .card { padding: 24px 18px; }
  .iq-value { font-size: 46px; }
}

/* ---------- Лендинг: расширенные секции ---------- */
.screen-wide { max-width: 760px; }

.section-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}

.steps-section, .trust-section, .faq-section, .example-section {
  margin-top: 40px;
}

.example-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  max-width: 560px;
  margin: 0 auto;
}
.example-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-page);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.example-fine-print {
  text-align: center;
  max-width: 480px;
  margin: 16px auto 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.step-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px;
}
.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--series-1);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.step-card h3 { font-size: 16px; margin: 0 0 8px; }
.step-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

.trust-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.trust-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 18px;
}
.trust-icon { font-size: 22px; margin-bottom: 10px; }
.trust-card h3 { font-size: 15px; margin: 0 0 6px; }
.trust-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

.faq-item {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 18px;
  margin-bottom: 10px;
}
.faq-item summary {
  cursor: pointer;
  padding: 14px 0;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 12px;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 16px;
}

@media (max-width: 640px) {
  .steps-grid { grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
}

/* ---------- Когнитивный профиль (результат) ---------- */
.profile-wrap { margin-bottom: 20px; }
.profile-band {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  background: var(--surface-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.profile-band strong { color: var(--text-primary); }
.profile-notes p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.profile-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.profile-tag-good { background: rgba(12,163,12,0.12); color: var(--status-good); }
.profile-tag-neutral { background: var(--gridline); color: var(--text-secondary); }

/* ---------- Футер ---------- */
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.footer-nav a {
  color: var(--text-secondary);
  font-size: 12.5px;
  text-decoration: none;
}
.footer-nav a:hover { text-decoration: underline; color: var(--text-primary); }

/* ---------- Юридические страницы (oferta/privacy/cookies) ---------- */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  line-height: 1.65;
}
.legal-page h1 { font-size: 26px; margin-bottom: 6px; }
.legal-page .legal-updated { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.legal-page h2 { font-size: 18px; margin: 32px 0 10px; }
.legal-page p, .legal-page li { color: var(--text-secondary); font-size: 15px; }
.legal-page a { color: var(--series-1); }
.legal-page .back-link { display: inline-block; margin-bottom: 24px; font-size: 14px; }
.legal-page .placeholder { background: #fff2d6; color: #8a5a00; padding: 1px 5px; border-radius: 4px; }

/* ---------- Печатная версия отчёта результата ---------- */
/* Активируется кнопкой "Печать / PDF-отчёт" на экране результата (window.print()).
   Печатаем только сам отчёт: топбар, футер, кнопки действий и подсказки для
   печати скрываем, карточку растягиваем на всю ширину листа и принудительно
   переводим на светлую схему (чтобы не расходовать чёрные чернила и чтобы
   текст читался при печати даже если у пользователя была включена тёмная тема). */
@media print {
  body { background: #ffffff; }
  .topbar, .footer, .result-actions, #shareNote, .referral-box, .referral-credit-box { display: none !important; }
  .stage { padding: 0; }
  .screen-result .card {
    box-shadow: none;
    border: none;
    max-width: 100%;
    background: #ffffff;
    color: #0b0b0b;
  }
  .screen-result { max-width: 100%; }
  .iq-value { color: #1c4f8f; }
  .profile-band, .profile-notes p, .lead, .fine-print { color: #1a1a1a; }
}
