/* ===== Базовые переменные: светлая и тёмная темы ===== */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --ink: #1f1d1a;
  --ink-2: #5f5a52;
  --ink-3: #8f897f;
  --line: #e3ddd3;
  --accent: #5b4bdb;
  --accent-ink: #ffffff;
  --accent-soft: #ebe8fd;
  --good: #2f8f6a;
  --warn: #c7742a;
  --bad: #c2453d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 29, 26, .06), 0 8px 24px rgba(31, 29, 26, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;

  /* Цвета категорий — используются в карточках и лепестках эмблемы */
  --c-personality: #5b4bdb;
  --c-situations: #e0703a;
  --c-emotions: #d6457a;
  --c-work: #2f8f6a;
  --c-communication: #2b84c6;
  --c-thinking: #b08a1e;
  --c-relationships: #c2456b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #211f1c;
    --surface-2: #2a2824;
    --ink: #f1ede6;
    --ink-2: #b9b2a6;
    --ink-3: #847d72;
    --line: #36332e;
    --accent: #8b7ff0;
    --accent-ink: #14121f;
    --accent-soft: #2b2745;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}
/* Подложка всего сайта: мягкие цветные пятна в тонах категорий + лёгкое зерно.
   Слои фиксированы, поэтому при прокрутке фон не «едет». */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
  background:
    radial-gradient(60vmax 45vmax at 8% -6%, color-mix(in srgb, var(--c-personality) 14%, transparent), transparent 70%),
    radial-gradient(50vmax 40vmax at 100% 18%, color-mix(in srgb, var(--c-situations) 11%, transparent), transparent 70%),
    radial-gradient(55vmax 45vmax at 70% 110%, color-mix(in srgb, var(--c-relationships) 10%, transparent), transparent 70%),
    radial-gradient(45vmax 35vmax at -5% 85%, color-mix(in srgb, var(--c-communication) 9%, transparent), transparent 70%);
}
body::after {
  opacity: .05;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::after { opacity: .07; } }
