/* ============================================
   SPLASH SCREEN - FICHIER DÉDIÉ
   ============================================ */

/* ============================================
   CONTENEUR PRINCIPAL
   ============================================ */

/* Remplace le grid terminal-frame (54px/1fr/54px) par flex :
   évite la chaîne height:100% cassée sur Firefox mobile */
.splash-frame {
    display: flex !important;
    flex-direction: column;
    isolation: isolate;
}

.splash-shell {
    width: min(
        calc(100vw - 20px),
        calc((100vh - 20px) * 4 / 3)
    );
    width: min(
        calc(100dvw - 20px),
        calc((100dvh - 20px) * 4 / 3)
    );
    max-width: none;
}

.splash-frame > .splash-container {
    flex: 1 1 0;
    min-height: 0;
}

.splash-frame::before,
.splash-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.splash-frame::before {
    z-index: 10;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.03) 0px,
            rgba(255, 255, 255, 0.03) 1px,
            rgba(0, 0, 0, 0.16) 2px,
            rgba(0, 0, 0, 0.16) 4px
        ),
        radial-gradient(circle at center, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.2) 78%, rgba(0, 0, 0, 0.45) 100%);
}

.splash-frame::after {
    z-index: 11;
    opacity: 0.08;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 0 1px, transparent 2px),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.18) 0 1px, transparent 2px),
        radial-gradient(circle at 45% 75%, rgba(255, 255, 255, 0.16) 0 1px, transparent 2px);
    background-size: 16px 16px, 22px 22px, 28px 28px;
}

.splash-container {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(1rem, 2vw, 2rem);
    padding: clamp(0.75rem, 1.5vw, 1rem);
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 1s ease-out;
    /* GLOW HÉRITÉ */
    text-shadow: var(--text-glow);
    /* IMPORTANT : Au-dessus de tout (scanlines ont z-index: 20) */
    z-index: 100;
    /* Empêcher le débordement */
    overflow: hidden;
}

.splash-container.fade-out {
    opacity: 0;
}

/* ============================================
   LOGO ASCII
   ============================================ */

.ascii-logo {
    position: absolute;
    top: calc(50% - clamp(40px, 7vh, 80px));
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-ascii);
    white-space: pre;
    line-height: 1.0;
    color: var(--terminal-text, #f2f2f2);
    font-size: clamp(0.5rem, 1.8vw, 0.9rem);
    text-align: center;
    min-height: auto;
    text-shadow: var(--text-glow-strong);
    /* Empêcher le débordement */
    max-width: 95%;
    overflow: hidden;
}

.ascii-line {
    visibility: hidden;
    display: block;
}

.ascii-line.visible {
    visibility: visible;
}

/* ============================================
   BARRE DE PROGRESSION
   ============================================ */

.loading-section {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: clamp(200px, 65vw, 380px);
    max-width: 380px;
    margin-top: clamp(160px, 30vh, 230px);
    /* IMPORTANT : Pas d'overflow:hidden ici pour laisser le contenu visible */
}

.loading-section.active {
    display: flex;
}

.progress-bar {
    display: flex;
    gap: clamp(1px, 0.3vw, 2px);
    justify-content: center;
    font-size: clamp(0.8rem, 2.2vw, 1.1rem);
    line-height: 1;
    flex-wrap: nowrap !important;
    overflow: hidden;
    white-space: nowrap;
}

.progress-char {
    color: rgba(255, 255, 255, 0.2);
    transition: color 0.08s ease-out, text-shadow 0.08s ease-out;
    flex-shrink: 0;
}

