:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7079;
  --line: #e8e8e4;
  --accent: #0e7a52;
  --accent-ink: #ffffff;
  --accent-soft: #e6f3ed;
  --warn: #c2410c;
  --warn-soft: #fdf0e8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --radius: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113;
    --card: #181b1f;
    --text: #eceef1;
    --muted: #9aa1aa;
    --line: #2a2e34;
    --accent: #3ccf91;
    --accent-ink: #062016;
    --accent-soft: #15302a;
    --warn: #fb923c;
    --warn-soft: #33210f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.nowrap { white-space: nowrap; }

/* Encabezado */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { white-space: nowrap; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.02rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .9rem; font-weight: 800;
}
.logo-dim { color: var(--muted); font-weight: 600; }
.vivo { white-space: nowrap; display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); font-weight: 500; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Portada */
.hero { padding: 36px 0 20px; }
.fecha { margin: 0 0 6px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.hero h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1.15; letter-spacing: -.025em; font-weight: 800; }
.sub { margin: 10px 0 0; color: var(--muted); max-width: 520px; }

/* Filtros */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.chip {
  font: inherit; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.chip:active { transform: scale(0.97); }
.chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Lista de cupones */
.lista { display: grid; gap: 12px; }
.cupon {
  display: grid;
  grid-template-columns: 132px 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: entrar 360ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }
.sin-animar .cupon { animation: none; }

/* Talón del cupón: el monto */
.talon {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 18px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  border-right: 2px dashed color-mix(in srgb, var(--accent) 30%, transparent);
}
.talon::before, .talon::after {
  content: ""; position: absolute; right: -9px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.talon::before { top: -9px; }
.talon::after { bottom: -9px; }
.monto { font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.monto-sufijo { margin-top: 4px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; }

.cuerpo { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cat { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.estado { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.estado-activo { color: var(--accent); background: var(--accent-soft); }
.estado-pocas { color: var(--warn); background: var(--warn-soft); }
.estado-proximamente, .estado-agotado { color: var(--muted); background: var(--bg); }

.condiciones { margin: 0; font-size: .9rem; color: var(--muted); }
.condiciones strong { color: var(--text); font-weight: 600; }
.nota { margin: 0; font-size: .8rem; color: var(--muted); }

.accion { display: flex; gap: 8px; align-items: stretch; }
.codigo {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  padding: 0 12px; height: 44px;
  border: 1.5px dashed var(--line); border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1rem; font-weight: 700; letter-spacing: .08em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.codigo.visto { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.btn {
  font: inherit; font-weight: 700; font-size: .92rem;
  height: 44px; padding: 0 18px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), filter 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.full { flex: 1; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { filter: brightness(1.07); }
  .chip:hover { border-color: var(--muted); }
}

.pie-cupon { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.vence.pronto { color: var(--warn); font-weight: 600; }
.ir { color: var(--muted); text-decoration: none; font-weight: 500; }
.ir:hover { color: var(--text); }

/* Agotados */
.agotados { margin-top: 36px; }
.agotados h2 { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 12px; }
.cupon.es-agotado { box-shadow: none; grid-template-columns: 100px 1fr; }
.es-agotado .talon { background: var(--bg); color: var(--muted); border-right-color: var(--line); }
.es-agotado .monto { font-size: 1.2rem; text-decoration: line-through; text-decoration-thickness: 2px; }
.es-agotado .cuerpo { padding: 12px 16px; gap: 6px; }
.es-agotado .codigo { height: 36px; color: var(--muted); font-size: .9rem; }

/* Esqueleto de carga */
.esqueleto { height: 150px; background: linear-gradient(90deg, var(--card), var(--bg), var(--card)); background-size: 200% 100%; animation: brillo 1.2s linear infinite; }
@keyframes brillo { to { background-position: -200% 0; } }

.vacio { text-align: center; color: var(--muted); padding: 40px 0; }

/* Pie */
.pie { margin-top: 56px; border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: .8rem; color: var(--muted); }
.pie p { margin: 0 0 8px; }

.pie a { color: inherit; }
.pie-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.pie-links a { color: var(--text); font-weight: 600; text-decoration: none; }
.pie-links a:hover { text-decoration: underline; }

/* Aviso de sitio independiente */
.aviso-top { background: var(--text); color: var(--bg); text-align: center; font-size: .78rem; font-weight: 500; padding: 7px 16px; }
.aviso-top a { color: inherit; font-weight: 700; }

/* Páginas legales */
.volver { font-size: .88rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.volver:hover { color: var(--text); }
.legal { padding-top: 32px; max-width: 680px; }
.legal h1 { font-size: clamp(1.6rem, 5vw, 2rem); letter-spacing: -.02em; margin: 0; }
.legal h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text); }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--accent); font-weight: 600; }
.legal code { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .9em; }
.actualizado { color: var(--muted) !important; font-size: .85rem; margin: 6px 0 20px; }

/* Aviso de copiado */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; white-space: nowrap;
  transition: transform 260ms var(--ease-out), opacity 200ms ease;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 520px) {
  .logo { font-size: .95rem; }
  .vivo .largo { display: none; }
  .hero { padding-top: 24px; }
  .cupon { grid-template-columns: 96px 1fr; }
  .cupon.es-agotado { grid-template-columns: 84px 1fr; }
  .monto { font-size: 1.3rem; }
  .cuerpo { padding: 14px; }
  .accion { flex-direction: column; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cupon { animation: none; }
  .esqueleto { animation: none; }
  .toast { transition: opacity 200ms ease; transform: translate(-50%, 0); }
}
