:root {
  --rosa: #ff4d88;
  --rosa-escuro: #d6336c;
  --rosa-claro: #ffe3ee;
  --fundo-1: #ffd6e7;
  --fundo-2: #ffeef5;
  --texto: #4a1f33;
  --branco: #fff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--texto);
  background: linear-gradient(160deg, var(--fundo-1), var(--fundo-2));
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#bg-hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#bg-hearts span {
  position: absolute; bottom: -40px; opacity: .35;
  animation: subir linear forwards;
}
@keyframes subir {
  to { transform: translateY(-110vh) rotate(25deg); opacity: 0; }
}

.tela {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.tela.ativa { display: flex; animation: aparecer .5s ease; }
@keyframes aparecer { from { opacity: 0; transform: scale(.96); } }

.card {
  background: var(--branco);
  border-radius: 24px;
  padding: 28px 22px;
  max-width: 400px; width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(214, 51, 108, .2);
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}

h1 { font-size: 1.6rem; line-height: 1.2; color: var(--rosa-escuro); }
h3 { font-family: "Caveat", cursive; font-size: 1.8rem; color: var(--rosa-escuro); line-height: 1.1; }
.saudacao { font-family: "Caveat", cursive; font-size: 1.8rem; }
.emoji-grande { font-size: 3.5rem; }
.pulsar { animation: pulsar 1.2s ease-in-out infinite; }
@keyframes pulsar { 50% { transform: scale(1.12); } }

.btn {
  font: inherit; font-weight: 600; font-size: 1.1rem;
  border: none; border-radius: 999px;
  padding: 12px 28px; cursor: pointer;
  background: var(--rosa); color: var(--branco);
  box-shadow: 0 4px 0 var(--rosa-escuro);
  transition: transform .1s, box-shadow .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rosa-escuro); }

.escondido { display: none !important; }

/* ---------- Jogo ---------- */
#tela-jogo { flex-direction: column; padding: 0; align-items: stretch; }
.area-jogo { position: relative; flex: 1; min-height: 0; }
#jogo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; font-size: 1.2rem; font-weight: 600;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
#contador { background: rgba(255,255,255,.75); padding: 4px 12px; border-radius: 99px; }
.btn-icone {
  margin-left: auto;
  font-size: 1.2rem; border: none; border-radius: 50%;
  width: 40px; height: 40px; background: rgba(255,255,255,.75); cursor: pointer;
}

#controles {
  height: 120px; flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px calc(env(safe-area-inset-bottom) + 8px);
  background: linear-gradient(#ffc9de, #ffb3d0);
  touch-action: none;
}
.setas { display: flex; gap: 14px; }
.ctl {
  width: 74px; height: 74px; border-radius: 50%; border: none;
  font-size: 1.9rem; color: var(--rosa-escuro);
  background: var(--branco); box-shadow: 0 5px 0 #e89ab8;
  touch-action: none; cursor: pointer;
}
.ctl.apertado { transform: translateY(4px); box-shadow: 0 1px 0 #e89ab8; background: var(--rosa-claro); }
.ctl-pulo { width: 88px; height: 88px; background: var(--rosa); color: var(--branco); box-shadow: 0 5px 0 var(--rosa-escuro); }
.ctl-pulo.apertado { background: var(--rosa-escuro); box-shadow: 0 1px 0 var(--rosa-escuro); }
#tela-jogo.cena #controles { display: none; }
#tela-jogo.sem-controles #controles { visibility: hidden; } /* rampa da boia: ninguém controla */
#tela-jogo.cena .hud #contador { display: none; }

#toast {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%);
  max-width: 86%; text-align: center;
  background: rgba(255,255,255,.92); color: var(--rosa-escuro);
  font-weight: 600; padding: 10px 18px; border-radius: 99px;
  box-shadow: 0 6px 20px rgba(214, 51, 108, .25);
  animation: aparecer .4s ease; pointer-events: none;
}

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 214, 231, .6); padding: 16px;
  animation: aparecer .35s ease;
}
.memoria { gap: 10px; }
.memoria img { width: 100%; max-height: 45vh; object-fit: cover; border-radius: 14px; }
.memoria p { font-size: 1.05rem; }

/* ---------- Pergunta e final ---------- */
#pergunta {
  position: absolute; left: 0; right: 0; bottom: 6%;
  display: flex; gap: 18px; justify-content: center; align-items: center;
  animation: aparecer .5s ease;
}
.btn-sim { transition: transform .25s; font-size: 1.3rem; }
.btn-nao { background: #bbb; box-shadow: 0 4px 0 #999; }
.btn-nao.fugindo { position: fixed; z-index: 10; transition: left .25s, top .25s; }

#final {
  position: absolute; left: 16px; right: 16px; top: 64px;
  display: flex; justify-content: center;
  animation: aparecer .6s ease;
}
#final .card { padding: 18px; gap: 8px; }
.carta { font-family: "Caveat", cursive; font-size: 1.5rem; line-height: 1.25; }
.assinatura { font-family: "Caveat", cursive; font-size: 1.3rem; align-self: flex-end; }

#olha {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(255, 77, 136, .88);
  animation: aparecer 1s ease;
}
#olha p {
  color: var(--branco); font-weight: 700; font-size: 2.6rem; text-align: center; line-height: 1.2;
  animation: pulsar 1.2s ease-in-out infinite;
}

#confete { position: fixed; inset: 0; pointer-events: none; z-index: 20; width: 100%; height: 100%; }

/* No computador (mouse) os botões de toque somem; usa as setas e espaço */
@media (hover: hover) and (pointer: fine) {
  #controles { display: none; }
}
