:root {
  --crema:      #fbf7f0;
  --papel:      #ffffff;
  --tinta:      #2b2622;
  --tinta-suave: #6f6862;
  --linea:      #e6ded2;
  --terracota:  #a8402b;
  --terracota-cl: #c4563e;
  --verde:      #2f6b46;
  --ambar:      #b7791f;
  --ambar-cl:   #fdf3e0;
  --gris:       #9a938c;
  --sombra:     0 1px 2px rgba(43,38,34,.06), 0 4px 14px rgba(43,38,34,.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--crema);
  color: var(--tinta);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }

/* ---------- Encabezado ---------- */
header.hero {
  background: linear-gradient(165deg, #8f3524 0%, #a8402b 55%, #b9503a 100%);
  color: #fff;
  padding: 34px 0 30px;
  position: relative;
  overflow: hidden;
}
header.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 12%, rgba(255,255,255,.13) 0, transparent 42%),
    radial-gradient(circle at 6% 92%, rgba(0,0,0,.14) 0, transparent 45%);
  pointer-events: none;
}
header.hero .wrap { position: relative; z-index: 1; }

.kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: 5px 11px;
  border-radius: 100px;
  margin-bottom: 14px;
}

header.hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: -.5px;
}

header.hero p.lead {
  margin: 0;
  font-size: 15.5px;
  max-width: 560px;
  color: rgba(255,255,255,.9);
}

/* ---------- Tarjetas ---------- */
.card {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--sombra);
}

.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

section { padding: 26px 0; }

h2 {
  font-family: Georgia, serif;
  font-size: 20px;
  margin: 0 0 12px;
  letter-spacing: -.2px;
}

h2 .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px; height: 25px;
  border-radius: 50%;
  background: var(--terracota);
  color: #fff;
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 700;
  margin-right: 9px;
  vertical-align: 2px;
}

/* ---------- Dedicatoria ---------- */
.dedicatoria {
  background: linear-gradient(180deg, #fffdf9 0%, #fdf6ec 100%);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 30px 26px 24px;
  text-align: center;
  position: relative;
  box-shadow: var(--sombra);
}
.dedicatoria .comilla {
  font-family: Georgia, serif;
  font-size: 54px;
  line-height: .6;
  color: var(--terracota);
  opacity: .28;
  margin-bottom: 10px;
}
.dedicatoria p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16.5px;
  line-height: 1.75;
  color: #3a332d;
  margin: 0 auto;
  max-width: 620px;
  font-style: italic;
}
.dedicatoria .firma {
  margin-top: 16px;
  font-size: 12.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--terracota);
  font-weight: 700;
}

/* ---------- Propósito ---------- */
.proposito {
  margin-top: 14px;
  padding: 0 18px;
  text-align: center;
}
.proposito p {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--tinta-suave);
  margin: 0 auto;
  max-width: 560px;
}

/* ---------- Premio ---------- */
.premio { border-left: 4px solid var(--terracota); }
.premio .premio-sello {
  font-family: Georgia, serif;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--terracota);
  margin: 0 0 12px;
}
.premio h3 {
  font-family: Georgia, serif;
  font-size: 19px;
  margin: 0 0 6px;
  color: var(--tinta);
}
.premio p { margin: 0; color: var(--tinta-suave); font-size: 14.5px; }

/* ---------- Datos clave ---------- */
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--linea); border-radius: 12px; overflow: hidden; border: 1px solid var(--linea); }
.datos div { background: var(--papel); padding: 14px 16px; }
.datos .lab { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--tinta-suave); margin-bottom: 3px; }
.datos .val { font-size: 17px; font-weight: 700; }
.datos .val.caro { color: var(--terracota); font-size: 21px; }

