/* ============================================================================
   SHARED LOADING SCREEN - Used by both initial HTML and Blazor overlay
   ============================================================================ */

/* Base loading screen styles - shared by both initial and Blazor loading */
#initial-loading,
#blazor-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Layer ordering - initial loading on top during handoff */
#initial-loading {
    z-index: 10000;
}

#blazor-loading {
    z-index: 9999;
}

/* Visibility states for Blazor component */
#blazor-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#blazor-loading.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Blazor loading starts with paused animations to sync with initial loading */
#blazor-loading {
    opacity: 0;
}

#blazor-loading * {
    animation-play-state: paused !important;
}

/* When synced and ready to show */
#blazor-loading.synced {
    opacity: 1;
}

#blazor-loading.synced * {
    animation-play-state: running !important;
}

/* Animated Background Orbs */
#initial-loading .animated-bg,
#blazor-loading .animated-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#initial-loading .gradient-orb,
#blazor-loading .gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    animation: float 8s ease-in-out infinite;
}

#initial-loading .orb-1,
#blazor-loading .orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ff6b6b 0%, #ee5a6f 100%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

#initial-loading .orb-2,
#blazor-loading .orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #4ecdc4 0%, #44a08d 100%);
    bottom: -150px;
    right: -150px;
    animation-delay: 2s;
}

#initial-loading .orb-3,
#blazor-loading .orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #a8e6cf 0%, #ffd3b6 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Loading Container */
#initial-loading .loading-container,
#blazor-loading .loading-container {
    position: relative;
    text-align: center;
    z-index: 10;
}

/* Game Controller Animation */
#initial-loading .game-controller,
#blazor-loading .game-controller {
    margin: 0 auto 40px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(-5deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(-20px) rotate(5deg);
    }
}

#initial-loading .controller-body,
#blazor-loading .controller-body {
    position: relative;
    width: 160px;
    height: 100px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    border-radius: 50px 50px 40px 40px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.5),
    inset 0 -5px 20px rgba(0, 0, 0, 0.2);
    margin: 0 auto;
}

/* D-Pad */
#initial-loading .dpad,
#blazor-loading .dpad {
    position: absolute;
    left: 25px;
    top: 30px;
    width: 40px;
    height: 40px;
}

#initial-loading .dpad-btn,
#blazor-loading .dpad-btn {
    position: absolute;
    background: #ffffff;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#initial-loading .dpad-up, #initial-loading .dpad-down,
#blazor-loading .dpad-up, #blazor-loading .dpad-down {
    width: 12px;
    height: 16px;
    left: 14px;
}

#initial-loading .dpad-up,
#blazor-loading .dpad-up {
    top: 0;
    animation: glow-up 1.5s ease-in-out infinite;
}

#initial-loading .dpad-down,
#blazor-loading .dpad-down {
    bottom: 0;
    animation: glow-down 1.5s ease-in-out infinite;
    animation-delay: 1s;
}

#initial-loading .dpad-left, #initial-loading .dpad-right,
#blazor-loading .dpad-left, #blazor-loading .dpad-right {
    width: 16px;
    height: 12px;
    top: 14px;
}

#initial-loading .dpad-left,
#blazor-loading .dpad-left {
    left: 0;
    animation: glow-left 1.5s ease-in-out infinite;
    animation-delay: 0.5s;
}

#initial-loading .dpad-right,
#blazor-loading .dpad-right {
    right: 0;
    animation: glow-right 1.5s ease-in-out infinite;
    animation-delay: 1.5s;
}

/* Action Buttons */
#initial-loading .action-buttons,
#blazor-loading .action-buttons {
    position: absolute;
    right: 25px;
    top: 25px;
    width: 50px;
    height: 50px;
}

#initial-loading .btn-circle,
#blazor-loading .btn-circle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#initial-loading .btn-y,
#blazor-loading .btn-y {
    background: #ffd93d;
    top: 0;
    left: 17px;
    animation: press 2s ease-in-out infinite;
    animation-delay: 0s;
}

#initial-loading .btn-b,
#blazor-loading .btn-b {
    background: #ff6b6b;
    right: 0;
    top: 17px;
    animation: press 2s ease-in-out infinite;
    animation-delay: 0.5s;
}

#initial-loading .btn-a,
#blazor-loading .btn-a {
    background: #95e1d3;
    bottom: 0;
    left: 17px;
    animation: press 2s ease-in-out infinite;
    animation-delay: 1s;
}

#initial-loading .btn-x,
#blazor-loading .btn-x {
    background: #a8e6cf;
    left: 0;
    top: 17px;
    animation: press 2s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes press {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(0.85);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
}

@keyframes glow-up {
    0%, 100% {
        background: #ffffff;
    }
    50% {
        background: #ffd93d;
        box-shadow: 0 0 10px #ffd93d;
    }
}

@keyframes glow-down {
    0%, 100% {
        background: #ffffff;
    }
    50% {
        background: #ff6b6b;
        box-shadow: 0 0 10px #ff6b6b;
    }
}

@keyframes glow-left {
    0%, 100% {
        background: #ffffff;
    }
    50% {
        background: #95e1d3;
        box-shadow: 0 0 10px #95e1d3;
    }
}

@keyframes glow-right {
    0%, 100% {
        background: #ffffff;
    }
    50% {
        background: #a8e6cf;
        box-shadow: 0 0 10px #a8e6cf;
    }
}

/* Loading Text */
#initial-loading .loading-text-container,
#blazor-loading .loading-text-container {
    color: #ffffff;
}

#initial-loading .loading-title,
#blazor-loading .loading-title {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Montserrat', 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

#initial-loading .loading-subtitle,
#blazor-loading .loading-subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: #a8b2d1;
    margin-bottom: 20px;
    font-family: 'Inter', sans-serif;
}

#initial-loading .loading-dots,
#blazor-loading .loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

#initial-loading .dot,
#blazor-loading .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    animation: dot-bounce 1.4s infinite ease-in-out;
}

#initial-loading .dot:nth-child(1),
#blazor-loading .dot:nth-child(1) {
    animation-delay: -0.32s;
}

#initial-loading .dot:nth-child(2),
#blazor-loading .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}
