/* ============================================================
   FUENTE
============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap");

.fala-login * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================================
   LAYOUT GENERAL
============================================================ */
html, body {
    width: 100%;
    height: 100%;
}

.fala-login {
    width: 100%;
    height: 100vh;
    font-family: "Montserrat", sans-serif;
    color: #fff;
    display: flex;
    overflow-x: hidden;
    background: radial-gradient(circle at 20% 20%, #6d2db3 0%, #4b1880 40%, #2e0a4e 75%, #180028 100%);
}

.fala-login .ripley-app {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

/* ============================================================
   ASIDE (DESKTOP)
============================================================ */
.fala-login .ripley-aside {
    width: 45%;
    min-width: 420px;
    background: url("assets/imagen/onboarding-bg.png") no-repeat center/cover;
    position: relative;
}

.fala-login .ripley-aside::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(54,0,112,0.65) 0%,
        rgba(54,0,112,0.25) 40%,
        rgba(54,0,112,0) 100%);
}

@media (max-width: 992px) {
    .fala-login .ripley-aside { display: none; }
}

/* ============================================================
   MAIN
============================================================ */
.fala-login .ripley-main {
    flex: 1;
    padding: 40px 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* LOGO */
.fala-login .ripley-header {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
}

.fala-login .ripley-header img {
    height: 42px !important;
}

/* Botón volver */
.fala-login .ripley-back {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 9999;
    color: #fff;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 1;
}

/* ============================================================
   PASOS
============================================================ */
.ripley-step {
    display: none !important;
}

.ripley-step--active {
    display: block !important;
}

/* ============================================================
   ONBOARDING CENTRADO (ARREGLADO)
============================================================ */
#step-onboarding {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0 auto;
}

#step-onboarding .step-title {
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

#step-onboarding .step-subtitle {
    font-size: 18px;
    opacity: 0.85;
    margin-bottom: 32px;
    text-align: center;
}

#step-onboarding .ripley-btn {
    width: 420px;
    max-width: 90%;
    text-align: center;
    margin-top: 16px;
}

#step-onboarding .ripley-forgot-link {
    margin-top: 18px;
    font-size: 16px;
    opacity: 0.9;
    text-align: center;
    width: 100%;
    display: block;
    text-decoration: underline;
}

/* ============================================================
   TITULOS GENERALES
============================================================ */
.fala-login .step-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 6px;
}

.fala-login .step-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 35px;
}

/* ============================================================
   BOTONES
============================================================ */
.fala-login .ripley-btn {
    width: 100%;
    padding: 15px;
    margin-top: 14px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.fala-login .ripley-btn--primary {
    background: #fff;
    color: #3f0f7b;
}

.fala-login .ripley-btn--secondary {
    background: #ffc400;
    color: #3f0f7b;
}

.fala-login .ripley-btn--outline {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.45);
    color: #fff;
}
.fala-login .ripley-btn--outline:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================
   INPUT RUT
============================================================ */
.fala-login .ripley-input-wrapper {
    width: 100%;
    padding: 18px 24px;
    margin: 12px auto 18px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 18px;
    position: relative;
    text-align: left;
}

.fala-login .ripley-rut-display {
    font-size: 20px;
    opacity: 0.9;
}

.fala-login .ripley-input-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #00e676;
    font-size: 22px;
    opacity: 0;
}

.fala-login .ripley-input-hidden {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* ============================================================
   TECLADOS
============================================================ */
.fala-login .ripley-keypad {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.fala-login .ripley-keypad button {
    height: 78px;
    border-radius: 18px;
    border: 2px solid rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: 0.1s;
}
.fala-login .ripley-keypad button:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.3);
}

.fala-login .rk-del {
    border-color: #fff !important;
    background: rgba(255,255,255,0.25) !important;
}

/* ============================================================
   PIN BOX
============================================================ */
.fala-login .ripley-pin-box {
    padding: 20px;
    margin-bottom: 18px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 18px;
    display: flex;
    justify-content: center;
    position: relative;
}

