:root {
  --fundo: #0b0b0d;
  --superficie: #15151a;
  --superficie-2: #1e1e26;
  --borda: #2a2a33;
  --texto: #f5f5f7;
  --texto-2: #b9b9c1;
  --marca: #f4c400;
  --marca-suave: rgb(244 196 0 / 0.12);
  --erro: #ff8a7a;
  --titulo-fonte: 'Unbounded', 'Arial Black', sans-serif;
  --corpo-fonte: 'Manrope', 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --topo-bilhete: 164px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--fundo);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--fundo);
  color: var(--texto);
  font: 500 1rem/1.5 var(--corpo-fonte);
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

/* Palco */
.palco {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(90% 60% at 50% 0%, rgb(244 196 0 / 0.14), transparent 70%);
}

.palco-leao {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(135vw, 900px);
  aspect-ratio: 345 / 360;
  margin: calc(min(135vw, 900px) * -0.52) 0 0 calc(min(135vw, 900px) * -0.5);
  background: url('/img/escudo-avseg.png') center / contain no-repeat;
  opacity: 0.045;
  animation: respirar 14s var(--ease-in-out) infinite alternate;
}

.feixe {
  position: absolute;
  top: -30vh;
  left: 50%;
  width: 34vmax;
  height: 150vh;
  transform-origin: 50% 0;
  background: linear-gradient(rgb(244 196 0 / 0.2), transparent 75%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  filter: blur(18px);
}

.feixe-a { margin-left: -44vmax; animation: varrer-a 11s var(--ease-in-out) infinite alternate; }
.feixe-b { margin-left: 10vmax; animation: varrer-b 13s var(--ease-in-out) infinite alternate; }

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

@keyframes respirar {
  from { transform: scale(1) rotate(-2deg); }
  to { transform: scale(1.08) rotate(2deg); }
}

@keyframes varrer-a {
  from { transform: rotate(-22deg); }
  to { transform: rotate(14deg); }
}

@keyframes varrer-b {
  from { transform: rotate(20deg); }
  to { transform: rotate(-16deg); }
}

/* Entrada */
.entra {
  animation: subir 0.9s var(--ease-out) both;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}

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

/* Estrutura */
.pagina {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 40px;
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px 96px;
}

.chamada {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100svh - 56px);
}

.marca {
  position: relative;
  width: min(62vw, 300px);
  margin-bottom: 36px;
}

.marca-brilho {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, #fff 50%, transparent 60%) no-repeat;
  background-size: 300% 100%;
  -webkit-mask: url('/img/logo-avseg.png') center / contain no-repeat;
  mask: url('/img/logo-avseg.png') center / contain no-repeat;
  animation: brilhar 6s linear 1.2s infinite;
}

@keyframes brilhar {
  0% { background-position: 130% 0; }
  30%, 100% { background-position: -30% 0; }
}

.sobretitulo {
  color: var(--marca);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 28px;
  font-family: var(--titulo-fonte);
  font-size: clamp(2.5rem, 12.2vw, 5.4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.linha { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }

.linha > span {
  display: inline-block;
  animation: emergir 1s var(--ease-out) both;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}

@keyframes emergir {
  from { transform: translateY(115%); }
  to { transform: none; }
}

.destaque { color: var(--marca); }

/* Contagem */
.contagem {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 4.6rem));
  gap: 8px;
  margin-bottom: 28px;
}

.contagem > div {
  padding: 10px 4px 8px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: rgb(21 21 26 / 0.72);
  text-align: center;
}

.contagem strong {
  display: block;
  overflow: hidden;
  font-family: var(--titulo-fonte);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.contagem span {
  color: var(--texto-2);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.contagem-hoje {
  color: var(--marca);
  font-family: var(--titulo-fonte);
  font-size: 1.4rem;
  font-weight: 600;
}

/* Botões */
.botao {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 58px;
  padding: 0 30px;
  border: 0;
  border-radius: 14px;
  background: var(--marca);
  color: #14110a;
  font: 600 0.95rem var(--titulo-fonte);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}

.botao:active { transform: scale(0.97); }
.botao:disabled { cursor: wait; opacity: 0.7; }

.botao-chamada::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / 0.65) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: varredura 4.5s linear 2s infinite;
}

@keyframes varredura {
  0% { transform: translateX(-120%); }
  28%, 100% { transform: translateX(120%); }
}

