/* ============================================================
   SORTEIO PREMIADO  —  tema "bilhete de loteria de luxo"
   noite profunda + ouro + cintilância
   ============================================================ */

:root {
  --noite: #0b1020;
  --noite-2: #131a33;
  --tinta: #f4ecdb;
  --tinta-suave: #b9b4a3;
  --ouro: #e7c873;
  --ouro-claro: #fff3c9;
  --ouro-fundo: #8a6d2f;
  --verde: #41c98a;
  --rubro: #e8665f;
  --borda: rgba(231, 200, 115, 0.28);
  --sombra: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
}

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

html, body { height: 100%; }

body {
  font-family: "Outfit", sans-serif;
  background: var(--noite);
  color: var(--tinta);
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 4vh 5vw;
}

/* ---------- atmosfera de fundo ---------- */
.aurora {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  filter: blur(70px);
}
.blob { position: absolute; border-radius: 50%; opacity: 0.5; mix-blend-mode: screen; }
.b1 { width: 46vw; height: 46vw; left: -10vw; top: -12vw;
  background: radial-gradient(circle, #2a3a7a, transparent 70%);
  animation: flutua 16s ease-in-out infinite; }
.b2 { width: 38vw; height: 38vw; right: -8vw; top: 18vh;
  background: radial-gradient(circle, #6b4f1a, transparent 70%);
  animation: flutua 20s ease-in-out infinite reverse; }
.b3 { width: 40vw; height: 40vw; left: 22vw; bottom: -18vw;
  background: radial-gradient(circle, #3a2160, transparent 70%);
  animation: flutua 24s ease-in-out infinite; }
@keyframes flutua {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, -3vw) scale(1.12); }
}

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- palco ---------- */
.palco { position: relative; z-index: 2; width: min(100%, 470px); min-width: 0; }

/* ---------- bilhete ---------- */
.bilhete {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 30%),
    linear-gradient(160deg, var(--noite-2), #0c1226 70%);
  border: 1px solid var(--borda);
  border-radius: 26px;
  padding: 46px 34px 30px;
  box-shadow: var(--sombra), inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  animation: surge 0.9s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes surge {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* moldura dourada interna pontilhada */
.bilhete::before {
  content: ""; position: absolute; inset: 12px; border-radius: 18px;
  border: 1.5px dashed rgba(231, 200, 115, 0.35);
  pointer-events: none;
}

/* picote (furos das bordas do bilhete) */
.picote { position: absolute; left: 0; right: 0; height: 22px;
  background-image: radial-gradient(circle at 11px 50%, var(--noite) 6px, transparent 7px);
  background-size: 22px 22px; background-repeat: repeat-x; }
.picote-top { top: -11px; }
.picote-bottom { bottom: -11px; }

/* ---------- topo ---------- */
.topo { text-align: center; position: relative; }
.selo {
  display: inline-block; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ouro); font-weight: 600;
  padding: 6px 14px; border: 1px solid var(--borda); border-radius: 999px;
  background: rgba(231, 200, 115, 0.06);
}
.titulo {
  font-family: "Fraunces", serif; font-weight: 900; line-height: 0.92;
  font-size: clamp(46px, 13vw, 70px); margin: 18px 0 14px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff7e0, var(--ouro) 55%, var(--ouro-fundo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 30px rgba(231, 200, 115, 0.25);
}
.titulo em { font-style: italic; font-weight: 500; }
.subtitulo { color: var(--tinta-suave); font-size: 15px; line-height: 1.5; }
.subtitulo strong { color: var(--tinta); }

/* ---------- bobina/rolagem do "sorteio" ---------- */
.bobina {
  position: relative; height: 58px; margin: 26px 0 4px; overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--borda);
  background: rgba(0,0,0,0.25);
  box-shadow: inset 0 6px 14px -6px rgba(0,0,0,0.8);
  display: none;
}
.bobina.ativa { display: block; }
.trilho { display: flex; align-items: center; height: 100%; padding-left: 12px; will-change: transform; }
.trilho span {
  flex: 0 0 auto; width: 66px; text-align: center;
  font-family: "Fraunces", serif; font-weight: 600; font-size: 26px; color: var(--ouro-claro);
  opacity: 0.9;
}
.trilho span.vit {
  font-size: 30px;
  filter: drop-shadow(0 0 8px rgba(65, 201, 138, 0.8));
}
.marcador {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  color: var(--ouro); font-size: 13px; filter: drop-shadow(0 0 6px var(--ouro));
}
.bobina::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--noite-2), transparent 18%, transparent 82%, var(--noite-2));
}

