/* ═══════════════════════════════════════════════════════════════════
   Components: Avatar Stage (Video / Placeholder)
   ═══════════════════════════════════════════════════════════════════ */

.fy-avatar-video-wrap,
.fy-avatar-placeholder {
  position: relative;
  overflow: hidden;
  min-height: clamp(300px, 36vw, 470px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(25, 38, 43, 0.12);
  /* #UI 数字人克制化：深海蓝 + 极弱蓝色 radial light，去掉大面积橙 */
  background: radial-gradient(120% 90% at 50% 20%, rgba(90, 125, 232, 0.28) 0%, rgba(16, 36, 58, 0) 60%), linear-gradient(155deg, #10243A 0%, #0C1B2E 100%);
}

.fy-avatar-video {
  display: block;
  width: 100%;
  height: clamp(300px, 36vw, 470px);
  object-fit: cover;
  background: #132622;
}

.fy-avatar-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 23% 18%;
  opacity: 0.42;
  filter: saturate(0.82) contrast(1.05);
}

.fy-avatar-placeholder > :not(.fy-avatar-poster) {
  position: relative;
  z-index: 1;
}

.fy-avatar-caption {
  position: absolute;
  inset: auto 14px 14px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(16, 36, 33, 0.84);
  color: var(--color-paper-light);
  font-size: 0.88rem;
  backdrop-filter: blur(8px);
}

.fy-avatar-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 28px;
  text-align: center;
  color: var(--color-paper-light);
}

.fy-avatar-placeholder::before {
  content: "";
  position: absolute;
  inset: 12% -14% auto;
  height: 70%;
  border-radius: 50%;
  background: rgba(255, 250, 241, 0.12);
  transform: rotate(-12deg);
}

.fy-avatar-placeholder > * { position: relative; }

.fy-avatar-placeholder strong {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 1.24rem;
}

.fy-avatar-placeholder p {
  max-width: 24ch;
  margin: 8px 0 0;
  color: rgba(255, 250, 241, 0.84);
}

.fy-avatar-placeholder.is-failed {
  background: linear-gradient(155deg, #9e5038, #6d3527 55%, #283a36);
}

/* Avatar Face (CSS fallback) */
.fy-avatar-face {
  width: 96px;
  height: 96px;
  border-radius: 40% 40% 46% 46%;
  background: #fff3df;
  box-shadow: 0 18px 38px rgba(30, 24, 18, 0.22);
  position: relative;
}

.fy-avatar-face span {
  position: absolute;
  top: 39px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-accent-600);
}

.fy-avatar-face span:first-child { left: 26px; }
.fy-avatar-face span:nth-child(2)  { right: 26px; }

.fy-avatar-face i {
  position: absolute;
  left: 34px;
  bottom: 23px;
  width: 28px;
  height: 12px;
  border-bottom: 4px solid var(--color-brand-700);
  border-radius: 50%;
}

/* Pulse animation */
.fy-avatar-pulse {
  width: 46px;
  height: 5px;
  margin-top: 18px;
  border-radius: var(--radius-full);
  background: rgba(255, 250, 241, 0.82);
  animation: fy-avatar-breathe 1.4s ease-in-out infinite;
}

@keyframes fy-avatar-breathe {
  0%, 100% { transform: scaleX(0.72); opacity: 0.55; }
  50%      { transform: scaleX(1);    opacity: 1; }
}

/* Progress bar */
.fy-avatar-progress {
  width: 100%;
  max-width: 240px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fy-avatar-progress span {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
  position: relative;
}

.fy-avatar-progress span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 240, 200, 0.85);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  width: var(--p, 0%);
}

.fy-avatar-progress small {
  font-size: 0.8rem;
  color: rgba(255, 250, 241, 0.85);
  white-space: nowrap;
  min-width: 2.4em;
  text-align: right;
}

/* TalkingHead fallback */
.fy-talking-head-fallback {
  width: min(100%, 430px);
  min-height: 250px;
}

.fy-talking-head-fallback .fy-digital-human {
  min-height: 250px;
  text-align: left;
}

/* Responsive */
@media (max-width: 820px) {
  .fy-avatar-video-wrap,
  .fy-avatar-placeholder,
  .fy-avatar-video {
    min-height: 300px;
    height: min(74vw, 430px);
  }
}

@media (max-width: 520px) {
  .fy-avatar-video-wrap,
  .fy-avatar-placeholder,
  .fy-avatar-video {
    min-height: 280px;
    height: 72vw;
  }
}
