:root {
  --azul: #2433D9;
  --azul-hondo: #141B7A;
  --tinta: #10165E;
  --cielo: #E3E7FF;
  --amarillo: #FFD43B;
  --verde: #1E9E5A;
  --rojo: #D93636;
  --blanco: #fff;
  --radio: 14px;
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--azul); min-height: 100vh; padding-bottom: env(safe-area-inset-bottom, 0); }
img { max-width: 100%; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Cabecera ---------- */
.hero {
  color: var(--blanco); text-align: center;
  padding: calc(28px + env(safe-area-inset-top, 0)) 20px 32px;
}
.titulo {
  margin: 0; font-weight: 900; text-transform: uppercase;
  font-size: clamp(3rem, 15vw, 5.5rem); line-height: .88; letter-spacing: -.02em;
  text-shadow: 0 5px 0 var(--azul-hondo);
}
.premios { margin: 18px auto 14px; max-width: 30ch; font-size: 1.15rem; line-height: 1.35; font-weight: 500; }
.pastilla {
  display: inline-block; margin: 0; padding: 8px 18px; border-radius: 999px;
  background: var(--azul-hondo); font-weight: 700; font-size: .95rem;
}

/* ---------- Pasos ---------- */
.contenido { max-width: 620px; margin: 0 auto; padding: 0 14px 120px; }
.paso {
  background: var(--blanco); border-radius: 22px; padding: 22px 18px;
  margin-bottom: 14px;
}
.paso h2 { margin: 0 0 6px; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.paso h2 .n {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--azul); color: var(--blanco);
  display: grid; place-items: center; font-size: 1rem;
}
.ayuda { margin: 0 0 14px; color: #4A5190; font-size: .95rem; }

/* ---------- Foto de premios ---------- */
.foto-premios { margin: 24px auto 0; max-width: 560px; }
.foto-premios img {
  display: block; width: 100%; height: auto; border-radius: 20px;
  border: 4px solid var(--blanco); box-shadow: 0 8px 0 var(--azul-hondo);
}

/* ---------- Mapa de números (estilo cine) ---------- */
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; font-size: .9rem; color: #4A5190; }
.leyenda span { display: flex; align-items: center; gap: 6px; }
.m { width: 18px; height: 18px; border-radius: 5px; display: inline-block; }
.m.libre { background: var(--cielo); }
.m.elegido { background: var(--amarillo); box-shadow: inset 0 0 0 2px var(--tinta); }
.m.ocupado { background: #C9CBDA; }
.grilla { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.grilla .numero { font-size: .78rem; border-radius: 6px; padding: 0; }
@media (min-width: 480px) { .grilla { gap: 5px; } .grilla .numero { font-size: .95rem; border-radius: 9px; } }
@media (max-width: 479px) { #paso1 { padding: 18px 10px; } }
.numero {
  aspect-ratio: 1; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--cielo); color: var(--azul-hondo);
  font-weight: 700; font-size: 1.05rem;
  transition: transform .12s, background .12s;
}
.numero:active { transform: scale(.92); }
.numero[aria-pressed="true"] { background: var(--amarillo); color: var(--tinta); box-shadow: inset 0 0 0 3px var(--tinta); }
.numero.ocupado { background: #C9CBDA; color: #8C90A8; text-decoration: line-through; cursor: not-allowed; }
.numero.ocupado:active { transform: none; }
.numero:disabled:not(.ocupado) { opacity: .45; cursor: wait; }

/* ---------- Pago ---------- */
.pago { border: 2px solid var(--cielo); border-radius: var(--radio); overflow: hidden; }
.fila { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--cielo); }
.fila:last-child { border-bottom: 0; }
.fila span { color: #4A5190; min-width: 78px; }
.fila strong { flex: 1; font-size: 1.1rem; }
.fila.total { background: var(--cielo); }
.copiar {
  border: 0; background: var(--azul); color: var(--blanco);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: .85rem; font-weight: 500;
}

/* ---------- Formulario ---------- */
label { display: block; font-weight: 500; margin: 14px 0 6px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=search] {
  width: 100%; padding: 13px 14px; border: 2px solid var(--cielo); border-radius: 12px;
  font-size: 1rem; color: var(--tinta); background: var(--blanco);
}
input:focus { border-color: var(--azul); outline: none; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.subir {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed #A9B2F5; border-radius: 14px; padding: 18px; text-align: center;
  cursor: pointer; color: #4A5190; font-weight: 400; margin-top: 6px; min-height: 110px;
}
.subir input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.subir:focus-within { border-color: var(--azul); }
.subir img { max-height: 220px; border-radius: 8px; }
.error { color: var(--rojo); font-weight: 500; min-height: 1.2em; margin: 14px 0 0; }

.boton {
  width: 100%; margin-top: 14px; padding: 16px; border: 0; border-radius: 14px;
  background: var(--azul); color: var(--blanco); font-weight: 700; font-size: 1.1rem; cursor: pointer;
}
.boton:disabled { opacity: .55; cursor: wait; }
.boton.claro { background: var(--cielo); color: var(--azul-hondo); }

/* ---------- Barra inferior ---------- */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--tinta); color: var(--blanco);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  display: flex; align-items: center; gap: 12px; justify-content: center;
}
.barra p { margin: 0; flex: 1; max-width: 420px; line-height: 1.25; }
.barra small { opacity: .75; display: block; }
.barra button { background: var(--amarillo); color: var(--tinta); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; }

/* ---------- Pantalla de éxito ---------- */
.exito { max-width: 520px; margin: 0 auto; padding: 0 14px 40px; }
.exito .paso { text-align: center; }
.ticket { display: block; width: 100%; max-width: 420px; margin: 16px auto 4px; border-radius: 16px; }
.boletos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0; }
.boletos b { background: var(--amarillo); border-radius: 10px; padding: 10px 14px; font-size: 1.3rem; }

/* ========== ADMIN ========== */
.admin { max-width: 960px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--blanco); border-radius: 16px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.9rem; font-weight: 900; }
.stat span { color: #4A5190; font-size: .9rem; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--cielo); color: var(--azul-hondo); cursor: pointer; font-weight: 500; }
.tabs button[aria-pressed="true"] { background: var(--azul); color: var(--blanco); }
.herramientas { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.herramientas input { flex: 1; min-width: 180px; }
.herramientas button { border: 0; border-radius: 12px; padding: 0 16px; background: var(--cielo); color: var(--azul-hondo); font-weight: 500; cursor: pointer; min-height: 48px; }
.pedido { border: 2px solid var(--cielo); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.pedido header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.pedido h3 { margin: 0; font-size: 1.1rem; }
.pedido .meta { color: #4A5190; font-size: .9rem; margin: 6px 0 10px; line-height: 1.5; }
.pedido .meta a { color: var(--azul); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips span { background: var(--cielo); border-radius: 8px; padding: 4px 10px; font-weight: 700; }
.estado { font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 4px 10px; }
.estado.pendiente { background: #FFF1C2; color: #7A5A00; }
.estado.aprobado { background: #D6F5E3; color: #11633A; }
.estado.rechazado { background: #FBDADA; color: #8E1F1F; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.acciones button { border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; }
.ver { background: var(--cielo); color: var(--azul-hondo); }
.aprobar { background: var(--verde); color: var(--blanco); }
.rechazar { background: #FBDADA; color: #8E1F1F; }
.vacio { text-align: center; color: #4A5190; padding: 24px 0; }

.sorteo { text-align: center; }
.bombo {
  font-size: clamp(4rem, 22vw, 8rem); font-weight: 900; line-height: 1;
  color: var(--azul); margin: 12px 0; font-variant-numeric: tabular-nums;
}
.ganador { font-size: 1.2rem; margin: 0 0 6px; }
.historial { list-style: none; padding: 0; margin: 16px 0 0; color: #4A5190; font-size: .9rem; }

.modal { position: fixed; inset: 0; background: rgba(16,22,94,.85); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal img { max-height: 85vh; border-radius: 12px; background: var(--blanco); }
.modal button { position: absolute; top: calc(14px + env(safe-area-inset-top, 0)); right: 14px; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--blanco); font-weight: 700; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
