:root {
  --roxo: #150426;
  --laranja: #EA5A2A;
  --roxo2: #63338A;
  --lilas: #EAE6F0;
  --verde: #1f9d55;
  --vermelho: #d63a3a;
  --texto-suave: rgba(234, 230, 240, .72);
  --linha: rgba(234, 230, 240, .14);
  --r: 16px;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--roxo); color: #fff; font-family: Inter, "Acumin Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { font-size: 17px; line-height: 1.35; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
#app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* topo */
.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: var(--roxo); border-bottom: 1px solid var(--linha); }
.barra h2 { font-size: 18px; font-weight: 800; flex: 1; }
.voltar { width: 48px; height: 48px; margin-left: -8px; border-radius: 12px; font-size: 26px; display: grid; place-items: center; }
.voltar:active { background: var(--linha); }
.marca { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.marca b { color: var(--laranja); }
.contador { font-size: 14px; font-weight: 600; background: var(--roxo2); padding: 6px 12px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ensaio { background: #f5c518; color: var(--roxo); text-align: center; font-weight: 800; font-size: 13px; padding: 4px; letter-spacing: .08em; }

.conteudo { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* botões */
.btn { min-height: 56px; border-radius: 14px; padding: 0 20px; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; transition: transform .06s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; }
.btn-laranja { background: var(--laranja); color: #fff; }
.btn-verde { background: var(--verde); color: #fff; }
.btn-claro { background: var(--lilas); color: var(--roxo); }
.btn-contorno { border: 2px solid var(--linha); color: var(--lilas); }
.btn-grande { min-height: 72px; font-size: 20px; }

/* PIN */
.pin { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 24px 24px calc(env(safe-area-inset-bottom) + 24px); }
.pin h1 { font-size: 28px; font-weight: 800; text-align: center; }
.pin h1 span { color: var(--laranja); }
.pontos { display: flex; justify-content: center; gap: 16px; height: 20px; }
.pontos i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--lilas); }
.pontos i.on { background: var(--laranja); border-color: var(--laranja); }
.pin .msg { text-align: center; min-height: 22px; color: #ff9b80; font-weight: 600; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; width: 100%; margin: 0 auto; }
.teclado button { height: 68px; border-radius: 16px; background: rgba(234, 230, 240, .08); font-size: 28px; font-weight: 600; }
.teclado button:active { background: var(--roxo2); }
.teclado .fn { font-size: 16px; background: none; color: var(--texto-suave); }
.tremer { animation: tremer .35s; }
@keyframes tremer { 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }

/* menu */
.modos { display: grid; gap: 14px; margin-top: 8px; }
.modo { text-align: left; border-radius: 20px; padding: 22px; display: flex; gap: 16px; align-items: center; min-height: 112px; }
.modo .ic { font-size: 36px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, .16); flex: none; }
.modo b { display: block; font-size: 22px; font-weight: 800; }
.modo small { color: inherit; opacity: .85; font-size: 15px; }
.modo-recepcao { background: var(--roxo2); }
.modo-porta { background: var(--laranja); }
.sair { margin-top: auto; }

/* busca */
.campo { width: 100%; height: 56px; border-radius: 14px; border: 2px solid var(--linha); background: rgba(234, 230, 240, .06); padding: 0 16px; font-size: 18px; outline: none; }
.campo:focus { border-color: var(--laranja); }
.campo::placeholder { color: var(--texto-suave); }
.aviso { color: var(--texto-suave); text-align: center; padding: 24px 8px; font-size: 15px; }
.lista { display: flex; flex-direction: column; gap: 10px; }
.item { text-align: left; background: rgba(234, 230, 240, .07); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 64px; }
.item:active { background: rgba(234, 230, 240, .14); }
.item .nome { font-weight: 800; font-size: 18px; }
.item .sub { color: var(--texto-suave); font-size: 14px; word-break: break-all; }
.chip { align-self: flex-start; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 99px; margin-top: 4px; }
.chip-sem_doacao { background: rgba(234, 230, 240, .16); color: var(--lilas); }
.chip-ingresso { background: var(--laranja); color: #fff; }
.chip-checkin { background: var(--verde); color: #fff; }

/* ficha (recepção) */
.ficha { background: var(--lilas); color: var(--roxo); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 6px; border-top: 6px solid var(--laranja); }
.ficha .nome { font-size: 24px; font-weight: 800; line-height: 1.15; }
.ficha .sub { color: var(--roxo2); word-break: break-all; }
.ok { background: rgba(31, 157, 85, .16); border: 2px solid var(--verde); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ok b { font-size: 20px; }
.link { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--lilas); }

/* modal */
.fundo { position: fixed; inset: 0; background: rgba(8, 1, 16, .72); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.folha { width: 100%; max-width: 560px; background: #22103a; border-radius: 24px 24px 0 0; padding: 24px 16px calc(env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; gap: 12px; max-height: 92dvh; overflow: auto; }
.folha h3 { font-size: 22px; font-weight: 800; }
.folha p { color: var(--texto-suave); }

/* porta */
.porta { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; }
.porta .barra { background: rgba(21, 4, 38, .92); }
.camera { flex: 1; position: relative; overflow: hidden; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mira { position: absolute; top: 50%; left: 50%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 24px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); outline: 4px solid var(--laranja); }
.camera .dica { position: absolute; left: 16px; right: 16px; bottom: 16px; text-align: center; font-weight: 600; text-shadow: 0 1px 4px #000; }
.camera .erro-cam { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--roxo); }
.rodape { padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); background: var(--roxo); display: flex; gap: 10px; }

.resultado { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 16px); gap: 12px; }
.res-liberado { background: #0f5e33; }
.res-ja_entrou, .res-invalido, .res-sem_doacao { background: #7d1b1b; }
.res-credenciado { background: var(--verde); justify-content: center; align-items: center; text-align: center; }
.resultado .selo { font-size: 15px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.resultado .grande { font-size: 34px; font-weight: 800; line-height: 1.1; word-break: break-word; }
.resultado .sub { font-size: 16px; opacity: .9; word-break: break-all; }
.resultado .topo-res { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.check { font-size: 96px; line-height: 1; }
a.btn { text-decoration: none; }
.ficha .chip-sem_doacao { background: var(--roxo2); color: #fff; }
