:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #1b2624;
  --ink-2: #4a5754;
  --ink-3: #7a8582;
  --line: #dfe3df;
  --line-strong: #c4ccc8;

  --brand: #1f6f67;
  --brand-ink: #ffffff;
  --brand-soft: #e1efec;
  --accent: #c8553d;

  --bar-lead: #00876f;
  --bar-rest: #9fd3c7;
  --track: #edf0ed;
  --grid: #dfe4e1;

  --plus-bg: #e7f3ee;
  --plus-line: #2f8a64;
  --minus-bg: #fbeee9;
  --minus-line: #c8553d;

  --radius: 16px;
  --shadow: 0 1px 2px rgb(20 40 36 / 6%), 0 8px 24px rgb(20 40 36 / 6%);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111817;
    --surface: #18211f;
    --surface-2: #1e2a28;
    --ink: #e8eeec;
    --ink-2: #b2bfbb;
    --ink-3: #85928e;
    --line: #2a3734;
    --line-strong: #3a4945;
    --brand: #5cc2b5;
    --brand-ink: #0d1716;
    --brand-soft: #1d3532;
    --accent: #ee8b74;
    --bar-lead: #20ad8f;
    --bar-rest: #2d5f57;
    --track: #1f2b29;
    --grid: #2a3734;
    --plus-bg: #17302a;
    --plus-line: #5cc29a;
    --minus-bg: #33201b;
    --minus-line: #ee8b74;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }
/* main.wrap — чтобы перебить горизонтальный padding из .wrap и не обнулить вертикальный */
main.wrap { flex: 1; padding-top: 56px; padding-bottom: 88px; outline: none; }
@media (max-width: 560px) { main.wrap { padding-top: 36px; padding-bottom: 64px; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); font-family: var(--serif); font-size: 20px;
}
.brand__text { font-size: 15px; letter-spacing: .01em; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 999px;
}
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.is-active { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 520px) {
  .brand__text { display: none; }
  .topnav a { padding: 8px 10px; }
}

/* ---------- typography ---------- */
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 6vw, 46px); letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 800; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--brand); margin: 0 0 10px; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 680px; }
.muted { color: var(--ink-3); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
@media (max-width: 560px) { .card { padding: 20px; } }
.stack > * + * { margin-top: 20px; }
.section { margin-top: 40px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 15px/1 var(--font); text-decoration: none;
  padding: 14px 22px; border-radius: 999px; transition: transform .12s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- home ---------- */
.hero { padding: 16px 0 8px; }
.hero h1 { max-width: 720px; }
.hero .lead { margin-top: 16px; }
.hero .btn-row { margin-top: 28px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature b { display: block; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 15px; }
@media (max-width: 720px) { .features { grid-template-columns: 1fr; } }
.scale-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.scale-list li { display: flex; align-items: center; gap: 12px; }
.scale-num {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--surface-2); font-weight: 800; color: var(--brand);
}
.notice { border-left: 3px solid var(--brand); padding: 4px 0 4px 16px; color: var(--ink-2); }

/* ---------- quiz ---------- */
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.quiz-head .count { font-weight: 700; color: var(--ink-2); font-size: 14px; }
.progress { height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress__bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }
.question { font-family: var(--serif); font-weight: 500; font-size: clamp(22px, 4.2vw, 30px); line-height: 1.35; margin: 32px 0 28px; min-height: 3.2em; }
.options { display: grid; gap: 10px; }
.option {
  appearance: none; width: 100%; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); font: 600 16px/1.3 var(--font);
  transition: border-color .15s, background .15s, transform .1s;
}
.option:hover { border-color: var(--brand); }
.option:active { transform: scale(.995); }
.option__num {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-2); color: var(--brand); font-weight: 800; font-size: 17px;
}
.option.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.option.is-selected .option__num { background: var(--brand); color: var(--brand-ink); }
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 16px; text-align: center; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; justify-content: center; }
.dot {
  appearance: none; border: 0; cursor: pointer; padding: 0;
  width: 26px; height: 26px; border-radius: 8px; font: 700 11px/26px var(--font);
  background: var(--track); color: var(--ink-3);
}
.dot.is-done { background: var(--brand-soft); color: var(--brand); }
.dot.is-current { outline: 2px solid var(--brand); outline-offset: 1px; }
.alert { background: var(--minus-bg); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; color: var(--ink); }

