/* Raspadinha: a capa do bilhete é um canvas (js/script.js) sobre a cena com o logo no topo da montanha. */

.anuncio {
  background: radial-gradient(circle at 15% 0%, var(--floresta-clara), var(--floresta) 65%);
}

.topo {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 5;
}

.titulo {
  position: absolute;
  right: 12px;
  top: 11px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  text-align: right;
}

.titulo em {
  font-style: normal;
  color: var(--verde);
}

/* Abertura: marca, título e bilhete entram em sequência */
.topo,
.titulo {
  animation: surgir 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s backwards;
}

.titulo {
  animation-delay: 0.25s;
}

/* ---------- Bilhete ---------- */

.cartao {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 52px;
  bottom: 12px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  animation: surgir-cartao 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s backwards;
}

/* Moldura creme com meia-lua nas laterais, como um ticket */
.recorte {
  position: absolute;
  inset: 0;
  padding: 6px;
  border-radius: 12px;
  background: var(--creme);
  -webkit-mask:
    radial-gradient(circle at 0 50%, transparent 9px, #000 9.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 9px, #000 9.5px) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 50%, transparent 9px, #000 9.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 9px, #000 9.5px) right / 51% 100% no-repeat;
}

/* Área raspável: no mouse basta passar por cima (cursor de moeda); no toque, arrastar */
.painel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='13' cy='13' r='11' fill='%2352b55a' stroke='%23fff' stroke-width='2'/%3E%3Ccircle cx='13' cy='13' r='6.5' fill='none' stroke='%23123133' stroke-width='1.5' opacity='.45'/%3E%3C/svg%3E")
      13 13,
    crosshair;
}

/* Sombra interna: a área raspável parece rebaixada na moldura, com capa ou sem */
.painel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(18, 49, 51, 0.18),
    inset 0 2px 6px rgba(18, 49, 51, 0.22);
  pointer-events: none;
}

.raspa {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease;
}

/* Passou do limite: o resto da capa se dissolve */
.revelado .raspa {
  opacity: 0;
}

/* Reflexo que passa pela capa enquanto ninguém raspou */
.brilho {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.brilho::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -40%;
  width: 26%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-20deg);
  animation: reluzir 3.4s ease-in-out 1.1s infinite;
}

.raspando .brilho {
  opacity: 0;
}

/* ---------- Cena revelada ---------- */

.cena {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cena svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cena-titulo {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  color: var(--floresta);
}

/* Logo sentado no pico (centro em 132, 77) */
.cena-logo {
  position: absolute;
  left: 103px;
  top: 48px;
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 3px 5px rgba(18, 49, 51, 0.35));
}

.raios,
.onda,
.faisca {
  position: absolute;
  left: 132px;
  top: 77px;
  border-radius: 50%;
}

/* Raios de sol atrás do logo, abrem na revelação */
.raios {
  width: 190px;
  height: 190px;
  margin: -95px 0 0 -95px;
  background: repeating-conic-gradient(rgba(82, 181, 90, 0.22) 0 9deg, transparent 9deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%);
  mask: radial-gradient(circle, #000 25%, transparent 70%);
  opacity: 0;
}

.onda {
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border: 3px solid var(--verde);
  opacity: 0;
}

/* Faíscas de 4 pontas em volta do logo */
.faisca {
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 0;
  background: var(--verde);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
}

.faisca:nth-of-type(3n) {
  background: var(--floresta-clara);
}

.faisca:nth-of-type(3n + 1) {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  background: var(--verde-vivo);
}

.revelado .raios {
  animation: abrir-raios 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s forwards;
}

.revelado .onda {
  animation: onda 0.9s ease-out 0.25s;
}

.revelado .cena-logo {
  animation: comemorar 0.8s cubic-bezier(0.3, 1.4, 0.5, 1) 0.2s;
}

.revelado .faisca {
  animation: faiscar 1s ease-out calc(0.3s + var(--d)) both;
}

/* ---------- Dica sobre o bilhete ---------- */

.raspe-aqui {
  position: absolute;
  left: 50%;
  top: 112px;
  translate: -50% 0;
  z-index: 3;
  pointer-events: none;
  animation: surgir 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 1.3s backwards;
}

.raspe-aqui .dica {
  white-space: nowrap;
}

/* Moedinha que "raspa" de um lado para o outro */
.moeda {
  width: 12px;
  height: 12px;
  border: 2px solid var(--floresta);
  border-radius: 50%;
  background: var(--verde);
  animation: esfregar 0.7s ease-in-out infinite alternate;
}

.revelado .raspe-aqui {
  visibility: hidden;
}

/* ---------- Animações ---------- */

@keyframes surgir-cartao {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
}

@keyframes reluzir {
  0% {
    left: -40%;
  }
  45%,
  100% {
    left: 125%;
  }
}

@keyframes esfregar {
  from {
    transform: translate(-2px, 1px) rotate(-20deg);
  }
  to {
    transform: translate(2px, -1px) rotate(20deg);
  }
}

@keyframes abrir-raios {
  from {
    opacity: 0;
    transform: scale(0.3) rotate(-40deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes onda {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(2.6);
  }
}

@keyframes comemorar {
  30% {
    transform: scale(1.18) rotate(-8deg);
  }
  60% {
    transform: scale(0.96) rotate(4deg);
  }
}

@keyframes faiscar {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0) rotate(0);
  }
  35% {
    opacity: 1;
    transform: translate(calc(var(--x) * 0.8), calc(var(--y) * 0.8)) scale(1.2) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(0.4) rotate(90deg);
  }
}
