/* =====================================================================
   GIRA Y GANA CON FUXION — estilos (mobile-first)
   Colores principales editables en :root (coinciden con config.js)
   ===================================================================== */
:root {
  --turquoise: #7FCBC4;
  --light-blue: #8EC5E8;
  --yellow: #F8B93B;
  --pink: #F4A3C1;
  --purple: #B79BD1;
  --cream: #F1ECE6;
  --navy: #1F4FA3;
  --navy-dark: #0E2F6E;
  --ink: #17223A;
  --muted: #5B6478;
  --white: #ffffff;
  --wa: #25D366;
  --wa-dark: #1aa74f;
  --danger: #D33F49;
  --ok: #1E9E6A;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(14, 47, 110, .12);
  --font-display: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
  --font-script: 'Kaushan Script', 'Brush Script MT', cursive;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wheel-size: min(88vw, 420px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: #FBF9F6;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(127,203,196,.28) 0, transparent 22%),
    radial-gradient(circle at 92% 8%, rgba(248,185,59,.28) 0, transparent 20%),
    radial-gradient(circle at 90% 70%, rgba(244,163,193,.25) 0, transparent 22%),
    radial-gradient(circle at 10% 85%, rgba(183,155,209,.28) 0, transparent 22%),
    radial-gradient(circle at 50% 40%, rgba(142,197,232,.18) 0, transparent 30%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
}
/* detalles sutiles de celebración */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(rgba(31,79,163,.10) 1.5px, transparent 1.6px),
    radial-gradient(rgba(248,185,59,.18) 1.5px, transparent 1.6px);
  background-size: 34px 34px, 54px 54px;
  background-position: 0 0, 17px 27px;
  opacity: .55;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

.demo-badge {
  position: sticky; top: 0; z-index: 40;
  background: repeating-linear-gradient(135deg, #FFD54A 0 14px, #1F1F1F 14px 28px);
  padding: 3px;
  text-align: center;
  font-size: .78rem;
}
.demo-badge button { border: 1px solid rgba(255,255,255,.72); border-radius: 999px; padding: 5px 10px; color: #fff; background: rgba(255,255,255,.12); font: inherit; font-size: .75rem; font-weight: 800; cursor: pointer; }
.demo-badge button:hover, .demo-badge button:focus-visible { background: rgba(255,255,255,.24); outline: 2px solid #fff; outline-offset: 2px; }
.demo-badge strong, .demo-badge span { display: block; background: #1F1F1F; color: #FFD54A; padding: 4px 8px; letter-spacing: .04em; }
.demo-badge span { color: #fff; font-weight: 600; background: #333; }

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; padding: 18px 20px 6px; text-align: center; max-width: 720px; margin: 0 auto; }
.hero__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero__logo { width: 64px; height: 64px; border-radius: 50%; box-shadow: var(--shadow); background: #fff; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--navy); background: #fff; color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; font-weight: 800;
  box-shadow: var(--shadow);
}
.icon-btn:focus-visible, .btn:focus-visible, .link-btn:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
#soundToggle .icon-on { display: none; }
#soundToggle[aria-pressed="true"] .icon-on { display: block; }
#soundToggle[aria-pressed="true"] .icon-off { display: none; }
.hero__title {
  font-family: var(--font-display); font-weight: 400; letter-spacing: .02em;
  font-size: clamp(2.4rem, 11vw, 4.4rem); line-height: .95; margin: 14px 0 6px; color: var(--navy);
  text-shadow: 0 3px 0 #fff, 0 6px 18px rgba(31,79,163,.18);
}
.hero__title::after { content: ""; display: block; width: 110px; height: 6px; margin: 10px auto 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--turquoise), var(--yellow), var(--pink), var(--purple)); }
.hero__subtitle { font-size: 1.05rem; font-weight: 700; margin: 8px 0 2px; color: var(--ink); }
.hero__note { margin: 0; font-size: .92rem; color: var(--muted); font-weight: 600; }

/* ---------- Layout ---------- */
.main { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 12px 14px 30px; display: grid; gap: 18px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px 20px; border: 1px solid rgba(31,79,163,.08); }
.card__step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__step h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; letter-spacing: .03em; color: var(--navy-dark); }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 1rem; flex: 0 0 auto; }

/* ---------- Formulario ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 5px; }
.field b { color: var(--danger); }
.field em { color: var(--muted); font-style: normal; font-weight: 600; }
.field input {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 13px 14px; border-radius: 14px; border: 2px solid #D8DEEA; background: #FAFBFE; color: var(--ink);
}
.field input:focus { border-color: var(--navy); background: #fff; }
.field input[readonly] { background: #EEF3FB; border-style: dashed; }
.field input.is-invalid { border-color: var(--danger); }
#code { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: .92rem; line-height: 1.35; }
.check input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--navy); }
.check b { color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; color: var(--navy); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.form-error { color: var(--danger); font-weight: 700; background: #FDECEE; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.form-ok { color: var(--ok); font-weight: 800; background: #E7F7F0; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 0; border-radius: 999px; padding: 15px 20px; font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .06em;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { cursor: not-allowed; filter: grayscale(.4); opacity: .55; box-shadow: none; }
.btn--primary { background: linear-gradient(135deg, var(--navy), #2A6BD6); box-shadow: 0 8px 18px rgba(31,79,163,.35); }
.btn--spin { background: linear-gradient(135deg, #F7A81B, #F26A5B); box-shadow: 0 10px 24px rgba(242,106,91,.4); font-size: 1.7rem; margin-top: 12px; }
.btn--spin:not(:disabled) { animation: pulse 1.6s ease-in-out infinite; }
.btn--wa { background: var(--wa); box-shadow: 0 8px 18px rgba(37,211,102,.35); }
.btn--wa:hover { background: var(--wa-dark); }
.btn--ghost { background: #fff; color: var(--navy); border: 2px solid var(--navy); font-size: 1.25rem; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::after { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 10px 24px rgba(242,106,91,.4); } 50% { box-shadow: 0 10px 34px rgba(242,106,91,.7); transform: scale(1.015); } }

/* ---------- Ruleta ---------- */
.card--wheel { text-align: center; }
.wheel-wrap { position: relative; width: var(--wheel-size); height: var(--wheel-size); margin: 26px auto 10px; }
.wheel-glow {
  position: absolute; inset: -6%; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, var(--turquoise), var(--yellow), var(--pink), var(--purple), var(--light-blue), var(--turquoise));
  filter: blur(18px); opacity: .35; transition: opacity .4s;
}
.wheel-wrap.is-spinning .wheel-glow { opacity: .75; animation: glow 1.2s linear infinite; }
@keyframes glow { to { transform: rotate(360deg); } }
.wheel {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 8px #fff, 0 0 0 11px var(--navy), 0 18px 40px rgba(14,47,110,.28);
  will-change: transform; background: #fff;
}
.wheel svg { width: 100%; height: 100%; display: block; }
.wheel-center {
  position: absolute; left: 50%; top: 50%; width: 27%; height: 27%; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--navy), 0 8px 18px rgba(0,0,0,.25); overflow: hidden;
}
.wheel-center img { width: 100%; height: 100%; object-fit: cover; }
.pointer {
  position: absolute; left: 50%; top: -22px; transform: translateX(-50%); z-index: 5;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.3)); transform-origin: 50% 20%;
}
.wheel-wrap.is-spinning .pointer { animation: wobble .14s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: translateX(-50%) rotate(-6deg); } to { transform: translateX(-50%) rotate(6deg); } }
.wheel-segment-text { font-family: var(--font-display); font-size: 26px; letter-spacing: .02em; }
.wheel-segment-script { font-family: var(--font-script); font-size: 22px; }
.spin-status { min-height: 1.4em; margin: 6px 0 0; font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.spin-status.is-luck { font-family: var(--font-script); font-size: 1.6rem; color: #F26A5B; animation: bounce .8s ease-in-out infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }

/* ---------- Leyenda ---------- */
.legend ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.legend li { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 8px 10px; font-size: .85rem; font-weight: 700; box-shadow: 0 3px 10px rgba(14,47,110,.06); }
.legend .sw { width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto; border: 2px solid rgba(0,0,0,.08); }
.legend li.is-out { opacity: .5; text-decoration: line-through; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 10px 20px 40px; text-align: center; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.footer a { color: var(--navy); font-weight: 800; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 14px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(14,47,110,.55); backdrop-filter: blur(3px); }
.modal__panel {
  position: relative; width: 100%; max-width: 460px; max-height: calc(100dvh - 28px); overflow: auto;
  background: #fff; border-radius: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); padding: 18px 18px 16px;
  animation: pop .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result { text-align: center; }
.result__ribbon { font-family: var(--font-script); color: #F26A5B; font-size: 1.4rem; }
.result__title { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; line-height: 1; margin: 4px 0 6px; color: var(--navy); letter-spacing: .02em; }
.result__prize { font-size: 1.35rem; font-weight: 800; margin: 0 0 10px; color: var(--ink); }
.result__prize strong { color: #F26A5B; }
.result__img { height: 96px; display: grid; place-items: center; margin: 2px auto 8px; }
.result__img img { max-height: 96px; max-width: 260px; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0,0,0,.18)); }
.result__body { margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.result__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; text-align: left; }
.result__meta div { background: #F4F7FC; border-radius: 12px; padding: 8px 10px; }
.result__meta dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; }
.result__meta dd { margin: 2px 0 0; font-weight: 800; font-size: .95rem; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.05rem !important; color: var(--navy); letter-spacing: .06em; }
.result__deadline { font-size: .86rem; font-weight: 700; color: #8A5A00; background: #FFF4D6; border-radius: 12px; padding: 8px 10px; margin: 0 0 12px; }
.result__actions { display: grid; gap: 8px; }
.result--retry .result__meta, .result--retry .result__deadline, .result--retry #waBtn, .result--retry #receiptBtn { display: none; }
.rules__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -22px; background: #fff; padding: 4px 0 10px; }
.rules__head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 2rem; color: var(--navy); }
.rules__body h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 3px; }
.rules__body p { margin: 0; font-size: .95rem; line-height: 1.5; }

/* ---------- Tablet / escritorio ---------- */
@media (min-width: 720px) {
  :root { --wheel-size: 460px; }
  .main { max-width: 1080px; grid-template-columns: 1fr 1.15fr; align-items: start; }
  .legend { grid-column: 1 / -1; }
  .legend ul { grid-template-columns: repeat(4, 1fr); }
  .card { padding: 24px; }
  .hero { padding-top: 26px; }
  .hero__logo { width: 74px; height: 74px; }
}
@media (min-width: 1100px) { :root { --wheel-size: 520px; } }

/* ---------- Accesibilidad: reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn--spin:not(:disabled), .wheel-wrap.is-spinning .pointer, .wheel-wrap.is-spinning .wheel-glow, .spin-status.is-luck { animation: none; }
  .modal__panel { animation: none; }
  .btn, .btn:active { transition: none; transform: none; }
}
