/* Luz de Luna — web de lealtad · misma dirección "Carta de día" que la web del
   menú (web/public/styles.css): crema de papel, negro para contrastes, hairlines
   doradas, serif Cormorant para marca/premios, sans Jost para controles. */
:root {
  --bg: #f1eadb;
  --surface: #faf5ea;
  --surface-2: #e8e0cc;
  --border: rgba(122, 98, 55, 0.32);
  --border-strong: rgba(122, 98, 55, 0.55);
  --ink: #1d1811;
  --ink-sec: #574f3e;
  --muted: #8b8168;
  --gold: #96742a;
  --gold-soft: rgba(150, 116, 42, 0.1);
  --champagne: #1d1811;
  --on-champagne: #f6f2e8;
  --ok: #3d7a32;
  --req: #b5453d;
  --font-ui: 'Jost', -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 3px 14px rgba(70, 52, 22, 0.1);
  --shadow-cta: 0 4px 16px rgba(29, 24, 17, 0.28);
  --maxw: 430px;
  color-scheme: light dark;
}
/* ── Modo oscuro (doc 86 D1): la misma «Carta de día» de noche — tinta, crema y
   oro claro, idéntica a la familia del pase y del strip (functions wallet/strip.ts
   PALETA.oscuro). Solo cambian los tokens; ningún componente sabe del tema. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1811;
    --surface: #262019;
    --surface-2: #322a20;
    --border: rgba(201, 162, 90, 0.28);
    --border-strong: rgba(201, 162, 90, 0.5);
    --ink: #f6f2e8;
    --ink-sec: #cfc4ac;
    --muted: #9d9179;
    --gold: #c9a25a;
    --gold-soft: rgba(201, 162, 90, 0.14);
    --champagne: #c9a25a;
    --on-champagne: #1d1811;
    --ok: #7fb573;
    --req: #d98079;
    --shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
    --shadow-cta: 0 4px 16px rgba(0, 0, 0, 0.45);
  }
  .spinner-inline { border-color: rgba(255, 255, 255, 0.22); border-top-color: currentColor; }
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-serif); background: var(--bg); color: var(--ink);
  font-size: 17.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; -webkit-tap-highlight-color: transparent; }

.vista { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.portada { min-height: 100vh; justify-content: center; padding-bottom: 8vh; }

/* ── Cabecera / marca ─────────────────────────────────────────────── */
.cabecera { text-align: center; padding: 12px 0 4px; }
.logo-luna { font-size: 34px; line-height: 1; }
.marca { font-family: var(--font-serif); font-weight: 600; font-size: 30px; letter-spacing: 0.5px; }
.sub {
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold); margin-top: 2px;
}

/* ── Tarjetas ─────────────────────────────────────────────────────── */
.tarjeta {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.hero { text-align: center; display: flex; flex-direction: column; gap: 14px; }
.hero-titulo { font-family: var(--font-serif); font-size: 26px; font-weight: 600; }
.hero-texto { color: var(--ink-sec); font-size: 16.5px; }
.pasos {
  font-family: var(--font-ui); font-size: 14.5px; color: var(--ink-sec);
  text-align: left; margin: 0 auto; padding-left: 24px; display: grid; gap: 4px;
}

/* ── Botones ──────────────────────────────────────────────────────── */
.boton-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-ui); font-weight: 600; font-size: 16px;
  background: #fff; color: #1f1f1f; border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 13px 22px; box-shadow: var(--shadow);
}
.boton-google:disabled { opacity: 0.6; }
.logo-g { width: 20px; height: 20px; }
.boton-principal {
  font-family: var(--font-ui); font-weight: 600; font-size: 16px;
  background: var(--champagne); color: var(--on-champagne);
  border-radius: 999px; padding: 13px 26px; box-shadow: var(--shadow-cta);
}
.boton-wallet {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  background: var(--champagne); color: var(--on-champagne);
  border-radius: 999px; padding: 12px 22px; box-shadow: var(--shadow-cta);
  margin: 6px auto 0;
}
.boton-wallet:disabled { opacity: 0.6; }
.logo-wallet { width: 20px; height: 20px; }
.enlace { font-family: var(--font-ui); font-size: 14px; color: var(--gold); text-decoration: underline; }
.volver { align-self: center; }

