/* Quiz — интерактивная самопроверка. Warm-editorial: forest #2F5B4F, Lora+Inter. */
.qz {
  --qz-bg:     #FAF7F2;
  --qz-fg:     #1C1A17;
  --qz-accent: #2F5B4F;
  --qz-muted:  #8A817A;
  --qz-border: rgba(47, 91, 79, 0.18);
  --qz-card:   #fff;
  max-width: 60rem;
  margin: 2rem auto 4rem;
  padding: 0 1rem;
  color: var(--qz-fg);
}
.qz h1 {
  font-family: 'Lora', 'Iowan Old Style', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.qz-intro { color: var(--qz-muted); max-width: 44rem; }

/* ---- setup (выбор фаз) ---- */
.qz-setup h2 { font-family: 'Lora', Georgia, serif; font-weight: 600; font-size: 1.15rem; }
.qz-mode { margin: 1.6rem 0 0; padding: 0 0 1.8rem; border-bottom: 1px solid var(--qz-border); }
.qz-mode:last-of-type { border-bottom: none; padding-bottom: 0; }
.qz-mode h2 { font-size: 1.3rem; margin-bottom: .2rem; }
.qz-mode-intro { color: var(--qz-muted); margin: 0 0 .9rem; max-width: 44rem; }
.qz-phases {
  display: flex; flex-direction: column;
  margin: .6rem 0 1.2rem;
  border: 1px solid var(--qz-border); border-radius: 10px; overflow: hidden;
  background: var(--qz-card);
}
.qz-phases label {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .9rem; margin: 0; cursor: pointer;
  border-top: 1px solid var(--qz-border);
  font-size: .95rem;
}
.qz-phases label:first-child { border-top: none; }
.qz-phases label:hover { background: rgba(47, 91, 79, 0.05); }
.qz-phases label > span:not(.qz-n) { flex: 1; }
.qz-phases .qz-n { margin-left: auto; color: var(--qz-muted); font-variant-numeric: tabular-nums; }
.qz-all-row {
  font-weight: 600; margin: .2rem 0 .7rem; padding: .55rem .9rem;
  background: rgba(47, 91, 79, 0.06); border: 1px solid var(--qz-border); border-radius: 10px;
}
.qz-all-row label { display: flex; align-items: center; gap: .65rem; margin: 0; cursor: pointer; }
.qz-shuffle-row { margin: .2rem 0 1rem; }
.qz-shuffle-row label { display: inline-flex; align-items: center; gap: .5rem; margin: 0; cursor: pointer; }

/* ---- runner: 2 колонки ---- */
.qz-run { display: grid; grid-template-columns: 13rem 1fr; gap: 2rem; align-items: start; }

/* левый sticky-прогресс */
.qz-aside { position: sticky; top: 5rem; }
.qz-phase-tag {
  display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--qz-accent);
  background: rgba(47,91,79,.09); padding: .2rem .55rem; border-radius: 20px;
}
.qz-count { font-family: 'Lora', Georgia, serif; font-size: 2.4rem; line-height: 1; margin: .7rem 0 .15rem; font-variant-numeric: tabular-nums; }
.qz-count b { color: var(--qz-accent); }
.qz-count span { color: var(--qz-muted); font-size: 1.3rem; }
.qz-of { color: var(--qz-muted); font-size: .85rem; margin: 0 0 1rem; }
.qz-track { height: 8px; border-radius: 6px; background: var(--qz-border); overflow: hidden; }
.qz-fill { height: 100%; width: 0; background: var(--qz-accent); border-radius: 6px; transition: width .35s ease; }
.qz-aside .qz-restart-link {
  display: inline-block; margin-top: 1.1rem; font-size: .85rem; color: var(--qz-muted);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline;
}