.fala-login .ripley-pin-dots {
    display: flex;
    gap: 18px;
}

.fala-login .ripley-pin-dots span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

.fala-login .ripley-pin-dots span.filled {
    background: #fff;
}

.fala-login .ripley-pin-dots span.revealed {
    background: transparent !important;
    font-size: 20px !important;
    color: #fff !important;
    font-weight: 700;
}

.fala-login .ripley-pin-eye {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 24px;
}

/* input real */
#ripleyPinInput {
    opacity: 0;
    position: absolute;
    left: -9999px;
    pointer-events: none;
}

/* ============================================================
   LINK
============================================================ */
.fala-login .ripley-forgot-link {
    color: #fff;
    font-size: 16px;
    text-decoration: underline;
    opacity: 0.9;
    margin-top: 10px;
    display: inline-block;
}

/* ============================================================
   TOAST
============================================================ */
.fala-login .ripley-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    padding: 14px 22px;
    border-radius: 12px;
    opacity: 0;
    transition: 0.3s ease;
}

/* ============================================================
   MOBILE FIX — CENTRAR TODO
============================================================ */
@media (max-width: 992px) {

    .fala-login .ripley-main {
        padding: 0;
        width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        min-height: calc(var(--vh, 1vh) * 100);
        padding-top: 40px;
    }

    #step-onboarding {
        margin-top: 60px;
        width: 100%;
        padding: 0 24px;
    }

    #step-onboarding .ripley-btn {
        width: 100%;
    }
}
@media (max-width: 992px) {
    .fala-login .ripley-header {
        right: 50%;
        transform: translateX(50%);
    }
}
/* ============================================
   FIX MOBILE: Logo centrado + textos alineados
============================================ */
@media (max-width: 992px) {

    /* Centrar bloque completo */
    #step-onboarding,
    #step-rut,
    #step-pin {
        margin-top: 20px !important;
        width: 100%;
        max-width: 90%;
        padding: 0 24px;
        text-align: center;
        align-items: center;
        justify-content: flex-start;
    }

    /* Texto principal más pequeño */
    .step-title {
        font-size: 28px !important;
        margin-top: 12px !important;
        margin-bottom: 6px !important;
    }

    /* Subtítulo más pequeño */
    .step-subtitle {
        font-size: 15px !important;
        margin-bottom: 24px !important;
        opacity: 0.9;
    }

    /* Botones ancho completo */
    .ripley-btn {
        width: 100% !important;
    }
}
/* ============================================
   FIX — "Te damos la bienvenida" en UNA sola línea
============================================ */
@media (max-width: 992px) {
    #step-pin .step-title,
    #step-rut .step-title,
    #step-onboarding .step-title {
        white-space: nowrap !important;   /* evita salto de línea */
        font-size: 26px !important;       /* tamaño más pequeño para que quepa */
        line-height: 1.2 !important;
        text-align: center !important;
    }
}
/* ==========================================
   FIX — Botón Volver SIEMPRE IZQUIERDA
========================================== */
.ripley-back {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 99999 !important;
}

/* ==========================================
   NO MOVER EL LOGO EN ESCRITORIO
========================================== */
.ripley-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
}

/* ==========================================
   EN MÓVIL: LOGO CENTRADO
========================================== */
@media (max-width: 768px) {
    .ripley-header img {
        margin: 0 auto;
        display: block;
    }
}
@media (max-width: 768px) {

    /* Más espacio DEL LOGO hacia abajo */
    .ripley-header {
        margin-bottom: 55px !important;
    }

    /* Ajusta el tamaño del título "Te damos la bienvenida" */
    #step-rut .step-title,
    #step-pin .step-title {
        font-size: 26px !important;
        margin-top: 5px !important;
        margin-bottom: 22px !important;
        text-align: center;
        line-height: 1.25;
        display: block;
    }
}

