:root {
  --wine: #6B1E36; --wine-d: #521628; --pink: #F8C9D6; --pink-d: #E58FAA; --mauve: #A8587A;
  --gold: #D9A94A; --cream: #FFF8EE; --bg: #FDF5EC; --ink: #3A2A2C; --muted: #7A6468;
  --ok: #2F7D4F; --ok-bg: #DDF1E4; --warn: #B7791F;
  --radius: 22px;
  --hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --fun: 'Chewy', 'Patrick Hand', cursive;
  --num: 'Fredoka', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--hand); font-size: 20px; line-height: 1.35;
  background: radial-gradient(ellipse at 50% 0%, #FFFDF9 0%, var(--bg) 55%, #F8E9DE 100%) fixed;
  padding-bottom: 96px; overflow-x: hidden;
}
main, .hero-head, .foot { max-width: 560px; margin: 0 auto; padding: 0 16px; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }

/* Estrellas colgantes */
.stars { position: absolute; inset: 0 0 auto 0; height: 160px; pointer-events: none; }
.stars span { position: absolute; left: var(--x); top: 0; width: 2px; height: var(--l); background: var(--gold); opacity: .8; }
.stars .s1 { --x: 6%; --l: 90px; --s: 34px; }
.stars .s2 { --x: 16%; --l: 44px; --s: 22px; }
.stars .s3 { --x: 84%; --l: 60px; --s: 24px; }
.stars .s4 { --x: 93%; --l: 120px; --s: 36px; }
.stars span::after {
  content: '★'; position: absolute; left: 50%; top: 100%; transform: translate(-50%, -35%);
  color: var(--gold); font-size: var(--s); line-height: 1;
}

.hero-head { text-align: center; padding-top: 36px; position: relative; }
.eyebrow { font-family: var(--fun); color: var(--mauve); font-size: 28px; margin: 0; letter-spacing: .04em; }
h1 {
  font-family: var(--fun); font-weight: 400; color: var(--wine); margin: 0; line-height: .95;
  font-size: clamp(64px, 19vw, 110px); letter-spacing: .02em; text-shadow: 0 4px 0 rgba(229,143,170,.45);
}
.sub { color: var(--mauve); font-size: 22px; margin: 6px 0 18px; }

/* Premio */
.prize { position: relative; }
.frame { margin: 0; border: 3px dashed var(--gold); border-radius: 40px; padding: 9px; background: rgba(255,255,255,.55); }
.frame img { border-radius: 32px; width: 100%; aspect-ratio: 4 / 4.4; object-fit: cover; object-position: 46% 55%; }
.tag {
  position: absolute; right: -6px; bottom: -26px; width: 128px; height: 128px; border-radius: 50%;
  background: var(--cream); border: 5px dotted var(--gold); box-shadow: 0 0 0 6px var(--cream), 0 14px 24px -10px rgba(107,30,54,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-8deg);
}
.tag strong { font-family: var(--fun); font-weight: 400; color: var(--wine); font-size: 32px; line-height: 1; }
.tag span { font-family: var(--fun); color: var(--pink-d); font-size: 19px; }

.draw { text-align: center; margin: 40px 0 10px; }
.date { font-family: var(--fun); color: var(--wine); font-size: 34px; margin: 0; }
.rule { margin: 2px 0 0; font-size: 20px; }

.winner {
  margin: 18px 0; padding: 18px; border-radius: var(--radius); text-align: center; color: #fff;
  background: linear-gradient(135deg, var(--wine), var(--mauve)); box-shadow: 0 14px 30px -14px rgba(107,30,54,.7);
}
.winner b { font-family: var(--num); font-size: 54px; display: block; line-height: 1.1; }

