:root {
  /* Acentos (sobreescritos por el <style> inline de base.html) */
  --ink: #1f2440;
  --ink-soft: #3a3f5c;
  --paper: #faf8f5;
  --card: #ffffff;
  --rosa: #e91e8c;
  --rosa-dark: #c20f73;
  --oro: #f6a623;
  --verde: #2bb673;
  --muted: #6b6a78;
  --line: #e7e2da;
  --radius: 14px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  /* Variables de tema (sobreescritas por el <style> inline según claro/oscuro) */
  --shadow: 0 1px 2px rgba(31,36,64,.06), 0 8px 24px rgba(31,36,64,.06);
  --overlay: rgba(31,36,64,.55);
  --oro-tint: #fdf1d8;
  --verde-tint: #e6f6ee;
  --oro-text: #b07c12;
  --oro-border: #f0dcae;
  --tile-pagado-bg: #f3f1ee;
  --tile-pagado-color: #b6b1bb;
  --flash-error-bg: #fdeaf0;
  --flash-error-color: #9b1c4b;
  --flash-warning-color: #8a5a00;
  --flash-success-color: #146c46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 6vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
a { color: inherit; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* Header / footer */
.site-header {
  display: flex; align-items: center;
  padding: 18px 20px; max-width: 1100px; margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 45deg, var(--rosa), var(--oro), var(--rosa));
  box-shadow: inset 0 0 0 3px var(--paper);
}
.brand-logo { height: 36px; width: auto; display: block; }
.site-footer {
  margin-top: 64px; padding: 32px 20px; text-align: center;
  color: var(--muted); border-top: 1px solid var(--line); font-size: .85rem;
}
.site-footer .fine { margin: 4px 0 0; opacity: .8; }

/* Flashes */
.flashes { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: .92rem; }
.flash-error   { background: var(--flash-error-bg);          color: var(--flash-error-color); }
.flash-warning { background: var(--oro-tint);                color: var(--flash-warning-color); }
.flash-success { background: var(--verde-tint);              color: var(--flash-success-color); }

.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .72rem;
  font-weight: 600; color: var(--rosa); margin: 0 0 .6em;
}
.lede { font-size: 1.08rem; color: var(--ink-soft); }
.section-title { margin: 48px 0 18px; }

/* Home hero */
.hero-home { max-width: 880px; margin: 24px auto 8px; padding: 28px 20px 8px; }
.hero-home h1 { max-width: 14ch; }
.hero-home .lede { max-width: 46ch; }

/* Rifa cards */
.rifa-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 620px) { .rifa-grid { grid-template-columns: 1fr 1fr; } }
.rifa-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid var(--line);
}
.rifa-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.14); }
.rifa-card-img { aspect-ratio: 16/10; background: var(--oro-tint); display: grid; place-items: center; }
.rifa-card-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { font-size: 3rem; }
.rifa-card-body { padding: 16px 18px 18px; }
.rifa-card-body .premio { color: var(--muted); margin: 2px 0 14px; font-size: .95rem; }
.rifa-card-meta { display: flex; justify-content: space-between; align-items: baseline; }
.precio { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--rosa); }
.restantes { font-size: .85rem; color: var(--verde); font-weight: 600; }

.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }
.cerradas { display: grid; gap: 8px; }
.cerrada-item { display: flex; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.ganador { color: var(--rosa); font-weight: 600; }

/* Rifa hero */
.rifa-hero {
  display: grid; gap: 24px; grid-template-columns: 1fr;
  max-width: 1000px; margin: 16px auto 0; padding: 12px 20px 0;
}
@media (min-width: 760px) { .rifa-hero { grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; } }
.rifa-hero-media img, .noimg-lg {
  width: 100%; border-radius: var(--radius); box-shadow: var(--shadow);
  aspect-ratio: 4/3; object-fit: cover; background: var(--oro-tint);
}
.noimg-lg { display: grid; place-items: center; font-size: 4rem; }
.facts { display: grid; gap: 0; margin: 22px 0 0; border-top: 1px solid var(--line); }
.facts > div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); margin: 0; font-size: .92rem; }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.ganador-banner { background: var(--oro-tint); border-radius: 10px; padding: 12px 16px; margin-top: 18px; }

