/* General Styles */
body {
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: #ffffff;
    font-family: 'Arial';
}

/* Top Menu */
#top-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1e1e1e;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

#logo h1 {
    margin: 0;
    font-size: 1.5em;
}

#menu-buttons {
    display: flex;
    gap: 10px;
}

.nav-button {
    padding: 8px 12px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.nav-button:hover {
    background-color: #555555;
}

#volume-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#volume-controls label {
    margin-right: 5px;
    font-size: 0.9em;
}

#volume-controls input[type="range"] {
    width: 100px;
}

/* Hero Section */
#hero-section {
    padding: 40px 20px;
    text-align: center;
    background-color: #1e1e1e;
}

#hero-section h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

#hero-section p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

#hero-image {
    width: 300px;
    max-width: 100%;
    border-radius: 10px;
}

/* Difficulty Selection */
#difficulty-section {
    padding: 20px;
    text-align: center;
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.difficulty-button {
    padding: 10px 20px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    min-width: 120px;
}

.difficulty-button:hover {
    background-color: #555555;
}

/* Game Section */
#game-section {
    padding: 20px;
    text-align: center;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#game-difficulty {
    font-size: 1.5em;
    margin: 0;
}

#game-grid {
    display: grid;
    grid-gap: 5px;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 90vmin;
    height: 90vmin;
    max-width: 800px;
    max-height: 800px;
    aspect-ratio: 1 / 1;
    background-color: #1e1e1e;
    padding: 10px;
    border-radius: 10px;
}

/* Tile Styles */
.tile {
    width: 100%;
    height: 100%;
    position: relative;
    perspective: 1000px; /* Enable 3D space for flipping */
}

.tile-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

/* Flipping the tile to show the front side */
.tile.flipped .tile-inner {
    transform: rotateY(180deg);
}

/* Front and Back of the tile */
.tile-front, .tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 2px solid white; /* White border for the back */
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
}

/* Default: Back side (shows 'Monkey Memory' text) */
.tile-back {
    background-color: #007BFF; /* Blue background */
    color: #ffffff;
    transform: rotateY(0deg); /* Default visible side */
    text-align: center;
    flex-direction: column;
}

.tile-back span {
    display: block;
}

.tile-back .monkees {
    font-weight: bold;
    font-size: 1em;
}

.tile-back .memory {
    font-weight: bold;
    font-size: 1em;
}

/* Flipped: Front side (shows monkey image) */
.tile-front {
    background-color: #2c2c2c;
    transform: rotateY(180deg); /* Hidden by default */
}

.tile-front img {
    width: 100%;
    height: 100%;
    border-radius: 5px;
    object-fit: cover;
}

/* Matched Tiles */
.tile.matched {
    background-color: #4caf50;
    cursor: default;
}

.tile.matched .tile-inner {
    transform: rotateY(180deg);
}


/* Statistics Section */
#statistics-section {
    padding: 20px;
    text-align: center;
    background-color: #1e1e1e;
}

.stats-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #2c2c2c;
    padding: 15px;
    border-radius: 10px;
    width: 150px;
    text-align: center;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

#restart-button {
    padding: 10px 20px;
    background-color: #ff5722;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#restart-button:hover {
    background-color: #e64a19;
}

/* About Section */
#about-section {
    padding: 40px 20px;
    text-align: center;
}

#about-section h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

#about-section p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

#about-image {
    width: 300px;
    max-width: 100%;
    border-radius: 10px;
}

/* Leaderboard Section */
#leaderboard-section {
    padding: 20px;
    text-align: center;
    background-color: #1e1e1e;
}

#leaderboard-section h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

#leaderboard-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.leaderboard-entry {
    background-color: #2c2c2c;
    padding: 10px 20px;
    border-radius: 5px;
    width: 80%;
    max-width: 500px;
    text-align: left;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
    .tile-back .monkees,
    .tile-back .memory {
        font-size: 0.9em;
    }

    #hero-image, #about-image {
        width: 250px;
    }
}

@media screen and (max-width: 768px) {
    #top-menu {
        flex-direction: column;
        align-items: flex-start;
    }

    #menu-buttons {
        margin: 10px 0;
    }

    #volume-controls {
        width: 100%;
        justify-content: space-between;
    }

    .difficulty-buttons {
        flex-direction: column;
    }

    .difficulty-button {
        width: 80%;
    }

    .stats-cards {
        flex-direction: column;
    }

    .stat-card {
        width: 80%;
    }

    #game-grid {
        width: 95vmin;
        height: 95vmin;
        max-width: 500px;
        max-height: 500px;
    }

    .tile {
        width: 100%;
        height: 100%;
    }

    .tile-front img {
        display: none; /* Ensure images don't overflow on small screens */
    }
}
