:root {
  --wine: #6b1d33;
  --wine-dark: #4a1424;
  --wine-soft: #f6e9ec;
  --gold: #c9a45c;
  --ink: #241a1d;
  --muted: #6f6266;
  --line: #eadfe2;
  --bg: #faf6f3;
  --card: #ffffff;
  --ok: #2f7d4f;
  --ok-soft: #e4f3ea;
  --warn: #a86a00;
  --warn-soft: #fbf0dc;
  --error: #b3261e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(74, 20, 36, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 .5rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }
small { color: var(--muted); font-size: .82rem; }
.muted { color: var(--muted); margin: 0 0 1rem; }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; word-break: break-all; }
[hidden] { display: none !important; }

/* Hero */
.hero {
  background: radial-gradient(120% 120% at 0% 0%, #8a2a45 0%, var(--wine-dark) 60%, #2b0b15 100%);
  color: #fff;
  padding: calc(28px + env(safe-area-inset-top)) 20px 64px;
  text-align: center;
}
.hero__kicker { text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; color: var(--gold); margin: 0 0 .25rem; }
.hero__title { font-size: 2.3rem; margin: 0; }
.hero__meta { margin: .5rem 0 0; opacity: .85; font-size: .92rem; }
.dot { margin: 0 .4rem; }

/* Card */
.card {
  background: var(--card);
  margin: -40px 12px 0;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px 18px 24px;
  max-width: 520px;
}
@media (min-width: 560px) { .card { margin: -40px auto 0; padding: 28px; } }

/* Progress */
.progress { display: flex; gap: 6px; list-style: none; margin: 0 0 20px; padding: 0; counter-reset: s; }
.progress li {
  flex: 1; font-size: .72rem; color: var(--muted); text-align: center;
  padding-top: 10px; border-top: 4px solid var(--line); border-radius: 2px;
  transition: border-color .3s, color .3s;
}
.progress li.is-active { border-color: var(--wine); color: var(--wine); font-weight: 600; }
.progress li.is-done { border-color: var(--gold); }

.step { animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Qty */
.qty { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 12px 0 4px; }
.qty__btn {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--wine);
  background: #fff; color: var(--wine); font-size: 1.8rem; line-height: 1; cursor: pointer;
  touch-action: manipulation;
}
.qty__btn:active { background: var(--wine-soft); }
.qty__btn:disabled { opacity: .3; }
.qty__value { font-family: Fraunces, serif; font-size: 3rem; min-width: 64px; text-align: center; }
.total {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--wine-soft); border-radius: 12px; padding: 12px 16px; margin: 8px 0 0;
}
.total strong { font-size: 1.4rem; color: var(--wine-dark); }

/* Forms */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 16px; /* evita zoom en iOS */
  padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
.field input:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(107, 29, 51, .12); }
.field input.is-invalid { border-color: var(--error); }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 10px; }
.person { border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 0; margin-bottom: 12px; }
.person__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--wine); font-weight: 600; margin: 0 0 8px; }
.field--sub { margin: 10px 0 0; }

/* Preguntas sí/no de cada entrada (botones segmentados) */
.q { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.q__label { font-weight: 500; font-size: .9rem; padding: 0; margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center; height: 100%;
  min-height: 46px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: .9rem; line-height: 1.25; cursor: pointer; background: #fff; touch-action: manipulation;
}
.seg input:checked + span { border-color: var(--wine); background: var(--wine-soft); color: var(--wine-dark); font-weight: 600; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(107, 29, 51, .2); }
.error { color: var(--error); font-size: .9rem; min-height: 0; margin: 4px 0 10px; }
.error:empty { margin: 0; }

/* Buttons */
.btn {
  display: block; width: 100%; font: inherit; font-weight: 600; font-size: 1.02rem;
  padding: 15px 18px; border-radius: 14px; border: 0; cursor: pointer; margin-top: 10px;
  touch-action: manipulation;
}
.btn--primary { background: var(--wine); color: #fff; }
.btn--primary:active { background: var(--wine-dark); }
.btn--primary:disabled { background: #c9b6bb; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--wine); border: 1.5px solid var(--line); }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
.back { background: none; border: 0; color: var(--muted); font: inherit; padding: 0 0 12px; cursor: pointer; }

/* Payment options */
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 16px;
  margin: 0 0 12px; font: inherit; color: inherit; cursor: pointer;
}
.option:active, .option:hover { border-color: var(--wine); background: #fffafb; }
.option__icon { font-size: 1.7rem; }
.option__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.option__chev { font-size: 1.6rem; color: var(--muted); }
.option:disabled { cursor: wait; }
.option:disabled:not(.is-loading) { opacity: .55; }
/* Mientras se crea la orden, la flecha pasa a ser un spinner */
.option.is-loading { border-color: var(--wine); }
.option.is-loading .option__chev {
  font-size: 0; width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
  border: 2.5px solid var(--wine-soft); border-top-color: var(--wine); animation: spin .8s linear infinite;
}

/* Transfer box */
.pay-box { border: 1.5px dashed var(--gold); border-radius: var(--radius); padding: 4px 14px; background: #fffdf8; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-row small { display: block; }
.big { font-size: 1.5rem; color: var(--wine-dark); }
.copy {
  flex-shrink: 0; border: 1.5px solid var(--wine); color: var(--wine); background: #fff;
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.copy.is-copied { background: var(--ok); border-color: var(--ok); color: #fff; }
.howto { padding-left: 1.2rem; color: var(--muted); font-size: .93rem; margin: 16px 0; }
.howto li { margin-bottom: 4px; }

.upload {
  display: flex; align-items: center; gap: 14px; border: 2px dashed var(--wine); border-radius: var(--radius);
  padding: 18px; cursor: pointer; background: var(--wine-soft);
}
.upload__icon { font-size: 1.8rem; }
.upload__text { font-weight: 600; color: var(--wine-dark); }
.preview { margin-top: 12px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.preview img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #f3eeee; }
.preview .file { padding: 14px; display: flex; gap: 10px; align-items: center; }

/* States */
.spinner {
  width: 48px; height: 48px; margin: 24px auto 16px; border-radius: 50%;
  border: 4px solid var(--wine-soft); border-top-color: var(--wine); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 8px auto 14px; display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 700;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin: 0 0 8px; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }

.ticket { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; margin: 16px 0; position: relative; }
.ticket__row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ticket__people { list-style: none; padding: 4px 0; margin: 0; }
.ticket__people li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px dashed var(--line); }
.ticket__people li:last-child { border-bottom: 0; }
.ticket__people li::before { content: "🍷"; position: absolute; left: 0; top: 8px; }
.ticket__people strong, .ticket__people small { display: block; }

/* Link para volver a la confirmación */
.linkbox { border: 1.5px dashed var(--gold); border-radius: var(--radius); background: #fffdf8; padding: 12px 14px; margin: 14px 0 4px; }
.linkbox > small { display: block; margin-bottom: 8px; }
.linkbox__row { display: flex; align-items: center; gap: 10px; }
.linkbox__url { flex: 1; min-width: 0; font-size: .78rem; color: var(--wine-dark); max-height: 3.6em; overflow: hidden; }

/* Bottom sheet */
.sheet {
  position: fixed; inset: 0; background: rgba(36, 10, 18, .55); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet__panel {
  background: #fff; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet__grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@media (min-width: 560px) {
  .sheet { align-items: center; }
  .sheet__panel { border-radius: 22px; padding: 24px; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; z-index: 30;
}
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 16px 32px; }
.demo-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .8rem; padding: 6px; }
a.btn { text-decoration: none; text-align: center; }
