:root {
  --bg:        #f6f6f4;
  --card:      #ffffff;
  --ink:       #18181b;
  --muted:     #6b7280;
  --line:      #ececec;
  --accent:    #15a06a;
  --accent-dk: #128a5b;
  --correct:   #15a06a;
  --wrong:     #e0564a;
  --correct-bg:#e8f6ef;
  --wrong-bg:  #fcebe9;
  --radius:    18px;
  --shadow:    0 18px 50px -24px rgba(17, 24, 39, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system,
    'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: calc(100vh - 160px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(20px, 6vw, 72px) 20px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  padding: clamp(28px, 5vw, 56px);
}

.title {
  font-size: clamp(1.7rem, 4.4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 28px;
}
.title.small { font-size: clamp(1.4rem, 3.6vw, 1.9rem); margin-bottom: 14px; }

.subtitle {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
  text-align: center;
  max-width: 30em;
  margin: 0 auto 30px;
}

/* ---------- Hero image ---------- */
.hero-img {
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 28px;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #eef1f0, #e2e8e5);
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-img.img-fallback { background: linear-gradient(135deg, #d9f0e6, #c8e6f0); }

/* ---------- Button ---------- */
.btn {
  display: block;
  width: max-content;
  min-width: 180px;
  margin: 0 auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 38px;
  font: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
  box-shadow: 0 12px 24px -12px rgba(21, 160, 106, .7);
}
.btn:hover { background: var(--accent-dk); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ---------- Homepage list ---------- */
.hero-list .subtitle { margin-bottom: 14px; }
.quiz-list { display: flex; flex-direction: column; gap: 18px; margin-top: 28px; }
.quiz-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.quiz-item:hover {
  border-color: #d7d7d4;
  box-shadow: 0 14px 30px -22px rgba(17,24,39,.35);
  transform: translateY(-2px);
}
.quiz-item-title { font-size: 1.16rem; font-weight: 700; margin: 0 0 8px; }
.quiz-item-desc { color: var(--muted); font-size: .96rem; line-height: 1.6; margin: 0; }
.empty { color: var(--muted); text-align: center; }

/* ---------- Screens ---------- */
.screen { display: none; animation: fade .35s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Progress ---------- */
.progress-wrap { margin-bottom: 26px; }
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: .85rem; font-weight: 600; color: var(--muted);
  margin-bottom: 10px;
}
.progress-bar { height: 7px; background: #eee; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

/* ---------- Question ---------- */
.question-text {
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.question-img { margin-bottom: 22px; }

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  text-align: left;
  background: #fafafa;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 16px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.option:hover:not(.disabled) { border-color: var(--accent); background: #f3faf6; }
.option.disabled { cursor: default; }
.option.correct { border-color: var(--correct); background: var(--correct-bg); }
.option.picked-wrong { border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong); }
.option.picked-correct { border-color: var(--correct); background: var(--correct-bg); color: var(--accent-dk); }

.explanation {
  margin: 22px 0 0;
  padding: 16px 18px;
  background: #f6f8f7;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  color: #444;
  font-size: .95rem;
  line-height: 1.6;
}
#nextBtn { margin-top: 28px; }


/* ---------- Result ---------- */
#screen-result { text-align: center; }
.score-ring {
  width: 170px; height: 170px;
  margin: 8px auto 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--correct-bg);
  border: 8px solid var(--accent);
  font-weight: 800;
}
.score-ring #scoreNum { font-size: 3.4rem; color: var(--accent-dk); line-height: 1; }
.score-ring .score-total { font-size: 1.4rem; color: var(--muted); align-self: flex-end; margin-bottom: 26px; }
.result-msg { color: var(--muted); font-size: 1.08rem; line-height: 1.6; max-width: 26em; margin: 0 auto 30px; }
.link-back {
  display: inline-block; margin-top: 18px;
  color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 600;
  border-bottom: 1px solid transparent;
}
.link-back:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 34px 20px;
}
.footer-links { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; }
.footer-links a:hover { color: var(--ink); }
.lang-select { margin-bottom: 16px; }
.lang-select select {
  font: inherit; font-size: .9rem; color: var(--ink);
  padding: 7px 30px 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer;
}
.copyright { color: var(--muted); font-size: .85rem; margin: 0; }

@media (max-width: 480px) {
  .btn { width: 100%; }
}

/* ---- About page ---- */
.about-card { text-align: left; }
.about-card .title, .about-card .subtitle { text-align: center; }
.about-card .subtitle { margin-left: auto; margin-right: auto; }
.about-h {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 26px 0 10px;
}
.about-card p { line-height: 1.65; margin: 0 0 12px; }
.about-list { margin: 0 0 8px; padding-left: 20px; line-height: 1.6; }
.about-list li { margin: 0 0 8px; }
.about-card .btn { display: inline-block; margin-top: 22px; }

/* ---- About: legal info block ---- */
.legal-info { font-size: .92rem; color: var(--muted); line-height: 1.55; }
.legal-info p { margin: 0 0 8px; }
.legal-info strong { color: var(--ink); }

/* ---- Footer imprint ---- */
.imprint { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.imprint-title { font-weight: 700; color: var(--ink); margin-bottom: 2px; }

/* ---- Контейнер баннерной платформы ----
   Карточки и их стили приходят вместе со сниппетом; здесь только место под них.
   Свой CSS карточек удалён: мёртвые правила потом принимают за рабочие.

   Контейнер стоит внутри #screen-reveal — экрана между вопросами и результатом.
   На вопросах он не существует в отрисовке вообще: скрывает .screen{display:none}.
   Отдельного правила «скрыть заранее» здесь нет намеренно: одна точка отказа
   лучше двух. */
.quiz-layout { display: flex; gap: 28px; align-items: flex-start; justify-content: center; width: 100%; flex-wrap: wrap; }
/* Баннер под кнопкой: кнопка остаётся первым действием на экране, баннер —
   вторым. Отступ сверху заметный, чтобы промах по кнопке не попадал в баннер. */
/* пустой контейнер не должен занимать место и ломать отступы */
/* Страховка инварианта: контейнер вне экрана результата виден на вопросах,
   а этого быть не должно ни при каких условиях. Если такой появится — он
   останется скрытым, а не «заработает» молча. */

#screen-reveal { text-align: center; }
#screen-reveal .btn { max-width: 320px; margin-left: auto; margin-right: auto; }


/* Stack the rail below the card on narrow screens */
@media (max-width: 920px) {
  .quiz-layout { flex-direction: column; align-items: center; }
}

/* ---------- Плашка тестового режима ----------
   Только для ссылки из админки. Намеренно заметная и вверху страницы: тестовый
   заход не должен выглядеть как обычный, иначе легко «проверить» на боевом
   трафике и потом не понять, откуда цифры. */
.test-bar {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
  padding: 10px 16px; background: #1f2937; color: #e5e7eb;
  font-size: .86rem; line-height: 1.5;
}
.test-bar b { color: #fff; }
.test-bar .test-ok  { color: #6ee7b7; }
.test-bar .test-bad { color: #fca5a5; }
.test-bar .test-note { color: #9ca3af; margin-left: auto; }

/* ============================================================
   СПЛИТ ДИЗАЙНОВ КВИЗА (App\Quizzes::DESIGNS, выбор — App\Designs::pick)

   q0 — то, что было до сплита: ни одной строки ниже на него не действует.
   Он контрольный, иначе не с чем сравнивать.

   Аудитория 40+, поэтому у всех четырёх новых вариантов общий пол: вопрос и
   варианты ответа не мельче 18px, по варианту можно попасть пальцем не целясь
   (не ниже 56px), контраст выше дефолтного. Различаются тем, чем берут.
   ============================================================ */
[data-design^="q"]:not([data-design="q0"]) .option{min-height:56px;display:flex;align-items:center}
[data-design^="q"]:not([data-design="q0"]) .btn{min-height:56px;font-weight:700}

/* ---------- q1 «Крупный» — та же сетка, доведённая до читаемой ----------
   Ничего не переосмысляем: только размеры. Ближайший сосед контрольного, по
   нему видно, сколько даёт один лишь кегль. */
[data-design="q1"] .question-text{font-size:clamp(1.5rem,3.6vw,1.85rem);line-height:1.3}
[data-design="q1"] .option{font-size:1.18rem;padding:17px 20px;border-radius:15px;border-width:2px}
[data-design="q1"] .btn{font-size:1.15rem;padding:17px 32px;border-radius:14px}
[data-design="q1"] .progress-meta{font-size:1rem}
[data-design="q1"] .explanation{font-size:1.1rem;line-height:1.6}

/* ---------- q2 «Крупные кнопки» — ответ как главный объект экрана ----------
   Вопрос спокойный, а варианты — крупные контрастные плашки во всю ширину с
   заметной рамкой. Расчёт на то, что человек ищет глазами, куда нажать, а не
   перечитывает вопрос. */
[data-design="q2"] .question-text{font-size:clamp(1.35rem,3.2vw,1.65rem);line-height:1.35;margin-bottom:28px}
[data-design="q2"] .options{gap:16px}
[data-design="q2"] .option{font-size:1.25rem;font-weight:600;padding:22px 22px;border-radius:16px;
  border-width:2.5px;background:#fff;min-height:68px}
[data-design="q2"] .option:hover{background:#f3faf6}
[data-design="q2"] .btn{font-size:1.2rem;padding:19px 34px;border-radius:16px;width:100%;max-width:420px}

/* ---------- q3 «Контрастный» — тёмный вопрос, светлые ответы ----------
   Вопрос вынесен на тёмную плашку: он перестаёт сливаться со списком, и глаз
   каждый раз возвращается к нему, а не к предыдущему ответу. */
[data-design="q3"] .question-text{font-size:clamp(1.45rem,3.4vw,1.8rem);line-height:1.3;
  background:#14241c;color:#fff;margin:-4px -4px 26px;padding:22px 22px;border-radius:16px}
[data-design="q3"] .option{font-size:1.2rem;padding:18px 20px;border-radius:14px;border-width:2px;
  background:#fff;border-color:#cfd8d3}
[data-design="q3"] .option:hover{border-color:var(--accent)}
[data-design="q3"] .progress-bar{height:10px}
[data-design="q3"] .btn{font-size:1.15rem;padding:18px 32px;border-radius:14px}

/* ---------- q4 «Спокойный» — тёплый фон, серифный вопрос, воздух ----------
   Противоположная ставка: не давить контрастом, а снизить напряжение. Серифный
   вопрос и мягкий фон читаются как страница книги, а не как тест. */
[data-design="q4"]{background:#f7f4ee}
[data-design="q4"] .card{background:#fffdf8;border:1px solid #e8e0d2;box-shadow:none}
[data-design="q4"] .question-text{font-family:'Lora',Georgia,'Times New Roman',serif;
  font-size:clamp(1.5rem,3.6vw,1.9rem);line-height:1.32;color:#1d1813}
[data-design="q4"] .options{gap:14px}
[data-design="q4"] .option{font-size:1.2rem;padding:19px 22px;border-radius:10px;
  background:#fffdf8;border-color:#ded3c0;border-width:2px}
[data-design="q4"] .option:hover{background:#f6f1e6}
[data-design="q4"] .btn{background:#2f6f4e;font-size:1.18rem;padding:18px 34px;border-radius:10px}
[data-design="q4"] .explanation{font-size:1.1rem;line-height:1.65}

@media (max-width:640px){
  /* На телефоне кнопка «дальше» должна дотягиваться до краёв во всех вариантах. */
  [data-design^="q"]:not([data-design="q0"]) .btn{width:100%;max-width:none}
}