/* ---------- result ---------- */
.verdict { display: grid; gap: 8px; justify-items: start; }
.verdict h1 a { color: inherit; text-decoration: none; }
.verdict h1 a:hover { color: var(--brand); }
.verdict .tagline { font-size: 18px; color: var(--ink-2); margin: 0; }
.verdict .also { margin: 4px 0 0; color: var(--ink-2); }
.verdict .btn-row { margin-top: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 5px 10px; border-radius: 999px;
}

.chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.chart-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch--lead { background: var(--bar-lead); }
.swatch--rest { background: var(--bar-rest); }
.pip-key { display: inline-flex; gap: 3px; }

.chart { margin-top: 20px; }
.chart__rows { position: relative; }
.chart__row {
  display: grid; grid-template-columns: 210px 1fr 92px; align-items: center; gap: 14px;
  padding: 7px 8px; margin: 0 -8px; border-radius: 10px;
  color: inherit; text-decoration: none;
}
.chart__row:hover, .chart__row:focus-visible { background: var(--surface-2); }
.chart__row:hover .chart__label, .chart__row:focus-visible .chart__label { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.chart__label { font-weight: 700; font-size: 15px; line-height: 1.25; display: flex; align-items: center; gap: 8px; }
.chart__track {
  position: relative; height: 18px; border-radius: 0 4px 4px 0;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: 25% 100%;
  border-right: 1px solid var(--grid);
}
.chart__bar {
  position: absolute; left: 0; top: 2px; bottom: 2px; width: 0;
  background: var(--bar-rest); border-radius: 0 4px 4px 0;
  transition: width .7s cubic-bezier(.2,.7,.2,1);
}
.chart__row.is-lead .chart__bar { background: var(--bar-lead); }
.chart__value { text-align: right; font-variant-numeric: tabular-nums; }
.chart__value b { font-size: 15px; }
.chart__value small { color: var(--ink-3); font-size: 13px; }
.pips { display: flex; gap: 3px; justify-content: flex-end; margin-top: 3px; }
.pip { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.pip.is-on { background: var(--ink-2); border-color: var(--ink-2); }
.chart__axis {
  display: grid; grid-template-columns: 210px 1fr 92px; gap: 14px; margin-top: 6px;
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.chart__axis-ticks { display: flex; justify-content: space-between; }
.chart__axis-ticks span:first-child { transform: translateX(-2px); }
.chart__axis-ticks span:last-child { transform: translateX(8px); }

@media (max-width: 600px) {
  .chart__row { grid-template-columns: 1fr auto; grid-template-areas: "label value" "track track"; row-gap: 6px; padding: 10px 8px; }
  .chart__label { grid-area: label; }
  .chart__value { grid-area: value; display: flex; align-items: center; gap: 8px; }
  .chart__value .pips { margin-top: 0; }
  .chart__track { grid-area: track; }
  .chart__axis { grid-template-columns: 1fr; }
  .chart__axis > :first-child, .chart__axis > :last-child { display: none; }
}

.table-toggle { margin-top: 20px; }
.table-toggle summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 14px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--ink-3); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
td.num, th.num { text-align: right; }
tr.is-lead td:first-child { font-weight: 800; }
@media (max-width: 600px) {
  table th:nth-child(2), table td:nth-child(2),
  table th:nth-child(4), table td:nth-child(4) { display: none; }
  table td:first-child { white-space: normal; }
  th, td { padding: 10px 6px; }
}

.method { font-size: 14px; color: var(--ink-2); }
.method ol { padding-left: 20px; margin: 8px 0 0; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  max-width: 260px; box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
}
.tooltip b { display: block; font-size: 14px; margin-bottom: 2px; }
.tooltip .tt-hint { opacity: .7; margin-top: 4px; display: block; }

/* ---------- types grid ---------- */
.types-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 28px; }
.type-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.type-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.type-card__num { font-family: var(--serif); color: var(--brand); font-size: 14px; }
.type-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.type-card__name { font-weight: 800; font-size: 18px; }
.type-card__tag { color: var(--ink-2); font-size: 14px; margin: 0; flex: 1; }
.type-card__score { display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: nowrap; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 10px; border-top: 1px solid var(--line); }
.type-card__score b { color: var(--ink); }
.type-card__score .pips { margin-top: 0; }
.type-card.is-lead { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- type article ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; font-weight: 600; margin-bottom: 24px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.type-hero { display: grid; gap: 10px; margin-bottom: 28px; }
.type-hero .tagline { font-size: 19px; color: var(--ink-2); margin: 0; font-family: var(--serif); font-style: italic; }
.score-chip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-top: 8px;
}
.score-chip__bar { flex: 1 1 160px; height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; }
.score-chip__bar i { display: block; height: 100%; background: var(--bar-lead); border-radius: 999px; }
.score-chip__text { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.score-chip__text b { color: var(--ink); }

.prose { font-size: 17px; line-height: 1.7; }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1em; }
.prose > h3 { font-size: 21px; font-weight: 800; margin-top: 1.9em; }
.prose h4 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: .5em; }
.prose li > ul { margin-top: .5em; }
.prose .note { color: var(--ink-2); font-size: 15px; background: var(--surface-2); padding: 12px 16px; border-radius: 12px; }
.callout { border-radius: 14px; padding: 18px 20px; background: var(--surface-2); border-left: 4px solid var(--brand); }
.callout > * + * { margin-top: .6em; }
.callout--plus { background: var(--plus-bg); border-left-color: var(--plus-line); }
.callout--plus h4 { color: var(--plus-line); }
.callout--minus { background: var(--minus-bg); border-left-color: var(--minus-line); }
.callout--minus h4 { color: var(--minus-line); }
.callout h4 { color: var(--brand); }
.example {
  margin: 1.6em 0 0; padding: 20px 22px; border-radius: 14px;
  background: var(--surface); border: 1px dashed var(--line-strong);
  font-family: var(--serif); font-size: 17px;
}
.example b { font-family: var(--font); }

