/* ローディング中はスクロール不可 */
body.loading-active {
    overflow: hidden;
}

/* トップ2回目以降：長いローダーを隠し、サブ用ローダーを表示 */
#loading-sub.top-loader-sub {
    display: none;
}
body.top-return-visit #loading {
    display: none !important;
}
body.top-return-visit #loading-sub.top-loader-sub {
    display: flex !important;
}

/* ローディング全体 */
#loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* テキスト（PCは余裕ある表示） */
.text-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #000000;
    opacity: 0;
    text-align: center;
    word-break: keep-all;
    font-size: clamp(2rem, 5vw, 5rem);
    padding: 0 5vw;
}

.text-wrapper .loading-en {
    display: block;
    width: 100%;
    white-space: nowrap;
}

.text-wrapper .loading-ja {
    display: block;
    width: 100%;
    font-size: 0.4em;
    margin-top: 2rem;
    font-weight: 400;
    white-space: nowrap;
}

/* タブレット縦・スマホ：画面中央80％に収め、左右余白を確保してフォント縮小 */
@media (max-width: 1024px) {
    .text-wrapper {
        width: 80vw;
        max-width: 80vw;
        box-sizing: border-box;
        padding: 0 2vw;
        font-size: clamp(0.875rem, 2.5vw, 3rem);
    }
}

@media (max-width: 576px) {
    .text-wrapper {
        font-size: clamp(1rem, 2.9vw, 2.5rem);
    }

    .text-wrapper .loading-ja {
        font-size: 0.5em;
        margin-top: 1.25rem;
    }

    .loading-bar {
        bottom: -1rem;
    }
}

/* 文字分割された1文字 */
.text-wrapper .char {
    display: inline-block;
}

/* 下のバー */
.loading-bar {
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: #495769;
    border-radius: 2px;
}

/* 上から下に被さる幕 */
.black-overlay {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0378ad;
    z-index: 10;
    transition: top 0.5s ease;
}

/* ロゴ最終出現 */
.final-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    font-size: clamp(2rem, 8vw, 5rem);
    color: #ffffff;
    opacity: 0;
    z-index: 20;
    transform-origin: center center;
    padding: 0 5vw;
    text-align: center;
}

.final-text-logo {
    height: 1em;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.final-text-copy {
    white-space: nowrap;
}