.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 12;
  pointer-events: none;
}

.balloon {
  position: absolute;
  left: 0;
  top: 0;
  aspect-ratio: 1;
  background: none;
  padding: 0;
  will-change: transform;
  pointer-events: auto;
  touch-action: none;
}

.balloon .art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balloon .tint-balloon {
  position: absolute;
  inset: 0;
}

.balloon span {
  position: absolute;
  left: 0;
  right: 0;
  top: 19%;
  text-align: center;
  font-size: 1em;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 3px 0 rgba(61, 58, 92, 0.25);
  pointer-events: none;
}

.balloon.pop .tint-balloon,
.balloon.pop span {
  animation: balloon-pop 0.26s ease-out forwards;
}

.goal {
  position: fixed;
  top: calc(max(14px, env(safe-area-inset-top)) + 78px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 999px;
  padding: 4px 26px;
  font-size: 30px;
  font-weight: 800;
  box-shadow: var(--shadow);
  z-index: 10;
}

.mascot-box.corner {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
  pointer-events: none;
}

.mascot-box.corner .bubble {
  max-width: min(280px, calc(100vw - 600px - clamp(90px, 14vw, 150px)));
}

@media (orientation: portrait) {
  .mascot-box.corner {
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 84px);
  }
  .mascot-box.corner .bubble {
    max-width: min(420px, calc(100vw - 60px - clamp(90px, 14vw, 150px)));
    margin-bottom: 40px;
  }
}

.start-balloons {
  display: flex;
  justify-content: center;
  gap: 6px;
  height: 140px;
}

.start-balloons .tint-balloon {
  width: 110px;
  animation: bob 2.4s ease-in-out infinite;
}

.start-balloons .tint-balloon:nth-child(2) {
  animation-delay: -0.8s;
  transform: translateY(-10px);
}

.start-balloons .tint-balloon:nth-child(3) {
  animation-delay: -1.6s;
}

@keyframes balloon-pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  60% {
    transform: scale(1.3);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.balloon.appear .tint-balloon,
.balloon.appear span {
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.speed {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 20px;
}

.speed button {
  min-width: 72px;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--sky);
  font-size: 20px;
  font-weight: 800;
  transition: transform 0.1s ease, background 0.2s ease;
}

.speed button:active {
  transform: scale(0.94);
}

.speed button.on {
  background: var(--mint-deep);
  color: #fff;
}

@media (max-width: 600px) {
  .goal {
    top: calc(max(10px, env(safe-area-inset-top)) + 52px);
    padding: 2px 20px;
    font-size: 24px;
  }
  .speed {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 6px;
    padding: 5px;
  }
  .speed > span {
    display: none;
  }
  .speed button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 0 4px;
    font-size: 16px;
    white-space: nowrap;
  }
  .mascot-box.corner {
    left: max(8px, env(safe-area-inset-left));
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 64px);
    align-items: center;
    gap: 6px;
  }
  .mascot-box.corner img {
    width: 56px;
  }
  .mascot-box.corner .bubble {
    max-width: calc(100vw - 96px);
    margin-bottom: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 17px;
    line-height: 1.3;
  }
  .mascot-box.corner .bubble::after {
    bottom: 50%;
    margin-bottom: -12px;
  }
  .start-balloons {
    height: 96px;
  }
  .start-balloons .tint-balloon {
    width: 76px;
  }
}

#start {
  padding-bottom: 96px;
}

@media (max-width: 600px) {
  #start {
    padding: 10px 10px 76px;
  }
  #start .panel {
    padding: 14px 16px 18px;
  }
  #start .panel p {
    font-size: 15px;
    margin: 6px 0;
  }
  #start .panel h1 {
    font-size: 26px;
    margin: 4px 0;
  }
  .start-balloons {
    height: 64px;
  }
  .start-balloons .tint-balloon {
    width: 52px;
  }
}
