/* Página pública (comprador) — mobile first */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 800; color: var(--gold); text-decoration: none; font-size: 16px; letter-spacing: -.01em; }
.logo svg { width: 18px; height: 18px; }
.ao-vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }

.wrap-page { max-width: 1040px; margin: 0 auto; padding: 18px 16px 140px; }
.wrap-page > * + * { margin-top: 18px; }

.aviso-home { background: color-mix(in srgb, var(--gold) 10%, var(--card)); border: 1px solid var(--gold); border-radius: 16px; padding: 12px 16px; font-size: 14px; }

/* hero */
.hero { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 24px; overflow: hidden; }
.hero-img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; background: var(--card); }
.hero-body { padding: 20px 18px; text-align: center; }
.hero h1 { font-size: 24px; font-weight: 800; }
@media (min-width: 640px) { .hero h1 { font-size: 30px; } }
.hero .sub { margin-top: 6px; color: var(--text-2); }
.hero .preco strong { color: var(--text); font-family: var(--font-display); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--card); border: 1px solid var(--border-soft); border-radius: 16px; padding: 10px 6px; }
.stat svg { color: var(--gold); width: 16px; height: 16px; }
.stat b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--gold); line-height: 1.2; margin-top: 2px; }
.stat span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.stat.destaque { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--card)); }
.stat.destaque b { font-size: 26px; }
.hero .progress { margin-top: 14px; }

/* banners */
.banner { display: flex; gap: 14px; align-items: center; border-radius: 20px; padding: 16px 18px; border: 1px solid var(--border); background: var(--card); }
.banner svg { width: 30px; height: 30px; color: var(--gold); flex: none; }
.banner.venc { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--card)); }
.banner h3 { font-size: 17px; }

/* lista de rifas */
.lista-rifas { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .lista-rifas { grid-template-columns: 1fr 1fr; } }
.rifa-card { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; transition: transform .15s, border-color .15s; }
.rifa-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.rifa-card img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; }
.rifa-card .corpo { padding: 16px; }
.rifa-card h3 { font-size: 18px; }

/* identificação */
.ident h2 { font-size: 18px; }
.ident .topo { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.ident .bolha { width: 42px; height: 42px; border-radius: 50%; background: var(--bg-2); color: var(--gold); display: flex; align-items: center; justify-content: center; flex: none; }
.seguro { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); background: var(--bg-2); border-radius: 12px; padding: 10px 12px; }
.seguro svg { color: var(--green); width: 16px; height: 16px; margin-top: 2px; }
.ola { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--card); border: 1px solid var(--border-soft); border-radius: 16px; }

/* grade */
.grade-card { padding: 14px; }
@media (min-width: 640px) { .grade-card { padding: 22px; } }
.grade-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.grade-topo h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.grade-topo h2 svg { color: var(--gold); }
.legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.ferramentas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.ferramentas .input { min-height: 38px; width: 110px; padding: 6px 10px; }
.ferramentas select.input { width: auto; }

