* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    height: 100vh;
    position: fixed;
    width: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 414px; /* iPhone Plus width */
    height: 100vh; /* fallback */
    height: calc(var(--vh, 1vh) * 100);
    max-height: 896px; /* iPhone Plus height */
    margin: auto;
    overflow: hidden;
    background: #000;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 414px;
    max-height: 896px;
    background: #1e3d4a;
    background-size: cover;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    touch-action: none;
}

/* On mobile devices, remove max-width/height constraints */
@media (max-width: 414px) {
    .game-container {
        max-width: none;
        max-height: none;
    }

    .game-wrapper {
        height: 100vh; /* fallback */
        height: calc(var(--vh, 1vh) * 100);
        max-height: none;
        position: fixed;
        top: env(safe-area-inset-top);
        bottom: env(safe-area-inset-bottom);
    }
}
/* Add desktop-specific styles */
@media (min-width: 415px) {
    .game-wrapper {
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }
}

/* Add iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .game-wrapper {
        /* Fix for iOS Safari */
        height: -webkit-fill-available;
    }
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-popup {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    animation: popup 0.3s ease-out;
}

.game-over-popup h2 {
    color: #333;
    margin-bottom: 1rem;
}

.game-over-popup button {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

.game-over-popup button:hover {
    background-color: #357abd;
}

@keyframes popup {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
} 

/* End Screen Styles */
.game-end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.game-end-buttons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.game-end-buttons img {
    position: absolute;
    transform-origin: left top;
    will-change: transform;
    backface-visibility: hidden; /* Performance optimization */
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Mobile optimization */
@media (max-width: 414px) {
    .game-end-content {
        padding: 20px;
        width: 90%;
    }

    .game-end-content h2 {
        font-size: 28px;
    }

    .game-end-content p {
        font-size: 20px;
    }

    .game-end-buttons {
        margin-top: 20px;
        gap: 15px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .game-end-content {
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
    }
}
 
/* Add at the top of the file */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

.loader-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-svg {
    width: 80px;
    height: 80px;
}
 
