/* Optional voice-intro wizard step: listening stage, mic orb, waveform, states. */

.voice-intro {
  --voice-accent: #ff9ab5;
  --voice-accent-2: #df7afe;
  --voice-glow: rgba(223, 122, 254, 0.28);
  text-align: center;
  justify-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0 0.35rem;
  width: 100%;
}

.voice-intro__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.voice-intro__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(129, 74, 200, 0.28);
  border: 1px solid rgba(223, 122, 254, 0.28);
}

.voice-intro__pill--soft {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-soft, rgba(243, 248, 255, 0.72));
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.voice-intro h2 {
  margin: 0.15rem 0 0;
  max-width: 18ch;
  line-height: 1.2;
}

.voice-intro__subtitle {
  max-width: 34ch;
  margin: 0;
  line-height: 1.45;
}

.voice-intro__examples {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: min(340px, 100%);
  margin: 0.1rem 0 0.05rem;
}

.voice-intro__cues {
  position: relative;
  width: 100%;
  height: 2.5rem;
  overflow: hidden;
}

.voice-intro__cue {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 0.25rem;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.3;
  color: rgba(255, 236, 244, 0.92);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 420ms ease,
    transform 420ms ease;
  pointer-events: none;
}

.voice-intro__cue.is-active {
  opacity: 1;
  transform: translateY(0);
}

.voice-intro__example-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
}

.voice-intro__example-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition:
    transform 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

.voice-intro__example-dots span.is-active {
  transform: scale(1.25);
  background: #ff9ab5;
  box-shadow: 0 0 0 3px rgba(255, 154, 181, 0.18);
}

.voice-recorder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: min(360px, 100%);
  margin: 0.4rem 0 0.15rem;
  padding: 1.35rem 1.1rem 1.15rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 90% 70% at 50% 18%, rgba(223, 122, 254, 0.14), transparent 58%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(129, 74, 200, 0.08));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.voice-recorder__glow {
  position: absolute;
  width: 180px;
  height: 180px;
  top: 12%;
  left: 50%;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--voice-glow), transparent 68%);
  filter: blur(2px);
  opacity: 0.55;
  pointer-events: none;
  animation: voice-glow-breathe 3.4s ease-in-out infinite;
}

.voice-recorder[data-state="recording"] .voice-recorder__glow {
  background: radial-gradient(circle, rgba(255, 122, 168, 0.38), transparent 68%);
  animation-duration: 1.6s;
  opacity: 0.85;
}

.voice-recorder[data-state="sending"] .voice-recorder__glow,
.voice-recorder[data-state="done"] .voice-recorder__glow {
  animation: none;
  opacity: 0.4;
}

@keyframes voice-glow-breathe {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.72;
  }
}

.voice-recorder__stage {
  position: relative;
  z-index: 1;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-recorder__ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 154, 181, 0.48);
  opacity: 0;
  transform: scale(0.78);
  pointer-events: none;
}

.voice-recorder[data-state="recording"] .voice-recorder__ring--1 {
  animation: voice-ring-pulse 1.8s ease-out infinite;
}

.voice-recorder[data-state="recording"] .voice-recorder__ring--2 {
  animation: voice-ring-pulse 1.8s ease-out infinite;
  animation-delay: 0.45s;
}

.voice-recorder[data-state="recording"] .voice-recorder__ring--3 {
  animation: voice-ring-pulse 1.8s ease-out infinite;
  animation-delay: 0.9s;
}

