:root {
  --bg: #f3f5f4;
  --ink: #111c1a;
  --muted: #5b6b67;
  --line: #dfe6e3;
  --brand: #0f766e;
  --accent: #f59e0b;
  --wa: #1fa855;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
body.has-cart { padding-bottom: 110px; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
.wrap { max-width: 920px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 560px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.box.center { text-align: center; }
.note { color: var(--muted); font-size: .95rem; }
.note.error { color: #b91c1c; }
.note.ok { color: #15803d; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.big { font-size: 1.1rem; padding: 14px 24px; }

/* Encabezado */
.hero { background: linear-gradient(160deg, #0f766e 0%, #0b3b37 100%); color: #fff; }
.hero-img { max-width: 920px; margin: 0 auto; }
.hero-img img { display: block; width: 100%; max-height: 460px; object-fit: cover; }
@media (min-width: 920px) { .hero-img { padding: 16px 16px 0; } .hero-img img { border-radius: var(--radius); } }
.hero-txt { max-width: 920px; margin: 0 auto; padding: 18px 16px 24px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 14px; }
.facts { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.facts li { background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 12px; }
.facts span { display: block; font-size: .8rem; opacity: .8; }
.facts .price { font-size: 1.4rem; color: #fde68a; }
.progress { height: 10px; background: rgba(255, 255, 255, .2); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); border-radius: 999px; }
.progress-txt { margin: 6px 0 0; font-size: .92rem; opacity: .95; }

.winner { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border-radius: var(--radius); padding: 22px; text-align: center; margin-bottom: 16px; }
.winner p { margin: 0; font-weight: 600; }
.winner strong { display: block; font: 800 3.4rem/1.1 ui-monospace, Consolas, monospace; letter-spacing: .08em; margin: 6px 0; }
.prizes { padding-left: 1.2rem; margin: 0 0 12px; }
.prizes li { margin-bottom: 4px; font-weight: 600; }

/* Cuadrícula */
.grid-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.grid-head h2 { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 13px; height: 13px; border-radius: 4px; border: 1px solid #c9d4d0; display: inline-block; background: #fff; }
.dot.ocupado { background: #cbd5d1; border-color: #cbd5d1; }
.dot.sel { background: var(--brand); border-color: var(--brand); }
.search { width: 100%; padding: 11px 14px; border: 1px solid #c9d4d0; border-radius: 12px; font: inherit; margin-bottom: 12px; }
.pager { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 9px; font: 600 .82rem ui-monospace, Consolas, monospace; cursor: pointer; }
.pager button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager select { padding: 8px 10px; border-radius: 10px; border: 1px solid #c9d4d0; font: inherit; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.n { height: 46px; border-radius: 10px; border: 1px solid #c9d4d0; background: #fff; color: var(--ink); font: 700 1rem ui-monospace, Consolas, monospace; cursor: pointer; }
.n:hover:not(:disabled) { border-color: var(--brand); }
.n.ocupado { background: #e5ebe8; color: #9aa8a3; border-color: #e5ebe8; text-decoration: line-through; cursor: not-allowed; }
.n.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.n.hit { outline: 3px solid var(--accent); outline-offset: 1px; }
.n:disabled:not(.ocupado) { cursor: default; }

/* Carrito */
.cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--ink); color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: 0 -6px 24px rgba(0, 0, 0, .2); }
.cart[hidden] { display: none; }
.cart-info { flex: 1; min-width: 160px; }
.cart-min { flex-basis: 100%; font-size: .85rem; color: #fde68a; }
.btn.wa.disabled { opacity: .45; cursor: not-allowed; }
.cart-nums { font: .85rem ui-monospace, Consolas, monospace; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70vw; }

.wa-float { position: fixed; right: 16px; bottom: 16px; z-index: 25; width: 56px; height: 56px; border-radius: 50%; background: var(--wa); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
body.has-cart .wa-float { display: none; }

/* Consulta */
.consulta { display: flex; gap: 8px; }
.consulta input { flex: 1; padding: 11px 14px; border: 1px solid #c9d4d0; border-radius: 12px; font: inherit; min-width: 0; }
.mis-numeros { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.mis-numeros li { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.mis-numeros strong { display: block; font: 800 1.6rem ui-monospace, Consolas, monospace; }
.mis-numeros span { font-size: .85rem; }
.mis-numeros .pagado { background: #dcfce7; border-color: #bbf7d0; }
.mis-numeros .abono { background: #fef3c7; border-color: #fde68a; }
.mis-numeros .pendiente { background: #fee2e2; border-color: #fecaca; }
.mis-numeros .ganador { outline: 3px solid var(--accent); }
.pay { background: #f6f8f7; border-radius: 12px; padding: 4px 14px; }

.closed { max-width: 520px; margin: 18vh auto; padding: 16px; text-align: center; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px 16px 30px; }

/* Portada de la plataforma */
.lp-top { max-width: 920px; margin: 0 auto; padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.lp-brand { font-size: 1.2rem; color: var(--brand); }
.lp-hero { text-align: center; padding: 40px 0 30px; }
.lp-hero h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); margin: 0 0 14px; }
.lp-hero p { max-width: 620px; margin: 0 auto 22px; color: var(--muted); font-size: 1.1rem; }
.lp-feats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.lp-feats .box { margin: 0; }
.lp-feats h3 { margin: 0 0 6px; }
.lp-feats p { margin: 0; color: var(--muted); }

/* Selección al azar */
.btn.block { width: 100%; }
.azar { border: 2px dashed #99d5cf; background: linear-gradient(180deg, #f0fdfa, #fff); }
.azar h2 { margin-bottom: .3rem; }
.azar .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.azar .btn:disabled { opacity: .7; cursor: wait; }
.azar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; font-weight: 600; }
.stepper { display: flex; align-items: center; border: 1px solid #c9d4d0; border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: #f3f5f4; font: 700 1.3rem system-ui, sans-serif; cursor: pointer; color: var(--ink); }
.stepper output { min-width: 48px; text-align: center; font: 700 1.2rem ui-monospace, Consolas, monospace; }
.azar-result { text-align: center; }
.azar-result:empty { display: none; }
.azar-title { margin: 16px 0 6px; font-weight: 700; }
.azar-nums { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.azar-num { display: inline-grid; place-items: center; min-width: 64px; height: 64px; padding: 0 10px; border-radius: 14px; font: 800 1.7rem ui-monospace, Consolas, monospace; background: #e5ebe8; color: #6b7a76; }
.azar-num.final { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(15, 118, 110, .35); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .azar-num.final { animation: none; } }

/* Formulario de apartado */
body.sheet-open { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 18, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
@media (min-width: 560px) { .sheet { align-items: center; } .sheet-card { border-radius: 20px; } }
.sheet-card h2 { margin: 0 0 4px; }
.sheet-sum { margin: 0 0 14px; color: var(--muted); }
.sheet-card label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
.sheet-card input { display: block; width: 100%; margin-top: 5px; padding: 12px 14px; border: 1px solid #c9d4d0; border-radius: 12px; font: inherit; }
.sheet-card input:focus { outline: 2px solid rgba(15, 118, 110, .35); border-color: var(--brand); }
.sheet-actions { display: flex; gap: 8px; margin-top: 6px; }
.sheet-actions .btn.wa { flex: 1; }
.sheet-card .btn.block { margin-top: 8px; }
.sheet-card .center { text-align: center; margin: 12px 0 0; }
.small { font-size: .85rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cart .btn.wa.disabled { opacity: .45; cursor: not-allowed; }
.mis-numeros .reservado { background: #ede9fe; border-color: #ddd6fe; }