/* Tablero — la firma */
.tablero-seccion { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.tablero-leyenda { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.chip { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.chip::before { content: ""; width: 12px; height: 12px; border-radius: 4px; }
.chip-libre::before    { background: var(--verde); }
.chip-apartado::before { background: var(--oro); }
.chip-pagado::before   { background: var(--muted); }

.tablero {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
}
.tile {
  font-family: var(--font-mono); font-size: 1.02rem; font-weight: 700;
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line);
  display: grid; place-items: center; padding: 0; background: var(--card);
  position: relative; transition: transform .08s ease, box-shadow .12s ease;
}
/* perforación tipo cachito */
.tile::before, .tile::after {
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: var(--paper); top: 50%; transform: translateY(-50%);
}
.tile::before { left: -4px; } .tile::after { right: -4px; }
.tile-libre { cursor: pointer; color: var(--ink); box-shadow: inset 0 -3px 0 var(--verde-tint); }
.tile-libre:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(43,182,115,.25); border-color: var(--verde); }
.tile-libre:focus-visible { outline: 3px solid var(--rosa); outline-offset: 2px; }
.tile-apartado { background: var(--oro-tint); color: var(--oro-text); border-color: var(--oro-border); cursor: not-allowed; }
.tile-pagado   { background: var(--tile-pagado-bg); color: var(--tile-pagado-color); text-decoration: line-through; border-color: var(--line); cursor: not-allowed; }

.cerrada-aviso { color: var(--muted); }

/* Pasos */
.pasos-seccion { margin-top: 12px; }
.pasos { counter-reset: paso; list-style: none; padding: 0; display: grid; gap: 12px; }
.pasos li { position: relative; padding-left: 44px; }
.pasos li::before {
  counter-increment: paso; content: counter(paso);
  position: absolute; left: 0; top: -2px; width: 30px; height: 30px;
  background: var(--ink); color: var(--paper); border-radius: 9px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
}

.bases-seccion p { color: var(--ink-soft); }
.bases summary { cursor: pointer; font-weight: 600; color: var(--rosa); margin-top: 8px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: 13px 22px; border-radius: 11px; border: none; cursor: pointer;
  text-decoration: none; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primario { background: var(--rosa); color: #fff; width: 100%; }
.btn-primario:hover { filter: brightness(1.05); }
.btn-whatsapp { background: #25d366; color: #06351a; font-weight: 700; margin: 18px 0; }
.btn-chico { padding: 7px 12px; font-size: .85rem; background: var(--ink); color: var(--paper); border-radius: 8px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  display: grid; place-items: end center; z-index: 50; padding: 0;
}
.modal-overlay[hidden] { display: none !important; }
@media (min-width: 560px) { .modal-overlay { place-items: center; padding: 20px; } }
.modal {
  background: var(--card); border-radius: 18px 18px 0 0; padding: 26px 22px 28px;
  width: 100%; max-width: 440px; position: relative; box-shadow: var(--shadow);
  animation: subir .22s ease;
}
@media (min-width: 560px) { .modal { border-radius: 18px; } }
@keyframes subir { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-cerrar { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.num-grande { font-family: var(--font-mono); color: var(--rosa); }
.modal form { display: grid; gap: 14px; margin-top: 8px; }
.modal label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.modal input[type=text], .modal input[type=tel] {
  font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink);
}
.modal input:focus { outline: 2px solid var(--rosa); border-color: var(--rosa); }
.metodos { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; display: grid; gap: 8px; }
.metodos legend { font-size: .82rem; color: var(--muted); padding: 0 6px; }
.metodo { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.modal-fine { font-size: .8rem; color: var(--muted); text-align: center; margin: 4px 0 0; }

/* Transferencia */
.pago-transfer, .estado-pago { padding-top: 28px; }
.datos-pago { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; margin: 22px 0; }
.datos-pago > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.datos-pago > div:last-child { border-bottom: none; }
.datos-pago span { color: var(--muted); font-size: .9rem; }
.datos-pago strong { font-weight: 600; }
.clabe-row strong { font-family: var(--font-mono); letter-spacing: .02em; }
.volver { display: inline-block; margin-top: 18px; color: var(--rosa); font-weight: 600; text-decoration: none; }

/* Estado de pago */
.estado-pago { text-align: center; max-width: 540px; }
.estado-icono { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto 18px; }
.estado-icono.ok   { background: var(--verde-tint); color: var(--verde); }
.estado-icono.wait { background: var(--oro-tint);   color: var(--oro); }
.estado-pago .btn { width: auto; margin-top: 12px; }

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