* {
  box-sizing: border-box;
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #f6f1df;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--viewport-width, 100vw);
  min-height: 0;
  height: var(--viewport-height, 100svh);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.screen {
  position: relative;
  display: none;
  width: var(--game-width, min(100vw, 56.25svh, 430px));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #ffeb55;
  box-shadow: 0 0 24px rgba(91, 58, 24, 0.12);
}

.screen.active {
  display: block;
}

.screen-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.intro-screen {
  background: #fffdf4;
}

.intro-area {
  left: 12.5%;
  top: 37%;
  width: 75%;
  height: 23%;
  border-radius: 999px;
}

.tap-area {
  position: absolute;
  z-index: 8;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.play-area {
  left: 17.5%;
  top: 74.2%;
  width: 65%;
  height: 11.4%;
}

.start-area {
  left: 13%;
  top: 77%;
  width: 74%;
  height: 11.3%;
}

.wallpaper-area {
  left: 18.5%;
  top: 59.8%;
  width: 63%;
  height: 9.2%;
  border-radius: 12px;
}

.home-area {
  left: 31.5%;
  top: 78.6%;
  width: 35%;
  height: 5.5%;
  border-radius: 12px;
}

.sound {
  position: absolute;
  z-index: 20;
  top: 1.6%;
  right: 2.7%;
  width: 9.5%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.sound-icon {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.sound-off,
.sound.is-muted .sound-on {
  visibility: hidden;
}

.sound.is-muted .sound-off {
  visibility: visible;
}

.found-check,
.found-mark {
  position: absolute;
  z-index: 12;
  display: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.found-check.visible,
.found-mark.visible {
  display: block;
  animation: pop 180ms ease-out both;
}

.found-check {
  top: 20.2%;
  width: 15%;
  height: auto;
}

.check-figurine {
  left: 28.3%;
}

.check-glasses {
  left: 50.7%;
}

.check-confetti {
  left: 72.9%;
}

.found-mark {
  height: auto;
}

.mark-confetti {
  left: 15.1%;
  top: 68.9%;
  width: 10.5%;
}

.mark-glasses {
  left: 75.5%;
  top: 70.8%;
  width: 13.5%;
}

.mark-figurine {
  left: 67.2%;
  top: 86.1%;
  width: 12.5%;
}

.hit-confetti {
  left: 7%;
  top: 64.2%;
  width: 17%;
  height: 9.5%;
}

.hit-glasses {
  left: 65.5%;
  top: 66.3%;
  width: 20%;
  height: 10%;
}

.hit-figurine {
  left: 57.5%;
  top: 81.7%;
  width: 20%;
  height: 9.5%;
}

.tap-confetti {
  position: absolute;
  z-index: 25;
  left: 0;
  top: 0;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background: var(--particle-color, #ff7900);
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--start-rotation));
  animation: tap-confetti-burst 520ms cubic-bezier(0.16, 0.72, 0.3, 1) forwards;
}

.sparkle {
  position: absolute;
  z-index: 24;
  left: 0;
  top: 0;
  color: #fff9a6;
  font-size: var(--sparkle-size, 24px);
  line-height: 1;
  text-shadow: 0 0 4px #fff, 0 0 9px #ffb300;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.2) rotate(var(--sparkle-rotation));
  animation: sparkle-pop 680ms ease-out var(--sparkle-delay, 0ms) forwards;
}

.countdown {
  position: absolute;
  z-index: 35;
  left: 50%;
  top: 50%;
  display: none;
  width: var(--game-width, min(100vw, 56.25svh, 430px));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffeb55;
  transform: translate(-50%, -50%);
}

.countdown.active {
  display: flex;
}

.countdown-image {
  display: none;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.countdown-image.active {
  display: block;
}

.countdown-image.number-image {
  width: 46%;
}

.countdown-image.start-image {
  width: 88%;
}

.countdown-image.pop {
  animation: count-pop 500ms cubic-bezier(0.2, 0.9, 0.28, 1) both;
}

.transition-wash {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.transition-wash.active {
  pointer-events: auto;
  animation: white-fade 440ms ease-in-out both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.65);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes tap-confetti-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--start-rotation)) scale(0.9);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) rotate(var(--end-rotation)) scale(0.45);
  }
}

@keyframes sparkle-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(var(--sparkle-rotation));
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sparkle-x)), calc(-50% + var(--sparkle-y))) scale(1.15) rotate(calc(var(--sparkle-rotation) + 28deg));
  }
}

@keyframes count-pop {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(-5deg);
  }
  40% {
    opacity: 1;
    transform: scale(1.08) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes white-fade {
  0% {
    opacity: 0;
  }
  46% {
    opacity: 0.94;
  }
  58% {
    opacity: 0.94;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 430px) {
  .screen {
    box-shadow: none;
  }
}
