:root {
  --rosa: #ff4fa3;
  --rosa-claro: #ff9fd0;
  --violeta: #9b5cff;
  --ouro: #ffd36e;
  --fundo: #07030d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--fundo);
  color: #fff;
  font-family: 'Nunito', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

#gl,
#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gl {
  z-index: 0;
  touch-action: none;
}

#fx {
  z-index: 5;
  pointer-events: none;
}

#flash {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, #fff 0%, #ffd1ea 25%, rgba(255, 79, 163, 0) 70%);
}

#som {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 17px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s;
}

#som.visivel {
  opacity: 0.8;
  pointer-events: auto;
}

.cena {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

.cena.ativa {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease;
}

/* ---------- intro ---------- */

.cartao {
  position: relative;
  width: min(88vw, 420px);
  padding: 34px 28px 30px;
  border-radius: 30px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 90px rgba(255, 79, 163, 0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: center;
  animation: entrar-cartao 1s cubic-bezier(0.2, 0.9, 0.2, 1) 0.3s both;
}

.cartao::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(130deg, rgba(255, 79, 163, 0.7), transparent 35%, transparent 65%, rgba(155, 92, 255, 0.7));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes entrar-cartao {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    filter: blur(8px);
  }
}

.cartao.saindo {
  animation: sair-cartao 0.65s cubic-bezier(0.6, 0, 0.8, 0.3) forwards;
}

@keyframes sair-cartao {
  to {
    opacity: 0;
    transform: translateY(-40px) scale(0.9);
    filter: blur(8px);
  }
}

#digitando {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(31px, 8.6vw, 40px);
  line-height: 1.16;
  min-height: 3.6em;
  text-align: left;
  overflow-wrap: anywhere;
  text-shadow: 0 0 18px rgba(255, 140, 198, 0.35);
}

#digitando .k {
  color: var(--rosa-claro);
}

.cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  margin-left: 3px;
  vertical-align: -0.08em;
  border-radius: 2px;
  background: var(--rosa-claro);
  animation: piscar 1s steps(1) infinite;
}

@keyframes piscar {
  50% {
    opacity: 0;
  }
}

#continuar {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 24px auto 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rosa), var(--violeta));
  box-shadow: 0 10px 30px rgba(255, 79, 163, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.3, 1.6, 0.4, 1), opacity 0.4s;
}

#continuar.visivel {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#continuar:active {
  transform: scale(0.9);
}

#continuar svg {
  width: 32px;
  height: 32px;
  animation: setinha 1.4s ease-in-out infinite;
}

@keyframes setinha {
  50% {
    transform: translateX(5px);
  }
}

#continuar::before,
#continuar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 140, 198, 0.6);
  animation: onda 2s ease-out infinite;
}

#continuar::after {
  animation-delay: 1s;
}

@keyframes onda {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.9);
    opacity: 0;
  }
}

/* ---------- presente ---------- */

#presente.tremendo {
  animation: tremer-tela 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes tremer-tela {
  10%, 90% { transform: translate(-1px, 1px); }
  20%, 80% { transform: translate(3px, -2px); }
  30%, 50%, 70% { transform: translate(-5px, 3px); }
  40%, 60% { transform: translate(5px, -3px); }
}

.palco {
  position: relative;
  width: 260px;
  height: 460px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 50px;
  cursor: pointer;
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
}

.palco.saindo {
  opacity: 0;
  transform: translateY(40px) scale(0.9);
  filter: blur(6px);
}

.palco::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 60px;
  width: 360px;
  height: 360px;
  margin-left: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 79, 163, 0.35), rgba(155, 92, 255, 0.12) 45%, transparent 70%);
  animation: respirar-halo 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes respirar-halo {
  50% {
    transform: scale(1.12);
    opacity: 0.75;
  }
}

.raios {
  position: absolute;
  left: 50%;
  bottom: 120px;
  width: 760px;
  height: 760px;
  margin: 0 0 -380px -380px;
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0.6) 30%, transparent 62%);
  mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0.6) 30%, transparent 62%);
}

.raios::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, 0) 0deg 9deg, rgba(255, 220, 150, 0.55) 11deg 13deg, rgba(255, 150, 210, 0) 15deg 24deg);
  animation: girar 14s linear infinite;
}

