#figure {
  --mane1: #ffbdac;
  --mane2: #f48d99;
  --mane3: #df799b;
  --mane4: #c171a4;
}
#figure.lilac {
  --mane1: #ddcbf4;
  --mane2: #c89ad9;
  --mane3: #b187ce;
  --mane4: #9275b4;
}
#pony-hair stop:nth-child(1) {
  stop-color: var(--mane1);
}
#pony-hair stop:nth-child(2) {
  stop-color: var(--mane2);
}
#pony-hair stop:nth-child(3) {
  stop-color: var(--mane3);
}
#pony-hair stop:nth-child(4) {
  stop-color: var(--mane4);
}
#figure #unicorn {
  animation: breathe 3.4s ease-in-out infinite;
}
#figure #tail {
  animation: swish 3.8s ease-in-out infinite;
}
#figure #ear-near {
  animation: twitch 7.1s ease-in-out infinite;
}
#figure #eyelids {
  animation: blink 5.7s ease-in-out infinite;
}
#figure #pupils {
  animation: look 8.7s ease-in-out infinite;
}
#figure #head {
  animation: curious 14s ease-in-out infinite;
}
#figure #mouth {
  animation: yawn 19s ease-in-out infinite;
}
#figure[data-state='sleeping'] #eyes {
  opacity: 0;
}
#figure[data-state='sleeping'] #eyelids,
#figure[data-state='petting'] #eyelids {
  animation: none;
  opacity: 1;
}
#figure[data-state='sleeping'] #unicorn {
  animation: slumber 4.5s ease-in-out infinite;
}
#figure[data-state='sleeping'] #head {
  animation: none;
  transform: rotate(-11deg);
}
#figure[data-state='sleeping'] #front-leg-near,
#figure[data-state='sleeping'] #hind-legs {
  transform: scaleY(0.65);
}
#figure[data-state='sleeping'] #tail {
  animation-duration: 8s;
}
#figure[data-state='hungry'] #head {
  rotate: -3deg;
}
#figure[data-state='tired'] #head {
  rotate: -6deg;
}
#figure[data-state='dirty'] #ear-far {
  rotate: -7deg;
}
#figure[data-state='sleeping']:before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 9%;
  width: 82%;
  height: 23%;
  bottom: 0;
  border-radius: 50%;
  background: repeating-linear-gradient(
    40deg,
    #e1c7e5 0 12px,
    #d9bddd 12px 23px
  );
  border: 2px solid #b69bbd;
  box-shadow: 0 4px 0 #b79ec2;
}
body.paused * {
  animation-play-state: paused !important;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.008, 0.982);
  }
}
@keyframes swish {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(7deg);
  }
}
@keyframes twitch {
  0%,
  68%,
  82%,
  100% {
    transform: rotate(0);
  }
  72% {
    transform: rotate(9deg);
  }
  77% {
    transform: rotate(-4deg);
  }
}
@keyframes blink {
  0%,
  92%,
  97%,
  100% {
    opacity: 0;
  }
  94%,
  95% {
    opacity: 1;
  }
}
@keyframes look {
  0%,
  52%,
  85%,
  100% {
    transform: translate(0, 0);
  }
  65%,
  77% {
    transform: translate(-1.9px, 1px);
  }
}
@keyframes curious {
  0%,
  70%,
  98%,
  100% {
    transform: rotate(0);
  }
  80%,
  88% {
    transform: rotate(3deg);
  }
}
@keyframes yawn {
  0%,
  89%,
  97%,
  100% {
    transform: scale(1);
  }
  94% {
    transform: scale(0.8, 1.7);
  }
}
@keyframes slumber {
  0%,
  100% {
    transform: translateY(13px) scale(1, 0.83);
  }
  50% {
    transform: translateY(13px) scale(1.012, 0.85);
  }
}
