:root {
  --bg: #0d0e11;
  --surface: #15171c;
  --surface-2: #1d2027;
  --text: #f7f7f5;
  --muted: #9fa4ad;
  --accent: #f0d21c;
  --accent-text: #101114;
  --border: rgba(255,255,255,.09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.modal-open { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  background: rgba(13,14,17,.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 8px; align-items: center; color: white; text-decoration: none; font-weight: 900; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-size: 13px; letter-spacing: -.05em; }
.ranking-link { color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }

.hero {
  min-height: 370px;
  display: flex;
  align-items: end;
  padding: 72px 5vw 54px;
  background:
    radial-gradient(circle at 80% 20%, rgba(240,210,28,.16), transparent 30%),
    linear-gradient(180deg, #171920 0%, #0d0e11 100%);
}
.hero-inner { width: min(850px, 100%); }
.eyebrow, .section-kicker { margin: 0 0 12px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(42px, 8vw, 88px); line-height: .95; letter-spacing: -.065em; max-width: 900px; }
.hero-copy { color: #c8cbd1; max-width: 620px; font-size: clamp(16px, 2vw, 20px); line-height: 1.55; margin: 24px 0 18px; }
.status-row { display: inline-flex; gap: 9px; align-items: center; padding: 9px 13px; border: 1px solid var(--border); border-radius: 999px; color: #c8cbd1; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #57d176; box-shadow: 0 0 0 5px rgba(87,209,118,.1); }

.section { padding: 48px 5vw 70px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.section h2 { margin: 0; font-size: clamp(30px, 5vw, 52px); letter-spacing: -.045em; }

.participant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.participant-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.photo-wrap { aspect-ratio: 4/5; background: var(--surface-2); position: relative; overflow: hidden; }
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: clamp(60px, 10vw, 120px); font-weight: 900; letter-spacing: -.08em; color: rgba(255,255,255,.12); background: radial-gradient(circle at 50% 30%, rgba(240,210,28,.17), transparent 45%); }
.number-badge { position: absolute; top: 15px; left: 15px; padding: 8px 10px; border-radius: 999px; background: rgba(10,10,12,.78); backdrop-filter: blur(10px); font-size: 12px; font-weight: 900; }
.participant-body { padding: 20px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.participant-body h3 { margin: 0 0 7px; font-size: 22px; letter-spacing: -.03em; }
.participant-body p { margin: 0; color: var(--muted); font-size: 14px; }
.participant-body p strong { color: var(--text); font-size: 17px; }
.support-button { border: 0; border-radius: 14px; padding: 14px 17px; cursor: pointer; background: var(--accent); color: var(--accent-text); font-weight: 950; letter-spacing: .02em; }
.support-button:hover { transform: translateY(-1px); }

.ranking-section { background: #111318; }
.ranking-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ranking-row { min-height: 84px; display: grid; grid-template-columns: 54px 48px 1fr auto; align-items: center; gap: 14px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ranking-row:last-child { border-bottom: 0; }
.rank-number { color: var(--accent); font-size: 24px; font-weight: 950; }
.rank-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 900; }
.rank-name { display: flex; flex-direction: column; gap: 3px; }
.rank-name span, .rank-votes span { color: var(--muted); font-size: 12px; }
.rank-votes { text-align: right; display: flex; flex-direction: column; }
.rank-votes strong { font-size: 21px; }
.ghost-button { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px; cursor: pointer; }

.modal { display: none; position: fixed; inset: 0; z-index: 50; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.modal-sheet { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(760px, 100%); max-height: 88vh; overflow-y: auto; background: #17191f; border: 1px solid var(--border); border-radius: 28px 28px 0 0; padding: 30px 24px max(28px, env(safe-area-inset-bottom)); }
.modal-close { position: absolute; right: 18px; top: 15px; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 26px; cursor: pointer; }
.modal-sheet h2 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.modal-participant { color: var(--muted); margin: 7px 0 22px; }
.package-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.package-card { position: relative; min-height: 135px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); cursor: pointer; padding: 14px 10px; }
.package-card.featured { border-color: rgba(240,210,28,.6); background: rgba(240,210,28,.07); }
.package-price { font-size: 22px; font-weight: 950; }
.package-card strong { font-size: 14px; }
.package-card > span:last-child { color: var(--muted); font-size: 12px; }
.package-tag { position: absolute; top: 8px; font-size: 9px; font-weight: 950; letter-spacing: .08em; color: var(--accent); }
.selection-box { margin-top: 18px; padding: 18px; border-radius: 16px; background: var(--accent); color: var(--accent-text); display: flex; flex-direction: column; gap: 4px; }
.selection-box small { margin-top: 5px; opacity: .72; }
.hidden { display: none !important; }
.loading-card, .error-card { grid-column: 1/-1; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 30px; color: var(--muted); }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 5vw; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
footer strong { color: var(--text); }

@media (max-width: 850px) {
  .participant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar { height: 60px; padding: 0 18px; }
  .hero { min-height: 310px; padding: 58px 18px 40px; }
  .section { padding: 38px 18px 54px; }
  .participant-grid { grid-template-columns: 1fr; gap: 14px; }
  .participant-card { display: grid; grid-template-columns: 42% 58%; }
  .photo-wrap { aspect-ratio: 1/1.15; }
  .participant-body { padding: 15px; flex-direction: column; align-items: stretch; justify-content: space-between; }
  .support-button { width: 100%; }
  .ranking-row { grid-template-columns: 36px 40px 1fr auto; gap: 9px; padding: 12px; }
  .rank-avatar { width: 38px; height: 38px; }
  .rank-votes strong { font-size: 17px; }
  .package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  footer { flex-direction: column; padding: 28px 18px; }
}


/* YaVuelta V1.3 - identidad de marca */
.brand {
  gap: 10px;
}
.brand-mark {
  text-transform: none;
  font-size: 14px;
}
.brand-name {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  letter-spacing: -0.045em;
  text-transform: none;
}
.brand-first,
.brand-v {
  text-transform: none;
}


/* ============================================================
   YaVuelta V1.4
   ============================================================ */

.brand-mark {
  text-transform: none !important;
  font-size: 13px;
  letter-spacing: -0.04em;
}

.brand-name {
  display: inline;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.055em;
  text-transform: none !important;
}

.brand-v {
  font-size: 1.12em;
  text-transform: uppercase !important;
}

.demo-banner {
  position: relative;
  z-index: 10;
  padding: 8px 5vw;
  text-align: center;
  background: var(--accent);
  color: #111;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 900;
  letter-spacing: .08em;
}

.step-label {
  margin: 22px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.package-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 210, 28, .18);
  transform: translateY(-2px);
}

.support-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.selected-package {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.selected-package > div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.selected-package span,
.selected-package strong {
  display: block;
}

.selected-package span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.selected-package strong {
  font-size: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.field {
  display: block;
  margin-bottom: 13px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: #d9dbe0;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  background: #101217;
  color: var(--text);
  font: inherit;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 210, 28, .1);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 900;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: .58;
  cursor: wait;
}

.form-message {
  margin: 6px 0 4px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 99, 99, .28);
  border-radius: 12px;
  background: rgba(255, 99, 99, .08);
  color: #ffb9b9;
  font-size: 13px;
}

.payment-step,
.success-step {
  padding-top: 12px;
  text-align: center;
}

.payment-step h3,
.success-step h3 {
  margin: 8px 0 8px;
  font-size: 24px;
}

.payment-step p,
.success-step p {
  color: #d8dae0;
  line-height: 1.55;
}

.payment-check {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 4px auto 12px;
  border-radius: 50%;
  background: rgba(240, 210, 28, .13);
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.payment-check.success {
  background: rgba(87, 209, 118, .12);
  color: #57d176;
}

.simulation-notice {
  margin: 18px 0 6px;
  padding: 13px;
  border: 1px dashed rgba(240, 210, 28, .32);
  border-radius: 13px;
  background: rgba(240, 210, 28, .06);
  color: #d8d3a8;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

@media (max-width: 680px) {
  .selected-package,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-sheet {
    max-height: 92vh;
    overflow-y: auto;
  }
}


/* YaVuelta V1.4.1 - corrección del flujo APOYAR */
.support-button {
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.modal.open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.modal-sheet {
  z-index: 52;
}

.modal-backdrop {
  z-index: 51;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  transform: translate(-50%, 20px);
  max-width: min(90vw, 420px);
  padding: 11px 16px;
  border-radius: 999px;
  background: #f0d21c;
  color: #111;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