/* правая карточка вопроса */
.qz-card {
  background: var(--qz-card); border: 1px solid var(--qz-border);
  border-radius: 14px; padding: 1.6rem 1.8rem; box-shadow: 0 1px 3px rgba(28,26,23,.05);
}
.qz-q { font-family: 'Lora', Georgia, serif; font-size: 1.35rem; line-height: 1.4; font-weight: 600; margin: 0 0 1rem; }
.qz-prompt { margin: 0 0 1.2rem; line-height: 1.6; }
.qz-prompt > :first-child { margin-top: 0; } .qz-prompt > :last-child { margin-bottom: 0; }
.qz-prompt pre { background: var(--qz-bg); border: 1px solid var(--qz-border); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; font-size: .88rem; }
.qz-answer pre { background: #fff; border: 1px solid var(--qz-border); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; }
.qz-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.qz-btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 9px;
  padding: .55rem 1.1rem; border: 1.5px solid var(--qz-accent); width: auto;
}
.qz-btn-primary { background: var(--qz-accent); color: #fff; }
.qz-btn-primary:hover { background: #264a40; }
.qz-btn-ghost { background: transparent; color: var(--qz-accent); }
.qz-btn-ghost:hover { background: rgba(47,91,79,.07); }
.qz-answer {
  margin-top: 1.3rem; padding: 1.1rem 1.3rem; border-left: 3px solid var(--qz-accent);
  background: var(--qz-bg); border-radius: 0 10px 10px 0; line-height: 1.6;
}
.qz-answer :first-child { margin-top: 0; } .qz-answer :last-child { margin-bottom: 0; }
.qz-answer a { color: var(--qz-accent); font-weight: 600; }
.qz-answer pre, .qz-answer code { font-size: .9em; }

/* done */
.qz-done-card { text-align: center; padding: 2.5rem 1.5rem; }
.qz-done-card h2 { font-family: 'Lora', Georgia, serif; }

/* мобильная: прогресс сверху горизонтально */
@media (max-width: 720px) {
  .qz-run { grid-template-columns: 1fr; gap: 1rem; }
  .qz-aside { position: static; display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
  .qz-count { font-size: 1.5rem; margin: 0; }
  .qz-of { display: none; }
  .qz-track { flex: 1 1 8rem; }
  .qz-card { padding: 1.3rem 1.2rem; }
  .qz-q { font-size: 1.2rem; }
}

/* Раннер: не прижимать к шапке, карточке — вес (не «плашка» в пустоте). */
.qz-run { margin-top: 1.6rem; }
.qz-card { min-height: 22rem; display: flex; flex-direction: column; }
.qz-card .qz-actions { margin-top: auto; }
@media (max-width: 900px) { .qz-card { min-height: 0; } }

/* Чекбоксы — в палитре (pico по умолчанию красит в свой синий/минт). */
.qz input[type="checkbox"] {
  accent-color: var(--qz-accent);
}
.qz input[type="checkbox"]:checked,
.qz input[type="checkbox"]:checked:active,
.qz input[type="checkbox"]:checked:focus {
  background-color: var(--qz-accent);
  border-color: var(--qz-accent);
}

/* Мобила: контент ответа не должен распирать grid-колонку за экран.
   min-width:auto у grid-items позволяет широким pre/таблицам выталкивать
   колонку шире вьюпорта — прижимаем и даём внутренний скролл. */
.qz-run > * { min-width: 0; }
.qz-card { min-width: 0; overflow-wrap: break-word; }
.qz-answer table,
.qz-prompt table { display: block; max-width: 100%; overflow-x: auto; }
.qz-answer code,
.qz-prompt code { word-break: break-word; }
.qz-answer pre code,
.qz-prompt pre code { word-break: normal; }

/* CTA в финале опроса: мост из самопроверки в курсы/программу. */
.qz-done-cta {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(47, 91, 79, 0.15);
}
.qz-done-cta p { margin: 0 0 .8rem; color: var(--qz-muted, #6b6b6b); }
.qz-done-cta-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.qz-done-cta-primary,
.qz-done-cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none !important;
  white-space: nowrap;
}
.qz-done-cta-primary {
  background: var(--qz-accent, #2F5B4F);
  color: #fff !important;
  border: 1px solid var(--qz-accent, #2F5B4F);
}
.qz-done-cta-primary:hover { opacity: .9; }
.qz-done-cta-secondary {
  border: 1px solid rgba(47, 91, 79, 0.4);
  color: var(--qz-accent, #2F5B4F) !important;
  background: #fff;
}
.qz-done-cta-secondary:hover { background: rgba(47, 91, 79, 0.08); }
