html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffd23f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.ch {
  width: min(88vw, 400px);
  display: grid;
  place-items: center;
}

.ch__hit {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch__hit:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 4px;
  border-radius: 16px;
}

.ch__scene {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 16/10;
}

.ch__char {
  position: absolute;
  bottom: 0;
  width: 24%;
  aspect-ratio: 1/0.92;
  border: 3px solid #17141a;
  border-radius: 50% 50% 46% 46%/44% 44% 56% 56%;
}

.ch__char--l {
  left: 8%;
  background: #4cd4a6;
}

.ch__char--r {
  right: 8%;
  background: #ff9ebb;
}

.ch__eye {
  position: absolute;
  top: 34%;
  width: 12%;
  aspect-ratio: 1;
  background: #17141a;
  border-radius: 50%;
}

.ch__eye--l1 {
  left: 30%;
}

.ch__eye--l2 {
  left: 56%;
}

.ch__eye--r1 {
  right: 56%;
}

.ch__eye--r2 {
  right: 30%;
}

.ch__smile {
  position: absolute;
  top: 54%;
  left: 50%;
  width: 20%;
  height: 10%;
  border: 3px solid #17141a;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.ch__bubble {
  position: absolute;
  top: 4%;
  width: 30%;
  aspect-ratio: 1/0.78;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 3px solid #17141a;
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: scale(0);
}

.ch__bubble--l {
  left: 6%;
  transform-origin: 20% 100%;
}

.ch__bubble--r {
  right: 6%;
  transform-origin: 80% 100%;
}

.ch__tail {
  position: absolute;
  bottom: -12%;
  width: 16%;
  aspect-ratio: 1;
  background: #ffffff;
  border-right: 3px solid #17141a;
  border-bottom: 3px solid #17141a;
  transform: rotate(45deg);
}

.ch__bubble--l .ch__tail {
  left: 14%;
}

.ch__bubble--r .ch__tail {
  right: 14%;
}

.ch__icon {
  width: 44%;
  aspect-ratio: 1;
}

.ch__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ch__icon--heart {
  color: #c2361a;
}

.ch__icon--cookie {
  color: #c93000;
}

.ch.is-demo .ch__bubble--l {
  animation-name: chPopL;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

.ch.is-demo .ch__bubble--r {
  animation-name: chPopR;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

.ch.is-demo .ch__tail {
  animation-name: chTail;
  animation-duration: 2s;
  animation-delay: -60ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

.ch.is-demo .ch__eye {
  animation-name: chBlink;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes chPopL {
  0% {
    transform: scale(0);
  }
  10% {
    transform: scale(1.08);
  }
  16%, 44% {
    transform: scale(1);
  }
  45%, 100% {
    transform: scale(0);
  }
}
@keyframes chPopR {
  0%, 49% {
    transform: scale(0);
  }
  50% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.08);
  }
  66%, 94% {
    transform: scale(1);
  }
  95%, 100% {
    transform: scale(0);
  }
}
@keyframes chBlink {
  0%, 19% {
    transform: scaleY(1);
  }
  20%, 24% {
    transform: scaleY(0.1);
  }
  25%, 69% {
    transform: scaleY(1);
  }
  70%, 74% {
    transform: scaleY(0.1);
  }
  75%, 100% {
    transform: scaleY(1);
  }
}
@keyframes chTail {
  0% {
    transform: rotate(45deg) scale(0);
  }
  4%, 44% {
    transform: rotate(45deg) scale(1);
  }
  45%, 49% {
    transform: rotate(45deg) scale(0);
  }
  50% {
    transform: rotate(45deg) scale(0);
  }
  54%, 94% {
    transform: rotate(45deg) scale(1);
  }
  95%, 100% {
    transform: rotate(45deg) scale(0);
  }
}
.ch.mine .ch__bubble--l {
  animation: none;
  transform: scale(1);
}

.ch.mine .ch__bubble--r {
  animation: none;
  transform: scale(0);
}

@media (max-width: 340px) {
  .ch {
    width: min(84vw, 400px);
  }
  .ch__char, .ch__bubble, .ch__smile {
    border-width: 2px;
  }
  .ch__tail {
    border-width: 2px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ch.is-demo .ch__bubble--l,
  .ch.is-demo .ch__bubble--r,
  .ch.is-demo .ch__tail,
  .ch.is-demo .ch__eye {
    animation: none !important;
  }
}