/* Tablero */
.board { margin-top: 22px; }
h2 { font-family: var(--fun); font-weight: 400; color: var(--mauve); text-align: center; font-size: 30px; margin: 10px 0; }
.legend { list-style: none; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 0; margin: 0 0 12px; font-size: 18px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend b { font-family: var(--num); font-weight: 600; color: var(--wine); }
.dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 2.5px solid var(--wine); }
.dot.libre { background: var(--pink); }
.dot.apartado { background: #FCE7B6; border-color: var(--warn); }
.dot.pagado { background: var(--wine); }

.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.num {
  aspect-ratio: 1; border-radius: 50%; border: 2.5px solid var(--wine); background: var(--pink); color: var(--wine);
  font-family: var(--num); font-weight: 700; font-size: clamp(13px, 3.6vw, 18px); padding: 0;
  display: flex; align-items: center; justify-content: center; transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.num:hover:not(:disabled) { transform: scale(1.08); }
.num:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.num.sel { background: var(--gold); border-color: var(--wine-d); color: #fff; transform: scale(1.1); box-shadow: 0 6px 12px -6px rgba(107,30,54,.7); }
.num.apartado { background: #FCE7B6; border-color: var(--warn); color: #8A5A12; cursor: not-allowed; }
.num.pagado { background: var(--wine); color: #fff; cursor: not-allowed; }
.num.win { box-shadow: 0 0 0 4px var(--gold); }
.hint { text-align: center; color: var(--muted); font-size: 18px; margin: 10px 0 0; }

/* Pagos */
.pay { margin-top: 26px; }
.pay-list { display: grid; gap: 10px; }
.pay-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--wine); color: #fff;
  border-radius: 999px; padding: 10px 10px 10px 22px; box-shadow: 0 7px 0 -2px rgba(229,143,170,.6);
}
.pay-item small { font-family: var(--fun); color: var(--pink); font-size: 20px; margin-right: 8px; }
.pay-item b { font-family: var(--num); font-weight: 700; font-size: 21px; letter-spacing: .04em; }
.copy { background: var(--cream); color: var(--wine); border: 0; border-radius: 999px; padding: 6px 14px; font-size: 17px; flex-shrink: 0; }

.foot { text-align: center; margin-top: 30px; color: var(--muted); font-size: 17px; }
.foot img { margin: 0 auto 4px; width: 110px; }

/* Barra inferior */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 560px) / 2 + 16px)); background: rgba(255,248,238,.96); backdrop-filter: blur(6px);
  border-top: 2px dashed var(--gold); font-size: 19px;
}
.bar[hidden] { display: none; }
.btn { background: var(--wine); color: #fff; border: 0; border-radius: 999px; padding: 12px 24px; font-family: var(--fun); font-size: 22px; letter-spacing: .03em; }
.btn:hover { background: var(--wine-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--wine); border: 2px solid var(--wine); }

/* Diálogo */
dialog { border: 0; border-radius: 28px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--cream); color: var(--ink); }
dialog::backdrop { background: rgba(58,42,44,.55); }
dialog h3 { font-family: var(--fun); font-weight: 400; color: var(--wine); font-size: 30px; margin: 0 0 6px; text-align: center; }
.picked { text-align: center; font-family: var(--num); color: var(--wine); font-weight: 600; margin: 0 0 12px; }
form label { display: block; margin-bottom: 12px; font-size: 19px; }
form input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 4px; padding: 12px 14px; font: 500 18px var(--num); color: var(--ink);
  border: 2px solid var(--pink-d); border-radius: 14px; background: #fff;
}
form input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.check { display: flex !important; gap: 10px; align-items: flex-start; font-size: 16px !important; color: var(--muted); }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--wine); flex-shrink: 0; }
.hp { position: absolute !important; left: -9999px; }
.error { color: #B3262F; min-height: 1.2em; margin: 4px 0 8px; font-size: 17px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; }
.done { text-align: center; }
.done .big { font-family: var(--num); font-weight: 700; color: var(--wine); font-size: 26px; margin: 4px 0; }
.done .pay-list { margin: 12px 0; text-align: left; }
.pay-item b { white-space: nowrap; }
.done .pay-item { padding-left: 16px; }
.done .pay-item small { font-size: 18px; margin-right: 6px; }
.done .pay-item b { font-size: 18px; letter-spacing: .02em; }
.done .wa { display: inline-block; margin: 8px 0 14px; color: var(--ok); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 17px; z-index: 20;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