@keyframes voice-ring-pulse {
  0% {
    opacity: 0.55;
    transform: scale(0.78);
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

.voice-recorder__progress {
  position: absolute;
  inset: 0;
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.voice-recorder[data-state="recording"] .voice-recorder__progress {
  opacity: 1;
}

.voice-recorder__progress-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3.5;
}

.voice-recorder__progress-fill {
  fill: none;
  stroke: var(--voice-accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  /* 2 * PI * 64 */
  stroke-dasharray: 402.12;
  stroke-dashoffset: 402.12;
  transition: stroke-dashoffset 240ms linear;
}

.voice-recorder__btn {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(145deg, rgba(129, 74, 200, 0.55), rgba(223, 122, 254, 0.28));
  color: #fff;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 220ms ease,
    border-color 160ms ease;
  box-shadow:
    0 16px 34px rgba(129, 74, 200, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: voice-mic-idle 2.8s ease-in-out infinite;
}

.voice-recorder[data-state="idle"] .voice-recorder__btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(223, 122, 254, 0.55);
  box-shadow:
    0 18px 40px rgba(129, 74, 200, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.voice-recorder__btn:focus-visible {
  outline: 2px solid rgba(223, 122, 254, 0.8);
  outline-offset: 4px;
}

.voice-recorder__btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  animation: none;
}

@keyframes voice-mic-idle {
  0%,
  100% {
    box-shadow:
      0 16px 34px rgba(129, 74, 200, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.16);
  }
  50% {
    box-shadow:
      0 18px 42px rgba(223, 122, 254, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
}

.voice-recorder__icon {
  width: 32px;
  height: 32px;
  display: none;
}

.voice-recorder__icon--mic {
  display: block;
}

.voice-recorder__spinner {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
}

.voice-recorder[data-state="recording"] .voice-recorder__btn {
  animation: none;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(145deg, #ff7ea8, #ff9ab5);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 16px 38px rgba(255, 122, 168, 0.48);
}

.voice-recorder[data-state="recording"] .voice-recorder__icon--mic {
  display: none;
}

.voice-recorder[data-state="recording"] .voice-recorder__icon--stop {
  display: block;
}

.voice-recorder[data-state="sending"] .voice-recorder__btn {
  cursor: wait;
  animation: none;
  background: linear-gradient(145deg, rgba(129, 74, 200, 0.55), rgba(223, 122, 254, 0.35));
}

.voice-recorder[data-state="sending"] .voice-recorder__icon--mic,
.voice-recorder[data-state="sending"] .voice-recorder__icon--stop {
  display: none;
}

.voice-recorder[data-state="sending"] .voice-recorder__spinner {
  display: block;
  animation: voice-spin 0.8s linear infinite;
}

.voice-recorder[data-state="done"] .voice-recorder__btn {
  animation: voice-done-pop 480ms ease;
  border-color: rgba(110, 231, 183, 0.45);
  box-shadow:
    0 16px 36px rgba(69, 196, 160, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.voice-recorder[data-state="done"] .voice-recorder__icon--mic {
  display: block;
}

.voice-recorder[data-state="done"] .voice-recorder__icon--stop,
.voice-recorder[data-state="done"] .voice-recorder__spinner {
  display: none;
}

.voice-recorder__success-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #0f2a22;
  background: linear-gradient(145deg, #6ee7b7, #45c4a0);
  border: 2px solid rgba(22, 17, 42, 0.85);
  box-shadow: 0 6px 16px rgba(69, 196, 160, 0.4);
  pointer-events: none;
}

.voice-recorder__success-badge svg {
  width: 14px;
  height: 14px;
}

.voice-recorder[data-state="done"] .voice-recorder__success-badge {
  display: inline-flex;
  animation: voice-badge-pop 420ms ease;
}

@keyframes voice-done-pop {
  0% {
    transform: scale(0.94);
  }
  55% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes voice-badge-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  70% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes voice-spin {
  to {
    transform: rotate(360deg);
  }
}

.voice-recorder__wave {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 280px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.voice-recorder[data-state="recording"] .voice-recorder__wave,
.voice-recorder[data-state="sending"] .voice-recorder__wave {
  opacity: 1;
  transform: translateY(0);
}

.voice-recorder[data-state="sending"] .voice-recorder__bars span {
  animation: voice-bar-shim 0.9s ease-in-out infinite;
}

.voice-recorder[data-state="sending"] .voice-recorder__bars span:nth-child(3n) {
  animation-delay: 0.15s;
}

.voice-recorder[data-state="sending"] .voice-recorder__bars span:nth-child(3n + 1) {
  animation-delay: 0.3s;
}

@keyframes voice-bar-shim {
  0%,
  100% {
    height: 18%;
  }
  50% {
    height: 62%;
  }
}

.voice-recorder__bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 42px;
}

.voice-recorder__bars span {
  flex: 1 1 0;
  max-width: 5px;
  min-width: 2.5px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    var(--voice-accent),
    var(--voice-accent-2),
    var(--purple, #814ac8)
  );
  height: 14%;
  transform-origin: center;
  transition: height 80ms ease-out;
  opacity: 0.92;
}

.voice-recorder__footer {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.2rem;
  justify-items: center;
  min-height: 2.6rem;
}

.voice-recorder__cta {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: -0.01em;
}

.voice-recorder[data-state="done"] .voice-recorder__cta {
  color: #9aefd0;
}

.voice-intro__status {
  margin: 0.15rem 0 0;
  min-height: 1.25em;
  max-width: 36ch;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-soft, rgba(243, 248, 255, 0.7));
}

.voice-intro__status:empty {
  min-height: 0;
}

@media (max-width: 520px) {
  .voice-intro {
    padding-top: 0.4rem;
  }

  .voice-intro__cue {
    font-size: 0.8rem;
  }

  .voice-intro__cues {
    height: 2.6rem;
  }

  .voice-recorder {
    padding: 1.15rem 0.9rem 1rem;
  }

  .voice-recorder__stage {
    width: 124px;
    height: 124px;
  }

  .voice-recorder__progress {
    width: 124px;
    height: 124px;
  }

  .voice-recorder__btn {
    width: 78px;
    height: 78px;
  }

  .voice-recorder__icon {
    width: 28px;
    height: 28px;
  }

  .voice-recorder__success-badge {
    width: 24px;
    height: 24px;
  }

  .voice-recorder__success-badge svg {
    width: 12px;
    height: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .voice-recorder__glow,
  .voice-recorder__ring,
  .voice-recorder__spinner,
  .voice-recorder__btn,
  .voice-recorder[data-state="done"] .voice-recorder__btn,
  .voice-recorder[data-state="done"] .voice-recorder__success-badge,
  .voice-recorder[data-state="sending"] .voice-recorder__bars span,
  .voice-intro__cue {
    animation: none !important;
    transition: none !important;
  }

  .voice-intro__cue {
    opacity: 0;
  }

  .voice-intro__cue.is-active {
    opacity: 1;
    transform: none;
  }
}