.grade { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
@media (min-width: 480px) { .grade { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 640px) { .grade { grid-template-columns: repeat(8, 1fr); gap: 8px; } }
@media (min-width: 900px) { .grade { grid-template-columns: repeat(10, 1fr); } }
.grade.d3 { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 480px) { .grade.d3 { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 900px) { .grade.d3 { grid-template-columns: repeat(10, 1fr); } }
.grade.so-livres .n:not(.livre):not(.meu) { display: none; }

.n {
  position: relative; aspect-ratio: 1; min-height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; border: 1px solid rgb(0 0 0 / .15);
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #fff9f0;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .12s, box-shadow .12s, background .2s;
  background: var(--green);
}
.grade.d3 .n { font-size: 14px; }
.n.livre:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.n.livre:active { transform: translateY(0); }
.n.meu { background: var(--orange); box-shadow: 0 0 0 2px var(--orange), var(--shadow); animation: pulsa 2s ease-in-out infinite; color: #0b0806; }
.n.res { background: color-mix(in srgb, var(--orange) 45%, var(--bg)); color: rgb(255 249 240 / .75); cursor: not-allowed; }
.n.meu-ag { background: color-mix(in srgb, var(--orange) 70%, var(--bg)); color: #0b0806; cursor: default; box-shadow: inset 0 0 0 2px var(--gold); }
.n.vendido { background: color-mix(in srgb, var(--red) 85%, var(--bg)); text-decoration: line-through; cursor: not-allowed; }
.n.meu-pago { background: var(--green); cursor: default; box-shadow: inset 0 0 0 2px var(--gold); }
.n.meu-pago::after, .n.meu-ag::after {
  content: ""; position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322b95b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat;
  border: 1px solid var(--green);
}
.n.meu-ag::after { border-color: var(--gold); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5b800' stroke-width='3' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.n.carregando { opacity: .6; pointer-events: none; }
.n.venc { box-shadow: 0 0 0 3px var(--gold), 0 0 18px color-mix(in srgb, var(--gold) 60%, transparent); }
.n.flash { animation: flash .9s ease-out 2; }
.grade.fechada .n { cursor: default; }
@keyframes pulsa { 50% { opacity: .7; } }
@keyframes flash { 50% { transform: scale(1.15); box-shadow: 0 0 0 4px var(--gold); } }

/* meus pedidos */
.pedido-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.pedido-item:first-of-type { border-top: 0; }
.nums { display: flex; flex-wrap: wrap; gap: 5px; }

/* barra inferior */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--card) 96%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); box-shadow: 0 -8px 24px -12px rgb(0 0 0 / .6);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  animation: sobe .2s ease-out;
}
.barra-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.barra b { font-family: var(--font-display); }
.barra .timer { color: var(--orange); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }

/* checkout */
.pix-qr { background: #fff; border-radius: 16px; padding: 10px; width: 220px; height: 220px; margin: 0 auto; }
.pix-qr svg { width: 100%; height: 100%; display: block; }
.copia { background: var(--bg); border: 1px dashed var(--border); border-radius: 12px; padding: 10px; font-size: 11px; word-break: break-all; max-height: 84px; overflow: auto; }
.passos { counter-reset: p; list-style: none; padding: 0; margin: 0; }
.passos li { counter-increment: p; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.passos li + li { margin-top: 6px; }
.passos li::before { content: counter(p); flex: none; width: 20px; height: 20px; border-radius: 50%; background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.resumo { background: var(--bg-2); border-radius: 16px; padding: 14px; }
.resumo .linha { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.resumo .linha + .linha { margin-top: 6px; }
.total { font-family: var(--font-display); font-size: 22px; color: var(--gold); font-weight: 800; }
.upload { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px dashed var(--border); border-radius: 14px; cursor: pointer; }
.upload:hover { background: var(--bg-2); }
.upload input { display: none; }
.upload .bolha { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-2); color: var(--gold); display: flex; align-items: center; justify-content: center; flex: none; }
.upload img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.sucesso { text-align: center; padding: 10px 0; }
.sucesso .ok-bola { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #0b0806; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.sucesso .ok-bola svg { width: 34px; height: 34px; }
.sucesso .ok-bola.analise { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }

/* menu lateral */
.sheet-bg { position: fixed; inset: 0; background: rgb(0 0 0 / .6); z-index: 40; animation: fade .15s; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); background: var(--card); border-left: 1px solid var(--border); z-index: 41; padding: 20px 16px; display: flex; flex-direction: column; gap: 4px; animation: entra .2s ease-out; padding-top: calc(20px + env(safe-area-inset-top)); }
.sheet a, .sheet button.item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; color: var(--text); text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; font-weight: 600; font-size: 15px; }
.sheet a:hover, .sheet button.item:hover { background: var(--bg-2); }
.sheet svg { color: var(--gold); }
@keyframes entra { from { transform: translateX(30px); opacity: .5; } }

.texto-rifa { white-space: pre-wrap; color: var(--text-2); font-size: 14px; }
.como { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 14px 0 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .como { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .como { grid-template-columns: repeat(4, 1fr); } }
.como li { display: flex; gap: 10px; font-size: 14px; }
.como .num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold); font-family: var(--font-display); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
footer.rodape { border-top: 1px solid var(--border-soft); padding: 26px 16px 120px; text-align: center; font-size: 12px; color: var(--text-3); }
