@font-face {
  font-family: "Outfit Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("assets/outfit-latin-wght-normal.woff2") format("woff2-variations");
}

/* Identidade Visitplann (mesmos tokens da web app) */
:root {
  --bg: #191818;
  --surface: #272625;
  --text: #f4f3eb;
  --muted: #aaa89f;
  --yellow: #fbdf14;
  --line: #393735;
}

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

html, body { height: 100%; }

body {
  font-family: "Outfit Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% 0%, rgba(251, 223, 20, .20), transparent 70%),
    radial-gradient(rgba(244, 243, 235, .07) 1px, transparent 1.5px);
  background-size: 100% 100%, 22px 22px;
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

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

.palco {
  position: relative;
  min-height: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: max(24px, 5vh) 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* topo fixo: o bilhete não salta quando aparece o bloco da app */
  gap: 20px;
}

/* ── Marca ───────────────────────────────── */
.marca {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.8px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(39, 38, 37, .7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.marca img { height: 24px; width: auto; display: block; }

.marca-ponto { color: var(--yellow); }

.cabecalho { text-align: center; }

.cabecalho h1 {
  font-size: clamp(40px, 12.5vw, 54px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -2px;
}

.cabecalho h1 span { display: block; }

.cabecalho .destaque {
  color: var(--yellow);
  text-shadow: 0 0 34px rgba(251, 223, 20, .45);
}

.cabecalho p {
  margin-top: 14px;
  font-size: 17px;
  color: var(--muted);
}

/* ── Bilhete ─────────────────────────────── */
.bilhete {
  position: relative;
  width: 100%;
  border-radius: 24px;
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, #2e2d2b 0%, var(--surface) 45%, #211f1e 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .6),
    0 0 80px rgba(251, 223, 20, .10),
    inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: entrar .7s cubic-bezier(.2, 1.3, .4, 1) both;
  transition: border-color .6s, box-shadow .6s;
}

.bilhete.ganhou {
  border-color: var(--yellow);
  animation: entrar .7s cubic-bezier(.2, 1.3, .4, 1) both, pulsar 1.8s ease-in-out .2s infinite;
}

@keyframes entrar {
  from { transform: translateY(36px) scale(.9) rotate(-3deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes pulsar {
  0%, 100% { box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 30px rgba(251, 223, 20, .25), inset 0 1px 0 rgba(255, 255, 255, .07); }
  50%      { box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 70px rgba(251, 223, 20, .55), inset 0 1px 0 rgba(255, 255, 255, .07); }
}

.moldura {
  padding: 6px;
  border-radius: 20px;
  border: 1.5px dashed rgba(251, 223, 20, .45);
}

.zona {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  background: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}

#folha {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  transition: opacity .7s ease, transform .7s ease;
}

#folha.revelada { opacity: 0; transform: scale(1.06); pointer-events: none; }

/* picotado com recortes laterais */
.picotado {
  position: relative;
  margin: 16px -16px 0;
  border-top: 2px dashed var(--line);
}

.picotado::before,
.picotado::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
}

.picotado::before { left: -12px; }
.picotado::after  { right: -12px; }

.bilhete.ganhou .picotado::before,
.bilhete.ganhou .picotado::after { border-color: var(--yellow); }

.bilhete-rodape {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 6px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.bilhete.ganhou #dica { color: var(--yellow); font-weight: 700; }

.serie {
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.5px;
  font-size: 12px;
  opacity: .7;
}

/* ── Resultado (por baixo da folha) ──────── */
.resultado {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  text-align: center;
  color: var(--bg);
  overflow: hidden;
  background: var(--text);
  isolation: isolate; /* mantém o prémio por baixo da folha */
}

/* raios a rodar lentamente */
.resultado::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(#fbe75a 0 12deg, #fff8c8 12deg 24deg);
  animation: rodar 40s linear infinite;
}

.resultado::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, .85) 0, rgba(255, 255, 255, 0) 65%);
}

.resultado.perdeu::before { display: none; }
.resultado.perdeu::after { background: radial-gradient(circle, #fff 0, var(--text) 70%); }

.resultado > * { position: relative; z-index: 1; }

@keyframes rodar { to { transform: translate(-50%, -50%) rotate(360deg); } }

.resultado-emoji {
  font-size: clamp(50px, 17vw, 76px);
  line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .2));
}

.resultado-etiqueta {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--yellow);
  background: var(--bg);
  padding: 4px 14px;
  border-radius: 999px;
  margin: 6px 0 2px;
}

.resultado.perdeu .resultado-etiqueta { display: none; }

.resultado-nome {
  font-size: clamp(26px, 8.5vw, 38px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.05;
}

.resultado.perdeu .resultado-nome { font-size: clamp(22px, 7vw, 30px); color: #4a4845; }

.resultado.festa .resultado-emoji { animation: saltar .8s cubic-bezier(.2, 1.7, .4, 1) both; }
.resultado.festa .resultado-etiqueta { animation: subir .5s ease .25s both; }
.resultado.festa .resultado-nome { animation: subir .5s ease .4s both; }

@keyframes saltar {
  from { transform: scale(.2) rotate(-25deg); }
  to   { transform: none; }
}

@keyframes subir {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Texto final ─────────────────────────── */
.mensagem {
  min-height: 26px;
  text-align: center;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.3px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s .3s, transform .5s .3s;
}

.mensagem.visivel { opacity: 1; transform: none; }

.mensagem:empty { display: none; } /* sem espaço vazio antes de raspar */

/* ── Chamada ao download da app ──────────── */
.app {
  width: 100%;
  display: none;
  grid-template-columns: 46px 1fr;
  align-items: center;
  column-gap: 12px;
  row-gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(39, 38, 37, .75);
}

.app[hidden] { display: none !important; }

/* só aparece depois de o bilhete estar raspado */
#bilhete.ganhou ~ .app,
#bilhete.perdeu ~ .app { display: grid; }

.app-icone {
  width: 46px;
  height: 46px;
  padding: 8px;
  border-radius: 13px;
  background: #000; /* igual ao fundo do ícone da app */
  border: 1px solid var(--line);
  object-fit: contain;
}

.app-textos { min-width: 0; }

.app h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1.15;
}

.app p {
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--muted);
}

.lojas {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.loja {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 13px;
  text-decoration: none;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.2px;
  white-space: nowrap;
  color: var(--bg);
  background: var(--yellow);
  border: 1px solid var(--yellow);
}

.loja.secundaria {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}

.loja svg { width: 20px; height: 20px; flex: none; }

.loja small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2px;
  opacity: .75;
}

.revelar {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px;
  opacity: .8;
}

.revelar[hidden] { display: none; }

@media (max-height: 720px) {
  .palco { gap: 14px; padding-top: 16px; }
  .marca { font-size: 20px; padding: 6px 14px 6px 11px; }
  .marca img { height: 20px; }
  .cabecalho h1 { font-size: 36px; letter-spacing: -1.5px; }
  .cabecalho p { margin-top: 8px; font-size: 15px; }
}

/* ecrã grande e alto (computador / projetor): um pouco mais de ar em cima */
@media (min-width: 700px) and (min-height: 900px) {
  .palco { padding-top: 8vh; }
}

@media (prefers-reduced-motion: reduce) {
  .bilhete, .bilhete.ganhou, .resultado::before,
  .resultado.festa .resultado-emoji, .resultado.festa .resultado-etiqueta, .resultado.festa .resultado-nome { animation: none; }
}