/* ============================================================
   FIX GLOBAL — iPHONE: SIN BORDES BLANCOS
============================================================ */
html, body {
    overscroll-behavior: none;
    overflow-x: hidden;
    background: #000;
}

body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================
   FIX FONDO COMPLETO EN IPHONE
============================================================ */
.fala-login {
    background-attachment: fixed !important;
}

/* ============================================================
   FIX LOGO — BAJARLO UN POCO EN MOVIL
============================================================ */
@media (max-width: 768px) {
    .ripley-header {
        top: calc(env(safe-area-inset-top) + 25px) !important;
        right: 50% !important;
        transform: translateX(50%) !important;
        margin-bottom: 45px !important;
    }

    .ripley-header img {
        margin: 0 auto !important;
        display: block !important;
    }
}

/* ============================================================
   FIX — BAJAR TODO EL CONTENIDO EN MOVIL
============================================================ */
@media (max-width: 768px) {
    .ripley-main {
        padding-top: calc(env(safe-area-inset-top) + 85px) !important;
        padding-left: 22px !important;
        padding-right: 22px !important;
        justify-content: flex-start !important;
    }
}

/* ============================================================
   FIX — ERROR DEL RUT NO MUEVE LA PANTALLA
============================================================ */
.ripley-input-wrapper {
    position: relative !important;
}

.ripley-input-error {
    position: absolute !important;
    bottom: -20px !important;
    left: 10px !important;
    font-size: 13px !important;
    color: #ff7b7b !important;
    pointer-events: none !important;
}

/* ============================================================
   FIX — EVITAR BORDES BLANCOS AL HACER SCROLL
============================================================ */
html, body {
    height: 100%;
    overscroll-behavior: none !important;
}
/* ==========================================
   FIX iPhone – eliminar franja negra inferior
========================================== */
.fala-login {
    min-height: calc(var(--vh, 1vh) * 100) !important;
    height: auto !important;
}
#rutErrorMsg {
    transition: opacity 0.25s ease;
    height: 16px;
    line-height: 16px;
}

#rutErrorMsg.visible {
    opacity: 1 !important;
}

#rutErrorMsg:not(.visible) {
    opacity: 0 !important;
}
@media (max-width: 992px) {
    .onboarding-bg {
        background: url("assets/imagen/onboarding-bg.png") no-repeat top center/cover !important;
    }
}
@media (max-width: 992px) {

    #step-onboarding.ripley-step--active {
        position: relative;
        z-index: 2; /* contenido arriba */
    }

    #step-onboarding.ripley-step--active::before {
        content: "";
        position: fixed; /* 🔥 ahora sí ocupa TODA la pantalla real */
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;

        background: url("assets/imagen/onboarding-bg.png")
            no-repeat center center;
        background-size: cover;

        z-index: -1; /* 🔥 se pone detrás del contenido */
    }
}
@media (max-width: 992px) {

    /* Fondo global SOLO si estás en onboarding */
    body.onboarding-bg,
    html.onboarding-bg {
        background: url("assets/imagen/onboarding-bg.png") no-repeat center center !important;
        background-size: cover !important;
        background-attachment: fixed !important;

        /* 🔥 FIX DEFINITIVO BORDE NEGRO / SCROLL LATERAL */
        overflow-x: hidden !important;
    }

    /* Eliminamos cualquier fondo interno para evitar cortes */
    #step-onboarding {
        background: transparent !important;
    }
}
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative;
}
/* ============================================================
   FIX DESKTOP — eliminar borde negro superior
============================================================ */
@media (min-width: 993px) {

    html, body, .fala-login {
        padding-top: 0 !important;   /* 🔥 elimina el notch fantasma */
        margin-top: 0 !important;
    }

    #ripley-app,
    .ripley-main,
    .ripley-center {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
}
/* ============================================================
   DESKTOP FIX — Fondo completo en todos los pasos (RUT, PIN, etc)
============================================================ */
@media (min-width: 993px) {

    /* Contenedor global de la izquierda */
    .ripley-aside {
        background: url("assets/imagen/onboarding-bg.png") no-repeat center center !important;
        background-size: cover !important;
        width: 45vw !important; /* igual que onboarding */
        min-height: 100vh !important;
        display: block !important;
    }

    /* para evitar recortes y bordes */
    .fala-login,
    .ripley-app {
        overflow: hidden !important;
    }
}
@media (min-width: 992px) {
    #step-onboarding.ripley-step--active::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 45vw;
        height: 100vh;
        background: url("assets/imagen/onboarding-bg.png") no-repeat center center;
        background-size: cover;
        z-index: -1;
    }
}
/* INPUT REAL RESTAURADO → Invisible y fuera de pantalla */
#ripleyPinInput {
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    z-index: -1 !important;
}
.ripley-pin-box {
    position: relative !important;
}

