/* =============================================
   FLAPPY MOON - Intro Loading Screen Styles
   Sequential intro with Moonsters Present + Flappy Moon
   ============================================= */

/* Loading Screen Container */
.flappy-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
    overflow: hidden;
}

.flappy-loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* =============================================
   INTRO SCREEN STYLES
   ============================================= */

/* Background Image - Full Cover */
.intro-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Intro Content Container */
.intro-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    padding-top: calc(60px + env(safe-area-inset-top));
}

/* Base styles for intro logos */
.intro-logo {
    max-width: 85%;
    height: auto;
    opacity: 0;
}

/* Phase 1: Moonsters Present - at top */
.intro-logo.moonsters-present {
    max-width: 320px;
    animation: fadeInScale 1.2s ease-out forwards;
    animation-delay: 0.3s;
}

/* Phase 2: Flappy Moon Title - centered below */
.intro-logo.flappy-title {
    max-width: 380px;
    margin-top: auto;
    margin-bottom: 50%;
    animation: fadeInUp 1s ease-out forwards;
    animation-delay: 1.5s;
}

/* Fade in with scale animation */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade in from below animation */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Bar Container - positioned at bottom */
.intro-progress-container {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    max-width: 80vw;
    z-index: 2;
}

/* iOS Safe Area for intro progress */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .intro-progress-container {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* =============================================
   LEGACY STYLES (kept for compatibility)
   ============================================= */

/* Animated Stars Background */
.loading-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.loading-stars::before,
.loading-stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgb(255, 247, 0);
    border-radius: 50%;
    box-shadow: 
        10vw 20vh 0 0 rgba(255,255,255,0.8),
        25vw 15vh 0 0 rgba(255,255,255,0.6),
        45vw 8vh 0 0 rgba(255,255,255,0.9),
        60vw 35vh 0 0 rgba(255,255,255,0.5),
        80vw 25vh 0 0 rgba(255,255,255,0.7),
        90vw 10vh 0 0 rgba(255,255,255,0.6),
        15vw 45vh 0 0 rgba(255,255,255,0.8),
        35vw 60vh 0 0 rgba(255,255,255,0.5),
        55vw 50vh 0 0 rgba(255,255,255,0.7),
        70vw 70vh 0 0 rgba(255,255,255,0.6),
        85vw 55vh 0 0 rgba(255,255,255,0.8),
        5vw 75vh 0 0 rgba(255,255,255,0.5),
        20vw 85vh 0 0 rgba(255,255,255,0.7),
        40vw 90vh 0 0 rgba(255,255,255,0.6),
        65vw 80vh 0 0 rgba(255,255,255,0.8),
        95vw 85vh 0 0 rgba(255,255,255,0.5),
        30vw 5vh 0 0 rgba(255,255,255,0.9),
        75vw 3vh 0 0 rgba(255,255,255,0.7);
    animation: twinkle 3s ease-in-out infinite alternate;
}

.loading-stars::after {
    animation-delay: 1.5s;
    box-shadow: 
        8vw 12vh 0 0 rgba(255,255,255,0.6),
        22vw 28vh 0 0 rgba(255,255,255,0.8),
        38vw 18vh 0 0 rgba(255,255,255,0.5),
        52vw 42vh 0 0 rgba(255,255,255,0.7),
        68vw 15vh 0 0 rgba(255,255,255,0.9),
        82vw 32vh 0 0 rgba(255,255,255,0.6),
        12vw 58vh 0 0 rgba(255,255,255,0.7),
        42vw 72vh 0 0 rgba(255,255,255,0.8),
        58vw 65vh 0 0 rgba(255,255,255,0.5),
        78vw 78vh 0 0 rgba(255,255,255,0.7),
        3vw 88vh 0 0 rgba(255,255,255,0.6),
        48vw 95vh 0 0 rgba(255,255,255,0.8),
        88vw 92vh 0 0 rgba(255,255,255,0.5);
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Main Loading Content */
.loading-content-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

/* Logo Container with Glow */
.loading-logo-container {
    position: relative;
    margin-bottom: 30px;
}

.loading-logo {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    object-fit: cover;
    animation: pulse-glow 2s ease-in-out infinite, float-bounce 3s ease-in-out infinite;
    filter: drop-shadow(0 0 25px rgba(0, 255, 136, 0.7));
}

/* =========================================================
   iPhone (no viewport meta / GameSalad webview):
   Upscale sizes (avoid transform/zoom blur)
   ========================================================= */
html.iphone-device #flappy-loading-screen .loading-content-wrapper {
    padding: 44px; /* 20px * 2.2 */
}

