/* 배비 캐릭터 v2 — SVG/CSS 리깅 + 상태 모션 */
.baeby-scene {
  position: relative;
  width: 160px;
  height: 180px;
  margin: 0 auto;
}

.baeby-glow {
  position: absolute;
  inset: 20px 10px 0;
  background: radial-gradient(circle, rgba(110, 231, 183, 0.35) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

.baeby-shadow {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  filter: blur(4px);
  transition: transform 0.3s, opacity 0.3s;
}

.baeby-character {
  position: relative;
  width: 130px;
  height: 150px;
  margin: 0 auto;
  z-index: 1;
}

.baeby-body {
  width: 96px;
  height: 96px;
  background: linear-gradient(160deg, #7ef0c8 0%, #34d399 45%, #10b981 100%);
  border-radius: 48% 48% 44% 44%;
  margin: 28px auto 0;
  position: relative;
  box-shadow:
    inset -8px -10px 20px rgba(5, 150, 105, 0.35),
    inset 6px 6px 16px rgba(255, 255, 255, 0.25),
    0 10px 28px rgba(52, 211, 153, 0.45);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}

.baeby-body::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 18px;
  width: 28px;
  height: 14px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.baeby-cheek {
  position: absolute;
  width: 14px;
  height: 8px;
  background: rgba(255, 120, 120, 0.35);
  border-radius: 50%;
  top: 48px;
  opacity: 0;
  transition: opacity 0.3s;
}

.baeby-cheek.left { left: 12px; }
.baeby-cheek.right { right: 12px; }

.baeby-face {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 40px;
}

.baeby-eye-wrap {
  position: absolute;
  top: 0;
  width: 18px;
  height: 20px;
}

.baeby-eye-wrap.left { left: 8px; }
.baeby-eye-wrap.right { right: 8px; }

.baeby-eye {
  width: 14px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  animation: blink 5s infinite;
}

.baeby-pupil {
  width: 8px;
  height: 9px;
  background: #0f1117;
  border-radius: 50%;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.15s;
}

.baeby-shine {
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  right: 2px;
}

.baeby-brow {
  width: 16px;
  height: 3px;
  background: #047857;
  border-radius: 2px;
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.25s;
}

.baeby-mouth {
  width: 18px;
  height: 9px;
  border: 3px solid #0f1117;
  border-top: none;
  border-radius: 0 0 18px 18px;
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.2s;
}

.baeby-arm {
  width: 22px;
  height: 10px;
  background: linear-gradient(90deg, #34d399, #6ee7b7);
  border-radius: 10px;
  position: absolute;
  top: 54px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.baeby-arm.left { left: -12px; transform: rotate(25deg); transform-origin: right center; }
.baeby-arm.right { right: -12px; transform: rotate(-25deg); transform-origin: left center; }

.baeby-hand {
  width: 10px;
  height: 10px;
  background: #6ee7b7;
  border-radius: 50%;
  position: absolute;
  top: -2px;
}

.baeby-arm.left .baeby-hand { left: -6px; }
.baeby-arm.right .baeby-hand { right: -6px; }

.baeby-feet {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.baeby-foot {
  width: 16px;
  height: 10px;
  background: #059669;
  border-radius: 8px 8px 12px 12px;
}

.baeby-antenna {
  width: 5px;
  height: 22px;
  background: linear-gradient(#059669, #047857);
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.baeby-antenna-tip {
  width: 14px;
  height: 14px;
  background: var(--accent2);
  border-radius: 50%;
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 12px var(--accent2);
}

.baeby-antenna-ring {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border: 2px solid var(--accent2);
  border-radius: 50%;
  opacity: 0;
}

.baeby-think-dots {
  position: absolute;
  top: -8px;
  right: -28px;
  display: none;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.baeby-think-dots span {
  background: var(--muted);
  border-radius: 50%;
  display: block;
  animation: dotFloat 1.4s ease-in-out infinite;
}

.baeby-think-dots span:nth-child(1) { width: 6px; height: 6px; }
.baeby-think-dots span:nth-child(2) { width: 8px; height: 8px; animation-delay: 0.15s; }
.baeby-think-dots span:nth-child(3) { width: 10px; height: 10px; animation-delay: 0.3s; }

.baeby-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.baeby-particle {
  position: absolute;
  font-size: 14px;
  animation: particleFly 0.9s ease-out forwards;
  opacity: 0;
}

.speech-bubble.typing::after {
  content: "▋";
  animation: cursorBlink 0.8s step-end infinite;
  margin-left: 2px;
}

/* ── 상태별 ── */
.baeby-character[data-state="idle"] .baeby-body { animation: float 3s ease-in-out infinite; }
.baeby-character[data-state="idle"] .baeby-cheek { opacity: 0.6; }
.baeby-character[data-state="idle"] .baeby-pupil { animation: lookAround 6s ease-in-out infinite; }

.baeby-character[data-state="listening"] .baeby-antenna { opacity: 1; }
.baeby-character[data-state="listening"] .baeby-antenna-ring { opacity: 1; animation: ringExpand 1.2s ease-out infinite; }
.baeby-character[data-state="listening"] .baeby-antenna-tip { animation: antennaBlink 0.5s infinite; }
.baeby-character[data-state="listening"] .baeby-mouth { animation: talk 0.35s ease-in-out infinite; height: 12px; border-radius: 50%; border: 3px solid #0f1117; }
.baeby-character[data-state="listening"] .baeby-arm.left { animation: waveLeft 0.5s ease infinite; }

.baeby-character[data-state="thinking"] .baeby-think-dots { display: flex; }
.baeby-character[data-state="thinking"] .baeby-brow { transform: translateX(-50%) rotate(-8deg); }
.baeby-character[data-state="thinking"] .baeby-eye-wrap.right .baeby-brow { transform: translateX(-50%) rotate(8deg); }
.baeby-character[data-state="thinking"] .baeby-body { animation: wobble 1.5s ease-in-out infinite; }

.baeby-character[data-state="roulette"] .baeby-body { animation: jumpSpin 0.55s ease infinite; }
.baeby-character[data-state="roulette"] .baeby-shadow { animation: shadowSquash 0.55s ease infinite; }
.baeby-character[data-state="roulette"] .baeby-arm.left { animation: waveLeft 0.35s ease infinite; }
.baeby-character[data-state="roulette"] .baeby-arm.right { animation: waveRight 0.35s ease infinite; }
.baeby-character[data-state="roulette"] .baeby-antenna-tip { animation: antennaBlink 0.3s infinite; }

.baeby-character[data-state="recommend"] .baeby-cheek { opacity: 1; }
.baeby-character[data-state="recommend"] .baeby-arm.right { transform: rotate(-70deg) translateY(-10px); }
.baeby-character[data-state="recommend"] .baeby-mouth { width: 22px; height: 11px; border-radius: 0 0 22px 22px; }
.baeby-character[data-state="recommend"] .baeby-body { animation: celebrateBounce 0.6s ease; }

.baeby-character[data-state="orderReady"] .baeby-arm.right { transform: rotate(-90deg) translate(-4px, -14px); }
.baeby-character[data-state="orderReady"] .baeby-body::after {
  content: "👍";
  position: absolute;
  right: -22px;
  top: 8px;
  font-size: 1.4rem;
  animation: thumbPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.baeby-character[data-state="error"] .baeby-body {
  background: linear-gradient(160deg, #fecaca, #f87171);
  animation: shake 0.4s ease;
}
.baeby-character[data-state="error"] .baeby-mouth {
  width: 14px; height: 6px;
  border: 3px solid #0f1117;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  top: 30px;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  97% { transform: scaleY(0.08); }
}

@keyframes lookAround {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(-70%); }
  75% { transform: translateX(-30%); }
}

@keyframes talk {
  0%, 100% { height: 9px; width: 18px; border-radius: 0 0 18px 18px; }
  50% { height: 14px; width: 14px; border-radius: 50%; }
}

@keyframes jumpSpin {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30% { transform: translateY(-16px) rotate(-6deg); }
  60% { transform: translateY(-8px) rotate(6deg); }
}

@keyframes shadowSquash {
  0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 0.25; }
  50% { transform: translateX(-50%) scaleX(0.7); opacity: 0.15; }
}

@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes waveLeft {
  0%, 100% { transform: rotate(25deg); }
  50% { transform: rotate(55deg); }
}

@keyframes waveRight {
  0%, 100% { transform: rotate(-25deg); }
  50% { transform: rotate(-55deg); }
}

@keyframes antennaBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--accent2); }
  50% { opacity: 0.5; box-shadow: 0 0 4px var(--accent2); }
}

@keyframes ringExpand {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.4); opacity: 0; }
}

@keyframes dotFloat {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-6px); }
}

@keyframes celebrateBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes thumbPop {
  0% { transform: scale(0) rotate(-20deg); }
  70% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes particleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0.3); }
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}
