html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #bfe6fb;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}
canvas#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}
button {
  font: inherit;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.round {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 252, 240, 0.92);
  box-shadow: 0 6px 0 rgba(60, 40, 30, 0.18), 0 10px 24px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  transition: transform 0.12s;
}
.round:active { transform: scale(0.92); }
.round svg { width: 58%; height: 58%; }
.round.big { width: 120px; height: 120px; }

#btnHome {
  position: fixed;
  left: calc(14px + env(safe-area-inset-left));
  top: calc(14px + env(safe-area-inset-top));
  z-index: 3;
}

#done {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 40px;
  z-index: 5;
  animation: rise 0.5s cubic-bezier(.2, 1.6, .4, 1);
}
#done .round { animation: breathe 1.6s ease-in-out infinite; }
#done .round + .round { animation-delay: 0.4s; }
@keyframes rise { from { transform: translateY(160px); } to { transform: none; } }
@keyframes breathe { 50% { transform: scale(1.08); } }

#grownups {
  position: fixed;
  right: calc(10px + env(safe-area-inset-right));
  top: calc(10px + env(safe-area-inset-top));
  display: flex;
  gap: 8px;
  z-index: 4;
  opacity: 0.55;
}
#grownups button {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  font-weight: 700;
  color: #2b2230;
}
#grownups .hold::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 4px solid #2f6db8;
  clip-path: inset(100% 0 0 0);
}
#grownups .hold.holding::after { animation: fill 0.7s linear forwards; }
@keyframes fill { to { clip-path: inset(0 0 0 0); } }

#start {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.35), rgba(30, 60, 90, 0.35));
  display: grid;
  place-items: center;
  transition: opacity 0.5s;
}
#start.gone { opacity: 0; pointer-events: none; }
#start .play {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #35c24a;
  box-shadow: 0 10px 0 #1f7a2c, 0 20px 40px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: breathe 1.4s ease-in-out infinite;
}
#start .play::after {
  content: "";
  position: absolute;
  left: 62px; top: 45px;
  border-left: 62px solid #fff;
  border-top: 40px solid transparent;
  border-bottom: 40px solid transparent;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  background: #bfe6fb;
  font-size: 60px;
  transition: opacity 0.6s;
}
#loading.gone { opacity: 0; pointer-events: none; }
#loading .dot {
  width: 60px; height: 60px; border-radius: 50%;
  background: #f2a31b;
  animation: bounce 0.7s ease-in-out infinite alternate;
}
@keyframes bounce { to { transform: translateY(-40px) scale(1.1, 0.9); } }

#flash {
  position: fixed; inset: 0; z-index: 5; background: #fff;
  opacity: 0; pointer-events: none;
}
#flash.go { animation: flash 0.7s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

#fade {
  position: fixed; inset: 0; z-index: 5; background: #fffaf0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s;
}
#fade.on { opacity: 1; }

#big {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  font-size: min(42vw, 42vh);
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 8px #2f6db8;
  paint-order: stroke fill;
  text-shadow: 0 10px 0 rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
}
#big.go { animation: big 0.7s ease-out; }
@keyframes big { 0% { opacity: 0; transform: scale(0.3); } 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1); } }

#hand {
  position: fixed; left: -28px; top: -6px; z-index: 4;
  width: 64px; height: 64px;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}
#hand svg { width: 100%; height: 100%; }
#hand.tap svg { animation: tap 0.6s ease-in-out infinite; }
#hand.slide { transition: transform 1s ease-in-out; }
@keyframes tap { 50% { transform: translateY(14px) scale(0.92); } }

#photo {
  position: fixed; inset: 0; z-index: 4;
  display: grid; place-items: center;
  background: rgba(30, 40, 60, 0.35);
}
#photo .frame {
  width: min(78vw, 120vh);
  padding: 18px;
  background: #fffaf0;
  border: 14px solid #b07a45;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
}
#photo img { display: block; width: 100%; border-radius: 4px; }
#photo.go .frame { animation: photo 0.8s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes photo { from { transform: scale(0.2) rotate(-12deg); opacity: 0; } to { transform: rotate(-2deg); opacity: 1; } }

@media (max-height: 500px) {
  .round { width: 66px; height: 66px; }
  .round.big { width: 92px; height: 92px; }
  #start .play { width: 130px; height: 130px; }
  #start .play::after { left: 48px; top: 35px; border-left-width: 46px; border-top-width: 30px; border-bottom-width: 30px; }
}