/* ---------- Progreso ---------- */
.progreso { margin-top: 16px; }
.progreso .barra { height: 10px; background: #efe7dc; border-radius: 100px; overflow: hidden; }
.progreso .relleno {
  height: 100%;
  background: linear-gradient(90deg, var(--terracota), #d17a5c);
  border-radius: 100px;
  transition: width .5s ease;
  min-width: 2px;
}
.progreso .pie { display: flex; justify-content: space-between; font-size: 13px; color: var(--tinta-suave); margin-top: 7px; }

/* ---------- Números ---------- */
.barra-filtros {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.chip {
  border: 1px solid var(--linea);
  background: var(--papel);
  color: var(--tinta);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.chip:hover { border-color: var(--terracota-cl); }
.chip.activo { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.chip .cuenta { opacity: .65; font-weight: 400; }

.buscador {
  flex: 1; min-width: 130px;
  border: 1px solid var(--linea);
  background: var(--papel);
  border-radius: 100px;
  padding: 7px 15px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--tinta);
}
.buscador:focus { outline: 2px solid var(--terracota-cl); outline-offset: 1px; }

.numeros {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
}

.n {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  font-family: inherit;
  padding: 0;
  letter-spacing: .5px;
}
.n:active { transform: scale(.94); }

.n.disp {
  background: var(--papel);
  border-color: #cfdcd2;
  color: var(--tinta);
  box-shadow: 0 1px 2px rgba(43,38,34,.05);
}
.n.disp:hover { border-color: var(--verde); box-shadow: 0 3px 10px rgba(47,107,70,.18); transform: translateY(-1px); }

.n.res {
  background: var(--ambar-cl);
  border-color: #ecd3a4;
  color: #8a5a00;
  cursor: default;
}
.n.pag {
  background: #efe9e1;
  border-color: #e3dad0;
  color: #b3aba2;
  text-decoration: line-through;
  cursor: default;
}

.n .tag {
  position: absolute;
  bottom: 4px;
  font-size: 7.5px;
  letter-spacing: .4px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: .8;
}

.n.oculto { display: none; }

/* ---------- Leyenda ---------- */
.leyenda { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; font-size: 13px; color: var(--tinta-suave); }
.leyenda span { display: flex; align-items: center; gap: 7px; }
.leyenda i { width: 13px; height: 13px; border-radius: 4px; display: inline-block; border: 1.5px solid transparent; }
.leyenda i.d { background: #fff; border-color: #cfdcd2; }
.leyenda i.r { background: var(--ambar-cl); border-color: #ecd3a4; }
.leyenda i.p { background: #efe9e1; border-color: #e3dad0; }

/* ---------- Vacío ---------- */
.vacio { text-align: center; padding: 30px 10px; color: var(--tinta-suave); display: none; }
.vacio.ver { display: block; }

/* ---------- Pasos ---------- */
.pasos { counter-reset: paso; list-style: none; padding: 0; margin: 0; }
.pasos li {
  counter-increment: paso;
  position: relative;
  padding: 0 0 16px 44px;
  font-size: 14.5px;
}
.pasos li:last-child { padding-bottom: 0; }
.pasos li::before {
  content: counter(paso);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--terracota);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.pasos li::after {
  content: "";
  position: absolute; left: 15px; top: 34px; bottom: 6px;
  width: 1.5px; background: var(--linea);
}
.pasos li:last-child::after { display: none; }
.pasos b { display: block; }

/* ---------- Botones ---------- */
/* ---------- Aplicación instalable ---------- */
.instalar {
  margin-top: 14px;
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 100px;
  padding: 9px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: .15s;
}
.instalar:hover { background: rgba(255,255,255,.24); }
.instalar[hidden] { display: none; }

.sin-red {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  background: var(--ambar);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 16px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.sin-red.ver { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--terracota);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  box-shadow: 0 2px 8px rgba(168,64,43,.25);
}
.btn:hover { background: #933722; }
.btn.wa { background: #1f7a4d; box-shadow: 0 2px 8px rgba(31,122,77,.25); }
.btn.wa:hover { background: #18613d; }
.btn.ghost { background: transparent; color: var(--terracota); border: 1.5px solid var(--terracota); box-shadow: none; }
.btn.ghost:hover { background: rgba(168,64,43,.06); }
.btn.bloque { width: 100%; }

/* ---------- Modal ---------- */
.modal-fondo {
  position: fixed; inset: 0;
  background: rgba(43,38,34,.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center; justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal-fondo.ver { display: flex; }
.modal {
  background: var(--papel);
  border-radius: 18px;
  max-width: 400px; width: 100%;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: sube .25s ease;
  text-align: center;
}
@keyframes sube { from { transform: translateY(16px); opacity: 0; } }

.modal .cifra {
  font-family: Georgia, serif;
  font-size: 62px;
  font-weight: 700;
  line-height: 1;
  color: var(--terracota);
  margin: 6px 0 4px;
  letter-spacing: -1px;
}
.modal .estado-txt { font-size: 14px; color: var(--tinta-suave); margin-bottom: 20px; }
.modal .quien {
  display: block;
  background: #f7f3ec;
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14.5px;
  color: var(--tinta-suave);
  margin: -8px 0 18px;
}
.modal .quien b { color: var(--tinta); font-size: 15.5px; }
.modal h3 { font-family: Georgia, serif; margin: 0 0 4px; font-size: 16px; }
.modal .acciones { display: grid; gap: 9px; }

/* ---------- Footer ---------- */
footer {
  background: var(--tinta);
  color: #cfc7bf;
  padding: 26px 0;
  font-size: 13.5px;
  margin-top: 20px;
}
footer b { color: #fff; }
footer .admin-link { color: #8b837b; text-decoration: none; font-size: 12px; }
footer .admin-link:hover { color: #cfc7bf; }

/* ---------- Alertas ---------- */
.aviso {
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 14px;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.aviso.ok  { background: #eef7f1; border-color: var(--verde); color: #245436; }
.aviso.err { background: #fdeeeb; border-color: var(--terracota); color: #8f3524; }

@media (max-width: 520px) {
  header.hero h1 { font-size: 27px; }
  .numeros { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 7px; }
  .n { font-size: 15px; }
  .datos { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}