@media print { body::before, body::after { display: none; } }
main { flex: 1; outline: none; padding-bottom: 64px; overflow-x: clip; /* скрывает выезд карточек во время анимации */ }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4.4vw, 46px); }
h2 { font-size: clamp(22px, 2.6vw, 30px); }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; color: var(--ink-3); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ===== Шапка ===== */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { font-weight: 700; font-size: 19px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 22px; height: 22px; background: url(/favicon.svg) center/contain no-repeat; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a { color: var(--ink-2); padding: 7px 12px; border-radius: 999px; white-space: nowrap; font-size: 15px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.account { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
/* Переключатели языка и валюты */
.prefs { display: flex; gap: 6px; }
.prefs select { width: auto; padding: 5px 8px; font-size: 13.5px; border-radius: 999px; background: var(--surface); }
/* Меню не помещается в одну строку (узкий экран или длинные подписи) — переносим его на вторую строку шапки.
   Класс .stacked ставит fitNav() в app.js */
.topbar-in.stacked { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 8px; gap: 8px 16px; }
.topbar-in.stacked .nav { order: 3; flex-basis: 100%; margin: 0 -12px; }
.topbar-in.stacked .prefs { margin-left: auto; }
@media (max-width: 760px) {
  .topbar-in { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 6px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .account { margin-left: auto; }
  .topbar-in.stacked .prefs { margin-left: 0; }
}

/* ===== Кнопки и поля ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.big { padding: 15px 28px; font-size: 17px; }
.btn.sm { padding: 6px 14px; font-size: 14px; }
.btn.link { background: none; color: var(--accent); padding: 4px 0; border: 0; font-weight: 500; }

label.field { display: block; }
label.field > span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.error-box { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }

/* ===== Карточки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }
.chip.warn { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); color: var(--bad); }
.chip.pro { background: linear-gradient(90deg, #f1b84b, #e0703a); color: #2a1a05; }
.section { margin-top: 56px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

/* Карточка теста в каталоге */
.test-card { display: flex; flex-direction: column; gap: 10px; color: var(--ink); position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.test-card:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 12px 32px rgba(31, 29, 26, .1); }
.test-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--cat, var(--accent)); }
.test-card h3 { margin: 4px 0 0; }
.test-card p { color: var(--ink-2); font-size: 14.5px; margin: 0; flex: 1; }
.test-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.test-card .cat-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: color-mix(in srgb, var(--cat) 14%, var(--surface)); color: var(--cat); }

/* Категории */
.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cat-tile { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.cat-tile:hover { border-color: var(--cat); text-decoration: none; }
.cat-tile .cat-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--cat) 14%, var(--surface)); color: var(--cat); flex: none; }
.cat-tile b { display: block; }
.cat-tile span { font-size: 13.5px; color: var(--ink-2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.filters button { font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ===== Главная ===== */
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 56px 0 40px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 560px; }

/* Фото-подложка главного экрана: на всю ширину окна, тонирована в фирменные цвета
   (снимок в оттенках серого кладётся на градиент через luminosity), к тексту и вниз растворяется в фоне. */
.hero-backdrop { position: absolute; z-index: -1; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); overflow: hidden; pointer-events: none;
  /* растворяем низ маской, а не цветом фона — так нет шва с цветными пятнами подложки */
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 55%, transparent 100%); }
.hero-backdrop::before, .hero-backdrop::after { content: ""; position: absolute; inset: 0; }
.hero-backdrop::before {
  background: url(/img/bg/hero-lake.webp) center 62% / cover no-repeat, linear-gradient(120deg, #b9aef5 0%, #f2c7d4 55%, #f6d3b4 100%);
  background-blend-mode: luminosity;
  opacity: .5;
}
.hero-backdrop::after {
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 34%, color-mix(in srgb, var(--bg) 10%, transparent) 72%, color-mix(in srgb, var(--bg) 35%, transparent) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent) 0%, transparent 25%);
}
@media (prefers-color-scheme: dark) {
  .hero-backdrop::before { background-image: url(/img/bg/hero-lake.webp), linear-gradient(120deg, #3b3177 0%, #5a2a44 55%, #5e3a22 100%); opacity: .55; }
}

.hero-art { position: relative; display: grid; place-items: center; }
.hero-art canvas { position: relative; z-index: 1; max-width: 80vw; height: auto !important; aspect-ratio: 1; }
.hero-art > p { position: relative; z-index: 1; }

/* Четыре сферы жизни вокруг кристалла: самопознание, общение, отношения, работа */
.orbit { position: absolute; inset: 0 0 32px; pointer-events: none; }
.orbit img {
  position: absolute; width: var(--s, 88px); aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--surface); outline: 2px solid var(--ring); outline-offset: 3px;
  box-shadow: var(--shadow); filter: saturate(.8);
  animation: orbit-float 9s ease-in-out infinite; animation-delay: calc(var(--i) * -2.2s);
}
.orbit img:nth-child(1) { --s: 96px; --ring: var(--c-personality); top: 2%; left: 2%; }
.orbit img:nth-child(2) { --s: 76px; --ring: var(--c-communication); top: 8%; right: 0; }
.orbit img:nth-child(3) { --s: 80px; --ring: var(--c-relationships); bottom: 10%; left: -2%; }
.orbit img:nth-child(4) { --s: 100px; --ring: var(--c-work); bottom: 2%; right: 4%; }
@keyframes orbit-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .hero-art { order: -1; }
  .hero-art canvas { width: 240px !important; }
  .orbit { left: 50%; width: min(100%, 380px); transform: translateX(-50%); }
  .orbit img { width: calc(var(--s) * .62); }
  .hero-backdrop::after { background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 30%, transparent) 0%, color-mix(in srgb, var(--bg) 55%, transparent) 45%, color-mix(in srgb, var(--bg) 80%, transparent) 70%); }
}
.feature { display: flex; flex-direction: column; gap: 6px; }
.feature .ico { font-size: 28px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.promo { padding: 28px; border-radius: 22px; color: #fff; position: relative; overflow: hidden; }
.promo p { opacity: .9; }
.promo .btn { background: #fff; color: #1f1d1a; }
.promo.love { background: linear-gradient(135deg, #c2456b, #e0703a); }
.promo.hr { background: linear-gradient(135deg, #2b3a8f, #5b4bdb); }

/* ===== Прохождение теста ===== */
.runner { max-width: 980px; margin: 0 auto; padding-top: 28px; }
.runner-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.progress { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--cat, var(--accent)), color-mix(in srgb, var(--cat, var(--accent)) 60%, #fff)); border-radius: 99px; transition: width .35s ease; }
.counter { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; min-width: 56px; text-align: right; }

.intro-card { text-align: center; padding: 44px 28px; max-width: 640px; margin: 24px auto; }
.intro-card .big-ico { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; display: grid; place-items: center; font-size: 40px; background: color-mix(in srgb, var(--cat) 14%, var(--surface)); color: var(--cat); }
.intro-card .facts { display: flex; justify-content: center; gap: 22px; margin: 18px 0 26px; color: var(--ink-2); font-size: 14.5px; flex-wrap: wrap; }
.intro-card .facts b { display: block; font-size: 22px; color: var(--ink); }

/* Шкальный вопрос: «Насколько это про вас?» */
.likert-stage { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
/* На телефоне кристалл остаётся, но компактный и над карточкой */
@media (max-width: 760px) {
  .likert-stage { grid-template-columns: 1fr; gap: 8px; }
  .likert-side { position: static; }
  .likert-side canvas { width: 110px !important; height: 110px !important; }
  .likert-side .tiny { display: none; }
}
.likert-side { position: sticky; top: 90px; text-align: center; }
.likert-side .tiny { margin-top: 6px; }
.q-card { padding: 40px 32px 32px; min-height: 360px; display: flex; flex-direction: column; justify-content: center; }
.q-card .ask { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 14px; }
.q-card blockquote { font-family: var(--serif); font-size: clamp(22px, 3vw, 30px); line-height: 1.3; margin: 0 0 34px; }
.scale5 { display: flex; justify-content: space-between; align-items: center; gap: 8px; max-width: 560px; }
.scale5 button {
  --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; cursor: pointer;
  border: 3px solid var(--col); background: transparent; transition: transform .15s ease, background .15s ease;
  flex: none; padding: 0;
}
.scale5 button:nth-child(1), .scale5 button:nth-child(5) { --s: 60px; }
.scale5 button:nth-child(2), .scale5 button:nth-child(4) { --s: 50px; }
.scale5 button:nth-child(3) { --s: 40px; }
.scale5 button:nth-child(1) { --col: #c2453d; }
.scale5 button:nth-child(2) { --col: #d98a6a; }
.scale5 button:nth-child(3) { --col: var(--ink-3); }
.scale5 button:nth-child(4) { --col: #6fae8f; }
.scale5 button:nth-child(5) { --col: #2f8f6a; }
.scale5 button:hover { transform: scale(1.1); background: color-mix(in srgb, var(--col) 18%, transparent); }
.scale5 button.on { background: var(--col); transform: scale(1.08); }
.scale-labels { display: flex; justify-content: space-between; max-width: 560px; font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }
.scale-labels .hover-label { color: var(--ink); font-weight: 600; }
.q-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; }
/* ===== 3D-карточки ===== */
/* Перспектива на контейнере — карточки внутри поворачиваются в объёме */
.runner, .stage3d { perspective: 1400px; }
/* Новая карточка «разворачивается» к зрителю, при возврате назад — с другой стороны */
.slide-in { animation: flipIn .45s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 50% 50% -120px; }
.slide-back { animation: flipBack .45s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 50% 50% -120px; }
.flip-out { animation: flipOutKf .16s ease-in both; transform-origin: 50% 50% -120px; pointer-events: none; }
@keyframes flipIn { from { opacity: 0; transform: rotateY(-62deg) translateX(40px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes flipBack { from { opacity: 0; transform: rotateY(62deg) translateX(-40px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes flipOutKf { to { opacity: 0; transform: rotateY(48deg) translateX(-30px) scale(.96); } }

/* Наклон карточек за курсором и блик, следующий за мышью */
.tilting {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-3px);
  transition: transform .08s linear, box-shadow .15s ease;
  box-shadow: 0 18px 40px rgba(31, 29, 26, .14);
  position: relative;
}
.tilting::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .22), transparent 55%);
}
.test-card, .arch-card, .q-card, .plan, .match-card { transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease; will-change: transform; }

/* Кнопки шкалы — объёмные «таблетки», которые проседают при нажатии */
.scale5 button { box-shadow: 0 4px 0 color-mix(in srgb, var(--col) 35%, transparent); }
.scale5 button:active, .scale5 button.on { box-shadow: 0 1px 0 color-mix(in srgb, var(--col) 35%, transparent); transform: translateY(3px) scale(1.04); }

/* Раскрытие результата: карточка поднимается из глубины */
.reveal-3d { animation: revealFlip .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes revealFlip {
  from { opacity: 0; transform: perspective(1200px) rotateX(55deg) translateY(60px) scale(.9); }
  to { opacity: 1; transform: perspective(1200px); }
}

/* Кристалл */
.crystal { display: block; margin: 0 auto; touch-action: none; }
.runner-top .crystal { margin: -10px 0; flex: none; }

/* Ситуационный тест в формате чата-истории */
.chat { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; padding: 14px 18px; border-radius: 20px; animation: pop .35s cubic-bezier(.2, .8, .2, 1) both; }
.msg.host { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: var(--shadow); }
.msg.me { background: var(--cat, var(--accent)); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.note { align-self: center; background: transparent; color: var(--ink-2); font-size: 14px; padding: 4px 12px; max-width: 100%; text-align: center; }
.msg .who { font-size: 12.5px; font-weight: 700; color: var(--cat, var(--accent)); margin-bottom: 4px; }
.msg .scene { display: inline-block; font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; }
.msg .q { font-size: 17.5px; }
.typing { display: inline-flex; gap: 4px; padding: 16px 18px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.replies { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 4px; }
.replies button {
  font: inherit; text-align: left; max-width: 86%; cursor: pointer;
  padding: 12px 16px; border-radius: 18px; border-bottom-right-radius: 6px;
  border: 1.5px solid color-mix(in srgb, var(--cat, var(--accent)) 45%, var(--line));
  background: var(--surface); color: var(--ink);
  animation: pop .3s cubic-bezier(.2, .8, .2, 1) both;
  transition: background .12s ease, transform .12s ease;
}
.replies button:hover { background: color-mix(in srgb, var(--cat, var(--accent)) 10%, var(--surface)); transform: translateX(-3px); }
.replies button kbd { font: 12px var(--font); color: var(--ink-3); margin-right: 8px; }
.reaction { display: flex; gap: 10px; align-items: center; }
.reaction .meter { width: 120px; height: 6px; background: var(--surface-2); border-radius: 9px; overflow: hidden; }
.reaction .meter i { display: block; height: 100%; background: var(--cat, var(--accent)); width: 0; transition: width .8s ease .1s; }
.chat-actions { display: flex; justify-content: space-between; margin-top: 6px; }

/* Угадайка перед результатом */
.guess { max-width: 640px; margin: 28px auto; text-align: center; }
.guess-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 22px 0; }
.guess-grid button { font: inherit; padding: 16px 12px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.guess-grid button:hover { border-color: var(--cat, var(--accent)); transform: translateY(-2px); }
.guess-grid .e { font-size: 28px; display: block; }

/* ===== Результат ===== */
.reveal { text-align: center; padding: 40px 24px 32px; position: relative; overflow: hidden; }
.reveal .emblem { width: 210px; height: 210px; margin: 0 auto; display: block; }
.reveal .emblem.grow path { transform-origin: 100px 100px; animation: petal .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes petal { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.reveal .arch-emoji { font-size: 40px; margin: -6px 0 6px; position: relative; }
.reveal .kicker { text-transform: uppercase; letter-spacing: .1em; font-size: 13px; color: var(--ink-3); }
.reveal h1 { margin: 6px 0 10px; }
.reveal .summary { max-width: 560px; margin: 0 auto; color: var(--ink-2); }
.guess-feedback { margin: 18px auto 0; max-width: 520px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 15px; }
.scale-row { padding: 20px 0; border-top: 1px solid var(--line); }
.scale-row:first-child { border-top: 0; }
.scale-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.scale-head h3 { margin: 0; font-size: 18px; }
.scale-head .pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; }
.bar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--cat, var(--accent)); transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.peer { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.tip { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 14.5px; }
.tip.locked { background: var(--surface-2); color: var(--ink-3); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tip.locked .blur { filter: blur(4px); user-select: none; }

/* Конфетти при раскрытии результата */
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; opacity: .9; }
@keyframes fall { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }

/* ===== Портрет ===== */
.portrait-head { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: center; }
@media (max-width: 720px) { .portrait-head { grid-template-columns: 1fr; text-align: center; } }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; flex: none; }
.ring::after { content: attr(data-label); width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ring.big { width: 96px; height: 96px; }
.ring.big::after { width: 78px; height: 78px; font-size: 20px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 14px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.badge .e { font-size: 30px; display: block; }
.badge b { display: block; font-size: 14px; margin-top: 4px; }
.badge span { font-size: 12px; color: var(--ink-3); }
.badge.off { opacity: .45; filter: grayscale(1); }
.arch-card { display: flex; gap: 14px; align-items: center; color: var(--ink); }
.arch-card:hover { text-decoration: none; border-color: var(--cat); }
.arch-card .e { font-size: 32px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--cat) 14%, var(--surface)); flex: none; }
.trait-list { display: flex; flex-wrap: wrap; gap: 8px; }
.trait { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.trait b { color: var(--good); margin-left: 4px; }
.trait.growth b { color: var(--warn); }

/* ===== 360°: сравнение «Вы» и «Другие» ===== */
.cmp-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 99px; margin: 14px 0 10px; }
.cmp-gap { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: color-mix(in srgb, var(--ink-3) 25%, transparent); }
.cmp-gap.hidden { background: color-mix(in srgb, var(--good) 30%, transparent); }
.cmp-gap.blind { background: color-mix(in srgb, var(--warn) 30%, transparent); }
.cmp-dot { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.cmp-dot.self, .cmp-key.self { background: var(--surface); border: 4px solid var(--accent); }
.cmp-dot.others, .cmp-key.others { background: #e0703a; border: 4px solid var(--surface); }
.cmp-legend { display: flex; gap: 18px; color: var(--ink-2); }
.cmp-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border-width: 3px !important; }
.cloud { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: center; padding: 10px 0; }
.cloud span { font-weight: 700; line-height: 1.2; }

/* Строка критерия в редакторе профиля вакансии */
.crit-row { display: grid; grid-template-columns: 1fr 230px 110px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.crit-row:first-of-type { margin-top: 8px; }
.crit-row select { padding: 8px 10px; font-size: 14.5px; }
.crit-row .check { align-items: center; }
.crit-row .check input { margin-top: 0; }
@media (max-width: 640px) { .crit-row { grid-template-columns: 1fr; gap: 6px; } }

/* Строка рекомендателя в форме кандидата */
.ref-row { display: grid; grid-template-columns: 1.2fr 1.3fr 1fr 1.1fr; gap: 8px; margin-bottom: 8px; }
.ref-row input, .ref-row select { padding: 9px 12px; font-size: 14.5px; }
@media (max-width: 760px) { .ref-row { grid-template-columns: 1fr 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--line); } }

/* ===== Таблицы ===== */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.mini-progress { width: 90px; height: 6px; background: var(--surface-2); border-radius: 9px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mini-progress i { display: block; height: 100%; background: var(--good); }

/* Выбор тестов в приглашении */
.test-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.test-picker label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: pointer; background: var(--surface); }
.test-picker label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.test-picker input { accent-color: var(--accent); margin-top: 3px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; }

/* ===== Знакомства ===== */
.match-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
@media (max-width: 640px) { .match-card { grid-template-columns: auto 1fr; } .match-card .match-score { grid-column: 1 / -1; justify-self: start; } }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; flex: none; }
.breakdown { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; font-size: 13.5px; align-items: center; margin-top: 10px; max-width: 380px; }
.breakdown .bar { height: 6px; margin: 0; }
.blurred { filter: blur(6px); user-select: none; pointer-events: none; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.checklist .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--surface-2); color: var(--ink-3); flex: none; }
.checklist .dot.ok { background: var(--good); color: #fff; }

/* ===== Тарифы ===== */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.featured { border: 2px solid var(--accent); }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.plan .price small { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.plan ul { padding-left: 18px; margin: 0; color: var(--ink-2); font-size: 14.5px; flex: 1; }
.plan li { margin-bottom: 4px; }
.plan .badge-top { position: absolute; top: -12px; right: 18px; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 24px; }
.tabs button { font: inherit; border: 0; background: transparent; padding: 8px 18px; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
/* Растянутые на всю ширину вкладки с равными половинами */
.tabs.full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
/* Мелкий вариант — для второстепенного выбора */
.tabs.sm { padding: 3px; }
.tabs.sm button { padding: 5px 12px; font-size: 14px; }
/* Шапка формы входа: переключатели и пояснение одним плотным блоком */
.auth-head { display: flex; flex-direction: column; gap: 8px; }
.auth-head .tabs { margin: 0; }
.auth-head p { margin: 0; padding: 0 4px; }

/* ===== Уведомления ===== */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); font-size: 15px; animation: pop .3s ease both; }

/* ===== Подвал ===== */
.footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--ink-3); font-size: 13.5px; }
.footer-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }

.loader { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* Печать отчёта работодателя */
@media print {
  .topbar, .footer, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .bar > i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

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

/* ===== Окно «Карточка для соцсетей» ===== */
.share-dlg { padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(0, 0, 0, .35); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.share-dlg::backdrop { background: rgba(15, 13, 25, .6); backdrop-filter: blur(4px); }
.share-dlg-in { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.share-dlg-head { display: flex; align-items: center; justify-content: space-between; }
.share-dlg-head h3 { margin: 0; }
.share-dlg-head .btn.link { color: var(--ink-3); font-size: 18px; padding: 4px 8px; }
.share-dlg .tabs.sm .tiny { color: inherit; opacity: .6; font-weight: 400; }
.share-dlg p { margin: 0; }
/* Превью: высота ограничена окном, ширина — по пропорциям выбранного формата */
.share-preview { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; }
.share-preview img { display: block; height: min(52dvh, 520px); aspect-ratio: 9 / 16; border-radius: 12px; box-shadow: var(--shadow); background: #141223; transition: opacity .2s ease; }
.share-dlg[data-format="post"] .share-preview img { aspect-ratio: 4 / 5; }
.share-dlg.busy .share-preview img { opacity: .4; }
.shared-row + .shared-row { margin-top: 14px; }
