/* ===== Палитра: бежевые + красно-розовые пастельные ===== */
:root {
  --cream: #f7f0e6;
  --sand: #efe3d3;
  --blush: #f7d9d8;
  --rose: #e9a7a8;
  --deep-rose: #c86b74;
  --wine: #a4444f;
  --coffee: #5c4033;
  --soft-coffee: #7a5f52;
  --text: #4a3a33;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  padding: 28px 20px 60px;
  overflow-x: hidden;
}

/* ===== Фон: мягкие пастельные пятна ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--cream) 0%, var(--sand) 100%);
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.7;
}

.b1 { width: 45vmax; height: 45vmax; background: radial-gradient(circle, var(--blush) 0%, rgba(247, 217, 216, 0) 68%); top: -10%; left: -8%; }
.b2 { width: 38vmax; height: 38vmax; background: radial-gradient(circle, #f3d3c7 0%, rgba(243, 211, 199, 0) 68%); bottom: -12%; right: -10%; }
.b3 { width: 28vmax; height: 28vmax; background: radial-gradient(circle, #f2c9c4 0%, rgba(242, 201, 196, 0) 68%); top: 18%; left: 58%; }
.b4 { width: 20vmax; height: 20vmax; background: radial-gradient(circle, #eec9be 0%, rgba(238, 201, 190, 0) 68%); bottom: 22%; left: 12%; }
.b5 { width: 24vmax; height: 24vmax; background: radial-gradient(circle, var(--rose) 0%, rgba(233, 167, 168, 0) 68%); top: -6%; right: 24%; opacity: 0.5; }

/* ===== Обёртка ===== */
.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--wine);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.back:hover { text-decoration: underline; }

/* ===== Появление элементов сверху вниз ===== */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.head { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s backwards; }

.menu-link.tab:nth-child(1) { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.13s backwards; }
.menu-link.tab:nth-child(2) { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s backwards; }
.menu-link.tab:nth-child(3) { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.23s backwards; }
.menu-link.tab:nth-child(4) { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.28s backwards; }

/* Панель теста появляется последней; при переключении вкладки проигрывается заново */
.test { animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.33s backwards; }

.src { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.4s backwards; }

/* Уважение к настройке «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  .head,
  .menu-link.tab,
  .test,
  .src {
    animation: none;
  }
}

/* ===== Шапка ===== */
.head {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  padding: 34px 30px;
  text-align: center;
  box-shadow:
    0 24px 60px -20px rgba(164, 68, 79, 0.28),
    0 6px 20px -8px rgba(92, 64, 51, 0.15);
}

.title {
  font-size: 30px;
  font-weight: 800;
  color: var(--coffee);
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 6px;
  color: var(--deep-rose);
  font-size: 17px;
  font-weight: 700;
}

.note {
  margin-top: 16px;
  color: var(--soft-coffee);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

/* ===== Меню выбора теста ===== */
.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 22px 0;
}

.menu-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid rgba(233, 167, 168, 0.45);
  background: rgba(255, 255, 255, 0.68);
  color: var(--coffee);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(164, 68, 79, 0.35);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease;
}

.menu-link.tab { justify-content: center; }

.menu-link.tab.active {
  background: linear-gradient(120deg, var(--blush), var(--rose));
  border-color: var(--deep-rose);
  color: var(--coffee);
}

.menu-link:hover {
  transform: translateY(-2px);
  background: linear-gradient(120deg, var(--blush), var(--rose));
  color: var(--coffee);
}

.menu-link:focus-visible {
  outline: 3px solid var(--deep-rose);
  outline-offset: 2px;
}

.menu-link .mi { font-size: 16px; }

/* ===== Карточка теста ===== */
.test {
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  padding: 26px 24px 22px;
  box-shadow:
    0 18px 44px -22px rgba(164, 68, 79, 0.22),
    0 4px 14px -6px rgba(92, 64, 51, 0.12);
}

.test-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--coffee);
  margin-bottom: 4px;
}

.test-sub {
  color: var(--soft-coffee);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

/* ===== Группы ===== */
.groups { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }

.grp-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--coffee);
  margin-bottom: 4px;
}

.items { display: flex; flex-direction: column; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(233, 167, 168, 0.25);
}

