/* 1. LAYOUT & STRUCTURE */

/* Global layout for mobile & desktop */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000000;
}

/* Base grid layout: Header - Main - Footer */
body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr;
    background-image: url('../img/index/desert-sunset-8420320_1920.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

/* Expanded mobile game mode */
body.game-expanded {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Hide header and footer in expanded mobile game mode */
body.game-expanded header,
body.game-expanded footer {
    display: none;
}

/* Canvas positioning in expanded mode */
body.game-expanded #canvas {
    display: block;
    margin: 0;
}

/* Header + Footer */
header,
footer {
    background-color: #29292955;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    overflow: hidden;
    padding: 0;
}

header img,
footer img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
}

/* Center canvas inside <main> */
main {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
}

/* Canvas visual style */
canvas {
    max-width: 100vw;
    height: auto;
    background-color: #000000;
    border-radius: 25px;
    box-shadow: 0px 0px 80px 50px #000000;
    pointer-events: none;
    position: relative;
}

/* 2. TYPOGRAPHY */

h2 {
    margin: 6px;
    background: linear-gradient(90deg, #f7c368, #a1230a, #87ad2f);
    background-size: 300%;
    animation: gradientMove 8s ease-in-out infinite alternate;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* 3. OVERLAYS */

#loading-overlay {
    position: fixed;
    inset: 0;
    background: #000000cc;
    color: #ffffff;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

#loading-overlay.active {
    display: flex;
}

#loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #fff;
    border-top: 6px solid #ffaa00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* 4. ANIMATIONS */

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}