/* ==========================================================
   PORTADA (login.php): una sola pantalla, sin scroll
   Estilo claro y cálido: crema, rosa y azul
   ========================================================== */
:root {
    --crema: #fff8f0;
    --rosa-suave: #ffe3ee;
    --rosa: #f4a6c3;
    --rosa-fuerte: #d63a73;
    --azul: #0066cc;
    --azul-oscuro: #004b99;
    --marino: #14213d;
    --oro: #f5c518;
    --texto-suave: #6b4a58;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body.portada {
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    color: var(--marino);
    background: var(--crema);
    overflow: hidden;
}

/* La pantalla ocupa exactamente el alto visible (svh = sin contar la barra del navegador móvil) */
.pantalla {
    height: 100vh;
    height: 100svh;
    display: grid;
    /* cinta, héroe y acceso se apilan según su contenido; lo que sobra queda libre al final */
    grid-template-rows: auto auto auto minmax(0, 1fr);
    background: linear-gradient(160deg, var(--rosa-suave) 0%, var(--crema) 55%, #e6f0fa 100%);
}

/* ---------- 1. CINTA DE IMÁGENES ---------- */
.cinta {
    height: clamp(58px, 11svh, 84px);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid #f3d3e0;
}
.cinta-pista {
    display: flex;
    width: max-content;
    animation: cinta-mover calc(var(--cajas, 12) * 3.6s) linear infinite;   /* más cajas → más tiempo, misma velocidad */
}
.cinta:hover .cinta-pista,
.cinta.pausada .cinta-pista { animation-play-state: paused; }
.cinta-grupo { display: flex; gap: 10px; padding-right: 10px; }
.cinta-caja {
    flex: none;
    /* Rectangulares (aprox. 16:9) también en móvil */
    width: clamp(78px, 14.5svh, 116px);
    height: clamp(44px, 8.2svh, 65px);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 6px rgba(20, 33, 61, 0.15);
    transition: transform 0.25s ease;
}
.cinta-caja:hover { transform: translateY(-3px) scale(1.06); }
/* Cajas con una expresión: texto centrado sobre el color de la caja */
.cinta-caja.frase { padding: 4px 6px; text-align: center; font-size: clamp(11px, 1.9svh, 15px); line-height: 1.15; text-wrap: balance; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.cinta-caja img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Colores de las cajas mientras no hay imagen */
.cinta-caja.c1 { background: linear-gradient(135deg, #f4a6c3, #d63a73); }
.cinta-caja.c2 { background: linear-gradient(135deg, #8ecae6, #0066cc); }
.cinta-caja.c3 { background: linear-gradient(135deg, #ffe08a, #f5a300); }
.cinta-caja.c4 { background: linear-gradient(135deg, #b8e0d2, #2a9d8f); }
.cinta-caja.c5 { background: linear-gradient(135deg, #cdb4db, #7b4fa3); }
.cinta-caja.c6 { background: linear-gradient(135deg, #ffc8a2, #e76f51); }
.cinta-caja.c7 { background: linear-gradient(135deg, #bde0fe, #4895ef); }
.cinta-caja.c8 { background: linear-gradient(135deg, #ffafcc, #b5179e); }
.cinta-caja.c9 { background: linear-gradient(135deg, #d8f3dc, #40916c); }
.cinta-caja.c10 { background: linear-gradient(135deg, #ffd6a5, #ff7b00); }
@keyframes cinta-mover { to { transform: translateX(-50%); } }

/* ---------- 2. HÉROE (imagen de fondo + texto) ---------- */
.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;   /* el texto empieza arriba, pegado a la cinta */
    text-align: center;
    padding: 84px 16px 36px;       /* en móvil deja sitio al idioma y al reloj, que van en las esquinas */
    overflow-x: clip;              /* lo que entra por los lados se corta, pero la imagen voladora puede salirse por arriba y por abajo */
}
@media (min-width: 700px) {
    .hero { padding: 48px 16px 36px; }   /* en ordenador el idioma y el reloj no tapan el texto */
}
@media (min-width: 900px) {
    .hero { padding-bottom: 64px; }   /* solo escritorio: más altura debajo de los pasos */
}
/* Móviles más bajos: el texto baja menos para que el botón y el nombre sigan dentro de la pantalla */
@media (max-width: 699px) and (max-height: 700px) {
    .hero { padding: 76px 16px 30px; }
}
@media (max-width: 699px) and (max-height: 620px) {
    .hero { padding: 62px 16px 16px; }
}
/* Recorta el fondo (que se mueve y se escala) sin recortar la imagen que cruza, que puede salirse del héroe */
.hero-recorte { position: absolute; inset: 0; overflow: hidden; }
.hero-fondo {
    position: absolute;
    /* Franja centrada: ocupa el 100 % del alto del héroe (antes 112 %) y se difumina un poco arriba y abajo */
    inset: 0 -6%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Capa blanca transparente sobre la imagen (va dentro del propio fondo, así se difumina con él) para que el texto se lea */
    background-image: linear-gradient(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.62)), var(--fondo, none);
    transition: transform 0.4s ease-out;
    animation: fondo-deriva 26s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes fondo-deriva {
    from { transform: scale(1.02) translate(0, 0); }
    to   { transform: scale(1.10) translate(-1.5%, -1%); }
}

.hero-contenido { position: relative; z-index: 2; width: 100%; max-width: 760px; }

.saludo {
    margin: 0;
    font-size: clamp(19px, 3.4svh, 28px);
    font-weight: 800;
    color: #8f1240;   /* granate oscuro: destaca sobre la imagen */
    letter-spacing: 0.3px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
}
.hero h1 {
    margin: 0.2em 0 0.25em;
    font-size: clamp(20px, 4.3svh, 36px);
    line-height: 1.12;
    color: var(--marino);
}
.hero h1 em { font-style: normal; color: var(--azul); }
.promesa {
    margin: 0 auto;
    max-width: 38ch;
    font-size: clamp(14px, 2.5svh, 19px);
    line-height: 1.4;
    font-weight: 700;
    color: #0b1220;   /* casi negro, en negrita */
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
}

/* Tres pasos: lista (apilada en móvil, en fila en ordenador) */
.pasos {
    display: flex;
    width: fit-content;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(4px, 1svh, 8px);
    margin: clamp(8px, 2svh, 16px) auto 0;
    padding: 0;
    list-style: none;
    text-align: left;
}
.paso {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(14px, 2.3svh, 18px);
    font-weight: 700;
    color: #0b1220;   /* casi negro, en negrita */
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
}
.paso b {
    flex: none;
    width: 1.7em;
    height: 1.7em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--azul);
    color: #fff;
    font-size: 0.85em;
}
.paso:last-child b { background: var(--oro); color: var(--marino); }
@media (min-width: 700px) {
    .pasos { flex-direction: row; align-items: center; gap: 32px; }
}

/* Imagen que cruza flotando: aparece una vez, 3 s después de cargar, de derecha a izquierda */
.volador {
    position: absolute;
    left: 100%;                       /* empieza justo fuera, a la derecha */
    top: 50%;
    z-index: 4;
    width: max-content;
    pointer-events: none;
    transform: translate(0, -50%);
    animation: volar 14s linear 3s 1 both;
}
.volador-flota {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: flotar 2.4s ease-in-out infinite alternate;
}
.volador img {
    display: block;
    height: clamp(110px, 25svh, 230px);
    width: auto;
    border: 4px solid #fff;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(20, 33, 61, 0.28);
}
.volador span {
    padding: 4px 14px;
    border: 2px solid var(--rosa);
    border-radius: 999px;
    background: #fff;
    color: var(--marino);
    font-size: clamp(14px, 2.3svh, 19px);
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(214, 58, 115, 0.18);
}
@keyframes volar {
    to { transform: translate(calc(-100vw - 100%), -50%); }   /* sale entera por la izquierda */
}
@keyframes flotar {
    from { transform: translateY(-9px) rotate(-2.5deg); }
    to   { transform: translateY(9px) rotate(2.5deg); }
}

/* Esquinas: idioma y reloj (las dos cajas miden lo mismo) */
.idioma, .reloj { width: 150px; height: 50px; }
.esquina { position: absolute; top: 8px; z-index: 3; }
.esquina-izq { left: 10px; }
.esquina-der { right: 10px; }

.idioma {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 12px;   /* igual que la caja del reloj */
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--rosa);
    box-shadow: 0 2px 8px rgba(20, 33, 61, 0.08);
}
.idioma button {
    flex: 1;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--marino);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.idioma button[aria-pressed="true"] { background: var(--azul); color: #fff; }

/* Widget de fecha y hora (se puede sustituir por otro) */
.reloj {
    padding: 5px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--rosa);
    text-align: center;
    line-height: 1.15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(20, 33, 61, 0.08);
}
.reloj-hora { display: block; font-size: clamp(16px, 2.8svh, 22px); font-weight: 800; color: var(--marino); font-variant-numeric: tabular-nums; }
.reloj-fecha { display: block; font-size: clamp(10px, 1.7svh, 12px); color: var(--texto-suave); white-space: nowrap; }
.reloj-fecha::first-letter { text-transform: uppercase; }

/* Aviso (contraseña cambiada, etc.) */
.aviso-portada {
    position: absolute;
    left: 50%;
    top: 52px;
    transform: translateX(-50%);
    z-index: 4;
    max-width: 92%;
    padding: 8px 14px;
    border-radius: 10px;
    background: #e6f6f4;
    border: 1px solid #2a9d8f;
    color: #14513f;
    font-size: 14px;
}

/* ---------- 3. ACCESO (botón + nombre), siempre dentro de la pantalla ---------- */
.acceso {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(135deg, #fff6fa 0%, #ffedf4 50%, #ffe3ee 100%);   /* rosa pálido con degradado suave, en oblicuo */
    border-top: 1px solid var(--rosa);
    box-shadow: 0 -6px 18px rgba(214, 58, 115, 0.08);
}
.btn-principal {
    width: 100%;
    max-width: 420px;
    height: 52px;
    margin: 0;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #1a7ae0, var(--azul));
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    animation: boton-pulso 2.6s ease-out infinite;
}
.btn-principal:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(0, 102, 204, 0.4); }
.btn-principal:active { transform: translateY(1px); }
.btn-principal.sin-pulso { animation: none; }
@keyframes boton-pulso {
    0%   { box-shadow: 0 6px 16px rgba(0, 102, 204, 0.35), 0 0 0 0 rgba(0, 102, 204, 0.45); }
    70%  { box-shadow: 0 6px 16px rgba(0, 102, 204, 0.35), 0 0 0 14px rgba(0, 102, 204, 0); }
    100% { box-shadow: 0 6px 16px rgba(0, 102, 204, 0.35), 0 0 0 0 rgba(0, 102, 204, 0); }
}

.campo-nombre { width: 100%; max-width: 420px; }
.campo-nombre input {
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 14px;
    border: 2px solid var(--rosa);
    border-radius: 12px;
    background: #fff;
    color: var(--marino);
    font-size: 18px;
}
.campo-nombre input:focus { outline: none; border-color: var(--azul); background: #fff; }
.campo-nombre.requerido input { border-color: var(--rosa-fuerte); animation: sacudida 0.4s; }
@keyframes sacudida {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.pista-nombre {
    margin: 0;
    max-width: 460px;
    font-size: clamp(14px, 2.4svh, 17px);
    font-weight: 700;
    line-height: 1.4;
    color: #0b1220;   /* casi negro, en negrita (igual que la frase y los pasos) */
    text-align: center;
}

/* ---------- Ventana de contraseña ---------- */
.dlg {
    width: min(92vw, 420px);
    padding: 22px 20px 18px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(20, 33, 61, 0.35);
    color: var(--marino);
}
.dlg::backdrop { background: rgba(20, 33, 61, 0.5); }
.dlg h2 { margin: 0 0 6px; font-size: 22px; }
.dlg p { margin: 0 0 12px; color: #4a4560; line-height: 1.4; }
.dlg label { display: block; margin: 10px 0 4px; font-size: 14px; font-weight: 600; }
.dlg .campo-pass { position: relative; }
.dlg input[type="password"], .dlg input[type="text"] {
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 76px 0 12px;
    border: 2px solid #d9dce3;
    border-radius: 10px;
    font-size: 18px;
}
.dlg input:focus { outline: none; border-color: var(--azul); }
.dlg .ver-pass {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 6px 8px;
    border: none;
    border-radius: 8px;
    background: #eef3fb;
    color: var(--azul-oscuro);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.dlg .acciones { display: flex; gap: 10px; margin-top: 16px; }
.dlg .acciones button {
    flex: 1;
    height: 48px;
    margin: 0;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.dlg .acciones .primario { background: var(--azul); color: #fff; }
.dlg .acciones .secundario { background: #eef0f4; color: var(--marino); }
.dlg .error-dlg { margin: 10px 0 0; color: #b42318; font-weight: 600; min-height: 1.2em; }
.dlg .solo-nuevo { display: none; }
.dlg.modo-crear .solo-nuevo { display: block; }
.dlg.modo-crear .solo-existente { display: none; }

/* ---------- Entrada suave del contenido ---------- */
.anim { animation: subir 0.6s ease-out backwards; }
.anim.d1 { animation-delay: 0.10s; }
.anim.d2 { animation-delay: 0.22s; }
.anim.d3 { animation-delay: 0.34s; }
.anim.d4 { animation-delay: 0.46s; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Ordenador: las 10 cajas ocupan todo el ancho (y la tira completa se desplaza) ---------- */
@media (min-width: 900px) {
    /* Solo ordenador: la imagen que cruza es mucho más grande (en móvil se queda como está) */
    .volador img { height: clamp(240px, 42svh, 480px); }
    .volador span { font-size: clamp(16px, 2.6svh, 22px); }
    /* Solo ordenador: el idioma y el reloj se acercan al centro, alineados con la columna del texto (760 px) */
    .esquina-izq { left: max(10px, calc(50% - 380px)); }
    .esquina-der { right: max(10px, calc(50% - 380px)); }
    /* Solo ordenador: aire arriba y abajo de toda la pantalla */
    .pantalla { padding-block: clamp(28px, 9svh, 110px); }
    .acceso { padding-top: clamp(26px, 4.5svh, 48px); padding-bottom: clamp(26px, 4.5svh, 48px); }   /* más aire arriba y abajo del botón y el nombre */
    .cinta { height: clamp(76px, 13svh, 110px); }
    /* Se ven siempre 10 cajas repartidas por todo el ancho; el resto entra desplazándose */
    .cinta-grupo { padding: 0 5px; }
    .cinta-caja { width: calc((100vw - 100px) / 10); aspect-ratio: auto; height: clamp(60px, 10.5svh, 90px); }
}

/* ---------- Pantallas bajas (móvil en horizontal, etc.) ---------- */
@media (max-height: 560px) {
    .promesa { display: none; }
    .pasos { margin-top: 6px; }
}
@media (max-height: 430px) {
    .pasos, .pista-nombre { display: none; }
}
@media (max-width: 380px) {
    .esquina-izq { left: 6px; }
    .esquina-der { right: 6px; }
    .reloj { padding: 2px 6px; }
    .reloj-fecha { font-size: 10px; }
}

/* Movimiento reducido: sin cinta, sin deriva ni pulsos */
@media (prefers-reduced-motion: reduce) {
    .cinta-pista, .hero-fondo, .btn-principal, .anim { animation: none !important; }
    .volador { display: none; }
    .cinta { overflow-x: auto; }
}