.item:last-child { border-bottom: none; }

.item-q {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.pts {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(233, 167, 168, 0.4);
  color: var(--wine);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* ===== Вопрос одного выбора (тревога): номер/текст/варианты ===== */
.q-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  padding-top: 14px;
  border-bottom: none;
}

.q-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--deep-rose);
  line-height: 1.4;
}

.q-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.options {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  margin: 4px 0 0 12px;
  border-bottom: 1px solid rgba(233, 167, 168, 0.25);
}

/* ===== Чекбокс варианта ===== */
.chk {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.chk input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chk .box {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(164, 68, 79, 0.4);
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.chk .box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 10px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: translate(-50%, -56%) rotate(45deg) scale(0);
  transition: transform 0.18s ease;
}

.chk:hover .box {
  border-color: var(--deep-rose);
  background: var(--blush);
}

.chk input:focus-visible + .box {
  outline: 3px solid var(--deep-rose);
  outline-offset: 2px;
}

.chk input:checked + .box {
  background: linear-gradient(120deg, var(--rose), var(--wine));
  border-color: transparent;
}

.chk input:checked + .box::after {
  transform: translate(-50%, -56%) rotate(45deg) scale(1);
}

/* ===== Кнопки и результат ===== */
.test-foot,
.btns {
  display: flex;
  justify-content: center;
  margin: 20px 0 4px;
}

.btn {
  padding: 14px 26px;
  border-radius: 16px;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, var(--blush), var(--rose));
  color: var(--coffee);
  box-shadow: 0 10px 24px -12px rgba(164, 68, 79, 0.5);
}

.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--wine);
  border: 1px solid rgba(233, 167, 168, 0.45);
}

.result {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow:
    0 18px 44px -22px rgba(164, 68, 79, 0.22),
    0 4px 14px -6px rgba(92, 64, 51, 0.12);
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--coffee);
  margin-bottom: 12px;
}

.score {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.score b { color: var(--wine); }

.verdict {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(247, 217, 216, 0.6);
  border: 1px solid rgba(233, 167, 168, 0.4);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.verdict .lvl {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--wine);
  margin-bottom: 6px;
}

.result .btn-ghost { margin-top: 16px; }

/* ===== Кнопка записи на консультацию ===== */
.consult {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.consult-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 16px;
  background: linear-gradient(120deg, var(--wine), var(--deep-rose));
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px -12px rgba(164, 68, 79, 0.6);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.consult-btn:hover { transform: translateY(-2px); }
.consult-btn:active { transform: translateY(0); }
.consult-btn:focus-visible {
  outline: 3px solid var(--deep-rose);
  outline-offset: 2px;
}

.src {
  margin-top: 18px;
  color: var(--soft-coffee);
  font-size: 12px;
  line-height: 1.5;
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 480px) {
  .head { padding: 26px 20px; }
  .title { font-size: 24px; }
  .test { padding: 20px 16px 18px; }
  .test-title { font-size: 19px; }
  .pt { font-size: 14px; }
  .pts { font-size: 11px; }
  .menu-link { font-size: 13px; padding: 10px 14px; }
}

/* Кнопки-ссылки и ряд кнопок */
a.btn { display: inline-block; text-decoration: none; }
.btns { gap: 12px; flex-wrap: wrap; }
.btn-ghost { background: rgba(255, 255, 255, 0.7); color: var(--wine); border: 1px solid rgba(233, 167, 168, 0.45); }

/* Кнопка-ссылка в карточке результата: те же размеры, что у <button> */
.btn { line-height: normal; }
.result a.btn-ghost { display: inline-block; margin-top: 16px; }

/* Вторичная кнопка (ссылка или button) в одном стиле с основной */
.btn { transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, box-shadow 0.2s ease; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.78);
  color: var(--wine);
  border: 1px solid rgba(233, 167, 168, 0.6);
  box-shadow: 0 10px 24px -14px rgba(164, 68, 79, 0.35);
}
.btn-ghost:hover {
  background: linear-gradient(120deg, var(--blush), var(--rose));
  color: var(--coffee);
  transform: translateY(-2px);
}
.btn-ghost:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--deep-rose); outline-offset: 2px; }
