body.entrance-open { overflow: hidden; }

.site-entrance {
  position: fixed;
  inset: 0;
  z-index: 900;
  min-height: 100svh;
  overflow: hidden;
  background: #f7eadc;
  isolation: isolate;
  transition: opacity .48s ease .95s, visibility .48s ease .95s;
}

.entrance-background {
  position: absolute;
  inset: -2%;
  background: url("assets/panapanana/entrance/entrance-background.jpg") center 49% / cover no-repeat;
  transition: opacity 1.15s cubic-bezier(.22,.7,.2,1), transform 1.15s ease, filter 1.15s ease;
}

.entrance-pet {
  --pet-width: clamp(150px, 16vw, 245px);
  position: absolute;
  left: 53%;
  top: 59%;
  width: var(--pet-width);
  aspect-ratio: 192 / 208;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  -webkit-tap-highlight-color: transparent;
  animation: entrance-float 2.2s ease-in-out infinite;
}

.entrance-pet:focus-visible { outline: 5px solid #fff000; outline-offset: 12px; border-radius: 45%; }

.entrance-sprite {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("assets/panapanana/entrance/shunana-spritesheet.webp");
  background-size: 800% 1100%;
  background-position: var(--sprite-x, 0%) var(--sprite-y, 0%);
  background-repeat: no-repeat;
  transform-origin: 50% 82%;
  filter: drop-shadow(9px 12px 0 #19245d);
}

.entrance-bubble {
  position: absolute;
  z-index: 2;
  left: 70%;
  bottom: 82%;
  width: max-content;
  padding: .48em 1.08em .5em;
  border: 3px solid #35273b;
  border-radius: 50% 46% 52% 48% / 55% 49% 52% 45%;
  background: #fffdf4;
  color: #35273b;
  box-shadow: 5px 6px 0 #19245d;
  font: 700 clamp(17px, 1.7vw, 27px)/1.05 "Bradley Hand", "Comic Sans MS", "Chalkboard SE", cursive;
  letter-spacing: .035em;
  text-transform: lowercase;
  transform: rotate(-2deg);
}

.entrance-bubble-stroke {
  position: absolute;
  z-index: 3;
  top: 70%;
  left: 5%;
  color: #35273b;
  font: 400 42px/.8 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  pointer-events: none;
  transform: rotate(26deg) scaleX(.76);
  transform-origin: center;
}

.entrance-pet.is-pyoko .entrance-sprite { animation: entrance-pyoko .82s cubic-bezier(.2,.72,.18,1); }
.entrance-pet.is-activated { animation: none; }
.entrance-pet.is-activated .entrance-sprite { animation: entrance-poyon .78s cubic-bezier(.16,.9,.18,1) both; }
.entrance-pet.is-activated .entrance-bubble { animation: bubble-pop .32s ease both; }

.entrance-particle {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  font-size: clamp(21px, 2.5vw, 39px);
  pointer-events: none;
  opacity: 0;
  animation: particle-burst .82s cubic-bezier(.18,.8,.24,1) var(--delay) both;
}

.site-entrance.is-entering .entrance-background { opacity: .1; transform: scale(1.035); filter: saturate(.75) brightness(1.2); }
.site-entrance.is-entering { opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes entrance-float { 0%,100% { transform: translate(-50%,-50%) translateY(-5px) rotate(-1deg); } 50% { transform: translate(-50%,-50%) translateY(7px) rotate(1deg); } }
@keyframes entrance-pyoko { 0%,100% { transform: translateY(0) scale(1); } 38% { transform: translateY(-19px) scale(1.035,.97); } 76% { transform: translateY(2px) scale(.985,1.025); } }
@keyframes entrance-poyon { 0% { transform: scale(1); } 20% { transform: translateY(7%) scale(1.2,.64); } 52% { transform: translateY(-12%) scale(.88,1.25); } 72% { transform: translateY(-6%) scale(1.16,.9); } 100% { transform: scale(1.08); } }
@keyframes bubble-pop { to { opacity: 0; transform: scale(.5) rotate(9deg); } }
@keyframes particle-burst { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--tx)),calc(-50% + var(--ty))) scale(1.05) rotate(var(--turn)); } }

@media (max-width: 900px) {
  .entrance-background { background-position: 54% center; }
  .entrance-pet { --pet-width: clamp(155px, 25vw, 215px); left: 52%; top: 58%; }
}

@media (max-width: 560px) {
  .entrance-background { background-position: 58% center; }
  .entrance-pet { --pet-width: clamp(145px, 42vw, 185px); left: 49%; top: 57%; }
  .entrance-sprite { filter: drop-shadow(6px 8px 0 #19245d); }
  .entrance-bubble { left: 63%; bottom: 84%; border-width: 2.5px; box-shadow: 4px 5px 0 #19245d; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .entrance-pet { animation: none; }
  .entrance-pet.is-pyoko .entrance-sprite { animation-duration: .01ms; }
  .entrance-pet.is-activated .entrance-sprite { animation-duration: .2s; }
  .entrance-particle { animation-duration: .25s; }
}
