/**
 * Loading Screen Styles
 * POP-style animated loading overlay with logo slide-in,
 * colorful individual character animation, and fade-out
 */

.loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeOutLoading 0.7s 2.5s ease-out forwards;
}

.loadingScreen.is-hidden {
    display: none;
}

.loadingScreen__content {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 3rem;
}

.loadingScreen__logo {
    width: 120px;
    height: 120px;
    opacity: 0;
    /* "Fuwafuwa" floating entrance */
    animation: floatInLogo 1.2s ease-out forwards, floatBob 3s 1.2s infinite ease-in-out;
}

.loadingScreen__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
}

.loadingScreen__textWrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center align for better vertical flow */
    gap: 0.5rem;
}

/* Dynamic Status Text (Hello -> Good -> Perfect!) */
/* Dynamic Status Text (Hello -> Good -> Perfect!) - Below Bar */
.loadingScreen__statusText {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: #4D96FF;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInStatus 0.5s ease-out forwards;
    margin-top: 1.5rem;
    /* Space from loading bar */
}

.loadingScreen__text--tag {
    font-size: 2rem;
    /* Reverted to original size */
    margin-top: 0;
}

.loadingScreen__text--brand {
    font-size: 3rem;
    /* Reverted to original size */
    font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
    font-style: italic;
    opacity: 1;
    /* Reverted opacity */
}

/* Individual character styling with colors */
.loadingScreen__char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: revealChar 0.4s ease-out forwards;
}

/* Rainbow colors for each character */
.loadingScreen__char:nth-child(1) {
    color: #FF6B9D;
    animation-delay: 0.5s;
}

/* Red/Pink */
.loadingScreen__char:nth-child(2) {
    color: #FFA07A;
    animation-delay: 0.6s;
}

/* Orange */
.loadingScreen__char:nth-child(3) {
    color: #6BCB77;
    animation-delay: 0.7s;
}

/* Green */
.loadingScreen__char:nth-child(4) {
    color: #B388FF;
    animation-delay: 0.8s;
}

/* Purple */
.loadingScreen__char:nth-child(5) {
    color: #FF6B9D;
    animation-delay: 0.9s;
}

/* Pink */
.loadingScreen__char:nth-child(6) {
    color: #4D96FF;
    animation-delay: 1.0s;
}

/* Blue */
.loadingScreen__char:nth-child(7) {
    color: #FFD93D;
    animation-delay: 1.1s;
}

/* Yellow */

/* Brand text colors - Y'z English (11 characters including space) */
.loadingScreen__text--brand .loadingScreen__char:nth-child(1) {
    color: #FF6B9D;
    animation-delay: 0.5s;
}

/* Y */
.loadingScreen__text--brand .loadingScreen__char:nth-child(2) {
    color: #FFA07A;
    animation-delay: 0.6s;
}

/* ' */
.loadingScreen__text--brand .loadingScreen__char:nth-child(3) {
    color: #FFD93D;
    animation-delay: 0.7s;
}

/* z */
.loadingScreen__text--brand .loadingScreen__char:nth-child(4) {
    color: transparent;
    animation-delay: 0.75s;
}

/* space */
.loadingScreen__text--brand .loadingScreen__char:nth-child(5) {
    color: #6BCB77;
    animation-delay: 0.8s;
}

/* E */
.loadingScreen__text--brand .loadingScreen__char:nth-child(6) {
    color: #4D96FF;
    animation-delay: 0.9s;
}

/* n */
.loadingScreen__text--brand .loadingScreen__char:nth-child(7) {
    color: #B388FF;
    animation-delay: 1.0s;
}

/* g */
.loadingScreen__text--brand .loadingScreen__char:nth-child(8) {
    color: #FF6B9D;
    animation-delay: 1.1s;
}

/* l */
.loadingScreen__text--brand .loadingScreen__char:nth-child(9) {
    color: #FFA07A;
    animation-delay: 1.2s;
}

/* i */
.loadingScreen__text--brand .loadingScreen__char:nth-child(10) {
    color: #6BCB77;
    animation-delay: 1.3s;
}

/* s */
.loadingScreen__text--brand .loadingScreen__char:nth-child(11) {
    color: #4D96FF;
    animation-delay: 1.4s;
}

/* h */

/* Loading Bar */
.loadingScreen__barWrap {
    width: 400px;
    height: 10px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 10px;
    position: relative;
    margin-top: 30px;
}

.loadingScreen__bar {
    width: 0%;
    height: 100%;
    background: #4D96FF;
    border-radius: 10px;
    animation: expandBar 1.7s 0.8s ease-out forwards;
}

.loadingScreen__barPercent {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    color: #4D96FF;
    font-weight: 700;
}

/* Keyframe Animations */
@keyframes floatInLogo {
    0% {
        transform: translateY(50px) scale(0.8) rotate(-5deg);
        opacity: 0;
    }

    60% {
        transform: translateY(-10px) scale(1.05) rotate(3deg);
        opacity: 1;
    }

    100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes floatBob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInStatus {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLogo {
    0% {
        transform: translateX(-100px);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes revealChar {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandBar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

@keyframes fadeInPercent {
    to {
        opacity: 1;
    }
}

@keyframes countPercent {
    0% {
        content: '0%';
    }

    10% {
        content: '10%';
    }

    20% {
        content: '20%';
    }

    30% {
        content: '30%';
    }

    40% {
        content: '40%';
    }

    50% {
        content: '50%';
    }

    60% {
        content: '60%';
    }

    70% {
        content: '70%';
    }

    80% {
        content: '80%';
    }

    90% {
        content: '90%';
    }

    100% {
        content: '100%';
    }
}

@keyframes fadeOutLoading {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loadingScreen__content {
        flex-direction: column;
        gap: 2rem;
    }

    .loadingScreen__logo {
        width: 80px;
        height: 80px;
    }

    .loadingScreen__text--tag {
        font-size: 1.5rem;
    }

    .loadingScreen__text--brand {
        font-size: 2rem;
    }

    .loadingScreen__barWrap {
        width: 300px;
    }
}