.progress-char.filled {
    color: var(--terminal-accent, #2044dd);
    text-shadow: var(--text-glow);
}

.progress-percentage {
    font-size: clamp(0.9rem, 2.8vw, 1.4rem);
    color: var(--terminal-text, #f2f2f2);
    text-shadow: var(--text-glow);
}

.loading-text {
    font-size: clamp(0.9rem, 2.8vw, 1.4rem);
    color: var(--terminal-text, #f2f2f2);
    min-height: 1.2rem;
    text-transform: lowercase;
    text-shadow: var(--text-glow);
}

/* ============================================
   LOGOS PARTENAIRES
   ============================================ */

.partners-section {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: clamp(300px, 85vw, 500px);
    margin-top: clamp(220px, 40vh, 300px); /* Augmente cette valeur */}

.partners-section.active {
    display: flex;
}

.partner-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.partner-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.partner-label {
    font-size: clamp(0.9rem, 3.5vw, 1.8rem);
    color: var(--terminal-text, #f2f2f2);
    text-shadow: var(--text-glow);
    text-transform: lowercase;
    margin-bottom: 0.25rem;
}

.partner-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.8rem, 3.5vw, 4rem);
    flex-wrap: wrap;
}

.partner-logo {
    max-width: clamp(80px, 18vw, 140px);
    height: auto;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

.single-logo {
    max-width: clamp(120px, 28vw, 230px);
}

.two-logos {
    display: flex;
    gap: clamp(0.8rem, 2.5vw, 1.8rem);
    align-items: center;
}

/* ============================================
   RESPONSIVE - TABLETTE / MOBILE
   ============================================ */

@media (max-width: 900px), (max-height: 700px) {
    .splash-container {
        justify-content: center;
        gap: 0.9rem;
        padding: calc(24px + env(safe-area-inset-top, 0px)) 0.75rem calc(20px + env(safe-area-inset-bottom, 0px));
        text-shadow: var(--text-glow);
        /* IMPORTANT : Assurer que le conteneur reste visible */
        display: flex !important;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .splash-shell {
    border: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    }

    .ascii-logo {
        position: absolute !important;
        top: 20% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: auto !important;
        max-width: min(92vw, 560px);
        margin: 0 auto;
        font-size: clamp(0.34rem, 1.65vw, 0.62rem);
        line-height: 0.95;
    }

    .loading-section {
        width: min(88vw, 460px);
        margin-top: 0;
    }

@media (max-width: 900px), (max-height: 700px) {
    .progress-bar {
        width: 100%;
        gap: 1px;
        font-size: clamp(0.65rem, 2.5vw, 0.9rem);
        flex-wrap: nowrap !important;
        overflow: hidden;
    }
}

    .progress-percentage,
    .loading-text {
        font-size: clamp(0.85rem, 4.5vw, 1.25rem);
        text-align: center;
    }

    .partners-section {
        max-width: min(92vw, 500px);
        margin-top: 0;
        gap: 0.75rem;
    }

    .partner-label {
        font-size: clamp(0.85rem, 4.5vw, 1.3rem);
        text-align: center;
    }

    .partner-logos {
        gap: 1.2rem;
    }

    .partner-logo {
        max-width: clamp(75px, 28vw, 120px);
    }

    .single-logo {
        max-width: clamp(110px, 48vw, 200px);
    }

    .two-logos {
        gap: 0.8rem;
    }

    .partner-section {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .splash-container {
        gap: 0.75rem;
        padding: calc(16px + env(safe-area-inset-top, 0px)) 0.5rem calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .ascii-logo {
        max-width: 100%;
        font-size: clamp(0.26rem, 1.9vw, 0.44rem);
    }

    .loading-section {
        width: min(92vw, 420px);
    }

    .partners-section {
        width: min(92vw, 420px);
    }

    .partner-logo {
        max-width: clamp(70px, 30vw, 110px);
    }

    .single-logo {
        max-width: clamp(100px, 50vw, 180px);
    }
}

/* Hauteur critique */
@media (max-height: 500px) {
    .splash-container {
        justify-content: center;
        gap: 0.4rem;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .ascii-logo {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 0 auto;
        font-size: clamp(0.24rem, 1.2vw, 0.4rem);
    }

    .loading-section,
    .partners-section {
        margin-top: 0;
    }

    .progress-percentage,
    .loading-text,
    .partner-label {
        font-size: clamp(0.8rem, 2.5vh, 1.1rem);
    }
}

/* ============================================
   CORRECTION BORDURE NOIRE - À AJOUTER
   ============================================ */

.splash-frame {
    background: var(--screen-blue, #06079d) !important;
}

.splash-shell {
    background: var(--screen-blue, #06079d) !important;
    border: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Pour couvrir tous les cas */
.crt-shell {
    background: var(--screen-blue, #06079d) !important;
}
