:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --text: #22201c;
  --muted: #6b665d;
  --line: #e4ded3;
  --accent: #2f4a6d;
  --accent-hover: #233a57;
  --danger: #b3261e;

  --beige: #c8a774;
  --purple: #7b4fa3;
  --red: #c8372d;
  --blue: #2c5aa0;
  --orange: #e07a1f;
  --green: #3f8f4f;
  --shade: #b9b2a7; /* теневая (отрицательная) часть полос */

  --radius: 14px;
  --serif: "PT Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
}

.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

.topbar { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }

main { padding-top: 40px; padding-bottom: 56px; min-height: 70vh; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0 0 16px; }
h1 { font-size: clamp(26px, 5vw, 36px); }
h2 { font-size: clamp(21px, 4vw, 26px); }
h3 { font-size: 17px; font-family: var(--sans); font-weight: 600; margin-top: 8px; }
p { margin: 0 0 16px; }
a { color: var(--accent); }

.eyebrow { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0 28px; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.facts strong { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.facts span { font-size: 14px; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 12px 24px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 16px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }

/* Вопрос */
.progress { margin-bottom: 28px; }
.progress-label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.progress-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }

.situation { margin-bottom: 24px; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  text-align: left; padding: 16px 18px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: 16px/1.5 var(--sans); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: #eef2f8; }
.option .letter {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); font-weight: 600; font-size: 14px;
}

.link-back { margin-top: 22px; background: none; border: 0; padding: 8px 0; color: var(--muted); font: 15px var(--sans); cursor: pointer; }
.link-back:hover { color: var(--text); }

/* Главная: карточки тестов */
.test-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.test-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.test-card:hover { border-color: var(--accent); }
.test-card strong { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.test-card-kicker { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.test-card-meta { font-size: 14px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.test-card .btn { margin-top: 8px; }

/* Корпоративный тест: карточка и шкала −3…+3 под её делениями */
.card-image { margin: 0 0 14px; }
.card-image img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #f3efe8; }
/* Деления на картинке стоят на 7–93% ширины — кнопки ставим ровно под ними. */
.options.scale { grid-template-columns: repeat(7, 1fr); gap: 0; padding: 0 0.5%; }
.options.scale .option {
  justify-content: center; align-items: center; margin: 0 4px; padding: 12px 0;
  font-weight: 600; font-variant-numeric: tabular-nums;
}

/* Форма */
.form { display: grid; gap: 16px; margin-top: 24px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.form input:not([type=checkbox]) {
  height: 50px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font: 16px var(--sans); color: var(--text);
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form input.invalid { border-color: var(--danger); }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.form .check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.form-error { color: var(--danger); font-size: 15px; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Результат */
.stage-name { white-space: nowrap; }

.diagram { margin: 28px 0; }
.diagram img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #f3efe8; }

/* На компьютере — картинка-диаграмма, на телефоне — полосы. */
.only-mobile { display: none !important; }
.chart.always { display: grid !important; }

.chart { display: grid; gap: 12px; margin: 28px 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bar-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; font-size: 15px; }
.bar-track { display: flex; height: 22px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.half { display: flex; flex: 1; }
.half-neg { display: none; justify-content: flex-end; }
.bar { height: 100%; width: 0; transition: width .6s ease; }
.bar-pos { border-radius: 6px; }
.bar-neg { background: var(--shade); }
.bar-row.top .bar-label { font-weight: 600; }

/* Корпоративный: теневая часть растёт влево от центра, сильная — вправо. */
.chart-diverging .half-neg { display: flex; border-right: 2px solid var(--muted); }
.chart-diverging .bar-pos { border-radius: 0 6px 6px 0; }
.chart-diverging .bar-neg { border-radius: 6px 0 0 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 16px; }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0 12px; }
.lists ul { margin: 0; padding: 0; list-style: none; }
.lists li { position: relative; padding-left: 22px; margin-bottom: 6px; }
.lists .neg li::before { content: "−"; position: absolute; left: 4px; color: var(--danger); font-weight: 700; }
.lists .pos li::before { content: "+"; position: absolute; left: 3px; color: var(--green); font-weight: 700; }

/* Длинные тексты корпоративных результатов */
.card-kicker { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.rich h3 { font-family: var(--serif); font-size: 21px; font-weight: 700; margin: 20px 0 10px; }
.rich > div > h3:first-child { margin-top: 0; }
.rich ul { margin: 0 0 16px; padding-left: 20px; }
.rich li { margin-bottom: 8px; }
.rich p:last-child, .rich ul:last-child { margin-bottom: 0; }
.about summary { cursor: pointer; font-weight: 600; }
.about[open] summary { margin-bottom: 16px; }
.offer .btn { margin-top: 20px; }

.footer { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: grid !important; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding-top: 28px; }
  .form .row, .lists, .test-cards { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 84px 1fr; gap: 8px; font-size: 14px; }
  .chart, .card, .test-card { padding: 16px; }
  .actions .btn { width: 100%; }
  .options.scale { padding: 0; }
  .options.scale .option { margin: 0 2px; padding: 10px 0; font-size: 14px; }
}
