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

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

.dg {
  display: grid;
  place-items: center;
}

.dg__hit {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.dg__scene {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: clamp(220px, 66vw, 300px);
  aspect-ratio: 16/9;
}

.dg__shadow {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 64%;
  height: 12px;
  background: rgba(23, 20, 26, 0.2);
  border-radius: 50%;
  transform: translateX(-50%);
}

.dg__body {
  position: absolute;
  bottom: 12px;
  left: 24%;
  width: 52%;
  height: 34%;
  background: #fff7e6;
  border: 3px solid #17141a;
  border-radius: 999px;
}

.dg__leg {
  position: absolute;
  bottom: 0;
  width: 7%;
  height: 16%;
  background: #fff7e6;
  border: 3px solid #17141a;
  border-radius: 4px;
}

.dg__leg--1 {
  left: 30%;
}

.dg__leg--2 {
  left: 40%;
}

.dg__leg--3 {
  left: 58%;
}

.dg__leg--4 {
  left: 68%;
}

.dg__head {
  position: absolute;
  bottom: 26%;
  left: 4%;
  width: 34%;
  aspect-ratio: 1;
  background: #fff7e6;
  border: 3px solid #17141a;
  border-radius: 50%;
  transform: rotate(-6deg);
  transform-origin: 80% 90%;
  animation-name: dgHeadTilt;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes dgHeadTilt {
  0%, 100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(-2deg);
  }
}
.dg__ear {
  position: absolute;
  top: -4%;
  left: 6%;
  width: 34%;
  aspect-ratio: 1/1.5;
  background: #ff9ebb;
  border: 3px solid #17141a;
  border-radius: 50% 50% 46% 46%;
  transform-origin: 50% 6%;
  animation-name: dgEarSway;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes dgEarSway {
  0%, 100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(7deg);
  }
}
.dg__tail {
  position: absolute;
  bottom: 38%;
  right: 16%;
  width: 6%;
  height: 24%;
  background: #ff9ebb;
  border: 3px solid #17141a;
  border-radius: 999px;
  transform-origin: 50% 100%;
  animation-name: dgWag;
  animation-duration: 0.5s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes dgWag {
  0%, 100% {
    transform: rotate(-22deg);
  }
  50% {
    transform: rotate(22deg);
  }
}
.dg[data-speed="2"] .dg__tail {
  animation-duration: 0.36s;
}

.dg[data-speed="3"] .dg__tail {
  animation-duration: 0.26s;
}

.dg__eyeOpen, .dg__happy {
  position: absolute;
  top: 34%;
  width: 13%;
  aspect-ratio: 1;
}

.dg__eyeOpen {
  background: #17141a;
  border-radius: 50%;
}

.dg__eyeOpen--1 {
  left: 20%;
}

.dg__eyeOpen--2 {
  left: 56%;
}

.dg__happy {
  border-top: 4px solid #17141a;
  border-radius: 50%;
  visibility: hidden;
}

.dg__happy--1 {
  left: 20%;
}

.dg__happy--2 {
  left: 56%;
}

.dg--love .dg__eyeOpen {
  visibility: hidden;
}

.dg--love .dg__happy {
  visibility: visible;
}

.dg__snout {
  position: absolute;
  top: 52%;
  left: 34%;
  width: 34%;
  aspect-ratio: 1/0.8;
  background: #ffffff;
  border: 3px solid #17141a;
  border-radius: 50%;
}

.dg__nose {
  position: absolute;
  top: 10%;
  left: 50%;
  width: 26%;
  aspect-ratio: 1;
  background: #17141a;
  border-radius: 50%;
  transform: translateX(-50%);
}

.dg__heart {
  position: absolute;
  top: 6%;
  left: 12%;
  width: 12%;
  aspect-ratio: 1;
  color: #ffd23f;
  transform: scale(0);
}

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

.dg__heart--fly {
  animation: dgHeartRise 900ms cubic-bezier(0.2, 1.2, 0.4, 1) 1 forwards;
}

@keyframes dgHeartRise {
  0% {
    transform: translateY(6px) scale(0.2);
  }
  30% {
    transform: translateY(-4px) scale(1.05);
  }
  70% {
    transform: translateY(-22px) scale(0.85);
  }
  100% {
    transform: translateY(-34px) scale(0.2);
  }
}
.dg.is-demo .dg__heart {
  animation-name: dgHeartShow;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.2, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes dgHeartShow {
  0%, 61% {
    transform: translateY(6px) scale(0);
  }
  68% {
    transform: translateY(-6px) scale(1.05);
  }
  80% {
    transform: translateY(-24px) scale(0.8);
  }
  88%, 100% {
    transform: translateY(-34px) scale(0);
  }
}
@media (max-width: 340px) {
  .dg__body, .dg__head, .dg__leg, .dg__tail, .dg__ear, .dg__snout {
    border-width: 2px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dg__tail,
  .dg__ear,
  .dg__head,
  .dg.is-demo .dg__heart,
  .dg__heart--fly {
    animation: none !important;
  }
}
