/* ============================================================
   Раздел «Тестирование» Allora. Официальные вопросы Росавиации
   (Приказ Минтранса России №42), ЧПС — самолёт. Один вопрос за
   раз, случайный порядок, мгновенная проверка и разбор ответа.
   Тёмная тема бренда, согласована с разделом «Глоссарий».
   ============================================================ */
:root {
  --bg:          #0e1117;
  --bg-soft:     #161b22;
  --bg-card:     #1c232c;
  --bg-card-2:   #222a35;
  --line:        #2a3340;
  --text:        #e6edf3;
  --text-dim:    #8b96a3;
  --text-muted:  #6b7480;
  --accent:      #6fb1ff;
  --accent-soft: rgba(111,177,255,0.10);
  --accent-line: rgba(111,177,255,0.30);
  --ok:          #35d07f;
  --ok-soft:     rgba(53,208,127,0.12);
  --ok-line:     rgba(53,208,127,0.45);
  --bad:         #ff6b6b;
  --bad-soft:    rgba(255,107,107,0.12);
  --bad-line:    rgba(255,107,107,0.45);
  --serif: "Iowan Old Style", "Charter", "Cambria", "Georgia", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(900px 500px at 90% -5%, #1c2a45 0%, transparent 60%),
    radial-gradient(700px 400px at -10% 10%, #16243a 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ---------------- Шапка ---------------- */
.ts-top {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,17,23,0.7);
  backdrop-filter: saturate(140%) blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.ts-top__brand { display: inline-flex; align-items: center; transition: opacity 0.2s; }
.ts-top__brand:hover { opacity: 0.8; }
.ts-top__brand img { height: 42px; width: auto; display: block; }
.ts-top__sep { width: 1px; height: 26px; background: var(--line); }
.ts-top__crumbs { font-size: 14px; color: var(--text-dim); }
.ts-top__crumbs .cur { color: var(--text); }

/* ---------------- Каркас ---------------- */
.ts-wrap { max-width: 820px; margin: 0 auto; padding: 40px 28px 80px; }
.ts-hero { margin-bottom: 26px; }
.ts-hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: 40px; line-height: 1.1; margin: 0 0 10px; letter-spacing: 0.01em;
}
.ts-hero p { color: var(--text-dim); font-size: 16px; line-height: 1.6; margin: 0; }
.ts-hero .ts-src { color: var(--text-muted); font-size: 13px; margin-top: 10px; }

/* ---------------- Карточка вопроса ---------------- */
.ts-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 26px 22px; box-shadow: 0 18px 40px -28px rgba(0,0,0,0.8);
}
.ts-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.ts-topic {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 100px; padding: 5px 12px;
}
.ts-id { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.ts-q {
  font-family: var(--serif); font-size: 22px; line-height: 1.4;
  color: var(--text); margin: 0 0 20px;
}

/* варианты */
.ts-opts { display: flex; flex-direction: column; gap: 10px; }
.ts-opt {
  display: flex; gap: 14px; align-items: flex-start;
  width: 100%; text-align: left;
  background: var(--bg-card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; cursor: pointer;
  color: var(--text); font-family: var(--sans); font-size: 15.5px; line-height: 1.5;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.ts-opt:hover:not(:disabled) { border-color: var(--accent-line); background: #262f3b; }
.ts-opt:active:not(:disabled) { transform: translateY(1px); }
.ts-opt:disabled { cursor: default; }
.ts-opt__key {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line);
  font-weight: 700; font-size: 13px; color: var(--text-dim); text-transform: uppercase;
}
.ts-opt__text { min-width: 0; padding-top: 2px; }

/* состояния после ответа */
.ts-opt.is-correct {
  border-color: var(--ok-line); background: var(--ok-soft);
}
.ts-opt.is-correct .ts-opt__key { background: var(--ok); border-color: var(--ok); color: #06231a; }
.ts-opt.is-wrong {
  border-color: var(--bad-line); background: var(--bad-soft);
}
.ts-opt.is-wrong .ts-opt__key { background: var(--bad); border-color: var(--bad); color: #2a0808; }
.ts-opt.is-dim { opacity: 0.6; }

/* ---------------- Разбор ---------------- */
.ts-feedback { margin-top: 20px; display: none; }
.ts-feedback.is-shown { display: block; animation: tsIn 0.25s ease; }
@keyframes tsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ts-verdict {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 10px;
}
.ts-verdict__icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.ts-verdict.ok    { color: var(--ok); }
.ts-verdict.bad   { color: var(--bad); }
.ts-verdict.ok  .ts-verdict__icon { background: var(--ok-soft);  border: 1px solid var(--ok-line); }
.ts-verdict.bad .ts-verdict__icon { background: var(--bad-soft); border: 1px solid var(--bad-line); }

.ts-explain {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0;
  padding: 14px 16px; color: var(--text-dim); font-size: 15px; line-height: 1.6;
}
.ts-explain b { color: var(--text); font-weight: 600; }
.ts-explain .ts-explain__correct { color: var(--text); }
.ts-explain .ts-explain__na { color: var(--text-muted); font-style: italic; }

/* панель кнопок */
.ts-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.ts-next {
  appearance: none; border: 1px solid var(--accent-line);
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 12px 26px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.ts-next:hover { background: rgba(111,177,255,0.18); border-color: var(--accent); }
.ts-next:active { transform: translateY(1px); }
.ts-next[hidden] { display: none; }
.ts-hint { color: var(--text-muted); font-size: 12.5px; text-align: right; margin-top: 12px; }

.ts-loading { color: var(--text-dim); padding: 40px 4px; font-size: 15px; }

/* ---------------- Адаптив ---------------- */
@media (max-width: 680px) {
  .ts-wrap { padding: 26px 16px 60px; }
  .ts-hero h1 { font-size: 30px; }
  .ts-top { padding: 14px 16px; gap: 12px; }
  .ts-top__brand img { height: 36px; }
  .ts-card { padding: 20px 16px 18px; border-radius: 14px; }
  .ts-q { font-size: 19px; }
  .ts-opt { font-size: 15px; padding: 12px 14px; }
  .ts-actions { justify-content: stretch; }
  .ts-next { width: 100%; justify-content: center; }
  .ts-hint { text-align: center; }
}
