/* ============================================================
   Estilos de la WebApp del aficionado — mobile-first.
   Los colores de marca llegan como variables desde config.js.
   ============================================================ */
:root {
  --brand: #d6281e;
  --brand-dark: #8f1712;
  --accent: #ffc832;
  --on-brand: #ffffff;
  --ink: #16181d;
  --ink-2: #565b66;
  --paper: #f7f7f5;
  --card: #ffffff;
  --line: #e3e2dc;
  --ok: #0c7a3e;
  --err: #c22525;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- splash ---------- */
#screen-splash {
  background: linear-gradient(165deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--on-brand);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 8px;
}
.splash-badge {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}
.splash-logo { width: 96px; height: 96px; margin: 18px auto 6px; }
.splash-logo svg { width: 100%; height: 100%; }
#screen-splash h1 { font-size: 34px; line-height: 1.1; }
.splash-tagline { font-size: 15px; opacity: 0.85; margin-bottom: 6px; }
.splash-prize {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 18px 0 6px;
  font-size: 15px;
  max-width: 340px;
}
.splash-prize strong { color: var(--accent); }
.match-line { font-size: 13px; opacity: 0.75; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 18px;
  border-radius: 999px;
  padding: 16px 40px;
  margin-top: 20px;
  transition: transform 0.08s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #201500; }
.btn-brand { background: var(--brand); color: var(--on-brand); }
.btn-ghost {
  background: transparent; color: var(--ink-2);
  font-weight: 500; font-size: 14px;
  text-decoration: underline;
  padding: 10px;
}
.hint { font-size: 13px; opacity: 0.7; margin-top: 10px; }

/* ---------- juego ---------- */
#screen-game { position: relative; background: #1e7a3c; }
#game-canvas {
  width: 100vw;
  height: 100dvh;
  display: block;
  touch-action: none;
}
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  pointer-events: none;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.hud .hud-score { font-size: 26px; }
.hud .hud-time { font-size: 20px; }
.hud .hud-lives { font-size: 18px; letter-spacing: 2px; color: #ff5a5a; }

/* ---------- resultado ---------- */
#screen-result, #screen-form, #screen-coupon {
  align-items: center;
  padding: 28px 22px 40px;
  gap: 4px;
}
.topbar {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 400px;
  color: var(--ink-2); font-size: 13px;
  margin-bottom: 18px;
}
.topbar .mini-logo { width: 28px; height: 28px; flex: 0 0 28px; }
.mini-logo svg { width: 100%; height: 100%; }

.score-big { font-size: 64px; font-weight: 800; line-height: 1; }
.score-label { font-size: 14px; color: var(--ink-2); margin-bottom: 14px; }

.banner {
  width: 100%; max-width: 400px;
  border-radius: 14px;
  padding: 16px 18px;
  text-align: center;
  font-size: 16px;
  margin: 8px 0;
}
.banner-ok { background: #e5f5eb; color: var(--ok); border: 1px solid #bfe5cd; }
.banner-ok strong { display: block; font-size: 19px; margin-bottom: 4px; }
.banner-miss { background: #fdf1e2; color: #8a5a12; border: 1px solid #f2ddba; }

.board {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 6px;
  margin: 10px 0;
}
.board h3 { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.board table { width: 100%; border-collapse: collapse; font-size: 15px; }
.board td { padding: 7px 4px; border-top: 1px solid var(--line); }
.board td:first-child { width: 42px; color: var(--ink-2); }
.board td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.board .board-you td { font-weight: 800; color: var(--brand); }

/* ---------- formulario ---------- */
form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; }
form h2 { font-size: 22px; margin-bottom: 2px; }
.form-sub { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
input[type="text"], input[type="email"] {
  font: inherit;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  width: 100%;
}
input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; line-height: 1.4;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.check input { width: 18px; height: 18px; margin-top: 1px; flex: 0 0 18px; accent-color: var(--brand); }
.check .req { color: var(--ink-2); font-size: 12px; display: block; }
.gdpr-note { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
#form-error { color: var(--err); font-size: 14px; font-weight: 600; }

/* cupón bloqueado (preview en el formulario) */
.coupon-locked {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--brand);
  color: var(--on-brand);
  padding: 18px 16px;
  text-align: center;
}
.coupon-locked .cl-inner { filter: blur(4px); opacity: 0.75; }
.coupon-locked .cl-title { font-size: 24px; font-weight: 800; }
.coupon-locked .cl-lock {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  background: rgba(0, 0, 0, 0.18);
}
.cl-caption {
  text-align: center; font-size: 13px; font-weight: 600;
  color: var(--ink-2); margin-top: -4px;
}

/* urgencia del sorteo */
.draw-note {
  width: 100%; max-width: 400px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-2);
}
.draw-note b { color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------- cupón ---------- */
.coupon {
  width: 100%; max-width: 400px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px dashed var(--brand);
  background: var(--card);
  text-align: center;
  margin: 14px 0;
}
.coupon-head {
  background: var(--brand);
  color: var(--on-brand);
  padding: 18px;
}
.coupon-head .coupon-title { font-size: 28px; font-weight: 800; }
.coupon-body { padding: 18px; }
.coupon-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0 6px;
}
.coupon-exp { font-size: 12px; color: var(--ink-2); }
.coupon-meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.footer-demo {
  margin-top: auto;
  padding-top: 26px;
  font-size: 11px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.6;
}
.footer-demo a { color: inherit; }
#qr-src {
  position: fixed; top: 8px; right: 10px;
  font-size: 10px; color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.25);
  padding: 2px 8px; border-radius: 999px;
}