#ripleyPinInput.pin-visible {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    width: 100% !important;
    height: 100% !important;

    text-align: center !important;
    font-size: 28px !important;
    letter-spacing: 10px !important;
    color: white !important;

    pointer-events: none !important;
    background: transparent !important;
    border: none !important;

    z-index: 20 !important;
    opacity: 1 !important;
}
/* ============================================================
   FIX DEFINITIVO — BOTÓN CONTINUAR (RUT/PIN) NO CLICKEABLE
   Compatible con Android y iPhone sin romper escritura
============================================================ */

/* 1) Aseguramos que los botones estén siempre ARRIBA */
#btnContinuarRut,
#btnFinalLogin {
    position: relative !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}

/* 2) El input real JAMÁS debe quedar encima del botón */
#ripleyPinInput,
#ripleyPinInput.pin-visible {
    z-index: 1 !important;        /* 🔥 antes era 20, eso tapaba todo */
    pointer-events: none !important;
}

/* 3) Los puntitos tampoco deben capturar clics */
.ripley-pin-dots {
    pointer-events: none !important;
    z-index: 1 !important;
}

/* 4) El ojo sí debe poder clickease */
.ripley-pin-eye {
    pointer-events: auto !important;
    z-index: 5 !important;
}

/* 5) El keypad queda debajo del botón */
.ripley-keypad,
#pinKeypad {
    z-index: 1 !important;
    pointer-events: auto !important; /* teclado sí funciona */
}

/* 6) La caja del PIN no bloquea clics fuera del input */
.ripley-pin-box {
    pointer-events: auto !important;
}
/* ============================================================
   FIX ÚNICO — Fondo 100% fijo SIN scroll y SIN borde negro
   (Funciona en Android y iPhone sin condiciones adicionales)
============================================================ */

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden !important;        /* 🔥 NO deja scrollear */
    overscroll-behavior: none !important;
    background: #000 !important;        /* evita parpadeos */
}

/* Contenedor principal que SIMULA background fijo */
.fala-login {
    position: fixed !important;         /* 🔥 fondo siempre fijo */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden !important;        /* nada se mueve */
    background-size: cover !important;  /* rellena pantalla */
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll !important; /* 🔥 evita borde negro en Android */
}

