/* ══════════════════════════════════════════════
   Колесо Баланса — Звезда в круге
   ══════════════════════════════════════════════ */

/* Контейнер колеса */
.bw-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 15px 5px;
  position: relative;
}

.bw-title {
  font-size: 15px;
  font-weight: 600;
  color: #3d3d3d;
  margin-bottom: 8px;
  text-align: center;
}

/* Кнопка чата над колесом */
.bw-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 220px;
  margin: 15px auto 15px;
  padding: 13px 8px;
  background: linear-gradient(135deg, #8b7355 0%, #6b5a47 100%);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(107,90,71,0.3);
}
.bw-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107,90,71,0.4);
}
.bw-chat-btn:active {
  transform: translateY(0);
}
.bw-chat-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* SVG контейнер */
.bw-star-wrap {
  position: relative;
  width: 215px;
  height: 215px;
  margin: 0 auto;
}

.bw-star-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(139,115,85,0.15));
}

/* Градиенты анимации заполнения */
.bw-star-svg .bw-ray-fill {
  transition: d 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
  opacity: 0.85;
}
.bw-star-svg .bw-ray-fill:hover {
  opacity: 1;
  filter: brightness(1.1);
}

/* Пунктирные линии незаполненной части */
.bw-star-svg .bw-ray-outline {
  fill: none;
  stroke-dasharray: 4 3;
  stroke-width: 1;
  opacity: 0.4;
}

/* Контур звезды */
.bw-star-svg .bw-star-stroke {
  fill: none;
  stroke: #8b7355;
  stroke-width: 2;
  stroke-linejoin: round;
  opacity: 0.6;
}

/* Круг */
.bw-star-svg .bw-circle {
  fill: none;
  stroke: #8b7355;
  stroke-width: 1.5;
  opacity: 0.25;
}

/* Метки сфер вокруг звезды */
.bw-sphere-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bw-sphere-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s;
}
.bw-sphere-label:hover { transform: scale(1.08); }

.bw-sphere-name {
  font-size: 11px;
  font-weight: 500;
  color: #6b5b4a;
  white-space: nowrap;
}

.bw-sphere-value {
  font-size: 13px;
  font-weight: 700;
  color: #3d3d3d;
}

/* Позиции меток (5-конечная звезда, новый порядок) */
.bw-sphere-label[data-sphere="spirituality"] { top: -5px;  left: 60%; transform: translateX(-50%); }
.bw-sphere-label[data-sphere="realization"]  { top: 27%;  right: -18px; }
.bw-sphere-label[data-sphere="relations"]    { bottom: -3%; right: 2%; }
.bw-sphere-label[data-sphere="health"]       { bottom: -3%; left: 11%; }
.bw-sphere-label[data-sphere="personality"]  { top: 26%;  left: -18px; }

/* Центральная кнопка */
.bw-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(139,115,85,0.2);
  background: linear-gradient(135deg, #ffffff 0%, #f5f0e8 100%);
  box-shadow: 0 2px 12px rgba(139,115,85,0.2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
}
.bw-center-btn:hover {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 4px 20px rgba(139,115,85,0.3);
  border-color: rgba(139,115,85,0.4);
}
.bw-center-btn:active { transform: translate(-50%, -50%) scale(0.97); }
.bw-center-btn-icon { font-size: 16px; line-height: 1; }
.bw-center-btn-text { font-size: 8px; color: #8b7355; font-weight: 600; margin-top: 1px; }

/* Общая оценка под звездой */
.bw-total {
  text-align: center;
  margin-top: 6px;
  font-size: 13px;
  color: #8b7355;
}
.bw-total-value {
  font-weight: 700;
  font-size: 15px;
  color: #3d3d3d;
}

/* Индикатор загрузки автозаполнения */
.bw-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}
.bw-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139,115,85,0.2);
  border-top-color: #8b7355;
  border-radius: 50%;
  animation: bw-spin 1s linear infinite;
}
@keyframes bw-spin {
  to { transform: rotate(360deg); }
}
.bw-loading-text {
  font-size: 14px;
  color: #8b7355;
  text-align: center;
}

/* ══════════════════════════════════════════════
   Анимация переливания (shimmer)
   ══════════════════════════════════════════════ */
@keyframes bw-shimmer {
  0%   { opacity: 0.75; }
  50%  { opacity: 0.95; }
  100% { opacity: 0.75; }
}
.bw-ray-fill.bw-animated {
  animation: bw-shimmer 3s ease-in-out infinite;
}