html.iphone-device #flappy-loading-screen .loading-logo-container {
    margin-bottom: 66px; /* 30px * 2.2 */
}

html.iphone-device #flappy-loading-screen .loading-logo {
    width: 308px;  /* 140px * 2.2 */
    height: 308px; /* 140px * 2.2 */
    border-radius: 44px; /* 20px * 2.2 */
}

@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 35px rgba(0, 255, 136, 0.9));
    }
}

@keyframes float-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-8px) scale(1.02);
    }
}

/* Orbiting Moon */
.loading-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    margin-top: -100px;
    margin-left: -100px;
    animation: orbit 3s linear infinite;
}

.loading-moon {
    position: absolute;
    top: 0;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

@keyframes orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Title */
.loading-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5), 0 0 40px rgba(0, 255, 136, 0.3);
    margin-bottom: 8px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.loading-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
    letter-spacing: 2px;
}

/* Progress Container */
.loading-progress-container {
    width: 280px;
    max-width: 80vw;
}

/* Progress Bar */
.loading-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88 0%, #00d4aa 50%, #00ff88 100%);
    background-size: 200% 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease-out;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading Status Text */
.loading-status {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    min-height: 18px;
}

.loading-percentage {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #00ff88;
    margin-top: 12px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

html.iphone-device #flappy-loading-screen .loading-title {
    font-size: 62px; /* 28px * 2.2 */
    letter-spacing: 6px;
    margin-bottom: 18px; /* 8px * 2.2 */
}

html.iphone-device #flappy-loading-screen .loading-subtitle {
    font-size: 31px; /* 14px * 2.2 */
    margin-bottom: 88px; /* 40px * 2.2 */
    letter-spacing: 4px;
}

html.iphone-device #flappy-loading-screen .loading-progress-container {
    width: 616px; /* 280px * 2.2 */
}

html.iphone-device #flappy-loading-screen .loading-progress-track {
    height: 13px; /* 6px * 2.2 */
    border-radius: 7px;
    margin-bottom: 35px; /* 16px * 2.2 */
}

html.iphone-device #flappy-loading-screen .loading-status {
    font-size: 26px; /* 12px * 2.2 */
    min-height: 40px; /* 18px * 2.2 */
    letter-spacing: 2px;
}

html.iphone-device #flappy-loading-screen .loading-percentage {
    font-size: 35px; /* 16px * 2.2 */
    margin-top: 26px; /* 12px * 2.2 */
}

/* Loading Tips */
.loading-tips {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 320px;
    text-align: center;
}

.loading-tip {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: fade-tip 4s ease-in-out infinite;
}

@keyframes fade-tip {
    0%, 100% { opacity: 0; transform: translateY(10px); }
    20%, 80% { opacity: 1; transform: translateY(0); }
}

/* Animated Dots for Status */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Tap to Continue (shown after loading) */
.loading-tap-continue {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    opacity: 0;
    animation: tap-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

.loading-tap-continue.show {
    opacity: 1;
    pointer-events: auto;
}

@keyframes tap-pulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* Responsive Adjustments */
@media (max-height: 600px) {
    .loading-logo {
        width: 100px;
        height: 100px;
        border-radius: 15px;
    }
    
    .loading-orbit {
        width: 150px;
        height: 150px;
        margin-top: -75px;
        margin-left: -75px;
    }
    
    .loading-moon {
        width: 14px;
        height: 14px;
        margin-left: -7px;
        margin-top: -7px;
    }
    
    .loading-title {
        font-size: 22px;
    }
    
    .loading-subtitle {
        font-size: 12px;
        margin-bottom: 25px;
    }
    
    .loading-tips {
        bottom: 40px;
    }
}

@media (max-width: 360px) {
    .loading-title {
        font-size: 20px;
        letter-spacing: 2px;
    }
    
    .loading-progress-container {
        width: 240px;
    }
}

/* iOS Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    .flappy-loading-screen {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

