:root {
  --cream: #f4f0e4;
  --cream-2: #ece6d6;
  --ink: #1c1a14;
  --green: #1f3d2c;
  --green-2: #2c5440;
  --gold: #9c7b3f;
  --line: #cfc7b3;
  --shadow: rgba(28, 26, 20, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

/* Encabezado tipo póster */
.station-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 6px; }
.station-num {
  font-weight: 800;
  font-size: 56px;
  line-height: 0.9;
  color: var(--green);
  letter-spacing: -2px;
}
.station-num .bar { display: block; width: 46px; height: 4px; background: var(--green); margin-top: 8px; }
.station-titles { padding-top: 4px; }
.station-title {
  font-weight: 800;
  font-size: 26px;
  line-height: 1.04;
  text-transform: uppercase;
  margin: 0;
}
.station-sub {
  font-style: italic;
  color: var(--green-2);
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.35;
}

.section-label {
  color: var(--green);
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 13px;
  border-bottom: 2px solid var(--green);
  display: inline-block;
  padding-bottom: 3px;
  margin: 26px 0 14px;
}

.prompt {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  margin: 4px 0 18px;
}

/* Buscador de nombre */
.field { margin-bottom: 18px; position: relative; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--green); letter-spacing: .4px; }
.field input {
  width: 100%;
  padding: 14px 14px;
  font-size: 17px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--green); }

.suggestions {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 22px var(--shadow);
  position: absolute;
  width: 100%;
  z-index: 20;
}
.suggestions li { padding: 12px 14px; cursor: pointer; font-size: 16px; border-bottom: 1px solid var(--cream-2); }
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover, .suggestions li.active { background: var(--cream-2); }
.suggestions .empty { color: #8a8576; font-style: italic; cursor: default; }

.chosen {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--green); color: #fff;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 15px;
}
.chosen button {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  border-radius: 999px; width: 22px; height: 22px; cursor: pointer; font-size: 14px; line-height: 1;
}