/* ── Saldo / progreso ─────────────────────────────────────────────── */
.saldo-card { text-align: center; }
.saludo { font-family: var(--font-ui); font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.saldo { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.saldo-grande { display: flex; align-items: baseline; gap: 8px; justify-content: center; line-height: 1; }
.saldo-numero { font-family: var(--font-serif); font-size: 64px; font-weight: 600; letter-spacing: -1px; }
.saldo-unidad {
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--gold);
}
.barra {
  width: 100%; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.barra-relleno {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, #c9a24f 100%);
  transition: width 0.6s ease;
}
/* ── Luna y camino (doc 86 §5 F5): el mismo dibujo que el strip del pase ── */
.saldo-fila { display: flex; align-items: center; justify-content: center; gap: 16px; }
.luna-saldo { width: 64px; height: 64px; flex: none; }
.luna-saldo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.camino { width: 100%; max-width: 320px; }
.camino svg { width: 100%; height: auto; display: block; overflow: visible; }
.saldo-texto { font-family: var(--font-ui); font-size: 15px; color: var(--ink-sec); }
.saldo-siguiente { font-family: var(--font-ui); font-size: 13px; color: var(--muted); margin-top: -6px; }
.vencimiento {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
  font-family: var(--font-ui); font-size: 12.5px; color: var(--muted);
}
.progreso.mini { width: 100%; max-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.progreso-meta { font-family: var(--font-ui); font-size: 12.5px; color: var(--muted); }
@keyframes pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ── Premios / historial ──────────────────────────────────────────── */
.seccion {
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--gold); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 10px;
}
.premio {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.premio:last-child { border-bottom: none; }
.premio-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.premio-nombre { font-family: var(--font-serif); font-size: 19px; font-weight: 600; line-height: 1.2; }
/* Estrellas de rango (☆ / ☆☆ / ☆☆☆): las mismas del camino; en oro cuando el saldo ya alcanza el premio. */
.premio-rango { font-family: var(--font-ui); font-size: 15px; letter-spacing: 1px; color: var(--muted); margin-right: 4px; }
.premio.alcanzable .premio-rango { color: var(--gold); }
.premio-desc { font-family: var(--font-ui); font-size: 13px; color: var(--ink-sec); }
.premio-costo { font-family: var(--font-ui); font-size: 13px; color: var(--gold); font-weight: 600; }
.premio-horario { color: var(--muted); font-weight: 400; }
.premio-motivo { font-family: var(--font-ui); font-size: 12.5px; color: var(--muted); font-style: italic; }
.boton-canjear {
  font-family: var(--font-ui); font-weight: 600; font-size: 14px;
  background: var(--champagne); color: var(--on-champagne);
  border-radius: 999px; padding: 9px 18px; flex-shrink: 0;
}
.boton-canjear:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.evento {
  display: flex; align-items: baseline; gap: 8px; font-family: var(--font-ui); font-size: 14.5px;
  padding: 7px 0; border-bottom: 1px dashed var(--border);
}
.evento:last-child { border-bottom: none; }
.evento-detalle { color: var(--muted); font-size: 13.5px; }
.evento-delta { margin-left: auto; font-weight: 600; color: var(--ink-sec); }
.evento-delta.pos { color: var(--ok); }
.evento-fecha { color: var(--muted); font-size: 13px; min-width: 52px; text-align: right; }

/* ── Claim / resultados ───────────────────────────────────────────── */
.resultado { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.resultado-icono { font-size: 52px; line-height: 1; }
.resultado-titulo { font-family: var(--font-serif); font-size: 28px; font-weight: 700; }
.resultado-detalle { color: var(--ink-sec); }
.celebrar .resultado-icono { animation: pop 0.5s ease; }
.error { color: var(--req); font-family: var(--font-ui); font-size: 14.5px; }

/* ── Canje / countdown ────────────────────────────────────────────── */
.canje { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.canje-etiqueta { font-family: var(--font-ui); font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold); }
.canje-premio { font-family: var(--font-serif); font-size: 26px; font-weight: 700; }
.canje-codigo {
  font-family: var(--font-ui); font-weight: 600; font-size: 34px; letter-spacing: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px 8px 20px;
}
@keyframes pulso { 50% { opacity: 0.55; } }
.canje-instruccion {
  font-family: var(--font-ui); font-size: 14px; color: var(--ink-sec);
  background: var(--gold-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 6px;
}
.consumir { width: 100%; }

/* Pantalla CONSUMIDO ✓ — verde, inconfundible (§2.1.5). Anclada arriba: el verde
   restante es fondo, no hueco. Reloj vivo + fecha + palomita latiendo = una captura
   no pasa por un canje vivo; a los 5 min se apaga a gris (.consumido-viejo). */
body.fondo-consumido { background: #2c5e24; transition: background 0.6s ease; }
body.fondo-consumido-viejo { background: #4a4a46; }
.consumido-fondo { min-height: 100vh; padding-top: 28px; justify-content: flex-start; }
.consumido {
  background: #e9f4e4; border-color: #3d7a32; text-align: center; display: flex;
  flex-direction: column; gap: 10px; align-items: center; transition: filter 0.6s ease;
}
.consumido-palomita { width: 84px; height: 84px; animation: latido 1.6s ease-in-out infinite; }
.consumido-palomita svg { width: 100%; height: 100%; display: block; }
.consumido-palomita circle { fill: var(--ok); }
.consumido-palomita path { fill: none; stroke: #e9f4e4; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes latido { 50% { transform: scale(1.08); } }
.consumido-titulo { font-family: var(--font-ui); font-size: 34px; letter-spacing: 6px; color: var(--ok); font-weight: 600; }
.consumido-hora { font-family: var(--font-ui); font-size: 18px; color: var(--ink-sec); }
.consumido-hace { font-family: var(--font-ui); font-size: 16px; font-weight: 600; color: var(--req); min-height: 0; }
.consumido-hace:empty { display: none; }
.consumido-ahora {
  width: 100%; border-top: 1px solid rgba(61, 122, 50, 0.35); padding-top: 10px; margin-top: 4px;
  display: grid; gap: 2px;
}
.consumido-fecha { font-family: var(--font-ui); font-size: 14px; letter-spacing: 1px; color: var(--ink-sec); }
.consumido-reloj {
  font-family: var(--font-ui); font-variant-numeric: tabular-nums; font-size: 40px;
  font-weight: 600; line-height: 1.1; color: var(--ok);
}
.consumido-franja {
  width: 100%; height: 6px; border-radius: 3px; overflow: hidden;
  background-color: rgba(61, 122, 50, 0.18);
  background-image: linear-gradient(90deg, transparent 0 30%, var(--ok) 50%, transparent 70% 100%);
  background-size: 200% 100%; animation: barrido 2.4s linear infinite;
}
@keyframes barrido { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.consumido-nota { color: var(--ink-sec); }
/* Ya no es un canje "de ahorita": se apaga, y la cajera lo nota de un vistazo. */
.consumido-viejo .consumido { filter: grayscale(1) opacity(0.85); }
.consumido-viejo .consumido-palomita, .consumido-viejo .consumido-franja { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .consumido-palomita, .consumido-franja { animation: none; }
}

/* Vigencia del canje: texto discreto bajo el botón, no un cronómetro protagonista. */
.canje-vigencia { font-family: var(--font-ui); font-size: 14px; color: var(--muted); }
.canje-vigencia.urgente { color: var(--req); font-weight: 600; animation: pulso 1s ease infinite; }
.cancelar-canje { color: var(--muted); margin-top: 4px; }

/* ── Varios ───────────────────────────────────────────────────────── */
.banner-canje {
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 500; text-align: left;
  background: var(--gold-soft); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink);
}
.pie-sesion {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-family: var(--font-ui); font-size: 13px; color: var(--muted); padding: 0 4px;
}
.pie-legal { font-family: var(--font-ui); font-size: 12px; color: var(--muted); text-align: center; padding: 0 8px; }
.pie-legal .enlace { font-size: 12px; }

/* ── Páginas legales (/privacidad, /terminos) ─────────────────────── */
.legal { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.legal h2 { font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.legal p, .legal li { font-size: 16px; color: var(--ink-sec); }
.legal strong { color: var(--ink); font-weight: 600; }
.legal ul { padding-left: 20px; display: grid; gap: 4px; }
.legal-version { font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.legal-nav { display: flex; justify-content: space-between; gap: 12px; padding: 0 4px; }
.cargando { text-align: center; padding: 38vh 20px; color: var(--muted); font-family: var(--font-ui); }

/* Señales de actividad (QA 2026-09-10): barra de red arriba mientras hay llamadas
   en vuelo; botón ocupado con spinner; vista pintada desde caché mientras refresca. */
#barra-red {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; pointer-events: none;
  background: linear-gradient(90deg, transparent 0 20%, var(--gold) 50%, transparent 80% 100%);
  background-size: 200% 100%; opacity: 0; transition: opacity 0.15s ease;
}
#barra-red.activa { opacity: 1; animation: barrido 1.2s linear infinite; }
.spinner-inline {
  display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
  border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.18); border-top-color: currentColor;
  animation: girar 0.8s linear infinite;
}
button.ocupado { opacity: 0.85; cursor: progress; }
.vista.refrescando .saldo-card { position: relative; }
.vista.refrescando .saldo-card::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: 6px; height: 2px; border-radius: 1px;
  background: linear-gradient(90deg, transparent 0 20%, var(--gold) 50%, transparent 80% 100%);
  background-size: 200% 100%; animation: barrido 1.2s linear infinite; opacity: 0.7;
}
.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--gold);
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ── Regalo de cumpleaños (doc 85) ────────────────────────────────── */
.cumple-card { display: flex; flex-direction: column; gap: 10px; }
.cumple-form { display: flex; flex-direction: column; gap: 10px; }
.cumple-form.compacto { text-align: left; }
.cumple-form.compacto .cumple-titulo { font-size: 18px; }
.cumple-titulo { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.cumple-texto { font-family: var(--font-ui); font-size: 14.5px; color: var(--ink-sec); }
.cumple-campos { display: flex; gap: 10px; align-items: center; }
.cumple-campos select {
  font: inherit; font-family: var(--font-ui); font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; flex: 1; min-width: 0; -webkit-appearance: none; appearance: none;
}
.cumple-campos select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.cumple-acciones { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cumple-ok { font-family: var(--font-ui); font-size: 14.5px; color: var(--ok); font-weight: 600; }
.premio.regalo { background: var(--gold-soft); border-radius: var(--radius-sm); padding: 12px; margin: 4px -12px; border-bottom: none; }
.premio-costo.gratis { color: var(--ok); }

/* ── Ruta de premios (doc 120): paradas con su costo en el círculo, unidas por una línea ── */
.ruta-paradas { list-style: none; margin: 4px 0 0; padding: 0; }
.parada { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }
.parada:last-child { padding-bottom: 4px; }
.parada:not(:last-child)::before {
  content: ''; position: absolute; left: 31px; top: 64px; bottom: 0; width: 3px;
  background: var(--border-strong); border-radius: 2px;
}
.parada-circulo {
  flex: 0 0 64px; height: 64px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid var(--gold); color: var(--gold); background: var(--surface);
}
.parada.ganada .parada-circulo, .parada.canjeada .parada-circulo { background: var(--gold); color: var(--on-champagne); }
.parada.canjeada .parada-circulo { opacity: 0.55; }
.parada-costo { font-family: var(--font-ui); font-size: 22px; font-weight: 600; line-height: 1; }
.parada-unidad { font-family: var(--font-ui); font-size: 11px; }
.parada-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 6px; flex: 1; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.parada:last-child .parada-info { border-bottom: none; }
.parada-nombre { font-family: var(--font-serif); font-size: 19px; font-weight: 600; line-height: 1.2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.parada-turno { font-family: var(--font-ui); font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-sec); }
.parada-turno.con-horario { background: var(--gold-soft); color: var(--gold); }
.parada-desc { font-family: var(--font-ui); font-size: 13.5px; color: var(--ink-sec); }
.parada-estado { font-family: var(--font-ui); font-size: 13px; color: var(--muted); }
.parada.ganada .parada-estado { color: var(--ok); font-weight: 600; }
.parada-accion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ruta-cierre { font-family: var(--font-ui); font-size: 13.5px; color: var(--ink-sec); margin-top: 10px; }
