:root {
  --navy: #0b1a3a;
  --navy-2: #13285a;
  --blue: #223971;
  --red: #db0a40;
  --red-dark: #b0062f;
  --yellow: #ffc906;
  --silver: #e9edf3;
  --white: #ffffff;
  --muted: #9fb0d3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--white);
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: var(--navy);
  background-image:
    radial-gradient(circle at 50% -10%, var(--navy-2) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, var(--navy-2) 0%, transparent 55%),
    repeating-linear-gradient(135deg, var(--navy-2) 0 1px, transparent 1px 24px);
}

/* ---------- Header ---------- */

.top {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--silver), var(--white));
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.top img {
  height: 44px;
  width: auto;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.machine {
  padding: 20px 16px;
}

/* ---------- Typography ---------- */

h1,
h2,
.title {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

h2 {
  font-size: 1.6rem;
}

.accent {
  color: var(--yellow);
}

.red {
  color: var(--red);
}

p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

/* ---------- Card ---------- */

.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 22px;
}

/* ---------- Buttons ---------- */

.btn {
  display: block;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: var(--white);
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  font-size: 1.25rem;
  letter-spacing: 1px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.btn:hover {
  background: var(--red-dark);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.yellow {
  background: var(--yellow);
  color: var(--navy);
}

.btn.ghost {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: var(--white);
}

.btn.small {
  width: auto;
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.95rem;
}

/* ---------- Inputs ---------- */

.input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
}

.input:focus {
  outline: none;
  border-color: var(--yellow);
}

/* ---------- Helpers ---------- */

.stack > * + * {
  margin-top: 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  margin: 18px 0;
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.gbtn {
  min-height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: var(--silver);
}

.err {
  background: rgba(219, 10, 64, 0.15);
  border: 1px solid var(--red);
  color: #ffd0dc;
  padding: 12px 14px;
  border-radius: 10px;
}

.hidden {
  display: none !important;
}

/* ---------- QR code ---------- */

.qr {
  background: var(--white);
  padding: 18px;
  border-radius: 18px;
  width: min(70vw, 380px);
  aspect-ratio: 1;
  margin: 0 auto;
  box-shadow: 0 0 0 6px var(--yellow), 0 20px 60px rgba(0, 0, 0, 0.5);
}

.qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Machine illustration ---------- */

.can-slot {
  height: 18px;
  width: 220px;
  margin: 24px auto;
  border-radius: 9px;
  background: #050b1a;
  box-shadow: inset 0 4px 10px #000, 0 0 0 4px var(--silver);
}

/* ---------- Points / burst ---------- */

.points {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(4rem, 18vw, 8rem);
  color: var(--yellow);
  line-height: 0.9;
  text-align: center;
}

.plus {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(3rem, 14vw, 6rem);
  color: var(--yellow);
  line-height: 1;
  animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes pop {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.burst {
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: 30px 0;
}

.burst::before {
  content: "";
  position: absolute;
  inset: -40px;
  z-index: -1;
  background: radial-gradient(circle, rgba(255, 201, 6, 0.35), transparent 60%);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

/* ---------- Steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 44px;
  margin: 14px 0;
  font-size: 1.1rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Footer ---------- */

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 20px 16px;
}

/* ---------- Desktop / tablet landscape ---------- */

@media (min-width: 900px) {
  .top img {
    height: 60px;
  }

  .machine {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 48px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    align-items: center;
    min-height: calc(100dvh - 90px);
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- iPad de la máquina: dato, ranking y ticket ---------- */

.fact {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 22px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--yellow);
  background: rgba(255, 201, 6, 0.08);
  border-radius: 0 12px 12px 0;
}
.fact p { margin: 0; }
.fact-icon { font-size: 1.8rem; line-height: 1; }

.rank ol { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.rank li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  counter-increment: r;
}
.rank li:not(.muted)::before { content: counter(r) "."; color: var(--muted); width: 1.5em; }
.rank li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li:last-child { border-bottom: 0; }

.ticket {
  width: min(78vw, 320px);
  margin: 18px auto 0;
  padding: 18px 18px 22px;
  background: #fdfdfb;
  color: #111;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  text-align: left;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  /* borde de papel rasgado abajo */
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 16px 8px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 16px 8px repeat-x;
  animation: print 0.9s ease-out both;
}
.ticket .qr { width: 100%; padding: 6px; box-shadow: none; border-radius: 0; margin: 12px 0; }
.ticket-head, .ticket-foot { text-align: center; font-weight: 700; letter-spacing: 1px; }
.ticket-head { padding-bottom: 8px; border-bottom: 2px dashed #bbb; }
.ticket-foot { padding-top: 10px; margin-top: 8px; border-top: 2px dashed #bbb; }
.ticket-big { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.ticket-row { display: flex; justify-content: space-between; gap: 8px; }
@keyframes print { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Recompensas (teléfono) ---------- */

.rewards { list-style: none; padding: 0; margin: 0; }
.reward {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}
.reward.ready { border-style: solid; border-color: var(--yellow); background: rgba(255, 201, 6, 0.07); }
.reward-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}
.reward-body { flex: 1; min-width: 0; }
.reward-name { font-weight: 600; line-height: 1.2; }
.reward-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.reward.ready .reward-meta { color: var(--yellow); }
.reward .btn.small { flex: none; padding: 8px 10px; font-size: 0.85rem; }
.bar { height: 6px; margin-top: 8px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--yellow); border-radius: 3px; }

/* ---------- QR fijo "Ve tus puntos" ---------- */

.mypoints { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.mypoints h2 { margin-bottom: 6px; }
.mypoints p { margin: 0; }
.qr.small-qr {
  flex: none;
  width: 130px;
  padding: 10px;
  margin: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 4px var(--yellow);
}
