:root {
  --navy: #071e54;
  --blue: #0b5f8e;
  --pink: #d4306c;
  --purple: #743b92;
  --cream: #fff9e9;
  --green: #18965f;
  --gold: #f4b41e;
  --muted: #6b7180;
  --shadow: 0 18px 55px rgba(24, 36, 72, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--navy);
  background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(rgba(255,249,233,.9), rgba(255,249,233,.96)), url("rifa-chaleira.png") center/cover;
  filter: blur(16px);
  transform: scale(1.05);
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  height: 68px;
  padding: 0 max(18px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(7,30,84,.1);
  background: rgba(255,249,233,.88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--navy); text-decoration: none; font-weight: 800; }
.brand-heart { display: grid; place-items: center; width: 34px; height: 34px; color: white; border-radius: 11px; background: var(--pink); transform: rotate(-5deg); }
.legend { display: flex; gap: 16px; font-size: 12px; font-weight: 700; color: #40495e; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.available { border: 1px solid var(--navy); background: white; }
.dot.reserved { background: var(--gold); }
.dot.paid { background: var(--green); }

main { padding: 34px 18px 0; }
.raffle-wrap { max-width: 940px; margin: 0 auto; }
.instruction { margin: 0 0 18px; text-align: center; }
.instruction strong { display: block; font-size: clamp(24px, 4vw, 38px); letter-spacing: -.04em; }
.instruction span { display: block; margin-top: 5px; color: var(--muted); }
.raffle-board {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  background: url("rifa-chaleira.png") center/100% 100% no-repeat;
  box-shadow: var(--shadow), 0 0 0 1px rgba(7,30,84,.08);
}
.number-overlay {
  position: absolute;
  left: 3.05%;
  right: 3.25%;
  top: 46.55%;
  height: 42.5%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  overflow: hidden;
  border: clamp(2px, .3vw, 4px) solid var(--navy);
  border-radius: clamp(7px, 1.4vw, 18px);
  background: rgba(255,255,255,.86);
  box-shadow: 0 8px 25px rgba(7,30,84,.08);
}
.number-button {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(7,30,84,.7);
  border-bottom: 1px solid rgba(7,30,84,.7);
  border-radius: 0;
  color: var(--navy);
  background: rgba(255,255,255,.72);
  font-size: clamp(10px, 2.25vw, 27px);
  font-weight: 900;
  line-height: 1;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.number-button:nth-child(10n) { border-right: 0; }
.number-button:nth-child(n+91) { border-bottom: 0; }
.number-button:hover:not(:disabled), .number-button:focus-visible {
  z-index: 2;
  transform: scale(1.08);
  outline: 3px solid white;
  color: var(--navy);
  background: #f8bfd3;
  box-shadow: 0 4px 15px rgba(7,30,84,.28);
}
.number-button.selected { z-index: 3; color: white; background: var(--pink); outline: 3px solid #fff; box-shadow: 0 0 0 5px var(--pink), 0 8px 20px rgba(7,30,84,.32); }
.number-button.reserved { color: #644b00; background: #f9d46e; cursor: not-allowed; }
.number-button.paid { color: white; background: var(--green); cursor: not-allowed; }
.number-button.reserved::after, .number-button.paid::after { position: absolute; top: 3px; right: 4px; line-height: 1; }
.number-button.reserved::after { content: "●"; color: #b27b00; font-size: clamp(4px, .8vw, 9px); }
.number-button.paid::after { content: "✓"; color: white; font-weight: 900; font-size: clamp(8px, 1.45vw, 17px); filter: drop-shadow(0 1px 1px rgba(0,50,30,.35)); }
.board-loading { position: absolute; inset: 46.2% 3% 10.7%; display: flex; gap: 10px; align-items: center; justify-content: center; color: white; font-weight: 700; background: rgba(7,30,84,.66); backdrop-filter: blur(3px); }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { max-width: 720px; margin: 30px auto 0; border: 1px solid rgba(7,30,84,.09); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.checkout { padding: clamp(22px, 4vw, 38px); }
.checkout-empty { display: flex; align-items: center; justify-content: center; gap: 18px; color: var(--muted); }
.checkout-empty strong { color: var(--navy); font-size: 18px; }
.checkout-empty p { margin: 3px 0 0; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: none; border-radius: 15px; font-size: 23px; background: #edf4fb; }
.buyer-form label { display: block; margin-top: 17px; color: #384056; font-size: 13px; font-weight: 800; }
.buyer-form input { width: 100%; margin-top: 7px; padding: 14px 15px; border: 1px solid #ccd2dd; border-radius: 12px; color: var(--navy); background: white; outline: none; }
.buyer-form input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(212,48,108,.13); }
.selected-summary { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #e6e8ee; }
.selected-summary > div { display: flex; flex-direction: column; gap: 3px; }
.selected-summary .summary-total { text-align: right; }
.selected-summary span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.selected-summary strong { font-size: 23px; }
.selected-numbers { min-height: 37px; margin: 14px 0 4px; display: flex; flex-wrap: wrap; gap: 7px; }
.selected-numbers span { min-width: 36px; height: 36px; padding: 0 7px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--pink); font-size: 13px; font-weight: 900; box-shadow: 0 4px 10px rgba(212,48,108,.18); }
.primary-button { width: 100%; margin-top: 22px; padding: 15px 20px; border: 0; border-radius: 13px; display: flex; justify-content: center; gap: 10px; color: white; background: linear-gradient(135deg, var(--pink), #b92476); font-weight: 800; box-shadow: 0 9px 22px rgba(212,48,108,.25); }
.primary-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.text-button { display: block; margin: 15px auto 0; padding: 5px; border: 0; color: var(--muted); background: none; font-weight: 700; }
.step-heading { display: flex; align-items: center; gap: 13px; }
.step-heading p { margin: 3px 0 0; color: var(--muted); }
.step-badge { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 50%; color: white; background: var(--pink); font-weight: 900; }
.pix-qr { width: min(260px, 75vw); display: block; margin: 19px auto; border: 8px solid white; border-radius: 16px; box-shadow: 0 5px 22px rgba(7,30,84,.12); }
.pix-code-label { font-size: 12px; font-weight: 800; color: var(--muted); }
.copy-row { display: flex; margin-top: 7px; }
.copy-row input { min-width: 0; flex: 1; padding: 13px; border: 1px solid #ccd2dd; border-right: 0; border-radius: 11px 0 0 11px; color: #4c5362; background: #f7f8fa; }
.copy-row button { padding: 0 18px; border: 0; border-radius: 0 11px 11px 0; color: white; background: var(--navy); font-weight: 800; }
.whatsapp-button { width: 100%; margin-top: 14px; padding: 14px 18px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; color: white; background: #168b4d; text-decoration: none; font-weight: 800; box-shadow: 0 8px 20px rgba(22,139,77,.2); }
.whatsapp-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.proof-note { margin: 8px 5px 0; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.45; }
.waiting { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 15px; border-radius: 13px; color: #705500; background: #fff7d8; }
.waiting p { margin: 2px 0 0; font-size: 13px; }
.pulse { width: 13px; height: 13px; flex: none; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(244,180,30,.5); animation: pulse 1.5s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(244,180,30,0); } 100% { box-shadow: 0 0 0 0 rgba(244,180,30,0); } }
.success-step { text-align: center; }
.success-check { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: white; background: var(--green); font-size: 42px; font-weight: 900; box-shadow: 0 8px 24px rgba(24,150,95,.25); }
.success-step h2 { margin: 0; }
.success-step p { max-width: 460px; margin: 8px auto; color: var(--muted); }

.how-it-works { max-width: 940px; margin: 60px auto 70px; text-align: center; }
.how-it-works h2 { font-size: 28px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps article { padding: 24px 18px; border-radius: 18px; background: rgba(255,255,255,.62); }
.steps span { width: 36px; height: 36px; display: grid; place-items: center; margin: auto; border-radius: 50%; color: white; background: var(--purple); font-weight: 900; }
.steps h3 { margin: 10px 0 4px; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; }
footer { padding: 25px 18px; display: flex; justify-content: center; gap: 18px; border-top: 1px solid rgba(7,30,84,.08); color: var(--muted); font-size: 13px; }
footer p { margin: 0; } footer a { color: var(--navy); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 12px; color: white; background: var(--navy); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 650px) {
  .topbar { height: 58px; }
  .brand { font-size: 14px; }
  .brand-heart { width: 30px; height: 30px; }
  .legend span { font-size: 0; }
  .legend { gap: 8px; }
  .dot { width: 12px; height: 12px; }
  main { padding: 23px 8px 0; }
  .instruction { padding: 0 10px; }
  .instruction strong { font-size: 25px; }
  .instruction span { font-size: 13px; }
  .raffle-board { border-radius: 13px; }
  .number-button.selected { outline-width: 1px; box-shadow: 0 0 0 3px var(--pink); }
  .card { margin-left: 8px; margin-right: 8px; border-radius: 18px; }
  .checkout { padding: 21px; }
  .checkout-empty { align-items: flex-start; }
  .steps { grid-template-columns: 1fr; }
  .how-it-works { margin: 45px 8px; }
  footer { flex-direction: column; align-items: center; gap: 6px; }
}