/* El CONTENIDO adentro sí puede moverse si es necesario */
.ripley-main {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto !important;        /* solo el contenido scrollea */
    -webkit-overflow-scrolling: touch;  /* estable en móviles */
    padding-bottom: 20px;
}
/* ================================================
   FIX SOLO PARA PANTALLAS PEQUEÑAS
   — habilita scroll sin modificar nada más
=================================================== */
@media (max-width: 600px) {
    html, body, .fala-login {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;   /* 🔥 scroll real */
        overflow-x: hidden !important;
    }

    .ripley-main {
        padding-bottom: 50px !important;  /* 🔥 solo un poco por seguridad */
    }
}
/* ============================================================
   FIX DEFINITIVO — CENTRAR RIPLEY-CENTER (RUT, PIN y KEYPAD)
============================================================ */
@media (max-width: 768px) {

    .ripley-center {
        width: 100% !important;
        max-width: 420px !important;
        margin-left: auto !important;
        margin-right: auto !important;

        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;

        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Cada step debe alinearse al centro */
    .ripley-step {
        width: 100% !important;
        max-width: 360px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
    }

    /* Keypad centrado sin romper el grid */
    .ripley-keypad {
        width: 100% !important;
        max-width: 360px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .ripley-pin-box,
    .ripley-input-wrapper {
        width: 100% !important;
        max-width: 360px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}
/* ============================================================
   FIX — Subir KEYPAD + Botón (sin romper alineación)
============================================================ */
@media (max-width: 768px) {

    /* 1. Subir todo el contenido del step PIN */
    #step-pin {
        margin-top: -10px !important; /* súbelo sin romper nada */
    }

    /* 2. Subir la caja del PIN */
    .ripley-pin-box {
        margin-bottom: 12px !important; /* antes era más grande */
    }

    /* 3. Subir el keypad */
    .ripley-keypad {
        margin-top: 10px !important; /* antes tenía más */
        margin-bottom: 10px !important;
    }

    /* 4. Subir el botón Continuar */
    #btnFinalLogin {
        margin-top: 14px !important;
    }

    /* 5. Reducimos padding superior del contenedor general */
    .ripley-main {
        padding-top: calc(env(safe-area-inset-top) + 65px) !important;
        /* antes tenías +90px y eso empujaba todo hacia abajo */
    }
}
/* ============================================================
   FIX — Bajar títulos "Te damos la bienvenida" (RUT & PIN)
   Manteniendo ambos EXACTAMENTE alineados
============================================================ */
@media (max-width: 768px) {

    #step-rut .step-title,
    #step-pin .step-title {
        margin-top: 38px !important;  /* Baja ambos a la misma altura */
    }
}
/* ============================================================
   FIX — Alinear altura de los teclados (RUT y PIN iguales)
============================================================ */
@media (max-width: 768px) {

    /* Keypad del RUT */
    #rutKeypad {
        margin-top: 18px !important;
    }

    /* Keypad del PIN */
    #pinKeypad {
        margin-top: 18px !important;
    }

    /* Alinear caja del PIN con caja del RUT */
    .ripley-pin-box {
        margin-top: 10px !important;
        margin-bottom: 18px !important;
    }

    /* Alinear caja del RUT */
    .ripley-input-wrapper {
        margin-bottom: 18px !important;
    }
}
/* ============================================================
   FIX — Subir teclados (RUT y PIN) por igual
   Mantiene simetría y no mueve logo/títulos
============================================================ */
@media (max-width: 768px) {

    /* Subir caja del RUT */
    .ripley-input-wrapper {
        margin-bottom: 12px !important; /* antes 18px */
        margin-top: 0 !important;       /* prevenir empuje extra */
    }

    /* Subir caja del PIN */
    .ripley-pin-box {
        margin-top: 0 !important;
        margin-bottom: 12px !important; /* antes 18px */
    }

    /* Subir keypad del RUT */
    #rutKeypad {
        margin-top: 10px !important;  /* antes 18px */
        margin-bottom: 6px !important;
    }

    /* Subir keypad del PIN */
    #pinKeypad {
        margin-top: 10px !important;  /* antes 18px */
        margin-bottom: 6px !important;
    }

    /* Subir un poquito el botón para que acompañe */
    #btnContinuarRut,
    #btnFinalLogin {
        margin-top: 10px !important;
    }
}
* ============================================================
   FIX — Centrado perfecto de los teclados (RUT y PIN)
