/* Font face for Minecraft font */
@font-face {
    font-family: 'Minecraft';
    src: url('font/MinecraftRegular-Bmg3.otf') format('opentype');
}

/* General body and html styles */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    font-family: 'Minecraft', sans-serif;
    color: #333;
    background-image: url('../Image/Background.png');
    background-repeat: repeat;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Body styles */
body {
    font-family: 'Minecraft', sans-serif;
    color: #333;
}

/* Content box styles */
#content-box {
    background-color: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 20px auto; /* Center the content box horizontally */
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Header styles */
#header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

#logo {
    width: 100px;
    height: 100px;
    margin-right: 20px;
    border-radius: 15px;
}

h1 {
    text-align: center;
    color: rgb(88, 50, 16);
    font-size: 3em;
    margin: 0;
}

/* Reveal container styles */
#reveal-container {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding-right: 20px;
    margin-bottom: 10px;
}

#revealCounter {
    font-size: 1.2em;
    color: #333;
}

/* Game container styles */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    margin-top: 20px;
}

/* Canvas styles */
#canvas {
    border: 2px solid #4CAF50;
    background-color: #fff;
}

/* Game area styles */
#gameArea {
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #4CAF50;
    border-radius: 10px;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    aspect-ratio: 1 / 1; /* Ensure the game area maintains a 1:1 aspect ratio */
}

#gameCanvas {
    width: 100%;
    height: 100%;
}

/* Controls styles */
#controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#guess-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

#guessInput {
    padding: 10px;
    font-size: 1em;
    border-radius: 5px;
    border: 2px solid #4CAF50;
    margin-right: 10px;
    width: 200px;
}

/* Button styles */
button {
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

#giveUpButton {
    background-color: #f44336; /* Red color for give up button */
}

#giveUpButton:hover {
    background-color: #d32f2f; /* Darker red on hover */
}

/* Message styles */
#message {
    margin-top: 20px;
    font-size: 18px;
    text-align: center;
}

/* Result styles */
#result {
    margin-top: 20px;
    font-size: 1.5em;
    color: #4CAF50;
}

/* Answer container styles */
#answer-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#scoreBox {
    margin-top: 10px;
    font-size: 1.5em;
    color: #4CAF50;
}

/* Popup styles */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100; /* Ensure popup is above ads */
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 90vw; /* Constrain the popup to be at maximum the width of the screen */
    max-height: 90vh; /* Constrain the popup to be at maximum the height of the screen */
    overflow: auto; /* Add scroll if content overflows */
}

.popup-content h2 {
    margin-top: 0;
}

.popup-content p {
    margin: 20px 0;
}

.popup-content button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.popup-content button:hover {
    background-color: #45a049;
}

.popup-content img {
    width: 100%;
    height: auto; /* Scale the height to fit the width */
    object-fit: contain;
}

.popup-content .center-button {
    text-align: center;
}

/* Footer styles */
footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8em;
    color: #666;
    padding: 10px;
    width: 80%;
    max-width: 800px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Top bar styles */
#top-bar {
    width: 100%;
    background-color: #181818;
    display: flex;
    justify-content: flex-end;
    padding: 10px;
}

#darkModeToggle {
    background-color: #1d1818;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
}

#darkModeToggle:hover {
    background-color: #130707;
}

/* Dark mode styles */
body.dark-mode, html.dark-mode {
    background-color: #343434;
    background-image: none; /* Remove background image in dark mode */
    color: #f0f0f0;
}

body.dark-mode #content-box {
    background-color: #202020;
    color: #f0f0f0;
}

body.dark-mode h1, 
body.dark-mode #revealCounter, 
body.dark-mode #result, 
body.dark-mode #scoreBox {
    color: #f0f0f0;
}

body.dark-mode button:hover {
    background-color: #666;
}

body.dark-mode .popup-content {
    background-color: #202020;
    color: #f0f0f0;
}

/* Tooltip styles */
#tooltip {
    color: black; /* Ensure tooltip text remains black */
}

/* Banner ad styles */
.banner-ad {
    position: fixed;
    width: 300px;
    height: 600px;
    z-index: 1000; /* Ensure ads are above other content */
}

.banner-left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.banner-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.banner-bottom {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 728px;
    height: 90px;
    z-index: 1000; /* Ensure ads are above other content */
}

.banner-mobile {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    z-index: 1000; /* Ensure ads are above other content */
    display: none; /* Default hidden */
}

@media (max-width: 600px) {
    body, html {
        flex-direction: column;
        align-items: stretch;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    #content-box {
        width: calc(100% - 60px); /* Ensure the content box fits within the screen width */
        margin: 20px auto; /* Center the content box horizontally */
        padding: 20px;
    }
    #header {
        flex-direction: column;
        align-items: center;
    }
    #logo {
        width: 80px;
        height: 80px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    h1 {
        font-size: 2em;
    }
    #gameArea {
        width: 90%;
        height: auto; /* Height will be automatically adjusted to maintain the aspect ratio */
    }
    #controls {
        width: 100%;
        padding: 10px;
    }
    #guess-container {
        flex-direction: column; /* Stack the elements vertically */
        align-items: stretch;
    }
    #guessInput {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    button {
        width: 100%;
        padding: 10px;
    }
    footer {
        width: calc(100% - 60px);
        padding: 20px;
        margin: 20px auto;
    }
    .banner-mobile {
        display: block; /* Show mobile ad on small screens */
    }

    .banner-left,
    .banner-right,
    .banner-bottom {
        display: none; /* Hide other ads on mobile */
    }
}

@media (min-width: 601px) {
    .banner-mobile {
        display: none; /* Ensure mobile ad is hidden on larger screens */
    }
}