.type-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.type-pager a {
  display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-decoration: none; color: var(--ink);
}
.type-pager a:hover { border-color: var(--brand); }
.type-pager small { display: block; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.type-pager b { font-size: 16px; }
.type-pager .next { text-align: right; grid-column: 2; }

/* ---------- report ---------- */
.report-actions { margin-top: 28px; }
.print-only { display: none; }
.answers-list { margin: 12px 0 0; padding-left: 0; list-style: none; counter-reset: q; font-size: 13px; }
.answers-list li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); counter-increment: q; }
.answers-list li span::before { content: counter(q) ". "; color: var(--ink-3); }
.answers-list b { color: var(--brand); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0 36px; font-size: 13px; color: var(--ink-3); }
.footer p { margin: 0 0 6px; max-width: 680px; }

@page { margin: 14mm; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .topbar, .no-print, .report-actions, .verdict .btn-row, .chart-head p, .tooltip { display: none !important; }
  .print-only { display: block; }
  main.wrap { padding-top: 0; padding-bottom: 0; }
  .card { box-shadow: none; }
  .chart, .verdict, table tr { break-inside: avoid; }
  .chart__bar { transition: none; }
  .chart__track, .chart__bar, .swatch, .pip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-toggle summary { list-style: none; color: #000; }
  a { color: inherit; text-decoration: none; }
  .answers-list li { break-inside: avoid; }
  .table-scroll { overflow: visible; }
  table { font-size: 10pt; }
  th, td { padding: 6px 4px; }
  table th:nth-child(2), table td:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