============================================================ */
@media (max-width: 768px) {

    .ripley-keypad {
        width: 100% !important;
        max-width: 340px !important;      /* 🔥 Ajuste perfecto de Ripley */
        margin-left: auto !important;
        margin-right: auto !important;

        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        justify-items: center !important;
        align-items: center !important;

        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Las cajas del PIN y RUT también se centran al pixel */
    .ripley-pin-box,
    .ripley-input-wrapper {
        width: 100% !important;
        max-width: 340px !important;      /* igual que keypad */
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
/* ============================================
   FIX SAFARI / iPHONE — Centrar keypad
============================================ */
@media (max-width: 768px) {
    .ripley-keypad {
        max-width: 320px !important;  /* 🔥 evita que se abra más a la derecha */
        margin-left: auto !important;
        margin-right: auto !important; /* 🔥 centra completamente */
        padding-left: 0 !important;
        padding-right: 0 !important;   /* 🔥 esto evita el desplazamiento */
    }

    /* Centrar el contenedor donde está el input del PIN también */
    .ripley-pin-box {
        max-width: 320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Igual para el keypad del RUT */
    #rutKeypad {
        max-width: 320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}
/* ============================================================
   FIX PRO PARA TODOS LOS iPHONE (SE, Mini, 11, 12, 13, 14, 15, 16)
   — Mantiene tu diseño actual en pantallas grandes
   — Optimiza solo donde hace falta
   ============================================================ */

/* 1) Altura real correcta en iPhone (evita saltos con el teclado) */
@media screen and (max-width: 768px) {
    :root {
        --vh: 1vh;
    }

    /* actualizar vh real */
    @supports (-webkit-touch-callout: none) {
        .fala-login {
            height: calc(var(--vh, 1vh) * 100) !important;
            min-height: calc(var(--vh, 1vh) * 100) !important;
        }
    }
}

/* 2) Centrar el keypad en TODAS las resoluciones chicas */
@media screen and (max-width: 768px) {

    .ripley-keypad,
    #rutKeypad {
        max-width: 320px !important;      /* 🔥 evita abrirse a la derecha */
        margin-left: auto !important;
        margin-right: auto !important;    /* 🔥 centrado perfecto */
        padding: 0 !important;
    }

    .ripley-pin-box {
        max-width: 320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* 3) Ajustar el título para evitar que quede pegado al logo */
@media screen and (max-width: 768px) {
    #step-rut .step-title,
    #step-pin .step-title {
        margin-top: 20px !important;    /* 🔥 separa del logo */
        margin-bottom: 20px !important;
    }
}

/* 4) Controlar scroll SOLO cuando es necesario (iPhones chicos) */
@media screen and (max-width: 650px) {
    html, body, .fala-login {
        overflow-x: hidden !important;
        overflow-y: auto !important;     /* 🔥 scroll suave sólo si hace falta */
        height: auto !important;
        min-height: 100vh !important;
    }

    .ripley-main {
        padding-bottom: 50px !important; /* margen para evitar corte */
    }
}

/* 5) Fondo fijo optimizado sin bugs de Safari */
@media screen and (max-width: 768px) {
    .fala-login {
        background-attachment: scroll !important; /* 🔥 no usar fixed en iPhone */
        background-size: cover !important;
        background-position: center !important;
    }
}

/* =========================================================
   FIX — Centrado perfecto en pantallas angostas (Fold, minis)
   ========================================================= */
@media (max-width: 380px) {
    .step-title,
    .ripley-label {
        text-align: center !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }

    .ripley-center {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
/* ============================================
   AJUSTE SOLO PARA ESCRITORIO
   (pantallas grandes)
============================================ */
@media (min-width: 992px) {

    /* Empuja todo el contenido hacia el centro vertical */
    .ripley-main {
        padding-top: 120px !important;  /* mueve todo hacia abajo */
    }

    /* Baja un poco el teclado para equilibrar */
    #rutKeypad,
    #pinKeypad {
        margin-top: 30px !important;
    }

    /* Baja el botón Continuar para que no quede pegado */
    #btnContinuarRut,
    #btnFinalLogin {
        margin-top: 25px !important;
    }
}