/* =====================================================================
   FORMULARIO "APÚNTATE" - responsive
   ===================================================================== */
[hidden] { display: none !important; }

.form-section {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 34px 14px 120px;
  background: rgba(0, 0, 0, .15);
}
#reyesForm {
  background: #1a1a1a;
  padding: clamp(18px, 4vw, 34px);
  border-radius: 20px;
  max-width: 1040px; width: 100%;                 /* un poco más ancho en monitor */
  box-shadow: 0 0 20px rgba(245, 223, 37, .6);
  color: #f5df25;
  font-family: inherit;
}

/* Título y subtítulo (se ajustan a la pantalla) */
.apuntate-page { text-align: center; padding: 0 0 4px; }
.apuntate-page h1 {
  font-family: 'Cinzel', serif;
  font-size: 48px;
  font-size: clamp(30px, 8.5vw, 48px);
  line-height: 1.15;
  color: #f5df25;
  margin: 0 0 10px;
}
.apuntate-page .subtitulo {
  font-size: clamp(15px, 4vw, 18px);
  line-height: 1.5;
  color: #fff;
  margin: 0 0 18px;
}
.aviso-obligatorio { font-size: 13px; color: #ddd; text-align: right; margin: 0 0 12px; }
.aviso-js { background: #3a1c1c; color: #ffb3ad; border-radius: 10px; padding: 12px; text-align: center; margin-bottom: 16px; }
.req, .aviso-obligatorio span { color: #ff6961; }

/* Filas y campos */
.form-row { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.form-group { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; position: relative; }
.form-group label { margin-bottom: 4px; font-weight: 700; font-size: 14px; text-align: left; }
.form-group input, .form-group select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border-radius: 10px; border: 1px solid #f5df25;
  background: #222; color: #f5df25;
  font: inherit; font-size: 16px;              /* 16px: el iPhone no hace zoom al tocar el campo */
}
.form-group select:disabled { opacity: .55; cursor: not-allowed; }
/* "Repite tu email": en ordenador ocupa la columna derecha, justo debajo de "Email" */
.fila-repetir .form-group { flex: 0 1 calc(50% - 8px); margin-left: auto; }
.form-group input:focus-visible, .form-group select:focus-visible,
.checkbox-group input:focus-visible, .btn-enviar:focus-visible, .link-btn:focus-visible {
  outline: 3px solid #fff; outline-offset: 2px;
}
input.error, select.error { border: 1px solid #ff6961 !important; }
input.success, select.success { border: 1px solid #4CAF50 !important; }
.error-msg { display: none; color: #ff8f88; font-size: 13px; margin-top: 5px; text-align: left; }
.error-msg.visible { display: block; }
.regalos > .error-msg { text-align: center; font-size: 14px; margin-top: 10px; }

/* ---------- Elección de cartas (compacto) ---------- */
.regalos {
  border: 1px solid rgba(245, 223, 37, .4); border-radius: 14px;
  padding: 10px 12px 12px; margin: 0 0 16px; min-width: 0;
}
.regalos legend { padding: 0 8px; font-weight: 700; font-size: 16px; }
.regalos-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.regalos-ayuda { flex: 1 1 200px; margin: 0; font-size: 13px; line-height: 1.35; color: #ddd; text-align: left; }
.contador { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.dots { display: flex; gap: 4px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #f5df25; background: transparent; transition: background .2s, box-shadow .2s; }
.dots span.on { background: #f5df25; box-shadow: 0 0 7px #f5df25; }

.regalos-grupos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; align-items: stretch; }
.grupo-cartas {
  flex: 1 1 290px; min-width: 0;
  padding: 8px 8px 10px; border: 1px solid rgba(245, 223, 37, .22); border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.grupo-cartas h3 { margin: 0 0 7px; font-size: 14px; font-weight: 700; text-align: center; line-height: 1.25; }
.grupo-cartas h3 small { display: block; font-weight: 400; font-size: 11.5px; color: #ccc; margin-top: 1px; }

.tiles {                                       /* las 5 fichas SIEMPRE en una fila; se encogen si hace falta */
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px;
  width: 100%; max-width: 324px; margin: 0 auto;      /* máximo 60px por ficha */
}
.tile { position: relative; }
.tile input {                                 /* oculto a la vista pero accesible con teclado */
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
.tile label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  aspect-ratio: 1 / 1; padding: 3px 2px;                  /* fichas CUADRADAS */
  border: 2px solid rgba(245, 223, 37, .55); border-radius: 11px;
  background: #222; color: #f5df25; text-align: center; font-size: 10px; font-weight: 700; line-height: 1.1;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .15s;
}
.tile-ico { font-size: 21px; line-height: 1; }
.tile-txt { display: block; }
.tile-num { display: block; font-size: 11px; line-height: 1.1; margin-top: 1px; }
.tile label:hover { border-color: #f5df25; transform: translateY(-2px); }
.tile input:checked + label {
  background: linear-gradient(45deg, #f5df25, #ffd700); color: #1a1a1a; border-color: #fff;
  box-shadow: 0 0 12px rgba(245, 223, 37, .65);
}
.tile input:checked + label::after {
  content: '✓'; position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #4CAF50; color: #fff; font-size: 12px; line-height: 20px; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.tile input:focus-visible + label { outline: 3px solid #fff; outline-offset: 2px; }
.tile input:disabled + label { opacity: .32; cursor: not-allowed; transform: none; }

.regalos-resumen { margin-top: 10px; text-align: center; font-weight: 700; font-size: 14px; min-height: 1.3em; }
.regalos-acciones { text-align: center; }
.link-btn { background: none; border: 0; color: #5db2ff; text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 4px 8px; }

/* Casillas */
.checkbox-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.checkbox-group label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; line-height: 1.45; color: #f5df25; cursor: pointer; }
.checkbox-group input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: #f5df25; }
.checkbox-link { color: #5db2ff; text-decoration: underline; }

/* Botón: oro brillante con destello, estrellitas y resplandor */
.form-row-boton { margin-bottom: 0; }
.btn-enviar {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 14px 18px;
  border-radius: 16px; border: 1px solid #fff3a8;
  background: linear-gradient(135deg, #b8860b 0%, #f5df25 26%, #fff6b0 50%, #f5df25 74%, #b8860b 100%);
  background-size: 220% 220%;
  color: #2b1c00; text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  font: inherit; font-size: 19px; font-weight: 700; letter-spacing: .05em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(122, 86, 0, .55), inset 0 -3px 6px rgba(122, 86, 0, .35),
              0 6px 18px rgba(245, 223, 37, .35), 0 0 30px rgba(245, 223, 37, .25);
  animation: oroFluye 7s ease-in-out infinite, resplandor 3s ease-in-out infinite;
  transition: transform .2s ease, filter .2s ease;
}
/* franja de luz que cruza el botón */
.btn-enviar::before {
  content: ''; position: absolute; z-index: 1; top: 0; left: -70%;
  width: 40%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  transform: skewX(-20deg);
  animation: destelloBoton 3.8s ease-in-out infinite;
}
.btn-texto { position: relative; z-index: 2; }
.btn-estrella { position: relative; z-index: 2; font-size: .9em; color: #fff; text-shadow: 0 0 6px #fff, 0 0 12px #f5df25; animation: titilar 1.8s ease-in-out infinite; }
.btn-estrella:last-child { animation-delay: .9s; }
.btn-enviar:hover:not(:disabled) { transform: translateY(-2px) scale(1.01); filter: brightness(1.07) saturate(1.1); }
.btn-enviar:hover:not(:disabled) .btn-estrella { animation-duration: .7s; }
.btn-enviar:active:not(:disabled) { transform: translateY(1px) scale(.99); filter: brightness(.97); }
.btn-enviar:disabled { cursor: wait; filter: grayscale(.25) brightness(.9); animation: oroFluye 7s ease-in-out infinite; }
.btn-enviar:disabled::before { animation: none; opacity: 0; }

@keyframes oroFluye   { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes resplandor { 0%, 100% { box-shadow: inset 0 0 0 1px rgba(122,86,0,.55), inset 0 -3px 6px rgba(122,86,0,.35), 0 6px 18px rgba(245,223,37,.30), 0 0 22px rgba(245,223,37,.20); }
                        50%      { box-shadow: inset 0 0 0 1px rgba(122,86,0,.55), inset 0 -3px 6px rgba(122,86,0,.35), 0 8px 24px rgba(245,223,37,.50), 0 0 42px rgba(245,223,37,.40); } }
@keyframes destelloBoton { 0% { left: -70%; } 45%, 100% { left: 140%; } }
@keyframes titilar { 0%, 100% { opacity: .45; transform: scale(.75) rotate(0deg); } 50% { opacity: 1; transform: scale(1.2) rotate(25deg); } }

/* Ordenador/tablet: espacios algo más ajustados para compensar la fila de "Repite tu email"
   (el formulario ocupa lo mismo que antes de añadirla) */
@media (min-width: 601px) {
  #reyesForm { padding-top: 26px; padding-bottom: 26px; }
  .apuntate-page h1 { margin-bottom: 4px; }
  .apuntate-page .subtitulo { margin-bottom: 8px; }
  .aviso-obligatorio { margin-bottom: 4px; }
  .form-row { margin-bottom: 8px; }
  .form-group label { margin-bottom: 3px; }
  .form-group input, .form-group select { min-height: 42px; padding-top: 7px; padding-bottom: 7px; }
}

/* Móvil: más denso para hacer menos scroll */
@media (max-width: 600px) {
  .form-section { padding: 10px 6px 100px; }              /* el pie fijo ocupa ~70px */
  #reyesForm { padding: 14px 12px 16px; border-radius: 16px; }
  .apuntate-page h1 { font-size: clamp(26px, 7.5vw, 36px); margin-bottom: 4px; }
  .apuntate-page .subtitulo { font-size: 14px; margin-bottom: 8px; line-height: 1.4; }
  .aviso-obligatorio { display: none; }                      /* los asteriscos ya lo indican; ahorra una línea */
  .form-row { gap: 6px 10px; margin-bottom: 8px; }
  .form-group { flex: 1 1 135px; }                         /* nombre/apellidos y provincia/localidad van de dos en dos */
  .form-row.apilar .form-group { flex-basis: 100%; }       /* teléfono/email y entrega/opción, uno debajo de otro */
  .form-group label { font-size: 13px; margin-bottom: 2px; }
  .form-group input, .form-group select { min-height: 40px; padding: 6px 10px; }
  .error-msg { font-size: 12px; margin-top: 3px; }

  .regalos { padding: 8px 8px 10px; margin-bottom: 12px; }
  .regalos legend { font-size: 15px; }
  .regalos-ayuda { font-size: 12.5px; flex-basis: 100%; }
  .regalos-top { gap: 4px; }
  .regalos-grupos { gap: 8px; }
  .grupo-cartas { flex-basis: 100%; padding: 7px 6px 9px; }
  .grupo-cartas h3 { margin-bottom: 6px; font-size: 13.5px; }
  .grupo-cartas h3 small { display: inline; margin-left: 5px; font-size: 11.5px; }
  .regalos-resumen { margin-top: 8px; font-size: 13px; }

  .checkbox-group { gap: 8px; margin-bottom: 12px; }
  .checkbox-group label { font-size: 13px; line-height: 1.35; }
  .btn-enviar { min-height: 52px; font-size: 18px; }
}
@media (max-height: 500px) { .form-section { padding-bottom: 40px; } }   /* móvil apaisado: el pie deja de ser fijo */

@media (prefers-reduced-motion: reduce) {
  .tile label, .btn-enviar { transition: none; }
  .btn-enviar, .btn-enviar::before, .btn-estrella { animation: none !important; }
}

/* ---------- Aviso de envío: solo la cuenta atrás ---------- */
#popupReyes {
  position: fixed; inset: 0; z-index: 999999;
  display: none; align-items: center; justify-content: center; padding: 14px;
  background: rgba(0, 0, 0, .86);
  opacity: 0; transform: scale(.94);
  transition: opacity .4s ease-out, transform .4s ease-out;
}
#popupReyes.show { opacity: 1; transform: scale(1); }
.reyes-popup-card {
  width: min(100%, 420px); box-sizing: border-box; text-align: center;
  background: #1a1a1a; border: 2px solid #f5df25; border-radius: 22px; padding: 30px 20px 32px;
  box-shadow: 0 0 34px rgba(245, 223, 37, .45);
}
#popupCountdown { color: #fff6c8; font-size: clamp(17px, 4.6vw, 22px); font-weight: 700; line-height: 1.3; }
/* Si el servidor tarda más que la cuenta atrás */
.cuenta-espera { display: block; padding: 14px 0; color: #f5df25; font-family: 'Cinzel', serif; font-size: clamp(26px, 8vw, 36px); text-shadow: 0 0 16px rgba(245, 223, 37, .5); }
.cuenta-num {
  display: block; margin: 4px 0 2px; color: #f5df25;
  font-family: 'Cinzel', serif; font-size: clamp(60px, 20vw, 92px); line-height: 1;
  text-shadow: 0 0 18px rgba(245, 223, 37, .55);
}

/* =====================================================================
   CAPTCHA DE IMÁGENES ("toca los Reyes Magos")
   ===================================================================== */
#captchaReyes {
  position: fixed; inset: 0; z-index: 999998;
  display: none; align-items: center; justify-content: center;
  padding: 14px; background: rgba(0, 0, 0, .82); backdrop-filter: blur(4px);
  overflow-y: auto;
}
#captchaReyes.abierto { display: flex; }
.captcha-card {
  position: relative; width: 100%; max-width: 520px; margin: auto;
  background: #1a1a1a; border: 2px solid #f5df25; border-radius: 20px;
  padding: 22px 18px 18px; text-align: center; color: #f5df25;
  box-shadow: 0 0 30px rgba(245, 223, 37, .45);
}
.captcha-card h2 { font-family: 'Cinzel', serif; font-size: clamp(21px, 5.6vw, 27px); line-height: 1.15; margin: 0 28px 6px; }
.captcha-card p { color: #fff; font-size: 15px; line-height: 1.4; margin: 0 0 14px; }
.captcha-cerrar {
  position: absolute; top: 8px; right: 8px; width: 38px; height: 38px;
  background: none; border: 0; color: #f5df25; font-size: 20px; cursor: pointer; border-radius: 50%;
}
.captcha-cerrar:hover { background: rgba(245, 223, 37, .15); }

.captcha-opciones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
@media (max-width: 480px) { .captcha-opciones { grid-template-columns: repeat(2, minmax(0, 1fr)); } }   /* en móvil 2x2: imágenes más grandes y fáciles de reconocer */
.captcha-opcion { position: relative; }
.captcha-opcion input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.captcha-opcion label {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #fffaf0, #f1e2b8);       /* fondo claro: se ven bien las figuras */
  border: 3px solid rgba(245, 223, 37, .55); border-radius: 16px;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.captcha-opcion label:hover { border-color: #f5df25; transform: translateY(-2px); }
.captcha-opcion img { width: 100%; height: 100%; object-fit: contain; padding: 5px; pointer-events: none; }
.captcha-texto { padding: 6px; color: #3a2a00; font-weight: 700; font-size: 14px; line-height: 1.15; }
.captcha-opcion input:checked + label { border-color: #fff; box-shadow: 0 0 0 3px #f5df25, 0 0 18px rgba(245, 223, 37, .75); }
.captcha-opcion input:checked + label::after {
  content: '✓'; position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: #4CAF50; color: #fff; font-size: 17px; line-height: 26px; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.captcha-opcion input:focus-visible + label { outline: 3px solid #fff; outline-offset: 3px; }

.captcha-msg { min-height: 1.5em; margin-bottom: 8px; color: #ff8f88; font-weight: 700; font-size: 14px; }
.captcha-botones { display: flex; gap: 10px; }
.captcha-btn {
  flex: 1; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 700; color: #1a1a1a;
  background: linear-gradient(45deg, #f5df25, #ffd700); transition: transform .2s, filter .2s;
}
.captcha-btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.captcha-btn-sec { background: transparent; color: #f5df25; border: 2px solid rgba(245, 223, 37, .6); }
.captcha-btn:focus-visible, .captcha-cerrar:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.captcha-card.sacudir { animation: sacudir .45s ease; }
@keyframes sacudir { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@media (max-width: 380px) { .captcha-card { padding: 20px 12px 14px; } .captcha-opciones { gap: 7px; } .captcha-btn { font-size: 15px; } }
@media (prefers-reduced-motion: reduce) { .captcha-card.sacudir, .captcha-opcion label { animation: none; transition: none; } }

/* Recorte de borde del captcha: Paje.png trae un resto de otra imagen pegado a su borde izquierdo.
   Se oculta con una máscara (sin dejar costura, porque las imágenes son transparentes). */
.captcha-opcion img.con-recorte {
  -webkit-mask-image: linear-gradient(to right, transparent 0, transparent var(--recorte-izq, 0%), #000 calc(var(--recorte-izq, 0%) + 4%));
  mask-image: linear-gradient(to right, transparent 0, transparent var(--recorte-izq, 0%), #000 calc(var(--recorte-izq, 0%) + 4%));
}