/* ---------- formulário ---------- */
.form { margin-top: 24px; }
.rotulo {
  display: block; text-align: center; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--tinta-suave); margin-bottom: 12px;
}
/* seletor de tipo de chave */
.tipos {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px;
}
.tipo {
  cursor: pointer; font-family: "Outfit", sans-serif;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 6px 13px; border-radius: 14px;
  color: var(--tinta-suave);
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--borda);
  transition: transform .18s, border-color .2s, color .2s, background .2s, box-shadow .2s;
}
.tipo svg { width: 26px; height: 26px; transition: transform .2s; }
.tipo span { font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em; }
.tipo:hover { transform: translateY(-2px); color: var(--tinta); border-color: rgba(231,200,115,0.5); }
.tipo:hover svg { transform: scale(1.08); }
.tipo[aria-selected="true"] {
  color: #2a1d05; border-color: var(--ouro);
  background: linear-gradient(180deg, var(--ouro-claro), var(--ouro) 70%, #d8b259);
  box-shadow: 0 10px 26px -12px rgba(231,200,115,0.7), inset 0 1px 0 rgba(255,255,255,0.6);
}

.campo { position: relative; animation: aparece .35s ease both; }
.campo input {
  width: 100%; font-family: "Outfit", sans-serif; font-size: 16px; color: var(--tinta);
  text-align: center;
  padding: 16px 18px; border-radius: 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--borda);
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.campo input::placeholder { color: rgba(185,180,163,0.55); }
.campo input:focus {
  outline: none; border-color: var(--ouro);
  background: rgba(0,0,0,0.45);
  box-shadow: 0 0 0 4px rgba(231,200,115,0.12);
}

.botao {
  position: relative; width: 100%; margin-top: 16px; cursor: pointer;
  font-family: "Outfit", sans-serif; font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  color: #2a1d05; padding: 17px; border: none; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--ouro-claro), var(--ouro) 45%, #c79a3e);
  box-shadow: 0 12px 30px -10px rgba(231,200,115,0.6), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform .15s, box-shadow .25s, filter .25s;
}
.botao:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 38px -10px rgba(231,200,115,0.75); }
.botao:active:not(:disabled) { transform: translateY(0) scale(.99); }
.botao:disabled {
  cursor: not-allowed;
  background: rgba(255,255,255,0.06);
  color: var(--tinta-suave);
  box-shadow: none;
  filter: none;
  border: 1px solid var(--borda);
}
.botao:disabled .botao-brilho { display: none; }
.botao-brilho {
  position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.7), transparent);
  transform: skewX(-18deg);
}
.botao:not(:disabled):hover .botao-brilho { animation: passa 0.9s ease; }
@keyframes passa { to { left: 140%; } }

/* ---------- resultado ---------- */
.resultado { text-align: center; margin-top: 6px; animation: aparece .5s ease both; }
@keyframes aparece { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.res-icone { font-size: 58px; line-height: 1; margin-bottom: 8px; }
.res-titulo {
  font-family: "Fraunces", serif; font-weight: 900; font-size: clamp(28px, 8vw, 40px);
  line-height: 1; margin-bottom: 12px; letter-spacing: -0.01em;
}
.res-texto { color: var(--tinta-suave); font-size: 16px; line-height: 1.55; }
.res-texto strong { color: var(--tinta); }

.ganhou .res-titulo {
  background: linear-gradient(180deg, #fff7e0, var(--ouro) 60%, var(--ouro-fundo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ganhou .valor {
  display: inline-block; margin-top: 14px;
  font-family: "Fraunces", serif; font-weight: 900; font-size: clamp(40px, 13vw, 62px);
  color: var(--verde); text-shadow: 0 0 30px rgba(65,201,138,0.5);
  animation: pulsa 1.6s ease-in-out infinite;
}
@keyframes pulsa { 50% { transform: scale(1.05); } }
.perdeu .res-titulo { color: var(--tinta); }
.resgatado .res-titulo { color: var(--ouro); }

.voltar {
  margin-top: 22px; cursor: pointer; font-family: "Outfit", sans-serif; font-weight: 500;
  font-size: 14px; color: var(--tinta-suave);
  background: transparent; border: 1px solid var(--borda); border-radius: 999px;
  padding: 10px 22px; transition: color .2s, border-color .2s;
}
.voltar:hover { color: var(--tinta); border-color: var(--ouro); }

/* ---------- rodapé do bilhete ---------- */
.rodape {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 26px; padding-top: 16px;
  border-top: 1px dashed rgba(231,200,115,0.25);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--tinta-suave);
}
.serie { font-family: "Fraunces", serif; font-size: 14px; color: var(--ouro); letter-spacing: 0.1em; }

.assinatura { text-align: center; margin-top: 22px; color: var(--tinta-suave); font-size: 16px; letter-spacing: 0.01em; }

/* tremor pra "perdeu" */
.tremor { animation: treme .5s; }
@keyframes treme {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

#confete { position: fixed; inset: 0; z-index: 5; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
