﻿/* ===================================================================
   Loading Screen CSS（超滑らか版）
   - 60fps 保証
   - GPU アクセラレーション完全最適化
   =================================================================== */

/* ===================================================================
   CSS 変数定義
   =================================================================== */
:root {
    --loading-bg-start: #42a5f5;
    --loading-bg-end: #1e88e5;
    --global-loading-bg: rgba(66, 165, 245, 0.85);
}

/* ===================================================================
   Animations（60fps 保証版）
   =================================================================== */

/* 回転アニメーション（GPU 専用プロパティのみ使用） */
@keyframes spin {
    0% {
        transform: rotate(0deg) scale(1) translateZ(0);
    }

    100% {
        transform: rotate(360deg) scale(1) translateZ(0);
    }
}

@-webkit-keyframes spin {
    0% {
        -webkit-transform: rotate(0deg) scale(1) translateZ(0);
    }

    100% {
        -webkit-transform: rotate(360deg) scale(1) translateZ(0);
    }
}

/* パルスアニメーション */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@-webkit-keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===================================================================
   Loading Container
   =================================================================== */
.loading-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    opacity: 1 !important;
    /* GPU レイヤー強制分離 */
    transform: translateZ(0);
    will-change: opacity;
    isolation: isolate;
}

    .loading-container.fade-out {
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease-out;
    }

/* ===================================================================
   静的ローディング画面の背景
   =================================================================== */
#loading-screen {
    background: linear-gradient(135deg, var(--loading-bg-start) 0%, var(--loading-bg-end) 100%) !important;
    /* GPU レイヤー分離 */
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===================================================================
   Loading Spinner（超滑らか版）
   =================================================================== */
.loading-spinner {
    width: 80px !important;
    height: 80px !important;
    border: 6px solid rgba(255, 255, 255, 0.3) !important;
    border-top-color: white !important;
    border-radius: 50% !important;
    /* アニメーション設定（60fps保証） */
    animation: spin 1s linear infinite !important;
    -webkit-animation: spin 1s linear infinite !important;
    /* GPU アクセラレーション強制 */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
    /* レイヤー分離 */
    isolation: isolate;
    contain: layout style paint;
    /* アンチエイリアシング */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   Loading Text
   =================================================================== */
.loading-progress-text {
    margin-top: 2rem !important;
    font-size: 1.2rem !important;
    font-weight: 500 !important;
    color: white !important;
    letter-spacing: 0.05em !important;
    /* アニメーション設定 */
    animation: pulse 2s ease-in-out infinite !important;
    -webkit-animation: pulse 2s ease-in-out infinite !important;
    /* GPU 最適化 */
    will-change: opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    isolation: isolate;
}

/* ===================================================================
   Global Loading Overlay
   =================================================================== */
.global-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: var(--global-loading-bg) !important;
    z-index: 9998 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    /* GPU 最適化 */
    transform: translate3d(0, 0, 0);
    will-change: opacity;
    isolation: isolate;
}

.global-loading-spinner {
    width: 60px !important;
    height: 60px !important;
    border: 6px solid rgba(255, 255, 255, 0.3) !important;
    border-top-color: #ffffff !important;
    border-radius: 50% !important;
    /* アニメーション設定（60fps保証） */
    animation: spin 1s linear infinite !important;
    -webkit-animation: spin 1s linear infinite !important;
    /* GPU アクセラレーション強制 */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
    /* レイヤー分離 */
    isolation: isolate;
    contain: layout style paint;
    /* アンチエイリアシング */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.global-loading-message {
    margin-top: 20px !important;
    color: #ffffff !important;
    font-size: 1.2rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.05em !important;
    /* GPU 最適化 */
    transform: translateZ(0);
    will-change: opacity;
    isolation: isolate;
}

/* ===================================================================
   Print Styles
   =================================================================== */
@media print {
    .loading-container,
    .global-loading-overlay {
        display: none !important;
    }
}

/* ===================================================================
   アニメーション削減設定を無視
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .global-loading-spinner {
        animation: spin 1s linear infinite !important;
        -webkit-animation: spin 1s linear infinite !important;
    }

    .loading-progress-text {
        animation: pulse 2s ease-in-out infinite !important;
        -webkit-animation: pulse 2s ease-in-out infinite !important;
    }
}
