:root {
  --azul-escuro: #0b3a5c;
  --azul: #1273b5;
  --azul-claro: #4fb3e8;
  --agua: #a8dcf5;
  --amarelo: #ffc93c;
  --branco: #f7fbfe;
  --verde: #3bb273;
  --vermelho: #e05656;
}

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

body {
  font-family: "Fredoka", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--azul-escuro) 0%, var(--azul) 55%, #0e5e94 100%);
  color: var(--branco);
  min-height: 100vh;
  overflow-x: hidden;
}

/* bolhas decorativas */
.bolhas { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bolhas::before, .bolhas::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.bolhas::before { width: 420px; height: 420px; top: -120px; right: -120px; }
.bolhas::after { width: 300px; height: 300px; bottom: -80px; left: -80px; }

header { text-align: center; padding: 34px 16px 10px; position: relative; z-index: 1; }
.gota-logo { font-size: 3rem; animation: flutuar 3s ease-in-out infinite; }
@keyframes flutuar { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 700; letter-spacing: 0.5px; }
.subtitulo { color: var(--agua); font-size: clamp(1rem, 2.5vw, 1.25rem); margin-top: 4px; }
.subtitulo strong { color: var(--amarelo); }

.progresso { max-width: 560px; margin: 22px auto 8px; padding: 0 20px; position: relative; z-index: 1; }
.progresso-texto { text-align: center; font-weight: 600; margin-bottom: 8px; font-size: 1.1rem; }
.barra { background: rgba(255,255,255,0.15); border-radius: 99px; height: 18px; overflow: hidden; }
.barra-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--azul-claro), var(--amarelo));
  border-radius: 99px;
  transition: width 1s ease;
}

main { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 10px 14px 40px; }

#puzzle-container {
  max-width: 520px;
  margin: 0 auto;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 22px;
  padding: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.3);
}
#puzzle { width: 100%; height: auto; display: block; }

/* peças da gota */
.piece { cursor: default; }
.piece.livre path {
  fill: rgba(255,255,255,0.06);
  stroke: rgba(255,255,255,0.35);
  stroke-width: 0.8;
  stroke-dasharray: 3 2;
  transition: fill 0.2s ease, stroke 0.2s ease;
}
.piece.doada path {
  stroke: rgba(10,30,45,0.75);
  stroke-width: 0.7;
  stroke-linejoin: round;
}
.piece .num {
  font-family: "Fredoka", sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: rgba(255,255,255,0.6);
  pointer-events: none;
}
.piece .marca {
  font-family: "Arial Black", Arial, sans-serif;
  font-weight: 700;
  fill: #222;
  pointer-events: none;
}
.piece.destaque path {
  stroke: var(--amarelo);
  stroke-width: 1.6;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px var(--amarelo));
}

.dica { text-align: center; color: var(--agua); margin: 18px 0 22px; line-height: 1.6; }

.doadores { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.doadores .chip {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 14px; border-radius: 99px; font-size: 0.9rem;
}
.doadores .chip b { color: var(--amarelo); font-weight: 600; }

/* modais */
.modal-fundo {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 26, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal {
  background: var(--branco); color: #17324a;
  border-radius: 22px; padding: 28px;
  width: 100%; max-width: 430px;
  position: relative;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  animation: subir 0.35s ease;
  max-height: 90vh; overflow-y: auto;
}
@keyframes subir { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.centro { text-align: center; }
.modal h2 { margin-bottom: 14px; color: var(--azul-escuro); }
.modal label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 0.95rem; }
.modal input {
  width: 100%; padding: 12px 14px; font-size: 1rem;
  border: 2px solid #cfe3f2; border-radius: 12px;
  font-family: inherit; outline: none;
}
.modal input:focus { border-color: var(--azul-claro); }
.fechar {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; font-size: 1.8rem;
  color: #8aa7bd; cursor: pointer; line-height: 1;
}
.premio-preview { background: #eaf6ff; border-radius: 14px; padding: 14px 16px; margin: 16px 0; }
.premio-preview h3 { font-size: 0.95rem; color: var(--azul); margin-bottom: 6px; }
.premio-preview ul, .premios-final { list-style: none; }
.premio-preview li, .premios-final li { padding: 3px 0; font-weight: 500; }
.premio-preview li.vazio { color: #7d97ab; font-weight: 400; }

.btn-principal {
  width: 100%; padding: 14px; margin-top: 6px;
  background: linear-gradient(90deg, var(--azul), var(--azul-claro));
  color: white; font-family: inherit; font-size: 1.05rem; font-weight: 600;
  border: none; border-radius: 14px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-principal:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(18,115,181,0.4); }
.btn-principal:disabled { opacity: 0.6; cursor: wait; transform: none; }
.erro { color: var(--vermelho); font-weight: 600; margin-top: 10px; text-align: center; }
.mini { font-size: 0.8rem; color: #7d97ab; text-align: center; margin-top: 10px; }
.emoji-grande { font-size: 3.2rem; margin-bottom: 6px; }
.premios-final { background: #eaf6ff; border-radius: 14px; padding: 14px; margin: 14px 0; text-align: left; }

.spinner {
  width: 52px; height: 52px; margin: 6px auto 18px;
  border: 5px solid #d7ecfa; border-top-color: var(--azul);
  border-radius: 50%; animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* overlay final */
.final-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(4, 26, 42, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.final-conteudo { text-align: center; max-width: 640px; position: relative; }
.final-conteudo h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--amarelo); }
.final-conteudo p { color: var(--agua); margin: 8px 0 18px; }
.membros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.membro {
  position: relative; aspect-ratio: 2/3;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  animation: brilhar 0.6s ease calc(var(--i) * 0.35s + 1s) both;
}
@keyframes brilhar { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.membro img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.membro .gala {
  opacity: 0;
  animation: vestir 2.2s ease-in-out calc(var(--i) * 0.35s + 1.8s) forwards;
}
@keyframes vestir {
  0% { opacity: 0; clip-path: circle(0% at 50% 45%); }
  100% { opacity: 1; clip-path: circle(80% at 50% 45%); }
}
.final-conteudo .btn-principal { max-width: 220px; }

footer { text-align: center; padding: 26px 16px 34px; color: rgba(255,255,255,0.55); font-size: 0.9rem; position: relative; z-index: 1; }

[hidden] { display: none !important; }


/* logo e música */
.logo {
  width: 110px; height: 110px; object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.35));
  animation: flutuar 3s ease-in-out infinite;
}
#btn-musica {
  position: absolute; top: 16px; right: 16px;
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  font-size: 1.3rem; cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
#btn-musica:hover { transform: scale(1.1); background: rgba(255,255,255,0.22); }
#btn-musica.tocando { background: var(--amarelo); border-color: var(--amarelo); animation: pulsar 1.2s ease-in-out infinite; }
@keyframes pulsar { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.aviso-entrega {
  background: #fff6dd;
  border: 1px solid #f0dfa8;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #7a5c00;
  margin: 4px 0 12px;
  line-height: 1.5;
}

.msg-extra {
  background: #e8f7ee;
  border: 1px solid #b9e4c9;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.92rem;
  color: #1f6b3f;
  margin-bottom: 10px;
  line-height: 1.5;
}
