/* Theme variables */
:root {
    --background-color: #ffffff;
    --text-color: #333333;
    --modal-bg: #ffffff;
}

[data-theme="dark"] {
    --background-color: #000000;
    --text-color: #ffffff;
    --modal-bg: #1a1a1a;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.game-body{
    display: flex;
}

#gameContainer {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%; /* Ensure full width */
    cursor: default;
}

.game-intro {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.game-intro h1 {
    font-size: 3.5rem;
    color: #189afe; /* Keep the blue title */
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.game-intro p {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-top: 0;
}

#startButton {
    position: relative;
    z-index: 1;
    display: block;
    margin: 20px auto;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#startButton:hover {
    background-color: #1976D2;
}

#gameOverModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(-100vh);
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 500px;
    height: 40vh;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#gameOverModal.active {
    transform: translate(-50%, -50%) translateY(0);
}

#gameOverModal h2 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 1.5rem;
}

#finalScoreMessage {
    font-size: 1.4rem;
    margin: 1.5rem 0;
    color: #666;
}

#restartButton {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    background-color: #3F51B5; /* Dark blue/purple */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restartButton:hover {
    background-color: #303F9F; /* Darker shade for hover */
}

#gameCanvas {
    display: none;
    border: 2px solid #333;
    border-radius: 8px;
    margin: 0 auto;
    cursor: default !important;
    width: 100%;
    height: auto;
    max-width: 900px;
}

canvas {
    border: 1px solid #000;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px; /* Add some margin for spacing */
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dark overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure modal is on top */
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
    animation: slideDown 0.5s ease; /* Slide down animation */
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

#scoreMessage {
    position: absolute;
    font-size: 24px;
    color: red;
    display: none; /* Initially hidden */
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.loading-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

.loading-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.loading-bar-container {
    width: 300px;
    height: 20px;
    background-color: #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3F51B5, #2196F3);
    transition: width 0.1s ease;
    border-radius: 10px;
}

.how-to-play-modal {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000; /* Make sure this is higher than other elements */
    transition: all 0.5s ease;
}

.how-to-play-modal.active {
    right: 0;
}

.how-to-play-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--modal-bg);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    min-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: var(--text-color);
}

.how-to-play-content h2 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.instructions {
    text-align: left;
    margin-bottom: 2rem;
}

.instructions p {
    margin: 1rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-buttons button {
    padding: 10px250px;
    border: none;
    border-radius: 40px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}

.start-playing {
    background-color: #2196F3;
    color: white;
}

/* Add this to your existing CSS file */
.contact-button {
    display: inline-block; /* Make it behave like a button */
    padding: 15px 15px; /* Add some padding */
    background-color: #4F27A8;/* Green background */
    color: white; /* White text */
    text-align: center; /* Center the text */
    text-decoration: none; /* Remove underline */
    border-radius: 30px; /* Rounded corners */
    font-family: 'Poppins', sans-serif; /* Match game font */
    font-size: 1rem; /* Font size */
    transition: background-color 0.3s; /* Smooth transition */
    margin: 5px;
}

.contact-button:hover {
    opacity: 0.7; 
}

.skip-tutorial {
    background-color: #e0e0e0;
    color: #666;
}

.help-button {
    position: absolute;
    top: 20px;
    right: 145px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #2196F3;
    color: white;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
    transition: 0.3s;
}

.help-button:hover {
    background-color: #1976D2;
    transform: scale(1.1);
}

.settings-container {
    position: absolute; /* Positioning relative to the game container */
    top: 80px; /* Adjust as needed */
    right: 30px; /* Adjust as needed */
    display: flex;
    flex-direction: column; /* Stack vertically on mobile */
    align-items: center; /* Align items to the start */
    z-index: 10; /* Ensure it appears above other elements */
}

.setting {
    display: flex;
    align-items: center; /* Center items vertically */
    margin: 5px 0; /* Space between settings */
}

.setting label {
    margin-right: 10px; /* Space between label and checkbox */
    font-family: 'Poppins', sans-serif; /* Match game font */
    font-size: 16px; /* Adjust font size */
}

.setting input[type="checkbox"] {
    width: 20px; /* Adjust checkbox size */
    height: 20px; /* Adjust checkbox size */
}

/* Media query for mobile responsiveness */
@media (max-width: 900px) {
    .settings-container {
        flex-direction: column;
    }
    
    #gameCanvas {
        width: 90vw !important;
        height: auto;
    }
    
    /* Increase score text size for mobile */
    .game-score {
        font-size: 24px !important; /* Regular score */
    }
    
    .game-high-score {
        font-size: 20px !important; /* High score */
    }
    
    /* Adjust game over modal text for mobile */
    #gameOverModal {
        width: 90%;
        padding: 1.5rem;
    }
    
    #finalScoreMessage {
        font-size: 1.6rem;
    }
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px; /* Position next to help button */
    width: 100px;
    height: 40px;
    border-radius: 20px;
    background-color: #4f43ff;
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 0;
    transition: 0.3s;
    overflow: hidden; /* Ensure emojis don't overflow */
}

/* Style for the sun and moon icons */
.theme-toggle .sun,
.theme-toggle .moon {
    position: absolute;
    transition: opacity 0.3s, transform 0.3s;
}

/* Default state (light mode) */
.theme-toggle .sun {
    opacity: 1;
}

.theme-toggle .moon {
    opacity: 0;
}

/* Dark mode state */
[data-theme="dark"] .theme-toggle .sun {
    opacity: 0;
}

[data-theme="dark"] .theme-toggle .moon {
    opacity: 1;
}

.theme-toggle:hover {
    background-color: #7a71ff;
    transform: scale(1.1);
}

/* Add these classes to help with score styling */
.game-score {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); /* Add shadow for better visibility */
}

.game-high-score {
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@media (max-width: 700px) {
    .top-information {
        display: flex;
        position: static;
        top: 20px;
    }

    .settings-container {
        flex-direction: row;
    }

    #gameCanvas {
        height: calc(95vw * 0.778) !important; /* Maintain 9:7 ratio (700/900 = 0.778) */
        max-height: 80vh; /* Prevent it from being too tall */
    }
}

/* Player name input */
.player-name-container {
    margin-top: 40px;
    text-align: center;
    z-index: 2;
}

.player-name-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: var(--text-color);
}

#playerNameInput {
    padding: 8px 12px;
    border: 2px solid #2196F3;
    border-radius: 6px;
    font-size: 1rem;
    background: var(--modal-bg);
    color: var(--text-color);
    text-align: center;
    width: 200px;
}

/* Leaderboard button */
.leaderboard-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #2196F3;
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    transition: 0.3s;
    display: flex;           /* Add flex display */
    justify-content: center; /* Center horizontally */
    align-items: center;     /* Center vertically */
    padding: 0;             /* Remove padding */
    line-height: 1;         /* Adjust line height */
}

/* Leaderboard modal */
.leaderboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
}

.leaderboard-modal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--modal-bg);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 5px 0;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 6px;
}

.leaderboard-item.highlight {
    background: rgba(33, 150, 243, 0.3);
    font-weight: bold;
}

/* Footer Styles */
.site-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /* background-color: var(--background-color); */
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--text-color);
}

.site-footer a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
}

.site-footer a:hover {
    text-decoration: underline;
}