/* ============================================================
   _check.css — публичный блиц «Проверь себя» (/check/)
   Компоненты: .check-app (стартовый экран, карточка вопроса,
   варианты/чипы/ввод, фидбек, итог). Зависит от _base.css
   (палитра, --radius-*, --font-serif, .btn).
   ============================================================ */

.check-section { max-width: 1080px; }
.check-start-card, .check-result .check-card { max-width: 880px; margin-left: auto; margin-right: auto; }

.check-app { margin-top: 8px; }

/* ── Стартовый экран ── */
.check-start { padding: 8px 0 12px; }
.check-start-card { text-align: center; padding: 34px 38px 32px; }
.check-start-nums {
  display: flex; justify-content: center; gap: 46px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.check-start-num b {
  display: block;
  font-family: var(--font-serif); font-weight: 700;
  font-size: 40px; line-height: 1; color: var(--accent-1);
}
.check-start-num span {
  display: block; margin-top: 6px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--faint);
}
.check-start-lead {
  max-width: 620px; margin: 0 auto 24px;
  font-size: 16.5px; line-height: 1.65; color: var(--text);
}
.check-formats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 28px; text-align: left;
}
.check-format {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
}
.check-format i {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 50px; margin-bottom: 10px;
  background: var(--white); border: 1.5px solid var(--accent-2);
  font-family: var(--font-serif); font-style: normal; font-weight: 700;
  font-size: 14px; color: var(--accent-1);
}
.check-format b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.check-format span { display: block; font-size: 12px; line-height: 1.45; color: var(--faint); }

/* ── Раскладка блица: лента + приклеенная панель справа ── */
.check-quiz { display: grid; grid-template-columns: 1fr 176px; gap: 24px; align-items: start; }
.check-quiz[hidden] { display: none; }
.check-rail {
  position: sticky; top: 90px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 34px -22px rgba(28, 18, 10, 0.28);
  padding: 18px 18px 16px;
  text-align: center;
}
.check-rail-count {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 30px; line-height: 1; color: var(--text);
}
.check-rail-count b { color: var(--accent-1); }
.check-rail-count span { color: var(--faint); font-size: 22px; margin: 0 2px; }
.check-rail-cap {
  margin-top: 5px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--faint);
}
.check-rail .check-progress-bar { margin: 12px 0 14px; }
.check-rail-score {
  padding-top: 12px; border-top: 1px dashed var(--border);
}
.check-rail-score b {
  display: block;
  font-family: var(--font-serif); font-weight: 700;
  font-size: 26px; line-height: 1; color: var(--accent-1);
}
.check-rail-score span {
  display: block; margin-top: 4px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--faint);
}
.check-progress-bar {
  flex: 1; height: 6px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.check-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── Карточка вопроса ── */
.check-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 44px -24px rgba(28, 18, 10, 0.3);
  padding: 30px 34px 28px;
}