.palco.abriu .raios {
  animation: abrir-raios 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes abrir-raios {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; }
  100% { opacity: 0.75; transform: scale(1); }
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

.flutua {
  position: relative;
  animation: flutuar 3.2s ease-in-out infinite;
}

@keyframes flutuar {
  50% {
    transform: translateY(-12px);
  }
}

.caixa {
  position: relative;
  width: 190px;
  height: 150px;
  transform-origin: 50% 100%;
}

.caixa.balancando {
  animation: balancar 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes balancar {
  10%, 90% { transform: rotate(-2deg); }
  20%, 80% { transform: rotate(4deg) scale(1.02); }
  30%, 50%, 70% { transform: rotate(-8deg) scale(1.03); }
  40%, 60% { transform: rotate(8deg) scale(1.03); }
}

.caixa.abrindo {
  animation: agachar 0.24s ease-in forwards;
}

@keyframes agachar {
  to {
    transform: scale(1.1, 0.88);
  }
}

.caixa.aberta {
  animation: pular 0.55s cubic-bezier(0.3, 1.6, 0.4, 1);
}

@keyframes pular {
  0% { transform: scale(1.1, 0.88); }
  40% { transform: scale(0.94, 1.08); }
  100% { transform: none; }
}

.frente {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  border-radius: 14px 14px 20px 20px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.16) 2px, transparent 2.6px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.24)),
    linear-gradient(180deg, #ff74b8, #e62d86 60%, #b5146a);
  box-shadow: inset 0 -12px 22px rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 24px 50px rgba(230, 45, 134, 0.35);
}

.frente::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 34px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #cf9a2f, #ffe8a6 45%, #f4c24f 55%, #c28a26);
  box-shadow: 0 0 14px rgba(255, 211, 110, 0.5);
}

.frente::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.28) 35%, transparent 50%);
  background-size: 250% 100%;
  animation: brilho-caixa 3.5s ease-in-out infinite;
}

@keyframes brilho-caixa {
  0% { background-position: 150% 0; }
  60%, 100% { background-position: -100% 0; }
}

.tampa {
  position: absolute;
  z-index: 4;
  left: -12px;
  right: -12px;
  top: -36px;
  height: 46px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.15), transparent 25%, transparent 75%, rgba(0, 0, 0, 0.2)),
    linear-gradient(180deg, #ff8cc7, #f03f92 70%, #c81f74);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transform-origin: 50% 100%;
}

.tampa::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 34px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #cf9a2f, #ffe8a6 45%, #f4c24f 55%, #c28a26);
}

.caixa.aberta .tampa {
  animation: voar-tampa 0.95s cubic-bezier(0.15, 0.8, 0.3, 1) forwards;
}

@keyframes voar-tampa {
  to {
    transform: translate(60px, -380px) rotate(-42deg);
    opacity: 0;
  }
}

.laco {
  position: absolute;
  left: 50%;
  top: -36px;
  width: 0;
  height: 0;
}

.laco span {
  position: absolute;
  top: 0;
  width: 66px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, transparent 36%, #d9a13a 38%, #ffe8a6 55%, #f4c24f 66%, #b98225 78%, transparent 80%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}

.laco span:first-child {
  right: 2px;
  transform: rotate(-22deg);
}

.laco span:nth-child(2) {
  left: 2px;
  transform: rotate(22deg);
}

.laco i {
  position: absolute;
  left: -14px;
  top: 16px;
  width: 28px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ffe8a6, #d9a13a);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.sombra {
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 170px;
  height: 22px;
  margin-left: -85px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.55), transparent 70%);
  animation: sombra 3.2s ease-in-out infinite;
}

@keyframes sombra {
  50% {
    transform: scale(0.85);
    opacity: 0.7;
  }
}

.dedo {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 30px;
  font-size: 118px;
  line-height: 1;
  opacity: 0;
  transform: translate(-50%, 0) scale(0.2);
  filter: drop-shadow(0 0 18px rgba(255, 211, 110, 0.75)) drop-shadow(0 0 40px rgba(255, 79, 163, 0.5));
  pointer-events: none;
}

.caixa.aberta .dedo {
  animation:
    subir-dedo 1s cubic-bezier(0.25, 1.6, 0.4, 1) 0.2s forwards,
    zoeira 0.45s ease-in-out 1.3s infinite alternate;
}

@keyframes subir-dedo {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.2); }
  40% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -150px) scale(1); }
}

@keyframes zoeira {
  from { transform: translate(-50%, -150px) rotate(-9deg) scale(1); }
  to { transform: translate(-50%, -160px) rotate(9deg) scale(1.05); }
}