@media (hover: hover) and (pointer: fine) {
  .botao:hover { background: #ffd51f; }
}

/* Ingresso */
.ingresso-area { scroll-margin-top: 20px; }

.bilhete {
  filter: drop-shadow(0 24px 50px rgb(0 0 0 / 0.55));
}

.bilhete-topo, .bilhete-corpo {
  --furo: radial-gradient(13px at 0 var(--y), transparent 97%, #000) ,
          radial-gradient(13px at 100% var(--y), transparent 97%, #000);
  -webkit-mask: var(--furo);
  -webkit-mask-composite: source-in;
  mask: var(--furo);
  mask-composite: intersect;
}

.bilhete-topo {
  --y: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  height: var(--topo-bilhete);
  margin: 0;
  padding: 22px 24px;
  border-radius: 22px 22px 0 0;
  background: var(--marca);
  color: #14110a;
}

.bilhete-topo dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.bilhete-topo dd {
  margin: 0;
  font-family: var(--titulo-fonte);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.bilhete-topo a { color: inherit; text-underline-offset: 3px; }

.bilhete-corpo {
  --y: 0;
  position: relative;
  padding: 30px 24px 28px;
  border-radius: 0 0 22px 22px;
  background: var(--superficie);
}

.bilhete-corpo::before {
  content: '';
  position: absolute;
  top: 0;
  right: 20px;
  left: 20px;
  border-top: 2px dashed var(--borda);
}

.formulario { display: grid; gap: 18px; }

.bilhete-corpo h2 {
  font-family: var(--titulo-fonte);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.campo label { display: block; margin-bottom: 6px; color: var(--texto-2); font-size: 0.9rem; }

.campo input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: var(--superficie-2);
  color: var(--texto);
  font: 500 1rem var(--corpo-fonte);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.campo input::placeholder { color: #6f6f79; }

.campo input:focus {
  border-color: var(--marca);
  outline: none;
  box-shadow: 0 0 0 3px var(--marca-suave);
}

.campo input[aria-invalid='true'] { border-color: var(--erro); animation: tremer 220ms var(--ease-out); }

@keyframes tremer {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(4px); }
}

/* Chave do acompanhante */
.chave {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
}

.chave input { position: absolute; opacity: 0; pointer-events: none; }

.chave-trilho {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--superficie-2);
  box-shadow: inset 0 0 0 1px var(--borda);
  transition: background-color 200ms ease;
}

.chave-trilho::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--texto-2);
  transition: transform 240ms var(--ease-out), background-color 200ms ease;
}

.chave input:checked + .chave-trilho { background: var(--marca); }
.chave input:checked + .chave-trilho::after { background: #14110a; transform: translateX(20px); }
.chave input:focus-visible + .chave-trilho { outline: 2px solid var(--marca); outline-offset: 2px; }

/* Canhoto do acompanhante */
.canhoto-caixa {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: -18px;
  transition: grid-template-rows 320ms var(--ease-out), margin-top 320ms var(--ease-out);
}

.canhoto-caixa.aberta { grid-template-rows: 1fr; margin-top: 0; }

.canhoto {
  display: grid;
  gap: 16px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 240ms ease, transform 320ms var(--ease-out);
}

.canhoto-caixa.aberta .canhoto { opacity: 1; transform: none; }

.canhoto legend {
  float: left;
  width: 100%;
  padding: 14px 0 0;
  border-top: 2px dashed var(--borda);
  font-weight: 700;
}

.canhoto legend + * { clear: both; }

.canhoto legend span {
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--marca);
  color: #14110a;
  font-size: 0.8rem;
}

.dica { margin-top: 6px; color: var(--texto-2); font-size: 0.85rem; }

/* Regras */
.regras {
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: rgb(30 30 38 / 0.5);
}

.regras summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.regras summary::-webkit-details-marker { display: none; }

.regras summary::after {
  content: '+';
  color: var(--marca);
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 200ms var(--ease-out);
}

.regras[open] summary::after { transform: rotate(45deg); }

.regras ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px 30px;
  color: var(--texto-2);
  font-size: 0.92rem;
}

.regras li::marker { color: var(--marca); }

.aceite {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--texto-2);
  font-size: 0.92rem;
  cursor: pointer;
}

.aceite input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--marca); }

