/* ===== Base / reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  background: #14110f;
  font-family: "Marker Felt", "Chalkboard SE", "Comic Sans MS", "Segoe Print", cursive;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}

/* Cornice "telefono" centrata su desktop, a tutto schermo su mobile */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #fffdf5;
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}

.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

/* ===== SPLASH ===== */
.splash {
  background:
    radial-gradient(120% 80% at 50% -10%, #fff 0%, #fff7e6 55%, #ffe9c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
/* righe da quaderno appena accennate */
.splash::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .25;
  background-image: repeating-linear-gradient(transparent 0 31px, #bcd4e6 31px 32px);
}
.splash-inner {
  position: relative; z-index: 2; text-align: center; padding: 24px;
  animation: pop .5s cubic-bezier(.18,1.4,.4,1) both;
}
.cake { font-size: 84px; line-height: 1; filter: drop-shadow(0 6px 0 rgba(0,0,0,.12)); animation: bob 2.4s ease-in-out infinite; }
.title {
  font-size: clamp(40px, 13vw, 64px);
  line-height: .98; color: #181818; margin: 10px 0 6px;
  letter-spacing: -.5px;
  text-shadow: 3px 3px 0 #ffd23f, 5px 5px 0 rgba(0,0,0,.12);
}
.sub { font-size: clamp(17px, 5vw, 22px); color: #5a534a; margin-bottom: 30px; }

.enter-btn {
  font: inherit; font-size: clamp(20px, 6vw, 26px);
  color: #fff; background: #ff5252;
  border: 4px solid #181818; border-radius: 18px;
  padding: 16px 30px; cursor: pointer;
  box-shadow: 5px 6px 0 #181818;
  transform: rotate(-2deg);
  transition: transform .08s ease, box-shadow .08s ease;
  animation: nudge 1.6s ease-in-out infinite;
}
.enter-btn:active { transform: rotate(-2deg) translate(4px,5px); box-shadow: 1px 1px 0 #181818; }
.hint { margin-top: 22px; font-size: 15px; color: #8a8178; }

/* confetti che salgono */
.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.confetti span {
  position: absolute; bottom: -40px; font-size: 26px; opacity: .85;
  animation: float-up linear infinite;
}
.confetti span:nth-child(1){ left: 8%;  animation-duration: 9s;  animation-delay: 0s;   }
.confetti span:nth-child(2){ left: 22%; animation-duration: 11s; animation-delay: 1.5s; font-size: 32px; }
.confetti span:nth-child(3){ left: 38%; animation-duration: 8s;  animation-delay: 3s;   }
.confetti span:nth-child(4){ left: 54%; animation-duration: 12s; animation-delay: .8s;  font-size: 30px; }
.confetti span:nth-child(5){ left: 68%; animation-duration: 10s; animation-delay: 2.2s; }
.confetti span:nth-child(6){ left: 80%; animation-duration: 9.5s;animation-delay: 4s;   font-size: 22px; }
.confetti span:nth-child(7){ left: 90%; animation-duration: 13s; animation-delay: 1s;   }
.confetti span:nth-child(8){ left: 15%; animation-duration: 14s; animation-delay: 5s;   font-size: 20px; }

/* ===== HOME ===== */
.home { background: #000; }
.bg-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}
.home-shade {
  position: absolute; inset: 0; pointer-events: none;
  /* alone morbido al centro per far risaltare il bottone, lascia liberi i sottotitoli del video in basso */
  background: radial-gradient(58% 42% at 50% 48%, rgba(0,0,0,.38) 0%, rgba(0,0,0,0) 72%);
}
.home-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;  /* bottone al centro schermo */
}
.gift-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; color: #181818;
  background: #ffd23f;
  border: 4px solid #181818; border-radius: 24px;
  padding: 18px 30px 16px; cursor: pointer;
  box-shadow: 0 8px 0 #181818, 0 16px 30px rgba(0,0,0,.45);
  transform: rotate(-1.5deg);
  transition: transform .08s ease, box-shadow .08s ease;
  animation: wobble 1.8s ease-in-out infinite;
}
.gift-btn:active { transform: rotate(-1.5deg) translateY(6px); box-shadow: 0 2px 0 #181818, 0 6px 14px rgba(0,0,0,.4); }
.gift-emoji { font-size: 46px; line-height: 1; animation: bob 2s ease-in-out infinite; }
.gift-label { font-size: 23px; line-height: 1.02; font-weight: 700; text-align: center; }

.sound-hint {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  font: inherit; font-size: 16px; color: #181818;
  background: #fff; border: 3px solid #181818; border-radius: 999px;
  padding: 9px 16px; cursor: pointer; box-shadow: 0 4px 0 #181818;
  animation: nudge 1.2s ease-in-out infinite;
}

/* ===== MODAL ===== */
.modal {
  position: absolute; inset: 0; z-index: 30;
  background: #fffdf5;
  animation: pop .32s cubic-bezier(.18,1.4,.4,1) both;
  overflow: hidden;
}
.face { position: absolute; inset: 0; }
.face .frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 22%;
  -webkit-user-drag: none;
}
.face .f2 { opacity: 0; }
.face.open .f2 { opacity: 1; }      /* swap istantaneo bocca aperta */
.face.open { animation: scream-shake .12s linear infinite; }

.bubble {
  position: absolute; left: 14px; right: 14px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2;
  background: #fff;
  border: 4px solid #181818; border-radius: 22px;
  padding: 18px 18px 20px;
  box-shadow: 0 8px 0 #181818;
  transform: rotate(-.6deg);
  animation: pop-late .5s .12s cubic-bezier(.18,1.4,.4,1) both;
}
/* codina del fumetto */
.bubble::after {
  content: ""; position: absolute; top: -16px; left: 40px;
  border: 12px solid transparent; border-bottom-color: #181818; border-top: 0;
}
.bubble-text { font-size: clamp(19px, 5.4vw, 25px); line-height: 1.25; color: #181818; text-align: center; }
.bubble-text b { color: #ff5252; white-space: nowrap; }

.close-btn {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 5;
  width: 48px; height: 48px;
  font: inherit; font-size: 22px; color: #181818;
  background: #fff; border: 3px solid #181818; border-radius: 50%;
  cursor: pointer; box-shadow: 0 4px 0 #181818;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.close-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #181818; }

/* ===== Keyframes ===== */
@keyframes pop      { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes pop-late { from { opacity: 0; transform: rotate(-.6deg) translateY(24px); } to { opacity: 1; transform: rotate(-.6deg) translateY(0); } }
@keyframes bob      { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes nudge    { 0%,100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(-2deg) scale(1.05); } }
@keyframes wobble   { 0%,100% { transform: rotate(-1.5deg) scale(1); } 50% { transform: rotate(1.5deg) scale(1.04); } }
@keyframes float-up { 0% { transform: translateY(0) rotate(0); opacity: 0; } 12% { opacity: .85; } 100% { transform: translateY(-112dvh) rotate(220deg); opacity: 0; } }
@keyframes scream-shake { 0% { transform: translate(-2px,1px) rotate(-.4deg); } 50% { transform: translate(2px,-1px) rotate(.4deg); } 100% { transform: translate(-1px,2px) rotate(-.3deg); } }

@media (prefers-reduced-motion: reduce) {
  .cake, .gift-emoji, .enter-btn, .gift-btn, .sound-hint, .confetti span { animation: none !important; }
  .face.open { animation: none !important; }
}
