:root {
  --bg: #000000;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  background: var(--bg);
}

.scene {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.start-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.dog-stage {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
}

.dog {
  position: relative;
  width: min(62vw, 660px);
  aspect-ratio: 282 / 485;
  margin-bottom: -18px;
}

.dog__body,
.dog__head {
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.dog__body {
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 100%;
  z-index: 1;
  transform: translateX(-50%);
}

.dog__head {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 75.5%;
  z-index: 2;
  transform: translateX(-50%);
  transform-origin: 50% 88%;
}

body.is-playing .dog__head {
  animation:
    head-start 1.6s ease-in-out forwards,
    head-swing 2.5s ease-in-out 1.6s infinite alternate;
}

@keyframes head-start {
  0% {
    transform: translateX(-50%) rotate(0deg);
  }
  100% {
    transform: translateX(calc(-50% - 3px)) rotate(-5deg);
  }
}

@keyframes head-swing {
  0% {
    transform: translateX(calc(-50% - 3px)) rotate(-5deg);
  }
  100% {
    transform: translateX(calc(-50% + 3px)) rotate(5deg);
  }
}

@media (max-width: 640px) {
  .dog {
    width: min(84vw, 460px);
  }
}
