* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f8fbff;
  background:
    radial-gradient(circle at 25% 20%, rgba(86, 116, 166, 0.16), transparent 36%),
    radial-gradient(circle at 80% 75%, rgba(23, 41, 74, 0.48), transparent 44%),
    linear-gradient(135deg, #090f1d 0%, #17233f 48%, #070d18 100%);
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.pika-wrap {
  position: relative;
  width: 450px;
  height: 450px;
  display: grid;
  place-items: center;
}

.pika {
  width: 450px;
  height: 450px;
  object-fit: contain;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 160ms ease;
}

.pika:hover {
  transform: translateY(-4px) scale(1.02);
}

.pika:active {
  transform: translateY(1px) scale(0.99);
}

.speech-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 72px);
  z-index: 2;
  max-width: min(430px, 86vw);
  min-width: 210px;
  min-height: 72px;
  padding: 18px 22px;
  border: 4px solid #10192f;
  border-radius: 28px;
  background: #fff7d6;
  color: #14203a;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.22;
  text-align: center;
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.16), 0 24px 50px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, 10px) scale(0.92) rotate(-1deg);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: 55%;
  bottom: -28px;
  width: 34px;
  height: 34px;
  background: #fff7d6;
  border-right: 4px solid #10192f;
  border-bottom: 4px solid #10192f;
  transform: rotate(45deg);
}

.speech-bubble.show {
  visibility: visible;
  opacity: 1;
  animation: bubble-in 220ms cubic-bezier(.2, 1.35, .4, 1) forwards;
}

.speech-bubble.typing::after {
  content: "|";
  margin-left: 3px;
  animation: caret 0.8s steps(1) infinite;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.82) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(-1deg);
  }
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .pika-wrap,
  .pika {
    width: min(450px, 86vw);
    height: min(450px, 86vw);
  }

  .speech-bubble {
    bottom: calc(100% - 44px);
    font-size: 18px;
    border-width: 3px;
    padding: 14px 18px;
  }
}
