/* ————— Токены. Светлая тема по умолчанию, тёмная — по системной настройке
   и по ручному переключателю (атрибут data-theme на <html>). ————— */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16191f;
  --text-dim: #5c6472;
  --text-faint: #8b94a3;
  --border: #e2e6ec;
  --border-strong: #cfd5de;
  --accent: #3f6fd8;
  --accent-soft: #eaf0fd;
  --shadow: 0 1px 2px rgba(16,25,40,.06), 0 8px 24px rgba(16,25,40,.06);
  --t1: #5b8def; /* открытость       */
  --t2: #d9803c; /* общительность    */
  --t3: #2f9e8f; /* организованность */
  --t4: #8e6ad0; /* сотрудничество   */
  --t5: #d05a85; /* устойчивость     */
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141a;
    --surface: #1a1d25;
    --surface-2: #22262f;
    --text: #eceef2;
    --text-dim: #a5adbb;
    --text-faint: #7d8696;
    --border: #2b303b;
    --border-strong: #3a4150;
    --accent: #7ba4f5;
    --accent-soft: #1e2938;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --t1: #7ba4f5; --t2: #e89b5e; --t3: #45bbaa; --t4: #a889e0; --t5: #e57ba3;
  }
}
:root[data-theme="dark"] {
  --bg: #12141a;
  --surface: #1a1d25;
  --surface-2: #22262f;
  --text: #eceef2;
  --text-dim: #a5adbb;
  --text-faint: #7d8696;
  --border: #2b303b;
  --border-strong: #3a4150;
  --accent: #7ba4f5;
  --accent-soft: #1e2938;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --t1: #7ba4f5; --t2: #e89b5e; --t3: #45bbaa; --t4: #a889e0; --t5: #e57ba3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(25px, 5.4vw, 34px); }
h2 { font-size: clamp(19px, 3.6vw, 23px); }
h3 { font-size: 17px; }
p { margin: 0; }
button { font: inherit; color: inherit; }

/* ————— Шапка ————— */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--t1), var(--t4));
}
.top-title { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.theme-btn {
  margin-left: auto; width: 34px; height: 34px; flex: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  display: grid; place-items: center; line-height: 0;
}
.theme-btn:hover { border-color: var(--border-strong); }
.theme-btn svg { width: 17px; height: 17px; stroke: var(--text-dim); fill: none; stroke-width: 1.7; }
.ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
}
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
:root[data-theme="light"] .ico-sun { display: block; }
:root[data-theme="light"] .ico-moon { display: none; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 30px);
}
.screen[hidden] { display: none; }

