:root {
  --brand-pink: #e6379a;
  --brand-pink-dark: #a01566;
  --brand-gold: #f5b301;
  --font-display: "Pacifico", "Comic Sans MS", cursive;
  --bg: #fdf2f8;
  --text: #1f2430;
  --muted: #6b7280;
  --error: #d64545;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    linear-gradient(rgba(60, 20, 60, 0.25), rgba(40, 15, 55, 0.4)),
    url("candy-bg.png") center / cover no-repeat fixed,
    #2a1030;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--text);
}

.card {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: 0 0 40px rgba(230, 55, 154, 0.35), 0 20px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.brand { margin-bottom: 28px; }
.logo { font-size: 44px; line-height: 1; }
.brand h1 {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 0.5px;
  color: var(--brand-pink);
  margin-top: 6px;
}
.subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }

form { text-align: left; display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 10px; }
input {
  padding: 12px 14px;
  border: 1.5px solid #f0d5e6;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--brand-pink); }

button {
  margin-top: 22px;
  padding: 13px;
  background: var(--brand-pink);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--brand-pink-dark); }
button:active { transform: scale(0.98); }

.error {
  background: #fdecec;
  color: var(--error);
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
}

.footer-note { margin-top: 24px; font-size: 12px; color: var(--muted); }

/* Pantalla de éxito */
#success-screen .confetti { font-size: 52px; animation: pop 0.5s ease; }
#success-screen h1 { font-family: var(--font-display); color: var(--brand-pink); margin: 14px 0 8px; }
.reward { font-size: 17px; color: var(--text); margin-bottom: 24px; }

/* Coffee ticket / voucher */
.ticket {
  position: relative;
  background: #fff8fb;
  border: 2px dashed var(--brand-pink);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 8px 0 20px;
  text-align: center;
  animation: pop 0.5s ease;
  box-shadow: 0 10px 30px rgba(230, 55, 154, 0.2);
}
/* Punched notches on each side, colored like the card behind them */
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(-50%);
}
.ticket::before { left: -13px; }
.ticket::after { right: -13px; }

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px dashed #f0c6dd;
}
.ticket-icon { font-size: 24px; }
.ticket-title { font-size: 14px; font-weight: 800; letter-spacing: 1.5px; color: var(--brand-pink); }

.ticket-body { padding: 14px 0 6px; }
.ticket-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.ticket-number {
  display: block;
  font-family: "Courier New", monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--brand-pink-dark);
  margin-top: 2px;
  word-break: break-all;
}

.ticket-footer { padding-top: 6px; }
.barcode {
  display: block;
  width: 75%;
  height: 34px;
  margin: 0 auto 8px;
  background: repeating-linear-gradient(
    90deg,
    #2a2a2a 0, #2a2a2a 2px,
    transparent 2px, transparent 4px,
    #2a2a2a 4px, #2a2a2a 7px,
    transparent 7px, transparent 9px
  );
}
.ticket-note { font-size: 11px; color: var(--muted); }

.badge-caption { font-size: 13px; color: var(--muted); }

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

/* background-attachment: fixed breaks iOS Safari — switch to scroll on touch devices */
@media (hover: none) and (pointer: coarse) {
  body {
    background:
      linear-gradient(rgba(60, 20, 60, 0.25), rgba(40, 15, 55, 0.4)),
      url("candy-bg.png") center / cover no-repeat scroll,
      #2a1030;
  }
}