/* Анимация появления при загрузке */
@keyframes bw-fill-in {
  from { transform: scale(0) rotate(-10deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 0.85; }
}
.bw-ray-fill.bw-appear {
  animation: bw-fill-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: center;
}

/* ══════════════════════════════════════════════
   Тест Колеса Баланса — Модалка
   ══════════════════════════════════════════════ */
.bw-test-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.bw-test-overlay.active { display: flex; }

.bw-test-modal {
  background: #faf8f5;
  border-radius: 20px;
  width: 92%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  position: relative;
}

.bw-test-header {
  padding: 20px 20px 10px;
  text-align: center;
}
.bw-test-title {
  font-size: 18px;
  font-weight: 600;
  color: #3d3d3d;
}
.bw-test-subtitle {
  font-size: 13px;
  color: #9a8b7a;
  margin-top: 4px;
}

/* Прогресс-бар */
.bw-test-progress {
  display: flex;
  gap: 3px;
  padding: 0 20px;
  margin: 12px 0;
}
.bw-test-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e8e0d5;
  transition: background 0.3s;
}
.bw-test-progress-dot.done { background: #8b7355; }
.bw-test-progress-dot.current { background: linear-gradient(90deg, #8b7355, #d4a574); }

/* Содержимое вопроса */
.bw-test-body {
  padding: 15px 20px 20px;
}
.bw-test-sphere-name {
  font-size: 12px;
  font-weight: 600;
  color: #d4a574;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.bw-test-question {
  font-size: 15px;
  color: #3d3d3d;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Слайдер оценки */
.bw-test-slider-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.bw-test-slider-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 11px;
  color: #9a8b7a;
}
.bw-test-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #e8e0d5 0%, #d4a574 50%, #8b7355 100%);
  outline: none;
}
.bw-test-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #8b7355;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.bw-test-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #8b7355;
  cursor: pointer;
}
.bw-test-slider-value {
  font-size: 28px;
  font-weight: 700;
  color: #8b7355;
}

/* Варианты ответа (уточняющий вопрос) */
.bw-test-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bw-test-option {
  padding: 10px 14px;
  border: 1.5px solid rgba(139,115,85,0.15);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #3d3d3d;
  transition: all 0.2s;
  text-align: left;
}
.bw-test-option:hover { border-color: rgba(139,115,85,0.3); background: #fffcf8; }
.bw-test-option.selected {
  border-color: #8b7355;
  background: linear-gradient(135deg, #f5f0e8, #fffcf8);
  box-shadow: 0 2px 8px rgba(139,115,85,0.15);
}

/* Поле ввода "Другое" */
.bw-test-other-input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 14px;
  border: 1.5px solid rgba(139,115,85,0.2);
  border-radius: 12px;
  font-size: 14px;
  color: #3d3d3d;
  background: #fff;
  font-family: inherit;
  resize: none;
  box-sizing: border-box;
}
.bw-test-other-input:focus { outline: none; border-color: #8b7355; }

/* Кнопки навигации */
.bw-test-nav {
  display: flex;
  gap: 10px;
  padding: 15px 20px 20px;
}
.bw-test-btn {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.bw-test-btn-back {
  background: #f0ebe4;
  color: #8b7355;
}
.bw-test-btn-back:hover { background: #e8e0d5; }
.bw-test-btn-next {
  background: linear-gradient(135deg, #8b7355, #a08060);
  color: #fff;
  box-shadow: 0 3px 10px rgba(139,115,85,0.3);
}
.bw-test-btn-next:hover { box-shadow: 0 4px 16px rgba(139,115,85,0.4); transform: translateY(-1px); }
.bw-test-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Экран загрузки (анализ AI) */
.bw-test-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}
.bw-test-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e8e0d5;
  border-top-color: #8b7355;
  border-radius: 50%;
  animation: bw-spin 0.8s linear infinite;
}
@keyframes bw-spin {
  to { transform: rotate(360deg); }
}
.bw-test-loading-text {
  font-size: 14px;
  color: #8b7355;
  text-align: center;
}

/* Закрыть модалку */
.bw-test-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(139,115,85,0.08);
  color: #8b7355;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.bw-test-close:hover { background: rgba(139,115,85,0.15); }

/* глобальное правило — не трогает bw-ray-fill */
path:not(.bw-ray-fill) {
  fill: none;
  /* stroke: white; */
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 2) Явно разрешаем fill для лучей звезды — используем более специфичный селектор */
.bw-star-svg path.bw-ray-fill {
  /* разрешаем использовать атрибут fill="url(#...)" внутри SVG */
  /* fill: unset; */
  stroke: none;
}

/* 3) Для контуров звезды (если нужно отдельное оформление) */
.bw-star-svg path.bw-ray-outline,
.bw-star-svg path.bw-star-stroke {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ══════════════════════════════════════════════
   Адаптив
   ══════════════════════════════════════════════ */
@media (max-width: 360px) {
  .bw-star-wrap { width: 240px; height: 240px; }
  .bw-center-btn { width: 60px; height: 60px; }
  .bw-center-btn-icon { font-size: 16px; }
  .bw-sphere-name { font-size: 10px; }
  .bw-sphere-value { font-size: 11px; }
}