/* ————— Заставка ————— */
.lede { color: var(--text-dim); margin-top: 14px; }
.note {
  margin-top: 18px; padding: 13px 15px; border-radius: 11px;
  background: var(--surface-2); color: var(--text-dim); font-size: 14.5px;
}
.scale { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.scale li { display: flex; align-items: baseline; gap: 11px; font-size: 15px; color: var(--text-dim); }
.scale b {
  flex: none; width: 25px; height: 25px; border-radius: 7px; font-size: 13.5px; font-weight: 650;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; filter: none; transform: none; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* ————— Вопрос ————— */
.bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .28s ease; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; font-size: 13.5px; color: var(--text-faint); }
.meta .chip { font-weight: 600; color: var(--text-dim); }
.q-text { margin: 26px 0 22px; font-size: clamp(19px, 3.8vw, 23px); font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.opts { border: 0; margin: 0; padding: 0; display: grid; gap: 9px; }
.opt { display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt > span {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); transition: border-color .12s, background .12s;
}
.opt > span::before {
  content: attr(data-n); flex: none;
  width: 27px; height: 27px; border-radius: 8px; font-size: 14px; font-weight: 650;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-dim);
  transition: background .12s, color .12s;
}
.opt:hover > span { border-color: var(--border-strong); background: var(--surface-2); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.opt input:checked + span::before { background: var(--accent); color: #fff; }
.opt-label { font-size: 15.5px; }
.nav { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.nav .spacer { margin-left: auto; }
.hint { margin-top: 16px; font-size: 13px; color: var(--text-faint); text-align: center; }

/* ————— Итоговый экран: только вопросы и ответы ————— */
/* Сжатая строка «1–4, 2–3, 3–5…» — тот формат, в котором ответы присылают.
   user-select: all, чтобы её можно было взять одним щелчком без кнопки. */
.code {
  margin-top: 20px; padding: 14px 16px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  font: 15px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word; user-select: all;
}

.tbl { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 12px; padding: 13px 15px; border-top: 1px solid var(--border); align-items: baseline; }
.row:first-child { border-top: 0; }
.row .n { color: var(--text-faint); font-size: 14px; font-variant-numeric: tabular-nums; }
.row .q { font-size: 15px; }
.row .a { text-align: right; font-size: 14px; color: var(--text-dim); white-space: nowrap; }
.row .a b {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 650;
  vertical-align: -6px; margin-left: 7px;
}
.sec { margin-top: 34px; }
.sec > p { margin-top: 6px; font-size: 14.5px; color: var(--text-dim); }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .row { grid-template-columns: 26px 1fr; }
  .row .a { grid-column: 2; text-align: left; margin-top: 2px; }
  .row .a b { margin-left: 0; margin-right: 7px; }
}
@media print {
  body { background: #fff; }
  .top, .actions, .hint, .toast { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .row { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ————— Шапка: возврат к списку тестов ————— */
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand:hover .top-title { color: var(--text); }

/* ————— Список тестов на главной ————— */
.intro { margin-bottom: 4px; }
.intro .lede { max-width: 56ch; }
.cards { display: grid; gap: 14px; margin-top: 24px; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
.tcard {
  display: flex; flex-direction: column; gap: 8px; padding: 20px;
  text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, transform .06s;
}
.tcard:hover { border-color: var(--accent); }
.tcard:active { transform: translateY(1px); }
.tcard h2 { font-size: 19px; }
.tcard p { font-size: 15px; color: var(--text-dim); }
.tcard .tmeta { margin-top: auto; padding-top: 8px; font-size: 13.5px; color: var(--text-faint); }
.tcard .go { font-size: 15px; font-weight: 600; color: var(--accent); }
/* Карточка-заготовка: видно, что тест готовится, но зайти в него нельзя */
.tcard.soon { pointer-events: none; box-shadow: none; border-style: dashed; }
.tcard.soon h2, .tcard.soon p { color: var(--text-faint); }

/* Refined visual system */
:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f2ede4;
  --text: #242923;
  --text-dim: #626a61;
  --text-faint: #858c80;
  --border: #e6e2d8;
  --border-strong: #c9d1bf;
  --accent: #386d58;
  --accent-soft: #e5f0e8;
  --shadow: 0 16px 48px rgba(54, 62, 44, .07);
  --radius: 22px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171d1a; --surface: #202923; --surface-2: #29352c;
    --text: #f1f1e9; --text-dim: #b7c3b6; --text-faint: #94a294;
    --border: #38463b; --border-strong: #627565;
    --accent: #9bd6af; --accent-soft: #294638;
    --shadow: 0 16px 48px rgba(0, 0, 0, .16);
  }
}
:root[data-theme="dark"] {
  --bg: #171d1a; --surface: #202923; --surface-2: #29352c;
  --text: #f1f1e9; --text-dim: #b7c3b6; --text-faint: #94a294;
  --border: #38463b; --border-strong: #627565;
  --accent: #9bd6af; --accent-soft: #294638;
  --shadow: 0 16px 48px rgba(0, 0, 0, .16);
}
body {
  min-height: 100vh;
  background: radial-gradient(circle at 85% 0%, var(--accent-soft), transparent 34rem), var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}
.wrap { max-width: 900px; padding: 28px 24px 88px; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.035em; }
h1 { font-size: clamp(38px, 6vw, 58px); line-height: 1.08; }
h2 { font-size: clamp(24px, 3vw, 30px); }
.top { margin-bottom: clamp(38px, 7vw, 76px); padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.mark { width: 38px; height: 38px; border-radius: 13px; background: var(--accent); position: relative; }
.mark::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--surface); font-size: 22px; }
.top-title { color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: .01em; }
.theme-btn { width: 42px; height: 42px; border-radius: 50%; transition: background .2s, transform .2s; }
.theme-btn:hover { background: var(--surface-2); transform: rotate(12deg); }
.theme-btn:focus-visible, .brand:focus-visible, .tcard:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.intro { padding: 0 0 10px; }
.intro { position: relative; min-height: 300px; padding-right: min(38%, 310px); }
.intro-art { position: absolute; width: min(40%, 340px); height: auto; right: -12px; top: -34px; pointer-events: none; }
.intro h1 { max-width: 12ch; }
.lede { font-size: clamp(16px, 2vw, 18px); line-height: 1.75; }
.intro .lede { max-width: 62ch; margin-top: 22px; }
.cards { gap: 18px; margin-top: 38px; }
.tcard { min-height: 280px; padding: 28px; gap: 14px; border-radius: 24px; box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.tcard:not(.soon) { background: linear-gradient(145deg, var(--surface), var(--accent-soft)); border-color: var(--border-strong); }
.tcard:not(.soon):hover { transform: translateY(-5px); box-shadow: 0 24px 48px rgba(54, 62, 44, .13); }
.tcard h2 { font-size: 27px; line-height: 1.16; }
.tcard p { line-height: 1.65; }
.tcard .tmeta { padding-top: 20px; }
.tcard .go { display: inline-flex; align-items: center; width: fit-content; gap: 8px; font-weight: 700; }
.tcard.soon { background: transparent; border-width: 1.5px; }
.card { border-radius: 26px; padding: clamp(24px, 5vw, 46px); }
.card h1 { max-width: 14ch; }
.note { border-left: 3px solid var(--accent); padding: 16px 20px; border-radius: 0 12px 12px 0; }
.scale { gap: 10px; margin-top: 28px; }
.scale li { align-items: center; }
.scale b { width: 30px; height: 30px; border-radius: 9px; }
.btn { min-height: 46px; border-radius: 12px; padding: 12px 22px; transition: filter .2s, transform .2s, background .2s; }
.btn:not(.btn-ghost) { color: #fff; }
:root[data-theme="dark"] .btn:not(.btn-ghost) { color: #17251b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.btn-ghost) { color: #17251b; } }
.btn:not([disabled]):hover { transform: translateY(-2px); }
.bar { height: 8px; }
.bar > i { background: linear-gradient(90deg, var(--accent), var(--t3)); }
.meta { font-size: 14px; }
.q-text { margin: 34px 0 28px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 4vw, 34px); font-weight: 500; line-height: 1.28; }
.opts { gap: 11px; }
.opt > span { min-height: 58px; padding: 13px 17px; border-radius: 14px; transition: border-color .2s, background .2s, transform .2s; }
.opt:hover > span { transform: translateX(3px); }
.opt > span::before { width: 30px; height: 30px; border-radius: 50%; }
.opt input:checked + span { border-width: 2px; }
.row { padding: 16px 18px; }
.row:nth-child(even) { background: var(--surface-2); }
@media (max-width: 600px) {
  .wrap { padding: 18px 18px 60px; }
  .top { margin-bottom: 38px; }
  .intro { min-height: 0; padding-right: 0; }
  .intro-art { position: relative; display: block; width: min(72%, 280px); margin: -20px auto 10px; right: auto; top: auto; }
  .cards { margin-top: 28px; }
  .tcard { min-height: 0; padding: 24px; }
  .card { padding: 24px 20px; }
  .nav { flex-wrap: wrap; }
}
@media print {
  body { background: #fff; }
  .card, .tcard { box-shadow: none; }
}

/* Ссылка, оформленная как кнопка: браузерное подчёркивание здесь лишнее */
a.btn { text-decoration: none; }
