:root {
  --bg: #faf2e2;
  --ink: #2a1e14;
  --accent: #c96e4a;
  --pu: #a78bfa;
  --pu-d: #5b21b6;
  --gr: #65a30d;
  --gr-bg: #d4f7a8;
  --gr-ink: #3f6212;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-snap-type: y mandatory; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}

/* Прогресс-бар */
.pb { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: rgba(0,0,0,.05); z-index: 100; }
.pf { height: 100%; background: var(--accent); width: 0; transition: width .4s ease; }

/* Экраны (снап по вертикали) */
.screen { min-height: 100vh; scroll-snap-align: start; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 80px 20px 40px; }
.si { width: 100%; max-width: 680px; }
h1 { font-size: 24px; text-align: center; margin: 0 0 12px; font-weight: 700; line-height: 1.3; }
.sub { text-align: center; color: #7a6a55; margin: 0 0 32px; font-size: 16px; }

/* Кнопки и инпуты */
.btn { display: block; width: 100%; padding: 18px; background: var(--accent); color: #fff; border: none; border-radius: 12px; font-size: 18px; font-weight: 600; cursor: pointer; transition: background .2s; text-align: center; text-decoration: none; }
.btn:hover { background: #a8553a; }
.btn:disabled { background: #ccc; cursor: not-allowed; }

.form-control { width: 100%; padding: 16px; border: 2px solid var(--pu); border-radius: 12px; font-size: 16px; margin-bottom: 15px; background: #fff; }
.form-control:focus { outline: none; border-color: var(--accent); }

/* Вопросы */
.qn { text-align: center; color: #a89680; font-size: 14px; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 1.5px; }
.qt { font-size: 22px; font-weight: 600; line-height: 1.4; margin: 0 0 28px; text-align: center; }
.qopts { display: grid; gap: 10px; }

/* Варианты ответов (квадратики с галочкой) */
.opt { display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 56px; border: 2px solid var(--pu); border-radius: 12px; background: rgba(167,139,250,.07); color: var(--pu-d); font-size: 16px; cursor: pointer; transition: all .15s; user-select: none; }
.opt:hover { border-color: #8b5cf6; background: rgba(167,139,250,.14); }
.opt:has(input:checked) { background: var(--gr-bg); border-color: var(--gr); color: var(--gr-ink); }
.opt input { display: none; }
.ob { flex-shrink: 0; width: 28px; height: 28px; border: 2px solid var(--pu); border-radius: 6px; display: flex; align-items: center; justify-content: center; background: #fff; transition: all .15s; }
.ob::after { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--gr); transform: scale(0); transition: transform .15s; }
.opt:has(input:checked) .ob { border-color: var(--gr); }
.opt:has(input:checked) .ob::after { transform: scale(1); }

/* Экран загрузки (прыгающие буквы) */
.lo { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 1000; padding: 20px; opacity: 1; transition: opacity .4s ease; }
.lo[hidden] { display: none; }
.lo.fade-out { opacity: 0; pointer-events: none; }
.lt { font-size: clamp(28px, 8vw, 48px); font-weight: 800; letter-spacing: 2px; margin-bottom: 24px; white-space: nowrap; }
.letter { display: inline-block; --hue: calc(var(--i) * 30); color: hsl(var(--hue), 90%, 55%); animation: wave 1.4s ease-in-out infinite, hueCycle 3s linear infinite; animation-delay: calc(var(--i) * -.12s), 0s; }
@keyframes wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes hueCycle { from { --hue: calc(var(--i) * 30); } to { --hue: calc(var(--i) * 30 + 360); } }
.ls { color: #7a6a55; font-size: 15px; margin: 0; }

/* Результаты */
.rs { display: block; width: 100%; max-width: 900px; background: #fff; padding: 28px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); margin: 0 auto; }
.rs h2 { text-align: center; color: var(--accent); margin-bottom: 20px; }
.ai-text { white-space: pre-wrap; font-size: 16px; line-height: 1.6; color: #333; margin-bottom: 30px; }
[hidden] { display: none !important; }

/* ===== МЕТАЛЛИЧЕСКИЙ ПЕРЕЛИВ (SHIMMER) ===== */
.btn, .btn-primary, .tst-btn, button[type="submit"], .contact-btn {
    position: relative;
    overflow: hidden;
}

.btn::before, .btn-primary::before, .tst-btn::before, button[type="submit"]::before, .contact-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(30deg);
    transition: left 0.6s ease-in-out;
    pointer-events: none;
    z-index: 10;
}

.btn:hover::before, .btn-primary:hover::before, .tst-btn:hover::before, button[type="submit"]:hover::before, .contact-btn:hover::before {
    left: 150%;
}

@keyframes shimmerSweep {
    0% { left: -100%; }
    100% { left: 150%; }
}

.shimmer-trigger::before {
    animation: shimmerSweep 1.5s ease-in-out 2;
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ГРУПП ВОПРОСОВ ===== */
@media (max-width: 640px) {
  /* Групповые экраны не привязываем к снапу — пусть скроллятся естественно */
  .screen.question-group {
    min-height: auto;
    scroll-snap-align: none;
    padding: 20px 14px 80px;
  }
  .screen.question-group .qn {
    font-size: 12px;
    margin-bottom: 10px;
  }
  .screen.question-group .qt {
    font-size: 15px;
    line-height: 1.35;
    margin: 14px 0 8px;
  }
  .screen.question-group .qopts {
    gap: 6px;
    margin-bottom: 4px;
  }
  .screen.question-group .opt {
    padding: 10px 12px;
    min-height: 44px;
    font-size: 14px;
    border-width: 1.5px;
    border-radius: 10px;
  }
  .screen.question-group .ob {
    width: 22px;
    height: 22px;
  }
  /* Обычные (одиночные) экраны — оставляем как были */
  .screen:not(.question-group) {
    min-height: 100vh;
    scroll-snap-align: start;
  }
}

/* ===== ДЕСКТОП: группы вопросов в 2 колонки ===== */
@media (min-width: 641px) {
  .screen.question-group .si { max-width: 1000px; }
  .screen.question-group .qn { text-align: center; margin-bottom: 20px; }
  .screen.question-group .qgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
    align-items: start;
  }
  .screen.question-group .qitem {
    display: flex;
    flex-direction: column;
  }
  .screen.question-group .qt {
    font-size: 15px;
    line-height: 1.35;
    margin: 0 0 8px;
    text-align: left;
  }
  .screen.question-group .qopts {
    gap: 6px;
    margin: 0;
  }
  .screen.question-group .opt {
    padding: 9px 12px;
    min-height: 40px;
    font-size: 14px;
    border-width: 1.5px;
  }
  .screen.question-group .ob { width: 20px; height: 20px; }
}

/* ===== МОБИЛЬНЫЙ: та же структура, но в одну колонку ===== */
@media (max-width: 640px) {
  .screen.question-group .qgrid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .screen.question-group .qitem { display: block; }
}

/* ===== ФИКС: ГРУППА ВОПРОСОВ НЕ ОБРЕЗАЕТСЯ НА ДЕСКТОПЕ ===== */
@media (min-width: 641px) {
  .screen.question-group {
    min-height: auto;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-align: start;
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px 20px 100px;
  }

  .screen.question-group .si {
    margin: 0 auto;
  }

  .screen.question-group .qgrid {
    margin-bottom: 24px;
  }

  .screen.question-group .qitem:last-child {
    margin-bottom: 20px;
  }
}
