:root {
  --creme: #fff7ee;
  --papel: #ffffff;
  --coral: #e7686d;
  --vermelho: #b4262e;
  --vermelho-escuro: #7f1a20;
  --dourado: #d9a441;
  --dourado-claro: #f6e3b8;
  --verde: #2e7d52;
  --tinta: #3b2324;
  --tinta-suave: #7a5d5e;
  --linha: #f0d9cf;
  --sombra: 0 6px 24px rgba(127, 26, 32, 0.12);
  --raio: 18px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--creme);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(231, 104, 109, 0.12), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(217, 164, 65, 0.14), transparent 40%);
  color: var(--tinta);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.com-barra { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

h1, h2, h3 { font-family: 'Fredoka', 'Nunito', sans-serif; line-height: 1.15; margin: 0; }

a { color: var(--vermelho); }

.pagina { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }

/* topo */
.topo { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 0 4px; gap: 8px; }
.topo img.logo {
  width: 112px; height: 112px; border-radius: 50%;
  box-shadow: 0 8px 28px rgba(180, 38, 46, 0.25); border: 4px solid var(--papel);
}
.topo h1 { font-size: 1.9rem; color: var(--vermelho); }
.topo .sub { color: var(--tinta-suave); font-size: 1rem; max-width: 560px; margin: 0; }
.insta {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none;
  color: var(--vermelho); background: var(--papel); border: 1px solid var(--linha);
  padding: 8px 14px; border-radius: 999px; min-height: 40px;
}
.insta svg { width: 18px; height: 18px; }

/* cartões */
.cartao {
  background: var(--papel); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: 16px; margin-top: 14px; border: 1px solid var(--linha);
}
.cartao h2 { font-size: 1.35rem; color: var(--vermelho-escuro); margin-bottom: 12px; }

.fatos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fato { background: var(--creme); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.fato .rotulo { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tinta-suave); font-weight: 800; }
.fato .valor { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; color: var(--tinta); overflow-wrap: anywhere; }

/* abas das centenas: faixa rolável no celular */
.abas {
  display: flex; gap: 6px; margin: 0 -16px 12px; padding: 2px 16px 6px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.abas::-webkit-scrollbar { display: none; }
.aba {
  flex: 0 0 auto; scroll-snap-align: start;
  font: inherit; font-weight: 800; font-size: 0.9rem; cursor: pointer;
  border: 1px solid var(--linha); background: var(--creme); color: var(--tinta);
  padding: 6px 12px; border-radius: 12px; min-height: 48px; line-height: 1.2;
}
.aba[aria-selected="true"] { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.aba .livres { display: block; font-size: 0.7rem; font-weight: 600; opacity: 0.85; }

/* grade: 5 colunas no celular */
.grade { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.num {
  font: inherit; font-family: 'Fredoka', sans-serif; font-size: 1.1rem;
  min-height: 48px; aspect-ratio: 1 / 1; border-radius: 12px; cursor: pointer; padding: 0;
  border: 2px solid var(--linha); background: var(--papel); color: var(--tinta);
  touch-action: manipulation; transition: transform 0.08s ease, background 0.15s ease;
}
.num:active:not(:disabled) { transform: scale(0.94); }
.num:focus-visible { outline: 3px solid var(--dourado); outline-offset: 2px; }
.num.escolhido { background: var(--dourado); border-color: #b9862a; color: #fff; }
.num.reservado { background: var(--dourado-claro); border-color: var(--dourado-claro); color: #a17a35; }
.num.pago { background: var(--coral); border-color: var(--coral); color: #fff; opacity: 0.85; }
.num:disabled { cursor: not-allowed; }

.legenda { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 14px; font-size: 0.88rem; color: var(--tinta-suave); }
.legenda span::before {
  content: ''; display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  margin-right: 6px; vertical-align: -2px; border: 2px solid var(--linha); background: var(--papel);
}
.legenda .l-escolhido::before { background: var(--dourado); border-color: #b9862a; }
.legenda .l-reservado::before { background: var(--dourado-claro); border-color: var(--dourado-claro); }
.legenda .l-pago::before { background: var(--coral); border-color: var(--coral); }

.busca { display: flex; gap: 8px; margin-bottom: 12px; }
.busca input { flex: 1; min-width: 0; }

/* formulários */
label { display: block; font-weight: 800; margin-bottom: 6px; }
input, textarea {
  font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--linha); background: var(--papel); color: var(--tinta); min-height: 50px;
}
input:focus, textarea:focus { outline: none; border-color: var(--coral); }
.campo-tel { display: flex; align-items: stretch; }
.campo-tel .ddi {
  display: flex; align-items: center; padding: 0 12px; font-weight: 800;
  background: var(--creme); border: 2px solid var(--linha); border-right: 0; border-radius: 12px 0 0 12px;
}
.campo-tel input { border-radius: 0 12px 12px 0; min-width: 0; }
.dica { font-size: 0.85rem; color: var(--tinta-suave); margin: 6px 0 0; }

.botao {
  font: inherit; font-weight: 800; cursor: pointer; border: 0; border-radius: 14px;
  padding: 14px 20px; min-height: 50px; background: var(--vermelho); color: #fff;
  box-shadow: 0 4px 0 var(--vermelho-escuro); transition: transform 0.08s ease;
  touch-action: manipulation; display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.botao:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--vermelho-escuro); }
.botao:disabled { opacity: 0.5; cursor: not-allowed; }
.botao.claro { background: var(--creme); color: var(--vermelho); box-shadow: 0 3px 0 var(--linha); border: 1px solid var(--linha); }
.botao.verde { background: var(--verde); box-shadow: 0 4px 0 #1d5536; }
.botao.cheio { width: 100%; }
.botao.pequeno { padding: 8px 12px; min-height: 44px; font-size: 0.92rem; border-radius: 10px; }

.escolhidos { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; margin: 6px 0 12px; }
.chip {
  font-family: 'Fredoka', sans-serif; background: var(--dourado); color: #fff;
  border-radius: 999px; padding: 4px 4px 4px 12px; display: inline-flex; align-items: center; gap: 2px;
}
.chip button { all: unset; cursor: pointer; font-weight: 800; width: 28px; height: 28px; text-align: center; line-height: 28px; }
.chip.reservado { background: var(--dourado-claro); color: #8a6526; padding-right: 12px; }
.chip.pago { background: var(--verde); padding-right: 12px; }

.total { font-family: 'Fredoka', sans-serif; font-size: 1.25rem; margin-bottom: 12px; }

.aviso { border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.aviso.erro { background: #fdecec; color: var(--vermelho-escuro); }
.aviso.ok { background: #e8f5ee; color: #1d5536; }
.aviso.info { background: var(--creme); color: var(--tinta); }
.oculto { display: none !important; }

.pix { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.pix code {
  font-size: 0.78rem; line-height: 1.35; background: var(--creme); padding: 10px 12px; border-radius: 10px;
  word-break: break-all; max-height: 7.5em; overflow-y: auto; user-select: all;
}

.fato.premio ~ .fato:last-child:nth-child(even) { grid-column: 1 / -1; }
.fato.premio { grid-column: 1 / -1; background: linear-gradient(135deg, #fff1df, var(--dourado-claro)); }
.fato.premio .valor { font-size: 1.15rem; }
.fato.premio img {
  display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 10px;
  background: #fff; border-radius: 12px; padding: 8px;
}
.fato.premio a { display: inline-block; margin-top: 4px; font-weight: 800; font-size: 0.9rem; padding: 6px 0; }

.valor-pix {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--creme); border-radius: 14px; padding: 12px; margin: 8px 0 4px;
  font-weight: 700; color: var(--tinta-suave);
}
.valor-pix strong { font-family: 'Fredoka', sans-serif; font-size: 2.2rem; color: var(--vermelho); line-height: 1.1; }
.aviso.atencao { background: #fff4d6; border: 1px solid var(--dourado); }

details.qr { margin-top: 10px; }
details.qr summary { cursor: pointer; font-weight: 800; color: var(--vermelho); padding: 8px 0; min-height: 44px; }
details.qr img { display: block; width: 100%; max-width: 300px; margin: 8px auto 0; border-radius: 12px; border: 1px solid var(--linha); }

/* sorteio */
.sorteio { text-align: center; }
.contagem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 6px; }
.contagem div { background: var(--creme); border-radius: 12px; padding: 8px 4px; }
.contagem b { display: block; font-family: 'Fredoka', sans-serif; font-size: 1.6rem; color: var(--vermelho); }
.contagem small { color: var(--tinta-suave); font-weight: 700; font-size: 0.78rem; }
.ganhador { font-family: 'Fredoka', sans-serif; font-size: 5rem; color: var(--vermelho); line-height: 1; margin: 10px 0; letter-spacing: 0.04em; }
.ganhador.girando { color: var(--dourado); }

/* barra fixa de compra (celular) */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--papel); border-top: 1px solid var(--linha);
  box-shadow: 0 -6px 20px rgba(127, 26, 32, 0.12);
}
.barra .resumo { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; line-height: 1.2; }
.barra .resumo small { display: block; font-family: 'Nunito', sans-serif; font-size: 0.8rem; color: var(--tinta-suave); }

.rodape { text-align: center; color: var(--tinta-suave); font-size: 0.9rem; margin-top: 28px; }

table { width: 100%; border-collapse: collapse; }

/* telas maiores */
@media (min-width: 640px) {
  .pagina { padding: 0 24px 48px; }
  .topo { padding-top: 28px; }
  .topo img.logo { width: 150px; height: 150px; }
  .topo h1 { font-size: 2.6rem; }
  .cartao { padding: 22px; margin-top: 18px; }
  .cartao h2 { font-size: 1.5rem; }
  .fatos { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .fato.premio ~ .fato:last-child:nth-child(even) { grid-column: auto; }
  .fatos:not(:has(.premio)) { grid-template-columns: repeat(4, 1fr); }
  .fato .valor { font-size: 1.2rem; }
  .abas { flex-wrap: wrap; overflow: visible; margin: 0 0 14px; padding: 0; }
  .grade { grid-template-columns: repeat(10, 1fr); gap: 6px; }
  .num { font-size: 1rem; min-height: 0; border-radius: 10px; }
  .num:hover:not(:disabled) { border-color: var(--coral); }
  .legenda { display: flex; flex-wrap: wrap; gap: 14px; }
  .pix { flex-direction: row; align-items: center; }
  .pix code { flex: 1; }
  .contagem { display: flex; justify-content: center; gap: 10px; }
  .contagem div { min-width: 80px; padding: 10px 14px; }
  .contagem b { font-size: 1.9rem; }
  .ganhador { font-size: 7rem; }
  .botao.cheio-mobile { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
