/* --- game/game.css --- */

/* This CSS file is specifically for styling elements related to the game on games.html */

body {
    /* Ensure body is set up for full-page sections */
    margin: 0;
    padding: 0;
    background: linear-gradient(to bottom, #050514, #000000); /* Match the cosmic background */
    overflow-x: hidden; /* Prevent horizontal scroll */
    position: relative;
    min-height: 100vh; /* Ensure body takes at least full viewport height */
}

/* The global cosmic-scene and cosmicCanvas should be positioned fixed */
.cosmic-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2; /* Behind everything */
    /* The canvas inside here is for the background stars */
}

/* Make header relative so content flows below it in portrait mobile */
header {
     position: relative; /* Override global fixed positioning for content flow */
}

/* Main section that contains the game */
.game-section {
    padding: clamp(1rem, 2vw, 2rem);
    margin-top: clamp(1rem, 2vw, 2rem); /* Add some space below the header */
    text-align: center;
    color: #fff;
    position: relative;
    z-index: 1; /* Ensure game content is above the background */
    min-height: calc(100vh - clamp(1rem, 2vw, 2rem) - clamp(1rem, 3vh, 3.125rem)); /* Simple calc for content height */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-section h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    text-shadow: 0 0 15px #00eaff;
    margin-bottom: clamp(0.5rem, 1vw, 1rem);
}

.game-section p {
     font-family: 'Exo 2', sans-serif;
     font-size: clamp(0.9rem, 1.8vw, 1.25rem);
     opacity: 0.9;
     margin-bottom: clamp(1rem, 2vw, 2rem);
}


/* Container for the game canvas and overlay */
.game-area {
    position: relative; /* Needed for absolute positioning of overlay */
    width: 100%;
    max-width: 900px; /* Max width for the game area */
    aspect-ratio: 16 / 9; /* Maintain a common widescreen aspect ratio */
    margin: 0 auto; /* Center the game area */
    border: 3px solid #00eaff; /* Holographic border */
    border-radius: 10px;
    overflow: hidden; /* Hide anything outside the border */
    box-shadow: 0 0 20px #00eaff, 0 0 10px rgba(0, 234, 255, 0.7);
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent background if canvas alpha is used */
    display: flex; /* Use flex to center canvas if needed */
    justify-content: center;
    align-items: center;
}

/* The Three.js game canvas */
#genesisDefenseCanvas {
    display: block; /* Remove extra space below canvas */
    width: 100%; /* Fill the game-area container */
    height: 100%; /* Fill the game-area container */
    position: absolute; /* Position inside .game-area */
    top: 0;
    left: 0;
    z-index: 2; /* Above the semi-transparent background */
}

/* Overlay for loading, messages, play button */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Dark overlay */
    z-index: 10; /* Above the game canvas */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.overlay-content {
    padding: clamp(1rem, 2vw, 2rem);
    border-radius: 10px;
    color: #fff;
    font-family: 'Exo 2', sans-serif;
}

.overlay-content h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    text-shadow: 0 0 10px #00eaff;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* Basic Loading Spinner */
.loading-spinner {
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #00eaff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: clamp(1rem, 2vw, 1.5rem) auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Styling for the "Play Now" button in the overlay */
#playGameButton {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    font-size: clamp(1rem, 2vw, 1.5rem);
    padding: clamp(0.5rem, 1vw, 0.8rem) clamp(1rem, 2vw, 1.5rem);
    min-width: clamp(180px, 20vw, 220px);
}

#walletConnectMessage {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    color: #ffd700; /* Highlight message */
}


/* Area below the game for info */
.game-info {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    padding: clamp(0.75rem, 1.5vw, 1.25rem);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00eaff;
    border-radius: 10px;
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: space-around; /* Distribute info items */
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: clamp(0.5rem, 1vw, 1rem);
}

.game-info p, .game-info .ai-hint {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    text-shadow: 0 0 8px rgba(0, 234, 255, 0.5);
}

.game-info .ai-hint {
    font-family: 'Exo 2', sans-serif; /* AI hint text might use a different font */
    color: #ffd700; /* Gold color for AI */
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    width: 100%; /* Take full width */
    text-align: center;
    margin-top: clamp(0.5rem, 1vw, 1rem);
}