/* Лента: отвеченные карточки копятся сверху, новая приезжает снизу */
.check-feed { display: grid; gap: 20px; }
.check-item {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.check-item.is-in { opacity: 1; transform: none; }
.check-item.is-answered { border-left: 5px solid var(--border); }
.check-item.res-right { border-left-color: #2F6B5E; }
.check-item.res-part { border-left-color: #9C7A23; }
.check-item.res-wrong { border-left-color: #99392E; }
@media (prefers-reduced-motion: reduce) {
  .check-item { opacity: 1; transform: none; transition: none; }
}
.check-item-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.check-item-num {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 14px; color: var(--accent-1); white-space: nowrap;
}
.check-era {
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent-2);
}
.check-q {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 21px; line-height: 1.45;
  color: var(--text); margin-bottom: 20px;
}
.check-hint { font-size: 13px; color: var(--faint); margin-bottom: 12px; }

/* ── Варианты (single/multi/order) ── */
.check-opt {
  display: block; width: 100%; text-align: left;
  padding: 13px 16px; margin-bottom: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit; font-size: 15.5px; line-height: 1.45;
  color: var(--text); cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.check-opt:hover:not(:disabled) { border-color: var(--accent-2); }
.check-opt.picked {
  border-width: 2px; border-color: var(--accent-1);
  background: #FBF1ED; font-weight: 600; padding: 12.5px 15.5px;
}
.check-opt--order.picked .check-order-num {
  background: var(--accent-1); border-color: var(--accent-1); color: var(--white);
}
.check-opt.is-right {
  border-width: 2px; border-color: #2F6B5E; background: #DFEDE3;
  color: #1F3522; font-weight: 600; padding: 12.5px 15.5px;
}
.check-opt.is-right::after { content: '✓'; float: right; font-weight: 700; color: #2F6B5E; }
.check-opt.is-wrong {
  border-width: 2px; border-color: #99392E; background: #F4DBD6;
  color: #6E241B; padding: 12.5px 15.5px;
}
.check-opt.is-wrong::after { content: '✗'; float: right; font-weight: 700; color: #99392E; }
.check-opt:disabled { cursor: default; }
.check-opt--order.is-right::after, .check-opt--order.is-wrong::after { content: none; }

.check-opt--order { display: flex; align-items: center; gap: 12px; }
.check-order-num {
  flex: 0 0 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  font-family: var(--font-serif); font-weight: 700; font-size: 14px;
  color: var(--accent-1); background: var(--white);
}
.check-opt--order.is-right .check-order-num { border-color: #2F6B5E; color: #2F6B5E; }
.check-opt--order.is-wrong .check-order-num { border-color: #99392E; color: #99392E; }
.check-order-was {
  margin-left: auto; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: #99392E;
}

/* ── Соответствие ── */
.check-match-legend {
  margin: 0 0 18px; padding: 14px 18px;
  background: var(--bg); border-radius: var(--radius-md);
  list-style: none;
  font-size: 14.5px; line-height: 1.7;
}
.check-match-legend b { color: var(--accent-1); margin-right: 6px; }
.check-match-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 11px 0; border-bottom: 1px dashed var(--border);
}
.check-match-row:last-of-type { border-bottom: 0; }
.check-match-left { flex: 1 1 260px; font-size: 15px; font-weight: 600; }
.check-match-chips { display: flex; gap: 7px; }
.check-chip {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--white); font: inherit; font-weight: 700;
  font-size: 14px; color: var(--text); cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.check-chip:hover:not(:disabled) { border-color: var(--accent-2); }
.check-chip.picked { border-color: var(--accent-1); background: var(--accent-1); color: var(--white); }
.check-chip:disabled { cursor: default; opacity: 0.55; }
.check-chip.is-key {
  border-color: #2F6B5E; background: #2F6B5E; color: var(--white); opacity: 1;
}
.check-chip.is-miss {
  border-color: #99392E; background: transparent; color: #99392E;
  text-decoration: line-through; opacity: 1;
}
.check-match-row.is-right { background: #DFEDE3; border-radius: var(--radius-sm); padding-left: 10px; padding-right: 10px; }
.check-match-row.is-wrong { background: #F4DBD6; border-radius: var(--radius-sm); padding-left: 10px; padding-right: 10px; }
.check-match-row.is-right .check-match-key { color: #2F6B5E; }
.check-match-row.is-wrong .check-match-key { color: #99392E; }
.check-match-key { font-size: 13.5px; font-weight: 700; white-space: nowrap; }

/* ── Открытый ввод ── */
.check-input {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg); font: inherit; font-size: 16px; color: var(--text);
}
.check-input:focus { outline: none; border-color: var(--accent-2); }
.check-input.is-right { border-width: 2px; border-color: #2F6B5E; background: #DFEDE3; color: #1F3522; font-weight: 600; }
.check-input.is-wrong { border-width: 2px; border-color: #99392E; background: #F4DBD6; color: #6E241B; }
.check-hint--answer { margin-top: 10px; font-weight: 600; color: #2F6B5E; }

/* ── Фидбек и действия ── */
.check-feedback {
  margin-top: 16px; padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14.5px; line-height: 1.6;
  border: 1px solid var(--border); background: var(--bg);
}
.check-feedback.is-right { border-color: #2F6B5E; background: #DFEDE3; }
.check-feedback.is-right b { color: #1F3522; }
.check-feedback.is-part { border-color: #9C7A23; background: #F5EAD2; }
.check-feedback.is-part b { color: #6E5415; }
.check-feedback.is-wrong { border-color: #99392E; background: #F4DBD6; }
.check-feedback.is-wrong b { color: #6E241B; }
.check-actions { margin-top: 20px; display: flex; gap: 12px; }

/* ── Итог ── */
.check-result-top {
  display: flex; align-items: center; gap: 30px;
  margin: 16px 0 18px;
}
.check-result-ring { position: relative; width: 132px; height: 132px; flex: 0 0 auto; }
.check-result-ring svg { display: block; width: 100%; height: 100%; }
.check-ring-val {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.check-ring-val b {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 38px; line-height: 1; color: var(--text);
}
.check-ring-val span {
  margin-top: 3px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint);
}
.check-result-main { min-width: 0; }
.check-result-range {
  display: inline-block; padding: 8px 18px; margin-bottom: 12px;
  background: var(--accent-1); color: var(--white);
  border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
}
.check-result-text { font-size: 16px; line-height: 1.65; }
.check-result-topics { font-size: 14.5px; color: var(--muted); margin-bottom: 16px; }
.check-topics-cap { font-weight: 600; color: var(--text); margin-right: 4px; }
.check-topic-chip {
  display: inline-block; padding: 4px 12px; margin: 0 5px 6px 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; font-size: 13px; color: var(--text);
}
.check-result-gap {
  margin-bottom: 16px; padding: 16px 20px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.check-result-gap-title {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--accent-1); margin-bottom: 8px;
}
.check-result-gap ul { margin: 0; padding: 0; list-style: none; }
.check-result-gap li {
  position: relative; padding: 3px 0 3px 20px;
  font-size: 14px; line-height: 1.55; color: var(--text);
}
.check-result-gap li::before {
  content: '·'; position: absolute; left: 4px;
  font-weight: 700; color: var(--accent-2);
}
.check-result-note { font-size: 13.5px; color: var(--faint); line-height: 1.6; margin-bottom: 22px; }
.check-result-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .check-formats { grid-template-columns: repeat(3, 1fr); }
  /* Панель прогресса переезжает наверх горизонтальной плашкой */
  .check-quiz { grid-template-columns: 1fr; gap: 16px; }
  .check-rail {
    order: -1;
    position: sticky; top: 66px; z-index: 5;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 16px; border-radius: 999px;
    text-align: left; background: var(--bg);
  }
  .check-rail-count { font-size: 20px; white-space: nowrap; }
  .check-rail-count span { font-size: 16px; }
  .check-rail-cap { display: none; }
  .check-rail .check-progress-bar { flex: 1; margin: 0; }
  .check-rail-score { display: flex; align-items: baseline; gap: 6px; padding: 0; border: 0; white-space: nowrap; }
  .check-rail-score b { font-size: 18px; }
  .check-rail-score span { margin: 0; }
}
@media (max-width: 640px) {
  .check-card { padding: 20px 16px; border-radius: var(--radius-md); }
  .check-start-card { padding: 24px 18px 22px; }
  .check-start-nums { gap: 28px; }
  .check-start-num b { font-size: 32px; }
  .check-formats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .check-format:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .check-q { font-size: 18px; }
  .check-opt { font-size: 14.5px; }
  .check-match-left { flex-basis: 100%; }
  .check-result-top { flex-direction: column; text-align: center; gap: 18px; }
  .check-actions .btn, .check-result-actions .btn { width: 100%; justify-content: center; }
  .check-actions, .check-result-actions { flex-direction: column; }
}
