/* PWA del consumidor — móvil primero, ligera. Sin frameworks. */
:root {
  --brand: #0b8457;
  --brand-dark: #075c3c;
  --bg: #0f1115;
  --card: #181b22;
  --text: #f3f5f7;
  --muted: #9aa3ad;
  --accent: #ffd166;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* El atributo hidden debe ganar siempre, aunque la clase defina display propio
   (sin esto, .prize-code { display:flex } mostraba la caja de código a quien pierde). */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

#app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 420px;
  gap: 18px;
  animation: fade 0.35s ease;
}
.screen.active { display: flex; }

@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 800; }
.muted { color: var(--muted); font-size: 1rem; line-height: 1.4; }
.small { font-size: 0.85rem; }
.emoji { font-size: 4rem; }

.step {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.brand-badge {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 999px;
}

.btn {
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 16px 22px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.08s ease, opacity 0.2s ease, background 0.2s ease;
  color: var(--text);
}
.btn:active { transform: scale(0.97); }

.btn.primary { background: var(--brand); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.option {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}
.btn.option:active { background: var(--brand-dark); }

.options { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--card);
  padding: 14px;
  border-radius: var(--radius);
}
.consent input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }

/* Ruleta */
.wheel-wrap { position: relative; width: 300px; height: 300px; }
.wheel-pointer {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  color: var(--accent);
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
#wheel {
  width: 300px; height: 300px;
  transition: transform 4.5s cubic-bezier(0.17, 0.67, 0.21, 1);
  border-radius: 50%;
  box-shadow: 0 0 0 8px var(--card), 0 12px 40px rgba(0,0,0,0.5);
}

/* Resultado */
.prize-code {
  background: var(--card);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prize-code .code {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: var(--accent);
}

/* Logo de la marca patrocinadora (tema por campaña) */
.brand-logo {
  max-width: 140px;
  max-height: 72px;
  object-fit: contain;
  border-radius: 10px;
}

/* Canje en barra */
.redeem { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.redeemed-badge {
  background: #103b25;
  border: 2px solid #1faf66;
  color: #5ee5a0;
  border-radius: var(--radius);
  padding: 16px;
  width: 100%;
  font-size: 1.15rem;
  font-weight: 800;
}
.redeemed-badge span { display: block; margin-top: 4px; font-size: 0.85rem; font-weight: 500; color: #9ad9b9; }

/* Spinner */
.spinner {
  width: 42px; height: 42px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
