:root {
  --ink: #0b2f2e; --ink-2: #14403e; --paper: #eef3f1; --card: #ffffff;
  --teal: #0b7a75; --teal-dark: #085c58; --stamp: #d6336c; --mango: #ffc857;
  --line: #cfdcd8; --muted: #4d6664; --danger: #b3261e; --ok: #12805c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); overflow-x: hidden;
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botones y campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--teal); color: #fff; font-weight: 700; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--teal-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { display: flex; width: 100%; }
.btn.stamp { background: var(--stamp); }
.btn.stamp:hover { background: #b82a5b; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: rgba(11,47,46,.06); }
.btn.danger { background: var(--danger); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 10px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-weight: 700; font-size: .9rem; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; font-size: 16px;
}
.input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(11,122,117,.2); }
.msg { padding: 12px 14px; border-radius: 12px; font-weight: 600; background: #e5eeec; }
.msg.err { background: #fbe4e2; color: #7d1710; }
.msg.ok { background: #dff3ea; color: #0b5a40; }

/* Tarjeta del cliente */
.ticket {
  position: relative; background: var(--ink); color: #fff; border-radius: 24px; padding: 22px 20px 20px;
  box-shadow: 0 10px 30px rgba(11,47,46,.25); overflow: hidden;
}
.ticket h1 { font-size: 1.7rem; font-weight: 800; overflow-wrap: anywhere; }
.ticket .who { color: #a9cbc7; margin-top: 4px; overflow-wrap: anywhere; }
.prize {
  margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--ink-2);
  display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
}
.prize b { font-size: 1.1rem; overflow-wrap: anywhere; }
.prize span { color: #a9cbc7; font-size: .875rem; white-space: nowrap; }
.perf { position: relative; margin: 20px -20px; border-top: 2px dashed rgba(255,255,255,.25); }
.perf::before, .perf::after {
  content: ""; position: absolute; top: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper);
}
.perf::before { left: -12px; } .perf::after { right: -12px; }
.stamps { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; }
.stamp-slot {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 800; min-width: 0;
  border: 2px dashed rgba(255,255,255,.3); color: rgba(255,255,255,.5); font-size: 1.1rem;
}
.stamp-slot.full {
  border: 0; color: #fff; font-size: 1.6rem; transform: rotate(var(--r, 0deg));
  background: radial-gradient(circle at 35% 30%, #ea5a8d, var(--stamp) 60%);
  box-shadow: inset 0 0 0 3px var(--stamp), inset 0 0 0 5px rgba(255,255,255,.88);
}
.stamp-slot.fresh { animation: stamp-in .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes stamp-in { from { transform: rotate(var(--r, 0deg)) scale(1.9); opacity: 0; } to { transform: rotate(var(--r, 0deg)) scale(1); opacity: 1; } }
.progress { margin-top: 16px; display: flex; justify-content: space-between; color: #a9cbc7; font-size: .95rem; }
.progress b { color: #fff; }

.card-block { margin-top: 16px; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 var(--line); }
.card-block h2 { font-size: 1.05rem; margin-bottom: 10px; }
.reward-ready {
  margin-top: 16px; padding: 16px; border-radius: var(--radius); background: var(--mango); color: #3b2a00;
}
.reward-ready h2 { font-size: 1.15rem; }
.reward-ready p { margin-top: 4px; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .tag { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e5eeec; white-space: nowrap; align-self: start; }
.list .tag.done { background: #dff3ea; color: #0b5a40; }
.manual { display: flex; gap: 8px; margin-top: 10px; }
.manual .input { letter-spacing: .25em; font-weight: 700; text-align: center; }
.manual .btn { flex: none; }
.feedback { margin-top: 16px; padding: 16px; border-radius: var(--radius); background: #dff3ea; color: #0b5a40; }
.feedback.err { background: #fbe4e2; color: #7d1710; }
.feedback h2 { font-size: 1.1rem; }
.feedback p { margin-top: 4px; }

/* Escáner */
.scanner { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .bar { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; color: #fff; background: linear-gradient(#000a, transparent); }
.scanner .frame {
  position: relative; z-index: 1; margin: auto; width: min(70vw, 300px); aspect-ratio: 1; border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); border: 3px solid var(--mango);
}
.scanner .hint { position: relative; z-index: 2; padding: 18px 20px 28px; text-align: center; color: #fff; background: linear-gradient(transparent, #000a); }

.page-center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.status-card { width: 100%; max-width: 420px; text-align: center; background: var(--card); border-radius: 22px; padding: 28px 22px; box-shadow: 0 10px 30px rgba(11,47,46,.12); }
.status-card .big { font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.status-card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.status-card .btn { margin-top: 18px; }

@media (prefers-reduced-motion: reduce) { .stamp-slot.fresh { animation: none; } }
.btn.ghost.light { color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.btn.ghost.light:hover { background: rgba(255,255,255,.12); }
.mt { margin-top: 16px; }
.center { text-align: center; }
.card-block + .btn, .btn + .small { margin-top: 16px; }
.wrap > .small.center { margin-top: 16px; }