/* =================================== */
/* MOBILE AND TABLET LANDSCAPE STYLES  */
/* =================================== */
@media (max-width: 2340px) and (orientation: landscape) {
    .game-section {
         margin-top: clamp(0.5rem, 1vw, 1rem); /* Less space above game in landscape */
    }
    .game-section h2 {
        font-size: clamp(1.5rem, 3vw, 2.2rem);
    }
    .game-section p {
        font-size: clamp(0.7rem, 1.5vw, 1rem);
        margin-bottom: clamp(0.5rem, 1vw, 1rem);
    }
    .overlay-content h3 {
        font-size: clamp(1.2rem, 2.5vw, 1.8rem);
         margin-bottom: clamp(0.7rem, 1.5vw, 1rem);
    }
    #playGameButton {
        font-size: clamp(0.8rem, 1.5vw, 1.1rem);
        padding: clamp(0.4rem, 0.8vw, 0.6rem) clamp(0.8rem, 1.5vw, 1.2rem);
        min-width: clamp(150px, 18vw, 180px);
    }
     #walletConnectMessage {
        font-size: clamp(0.7rem, 1.5vw, 1rem);
     }
     .game-info p, .game-info .ai-hint {
        font-size: clamp(0.7rem, 1.2vw, 1rem);
     }
     .game-info {
        margin-top: clamp(1rem, 2vw, 1.5rem);
        padding: clamp(0.5rem, 1vw, 0.8rem);
     }
}


/* =================================== */
/* MOBILE AND TABLET PORTRAIT STYLES   */
/* =================================== */
@media (max-width: 768px) and (orientation: portrait) {
    .game-section {
         padding: clamp(0.5rem, 1.5vw, 1rem);
         margin-top: clamp(0.5rem, 1.5vw, 1rem); /* Less space above game in portrait */
         min-height: calc(100vh - clamp(0.5rem, 1.5vw, 1rem) - clamp(1rem, 3vh, 1.875rem)); /* Adjust calc */
    }
     .game-section h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
     }
     .game-section p {
        font-size: clamp(0.8rem, 2vw, 1rem);
        margin-bottom: clamp(0.8rem, 2vw, 1.2rem);
     }
    .game-area {
        border-width: 2px;
        border-radius: 8px;
         aspect-ratio: 4 / 3; /* Maybe a more mobile-friendly aspect ratio? Or keep 16/9? */
    }
    .overlay-content h3 {
        font-size: clamp(1.2rem, 3vw, 1.8rem);
         margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
    }
    #playGameButton {
        font-size: clamp(0.9rem, 2vw, 1.1rem);
        padding: clamp(0.5rem, 1.5vw, 0.8rem) clamp(1rem, 2.5vw, 1.5rem);
        min-width: clamp(150px, 30vw, 180px);
    }
     #walletConnectMessage {
        font-size: clamp(0.8rem, 2vw, 1rem);
     }
     .game-info p, .game-info .ai-hint {
        font-size: clamp(0.7rem, 1.8vw, 0.9rem);
        flex-basis: 45%; /* Two items per row */
        text-align: center;
     }
     .game-info .ai-hint {
        flex-basis: 100%; /* AI hint takes full width */
     }
     .game-info {
        margin-top: clamp(1rem, 2.5vw, 1.5rem);
        padding: clamp(0.5rem, 1.5vw, 0.8rem);
        gap: clamp(0.5rem, 1.5vw, 0.8rem);
     }
}

/* Smaller Mobile Devices (Portrait) */
@media (max-height: 480px) and (orientation: portrait) {
    .game-section h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); margin-bottom: clamp(0.3rem, 1vw, 0.5rem); }
    .game-section p { font-size: clamp(0.7rem, 2vw, 0.8rem); margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem); }
    .game-area { aspect-ratio: 16 / 9; /* Keep widescreen if height is very limited */ }
    .overlay-content h3 { font-size: clamp(1rem, 3vw, 1.2rem); margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem); }
    #playGameButton { font-size: clamp(0.7rem, 2vw, 0.8rem); min-width: clamp(120px, 25vw, 140px); padding: clamp(0.3rem, 1vw, 0.5rem); }
    #walletConnectMessage { font-size: clamp(0.7rem, 1.8vw, 0.8rem); }
    .game-info p, .game-info .ai-hint { font-size: clamp(0.6rem, 1.5vw, 0.75rem); }
    .game-info { gap: clamp(0.3rem, 1vw, 0.5rem); padding: clamp(0.4rem, 1vw, 0.6rem); }
}


/* Ensure global styles for header, footer, etc. apply correctly */
/* (No need to redefine them here, they are linked in games.html) */