/* =========================================================
   Фаза — equalizer under brand (JS-driven, CSS fallback)
   Unique keyframes — no clash with click FX
   ========================================================= */

.phase-signal {
  --eq-bar: color-mix(in srgb, var(--lime) 88%, #fff);
  --eq-mid: var(--teal);
  --eq-deep: var(--teal-deep, var(--teal));
  --eq-glow: color-mix(in srgb, var(--lime) 50%, transparent);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;
  height: 28px;
  margin: 0.28rem 0 1.1rem;
  max-width: 13.5rem;
  padding: 0 0 5px;
  isolation: isolate;
  contain: layout style;
}

.phase-signal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 8%;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--eq-mid) 0%,
    var(--eq-bar) 42%,
    color-mix(in srgb, var(--eq-mid) 35%, transparent) 78%,
    transparent 100%
  );
  opacity: 0.75;
  pointer-events: none;
}

.phase-signal i {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 4.5px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    var(--eq-bar) 0%,
    var(--eq-mid) 52%,
    var(--eq-deep) 100%
  );
  transform: scaleY(0.35);
  transform-origin: center bottom;
  opacity: 0.92;
  will-change: transform;
  box-shadow:
    0 0 10px var(--eq-glow),
    0 0 18px color-mix(in srgb, var(--eq-mid) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  /* CSS fallback if JS off / reduced — unique name */
  animation: phaseEqPulse 1.35s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
  animation-play-state: paused;
}

.phase-signal.is-eq-live i {
  animation: none;
}

.phase-signal:not(.is-eq-live) i {
  animation-play-state: running;
}

.phase-signal i:nth-child(1) { animation-duration: 1.15s; animation-delay: 0s; }
.phase-signal i:nth-child(2) { animation-duration: 1.42s; animation-delay: -0.18s; }
.phase-signal i:nth-child(3) { animation-duration: 0.98s; animation-delay: -0.42s; }
.phase-signal i:nth-child(4) { animation-duration: 1.28s; animation-delay: -0.08s; }
.phase-signal i:nth-child(5) { animation-duration: 1.55s; animation-delay: -0.55s; }
.phase-signal i:nth-child(6) { animation-duration: 1.08s; animation-delay: -0.3s; }
.phase-signal i:nth-child(7) { animation-duration: 1.36s; animation-delay: -0.62s; }

@keyframes phaseEqPulse {
  0%,
  100% { transform: scaleY(0.28); opacity: 0.72; }
  18% { transform: scaleY(0.62); opacity: 0.9; }
  36% { transform: scaleY(0.4); opacity: 0.8; }
  54% { transform: scaleY(1); opacity: 1; }
  72% { transform: scaleY(0.52); opacity: 0.88; }
  88% { transform: scaleY(0.78); opacity: 0.95; }
}

.phase-signal-sm {
  height: 22px;
  gap: 4px;
  margin: 0.18rem 0 0.75rem;
  max-width: 10.5rem;
  padding-bottom: 4px;
}

.phase-signal-sm i {
  width: 3.6px;
}

.phase-signal-md {
  height: 26px;
  gap: 4.5px;
  margin: 0.2rem auto 1rem;
  justify-content: center;
  max-width: 11.5rem;
}

.phase-signal-md i {
  width: 4px;
}

.result-signal {
  margin: 0.3rem 0 0.8rem;
}

body.theme-couple .phase-signal,
body.theme-friends .phase-signal,
body.theme-family .phase-signal {
  --eq-bar: color-mix(in srgb, var(--lime) 75%, #fff);
  --eq-mid: var(--teal);
  --eq-deep: var(--teal-deep, var(--teal));
  --eq-glow: color-mix(in srgb, var(--lime) 55%, transparent);
}

body.theme-couple .phase-signal::after,
body.theme-friends .phase-signal::after,
body.theme-family .phase-signal::after {
  opacity: 0.9;
}

/* —— NEW: logo twin-sync (не эквалайзер) —— */
.logo {
  gap: 0.45rem;
}

.logo-sync {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 0.2rem;
  height: 10px;
}

.logo-sync i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--logo-to, var(--lime)) 55%, var(--logo-from, var(--teal)));
  animation: logoDot 2.2s var(--ease) infinite;
}

.logo-sync i:last-child {
  animation-delay: 0.35s;
  background: radial-gradient(circle at 30% 30%, #fff, var(--logo-from, var(--teal)) 55%, var(--logo-to, var(--lime)));
}

.logo-sync b {
  display: block;
  width: 8px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--logo-from, var(--teal)), var(--logo-to, var(--lime)));
  opacity: 0.55;
  animation: logoBridge 2.2s var(--ease) infinite;
  transform-origin: center;
}

@keyframes logoDot {
  0%,
  100% { transform: scale(0.85); opacity: 0.65; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes logoBridge {
  0%,
  100% { transform: scaleX(0.7); opacity: 0.35; }
  50% { transform: scaleX(1); opacity: 0.85; }
}

/* —— NEW: mini sync near eyebrows / quiz —— */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.mini-sync {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 8px;
}

.mini-sync i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal);
  animation: logoDot 1.9s var(--ease) infinite;
  box-shadow: 0 0 6px color-mix(in srgb, var(--lime) 40%, transparent);
}

.mini-sync i:last-child {
  animation-delay: 0.3s;
  background: var(--lime);
}

.mini-sync b {
  width: 7px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), var(--lime));
  animation: logoBridge 1.9s var(--ease) infinite;
  opacity: 0.6;
}

.quiz-live-sync {
  margin-right: 0.2rem;
}

.quiz-live-sync i {
  width: 5px;
  height: 5px;
}