.dedo.sumindo {
  animation: poof 0.45s cubic-bezier(0.5, 0, 0.8, 0.4) forwards !important;
}

@keyframes poof {
  0% { opacity: 1; transform: translate(-50%, -155px) scale(1); filter: blur(0); }
  35% { opacity: 1; transform: translate(-50%, -155px) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -155px) scale(0); filter: blur(10px); }
}

.balao {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 300px;
  padding: 8px 20px 11px;
  border-radius: 24px;
  background: #fff;
  color: #3a0d2c;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 34px rgba(255, 255, 255, 0.3);
  opacity: 0;
  transform: translateX(-50%) scale(0) rotate(-12deg);
  transform-origin: 50% 120%;
}

.balao::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -11px;
  margin-left: -12px;
  border: 12px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

.caixa.aberta .balao {
  animation: balao 0.55s cubic-bezier(0.3, 1.8, 0.4, 1) 1.05s forwards;
}

@keyframes balao {
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1) rotate(-4deg);
  }
}

.balao.sumindo {
  animation: sumir-balao 0.35s ease-in forwards !important;
}

@keyframes sumir-balao {
  from { opacity: 1; transform: translateX(-50%) scale(1) rotate(-4deg); }
  to { opacity: 0; transform: translateX(-50%) scale(0.3) rotate(10deg); }
}

.dica {
  margin-top: 6px;
  font-weight: 600;
  font-size: 16px;
  color: rgba(255, 230, 242, 0.75);
  opacity: 0;
  transition: opacity 0.6s;
}

.dica.visivel {
  opacity: 1;
  animation: respirar 2.2s ease-in-out infinite;
}

@keyframes respirar {
  50% {
    opacity: 0.45;
  }
}

.risada {
  position: absolute;
  top: max(9vh, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 7;
  text-align: center;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.risada.visivel {
  animation: risada 0.5s cubic-bezier(0.3, 1.7, 0.4, 1) forwards;
}

.risada.saindo {
  animation: sumir-risada 0.7s ease forwards;
}

@keyframes risada {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sumir-risada {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-20px); }
}

.kkk {
  font-weight: 800;
  font-size: clamp(24px, 8.2vw, 58px);
  letter-spacing: 1px;
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(90deg, #ffd36e, #ff4fa3, #9b5cff, #5fd8ff, #ffd36e);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 79, 163, 0.55));
  animation: arco-iris 1.4s linear infinite, chacoalhar 0.14s linear infinite;
}

@keyframes arco-iris {
  to {
    background-position: 300% 0;
  }
}

@keyframes chacoalhar {
  25% { transform: translate(1px, -1px) rotate(-0.6deg); }
  75% { transform: translate(-1px, 1px) rotate(0.6deg); }
}

.brincando {
  margin-top: 10px;
  min-height: 1.2em;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(30px, 8.4vw, 42px);
  text-shadow: 0 0 20px rgba(255, 140, 198, 0.45);
}

/* ---------- coração ---------- */

#coracao {
  justify-content: flex-end;
  padding-bottom: max(7vh, env(safe-area-inset-bottom));
  pointer-events: none;
}

.titulo {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(50px, 14vw, 84px);
  line-height: 1;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.55), 0 0 26px rgba(255, 79, 163, 0.9), 0 0 60px rgba(155, 92, 255, 0.65);
}

.palavra {
  display: inline-block;
  white-space: nowrap;
}

.letra {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px) scale(0.6) rotate(-10deg);
  filter: blur(8px);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 1.6, 0.4, 1), filter 0.6s ease;
}

.letra.on {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

.subtitulo {
  margin-top: 14px;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(15px, 4.3vw, 20px);
  color: rgba(255, 222, 240, 0.85);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease, transform 1s ease;
}

.subtitulo.on,
.toque.on {
  opacity: 1;
  transform: none;
}

.toque {
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transition: opacity 1s;
}

.toque.on {
  animation: respirar 2.4s ease-in-out infinite;
}

#denovo {
  margin-top: 16px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s;
}

#denovo.on {
  opacity: 1;
  pointer-events: auto;
}

.coracao-css {
  display: none;
}

.sem-webgl .coracao-css {
  display: block;
  margin-bottom: auto;
  margin-top: 18vh;
  font-size: 160px;
  filter: drop-shadow(0 0 30px rgba(255, 79, 163, 0.9));
  animation: flutuar 3s ease-in-out infinite;
}

.previa .flutua,
.previa .sombra {
  animation: none;
}