/* Opciones de voto */
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 16px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 16px; line-height: 1.3;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .05s;
  color: var(--ink);
}
.opt:active { transform: scale(.99); }
.opt .badge {
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--green); color: var(--green);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.opt.selected { border-color: var(--green); background: #eef3ee; }
.opt.selected .badge { background: var(--green); color: #fff; }
.opt:disabled { cursor: default; opacity: .55; }
.opt.selected:disabled { opacity: 1; }

.note { font-size: 14px; color: #6f6a5b; margin-top: 16px; line-height: 1.4; }
.error { color: #9b2226; font-weight: 600; margin-top: 12px; }

/* Estado de confirmación */
.confirm { text-align: center; padding: 30px 6px; }
.confirm .check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 32px; margin: 0 auto 16px;
}
.confirm h2 { font-size: 22px; margin: 0 0 8px; }
.confirm p { color: #5f5a4d; margin: 0 0 20px; }

.btn {
  display: inline-block; text-decoration: none;
  background: var(--green); color: #fff; border: none;
  padding: 14px 22px; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn:disabled { opacity: .5; cursor: default; }

.footer-link { text-align: center; margin-top: 26px; }
.footer-link a { color: var(--green); font-size: 14px; }

/* Página de inicio / índice */
.hero { text-align: center; padding: 18px 0 8px; }
.hero .names { font-size: 30px; font-weight: 800; color: var(--green); }
.hero .date { letter-spacing: 2px; color: var(--gold); font-weight: 700; margin-top: 4px; }
.hero p { color: #5f5a4d; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.card-st {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 16px;
}
.card-st .n { color: var(--green); font-weight: 800; font-size: 22px; }
.card-st .t { font-weight: 700; font-size: 14px; text-transform: uppercase; margin-top: 4px; line-height: 1.15; }

/* Resultados */
.res-head { text-align: center; margin-bottom: 8px; }
.res-head h1 { color: var(--green); font-size: 26px; margin: 0; text-transform: uppercase; }
.stats { display: flex; justify-content: center; gap: 26px; margin: 14px 0 24px; }
.stat { text-align: center; }
.stat .big { font-size: 30px; font-weight: 800; color: var(--green); }
.stat .lbl { font-size: 12px; letter-spacing: 1px; color: #6f6a5b; text-transform: uppercase; }

.res-card { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.res-card .rh { display: flex; align-items: baseline; gap: 10px; }
.res-card .rh .num { color: var(--green); font-weight: 800; font-size: 18px; }
.res-card .rh .ttl { font-weight: 800; text-transform: uppercase; font-size: 15px; }
.res-card .q { color: #5f5a4d; font-size: 14px; margin: 4px 0 14px; }
.bar-row { margin-bottom: 12px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; gap: 10px; }
.bar-row .top .txt { display: flex; gap: 8px; }
.bar-row .top .txt b { color: var(--green); }
.bar-row .top .cnt { color: #6f6a5b; white-space: nowrap; }
.bar-track { background: var(--cream-2); border-radius: 8px; height: 16px; overflow: hidden; }
.bar-fill { background: var(--green); height: 100%; width: 0; border-radius: 8px; transition: width .5s ease; }
.bar-row.lead .bar-fill { background: var(--gold); }
.bar-row.lead .top .txt b { color: var(--gold); }
.res-card .none { color: #8a8576; font-style: italic; font-size: 14px; }

.ok { color: var(--green); font-weight: 700; font-size: 12px; background: #e7efe7; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }

/* ---------- Splash (pantalla de bienvenida al escanear) ---------- */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--cream);
  display: grid; place-items: center; overflow: hidden;
  opacity: 0; animation: splashIn .55s ease forwards;
}
#splash.hide { opacity: 0; transition: opacity .7s ease; pointer-events: none; }
@keyframes splashIn { to { opacity: 1; } }

/* Capa tipográfica (se ve si no hay foto) */
.splash-fallback {
  text-align: center; padding: 28px;
  font-family: Georgia, "Times New Roman", serif; color: var(--green);
}
.splash-fallback .nos { font-family: "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 5px; font-size: 13px; font-weight: 700; color: var(--green-2); }
.splash-fallback .kite { font-size: 30px; margin: 8px 0 4px; }
.splash-fallback .sp-names { font-size: 52px; line-height: 1.05; font-weight: 700; }
.splash-fallback .sp-names .y { display: block; color: var(--gold); font-style: italic; font-size: 30px; margin: 2px 0; }
.splash-fallback .sp-div { width: 60px; height: 2px; background: var(--gold); margin: 16px auto; }
.splash-fallback .sp-date { font-family: "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 3px; font-size: 13px; font-weight: 700; color: var(--gold); }
.splash-fallback .sp-place { font-family: "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 2px; font-size: 11px; color: #8a8576; margin-top: 6px; }

/* Capa de foto (cubre la tipográfica si la imagen carga) */
.splash-photo-wrap { position: absolute; inset: 0; }
.splash-photo-wrap img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: splashZoom 2.6s ease-out forwards;
}
@keyframes splashZoom { from { transform: scale(1.05); } to { transform: scale(1); } }
.splash-scrim { position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(28,26,20,.15) 0%, rgba(28,26,20,0) 35%, rgba(28,26,20,.6) 100%); }
.splash-cap { position: absolute; left: 0; right: 0; bottom: 9%; text-align: center; color: #fff;
  font-family: Georgia, "Times New Roman", serif; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.splash-cap b { display: block; font-size: 40px; font-weight: 700; }
.splash-cap span { font-family: "Helvetica Neue", Arial, sans-serif; letter-spacing: 3px; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .splash-photo-wrap img { animation: none; }
}

/* Pestañas de resultados */
.tabs { display: flex; gap: 8px; margin: 18px 0; }
.tab {
  flex: 1; padding: 11px 10px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--green);
}
.tab.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Ranking */
.rank { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-bottom: 1px solid var(--cream-2); }
.rank li:last-child { border-bottom: none; }
.rank .pos { width: 34px; text-align: center; font-weight: 800; font-size: 18px; color: var(--green); }
.rank .who { flex: 1; font-weight: 600; }
.rank .pts { font-weight: 800; color: var(--green); }
.rank .pts small { font-weight: 600; color: #8a8576; font-size: 11px; }
.rank li.top3 { background: #faf7ee; }
.rank li.top3 .pos { font-size: 22px; }

.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #2e9e5b; margin-right: 6px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* QR */
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qr-cell { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; }
.qr-cell .n { color: var(--green); font-weight: 800; font-size: 18px; }
.qr-cell .t { font-size: 12px; text-transform: uppercase; font-weight: 700; margin: 2px 0 10px; min-height: 28px; }
.qr-cell canvas, .qr-cell img { width: 160px; height: 160px; }
.qr-cell .url { font-size: 10px; color: #8a8576; word-break: break-all; margin-top: 8px; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .qr-cell { break-inside: avoid; }
}