/* —— NEW: option twin pulse —— */
.option::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 16px;
  height: 8px;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at 20% 50%, var(--teal) 0 2px, transparent 2.5px),
    radial-gradient(circle at 80% 50%, var(--lime) 0 2px, transparent 2.5px),
    linear-gradient(90deg, transparent 20%, color-mix(in srgb, var(--teal) 55%, transparent) 50%, transparent 80%)
      center / 100% 1.5px no-repeat;
  opacity: 0.22;
  pointer-events: none;
  transition: opacity 0.25s ease;
  animation: optionSync 2.6s var(--ease) infinite;
}

.option:hover::after {
  opacity: 0.75;
}

.option.is-picked::after {
  /* pick burst / shine handled in design-alive.css */
  opacity: 1;
  filter: none;
  animation: none;
}

@keyframes optionSync {
  0%,
  100% { transform: translateY(-50%) scaleX(0.88); }
  50% { transform: translateY(-50%) scaleX(1); }
}

/* —— NEW: progress traveling mote —— */
.progress-track {
  position: relative;
  overflow: hidden;
}

.progress-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lime) 80%, #fff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--lime) 55%, transparent);
  opacity: 0.55;
  animation: progressMote 3.2s linear infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes progressMote {
  0% { left: 0; opacity: 0; }
  12% { opacity: 0.7; }
  88% { opacity: 0.7; }
  100% { left: calc(100% - 7px); opacity: 0; }
}

.progress-fill {
  z-index: 1;
  position: relative;
}

/* —— NEW: mode tag twin dots —— */
.mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.mode-card .mode-tag::after {
  content: "";
  width: 14px;
  height: 6px;
  background:
    radial-gradient(circle at 15% 50%, var(--teal) 0 2px, transparent 2.4px),
    radial-gradient(circle at 85% 50%, var(--lime) 0 2px, transparent 2.4px),
    linear-gradient(90deg, var(--teal), var(--lime)) center / 70% 1.5px no-repeat;
  opacity: 0.55;
  animation: logoBridge 1.8s var(--ease) infinite;
}

.mode-card.is-pro .mode-tag::after,
.mode-card[data-mode="paid"] .mode-tag::after {
  background:
    radial-gradient(circle at 15% 50%, var(--lime) 0 2px, transparent 2.4px),
    radial-gradient(circle at 85% 50%, #fff 0 2px, transparent 2.4px),
    linear-gradient(90deg, var(--lime), #fff) center / 70% 1.5px no-repeat;
}

/* —— NEW: who-badge twin —— */
.who-badge {
  position: relative;
  padding-left: 1.55rem;
}

.who-badge::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: calc(50% - 3px);
  width: 14px;
  height: 6px;
  background:
    radial-gradient(circle at 15% 50%, currentColor 0 2px, transparent 2.3px),
    radial-gradient(circle at 85% 50%, currentColor 0 2px, transparent 2.3px),
    linear-gradient(90deg, currentColor, currentColor) center / 55% 1.5px no-repeat;
  opacity: 0.65;
  animation: logoBridge 1.7s var(--ease) infinite;
}

/* —— NEW: invite = orbit link (не полоски) —— */
.invite-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.invite-fab::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--teal) 55%, transparent);
  background:
    radial-gradient(circle at 32% 50%, var(--teal) 0 1.8px, transparent 2.2px),
    radial-gradient(circle at 68% 50%, var(--lime) 0 1.8px, transparent 2.2px);
  animation: inviteOrbit 2.2s var(--ease) infinite;
  flex-shrink: 0;
}

body.theme-couple .invite-fab.is-active::before,
body.theme-couple.coop-on .invite-fab::before,
body.theme-couple .invite-fab:hover::before {
  border-color: color-mix(in srgb, #d9486c 70%, transparent);
  box-shadow: 0 0 10px rgba(255, 143, 171, 0.65);
}

@keyframes inviteOrbit {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.7;
    border-color: color-mix(in srgb, var(--teal) 40%, transparent);
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
    border-color: color-mix(in srgb, var(--lime) 65%, transparent);
  }
}

/* —— NEW: step pill blink —— */
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.step-pill::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--lime);
  box-shadow: 0 0 8px color-mix(in srgb, var(--lime) 50%, transparent);
  animation: logoDot 2s var(--ease) infinite;
}

/* —— NEW: score mote —— */
.score-ring-wrap {
  position: relative;
}

.score-ring-wrap::after {
  content: "";
  position: absolute;
  top: 10%;
  right: 16%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ring-color, #ff5c8a);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ring-color, #ff5c8a) 60%, transparent);
  opacity: calc(0.35 + var(--ring-fill, 0.5) * 0.65);
  animation: scoreMote 2.8s var(--ease) infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes scoreMote {
  0%,
  100% { opacity: 0.35; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1.2); }
  70% { opacity: 0.55; transform: scale(0.9); }
}

/* hide leftover sync-hero markup if any */
.phase-sync {
  display: none !important;
}

@media (max-width: 820px) {
  .phase-signal {
    height: 24px;
    gap: 4px;
  }

  .phase-signal i {
    width: 3.8px;
  }

  .phase-signal-sm {
    height: 20px;
  }

  .option::after {
    right: 0.65rem;
    opacity: 0.18;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phase-signal i,
  .logo-sync i,
  .logo-sync b,
  .mini-sync i,
  .mini-sync b,
  .option::after,
  .progress-track::after,
  .mode-card .mode-tag::after,
  .who-badge::before,
  .invite-fab::before,
  .step-pill::after,
  .score-ring-wrap::after {
    animation: none !important;
  }

  .phase-signal i {
    transform: scaleY(0.55) !important;
    opacity: 0.85 !important;
  }

  .phase-signal i:nth-child(odd) {
    transform: scaleY(0.72) !important;
  }

  .phase-signal i:nth-child(3n) {
    transform: scaleY(0.42) !important;
  }
}