.erro { margin-top: 6px; color: var(--erro); font-size: 0.9rem; font-weight: 700; }
.erro:empty { display: none; }
.formulario > .erro { margin-top: -10px; }
.erro-geral { text-align: center; }

.botao:focus-visible,
.aceite input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 3px;
}

.bilhete-topo a:focus-visible { outline-color: #14110a; }

/* Sucesso */
.sucesso { display: grid; gap: 12px; justify-items: center; padding: 10px 0; text-align: center; }
.sucesso:focus { outline: none; }
.sucesso p { color: var(--texto-2); }

.sucesso svg {
  width: 84px;
  fill: none;
  stroke: var(--marca);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sucesso svg circle, .sucesso svg path {
  stroke-dasharray: 190;
  stroke-dashoffset: 190;
  animation: tracar 700ms var(--ease-out) forwards;
}

.sucesso svg path { animation-delay: 320ms; }
.sucesso h2, .sucesso p { animation: subir 600ms var(--ease-out) 420ms both; }

@keyframes tracar {
  to { stroke-dashoffset: 0; }
}

/* Faixa */
.faixa {
  position: fixed;
  right: -8px;
  bottom: 0;
  left: -8px;
  z-index: 3;
  overflow: hidden;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: var(--marca);
  color: #14110a;
}

.faixa-trilho {
  display: flex;
  width: max-content;
  animation: correr 34s linear infinite;
}

.faixa span {
  padding-right: 22px;
  font-family: var(--titulo-fonte);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.faixa span::after { content: '✦'; margin-left: 22px; }

@keyframes correr {
  to { transform: translateX(-50%); }
}

/* Página pessoal do QR */
.pagina-qr {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px 16px;
  background: radial-gradient(90% 60% at 50% 0%, rgb(244 196 0 / 0.16), transparent 70%), var(--fundo);
}

.ingresso {
  width: 100%;
  max-width: 24rem;
  overflow: hidden;
  border-radius: 22px;
  background: var(--superficie);
  box-shadow: 0 24px 50px rgb(0 0 0 / 0.55);
  text-align: center;
  animation: subir 700ms var(--ease-out) both;
}

.ingresso-cabeca {
  padding: 22px 20px 16px;
  border-bottom: 3px solid var(--marca);
  background: var(--fundo);
}

.ingresso-logo { width: 170px; height: auto; margin: 0 auto 12px; }

.ingresso h1 {
  margin: 0;
  color: var(--marca);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ingresso-corpo { padding: 20px; }

.ingresso-nome {
  font-family: var(--titulo-fonte);
  font-size: 1.15rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ingresso-papel { color: var(--texto-2); font-size: 0.9rem; }

.ingresso-qr {
  width: min(100%, 280px);
  margin: 16px auto;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
}

.ingresso-aviso { color: var(--texto-2); font-size: 0.9rem; }

.ingresso-dados { margin: 16px 0 0; text-align: left; }

.ingresso-dados div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--borda);
}

.ingresso-dados dt { color: var(--texto-2); }
.ingresso-dados dd { margin: 0; font-weight: 700; text-align: right; }
.ingresso-dados a { color: var(--marca); }

@media (min-width: 960px) {
  :root { --topo-bilhete: 150px; }

  .pagina {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 56px;
    align-items: center;
    min-height: 100svh;
    padding: 40px 32px 72px;
  }

  .chamada { min-height: 0; }
  .marca { width: 300px; }
  h1 { font-size: clamp(3.4rem, 6.2vw, 5.4rem); }
  .contagem { grid-template-columns: repeat(4, 5.4rem); }
  .botao-chamada { display: none; }
  .bilhete-topo { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .palco-leao, .feixe, .marca-brilho, .botao-chamada::after, .faixa-trilho { animation: none; }
  .marca-brilho { display: none; }
  .faixa-trilho { width: auto; }

  .entra, .linha > span, .ingresso { animation: aparecer 300ms ease both; }

  .sucesso svg circle, .sucesso svg path { stroke-dashoffset: 0; animation: none; }
  .sucesso h2, .sucesso p { animation: aparecer 300ms ease both; }

  .canhoto, .canhoto-caixa { transition: opacity 200ms ease; transform: none; }
  .campo input[aria-invalid='true'] { animation: none; }
}

@keyframes aparecer {
  from { opacity: 0; }
  to { opacity: 1; }
}
