*,
*::before,
*::after {
  box-sizing: border-box;
  padding: 0;
  border: 0;
}

body {
  width: 100vw;
  height: 100vh;
  background-color: #ddd;
  display: flex;
  justify-content: center;
  align-items: center;
}

.matching {
  display: flex;
  gap: 20px;
  position: relative;
  width: 200px;
  height: 200px;
}

.avatar {
  position: absolute;
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0px 0px 0px 3px #fff;
}

.matching > img {
  animation-name: move, scale, rotate;
  animation-duration: 1.4s, 1.4s, 1.4s;
  animation-iteration-count: infinite, infinite, infinite;
  animation-timing-function: ease-in-out, linear, linear;
  opacity: 0;
}

.matching > img:nth-of-type(2) {
  animation-delay: 0.45s;
}

.matching > img:nth-of-type(3) {
  animation-delay: 0.9s;
}

.bottom {
  width: 100%;
  display: flex;
  position: absolute;
  gap: 20px;
  bottom: 30px;
}

.bottom img {
  width: 20px;
  height: 20px;
  animation: 1.6s infinite circle ease-in-out;
}

.text {
  font-weight: 700;
}

.result {
  display: none;
}

.result.show {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: popup 1s;
}

.result img {
  position: relative;
}

.result .firework {
  position: absolute;
  z-index: -1;
}

@keyframes popup {
  from {
    transform: translateY(50px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0px);
    opacity: 1;
  }
}

@keyframes circle {
  from {
    transform: rotate(360deg) translateX(5px) rotate(-360deg);
  }
  to {
    transform: rotate(0deg) translateX(5px) rotate(0deg);
  }
}

@keyframes move {
  0% {
    left: -70px;
  }
  70% {
    left: 70px;
  }
  100% {
    left: -70px;
  }
}

@keyframes scale {
  0% {
    opacity: 1;
    z-index: 1;
    transform: scale(1);
  }
  32% {
    z-index: 1;
    transform: scale(0.8);
    animation-timing-function: ease-in;
  }
  70% {
    z-index: 2;
    transform: scale(1);
    animation-timing-function: ease-in;
  }
  75% {
    z-index: 2;
    transform: scale(1.2);
    animation-timing-function: ease-in-out;
  }
  82% {
    z-index: 2;
    transform: scale(1.5);
  }
  90% {
    z-index: 2;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    z-index: 1;
    transform: scale(1);
  }
}

@keyframes rotate {
  0% {
    background-position: 100px;
  }
  100% {
    background-position: 0px;
  }
}
