/* Ensure body properly centers content */
body, html {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align content to the top */
    min-height: 100vh; /* Use min-height to allow content to expand */
    overflow-y: auto; /* Allow vertical scrolling */
}
html {
    touch-action: manipulation; /* Prevents double-tap zoom */
    -webkit-tap-highlight-color: transparent; /* Prevents highlighting */
}

/* Popup styles */
#correct-word-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8); /* Semi-transparent black overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#correct-word-popup .popup-content {
    background: #1a1a1a; /* Dark background color */
    padding: 20px;
    text-align: center;
    border-radius: 10px;
    color: #ffffff; /* White text color */
}

#correct-word-popup h1 {
    font-size: 3em;
    margin: 0;
    color: #ffffff; /* Ensure the header text is white */
}

#correct-word-popup h2 {
    color: #ffffff; /* Ensure the subheader text is white */
}

/* Missed words styles */
.missed-words-header {
    text-align: center;
    margin-top: 20px;
    font-size: 2em;
    color: #333333; /* Dark text color */
}

.missed-words-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.missed-word-card {
    background: #f9f9f9; /* Light background color */
    margin: 5px;
    padding: 15px 25px;
    font-size: 1.5em;
    border-radius: 8px;
    text-align: center;
    color: #333333; /* Dark text color */
    border: 2px solid #cccccc; /* Border for better visibility */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1); /* Subtle shadow */
}

/* Adjustments for better visibility on different devices */
@media (max-width: 600px) {
    #correct-word-popup .popup-content {
        padding: 15px;
    }
    #correct-word-popup h1 {
        font-size: 2em;
    }
    .missed-word-card {
        padding: 10px 15px;
        font-size: 1.2em;
    }
}

/* Center container for logo, image, and buttons */
#game-mode-selection {
    margin-top: 0; /* Remove extra margin */
    padding: 0px;
    background: #222; /* Card-like background */
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); /* Slight shadow */
    max-width: 350px; /* Constrain width */
    text-align: center;
}

/* Adjust spacing and size of the logo */
#game-mode-selection .wordlrush-logo {
    font-size: 50px; /* Larger font size */
    margin: 5px 0 15px; /* Reduce top margin, add bottom margin */
}

/* Style the image */
#results img {
    width: 230px;
    height: 230px;
    border-radius: 50%; /* Circle */
    object-fit: cover;
    margin-bottom: 15px; /* Spacing between image and buttons */
    border: 4px solid #FFD700; /* Gold border */
}

/* Style the image */
#game-mode-selection img {
    width: 230px;
    height: 230px;
    border-radius: 50%; /* Circle */
    object-fit: cover;
    margin-bottom: 15px; /* Spacing between image and buttons */
    border: 4px solid #FFD700; /* Gold border */
}

/* Heading for Game Mode */
#game-mode-selection h2 {
    font-size: 24px;
    margin: 10px 0 20px;
    color: #FFD700;
    font-weight: bold;
}

/* Game mode button styling */
#game-mode-selection button {
    width: 90%;
    padding: 12px 0;
    margin: 10px 0; /* Consistent margin between buttons */
    border-radius: 10px;
    font-size: 1.2em;
    color: #fff;
    background: linear-gradient(145deg, #444, #555); /* Gradient for better look */
    border: 2px solid #FFD700; /* Gold border */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); /* Subtle text shadow */
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3); /* Elevated shadow */
}

/* Button hover and active states */
#game-mode-selection button:hover {
    background: linear-gradient(145deg, #555, #666);
    transform: translateY(-3px); /* Slight lift on hover */
}

#game-mode-selection button:active {
    background: linear-gradient(145deg, #333, #444); /* Darker background */
    transform: translateY(1px); /* Pressed down effect */
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5); /* Inset shadow */
}


/* WordlRush Logo Styling */
.wordlrush-logo {
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 40px; /* Slightly smaller font */
    margin: 10px 0; /* Reduce spacing above and below */
    color: #FFD700; /* Bright gold */
    text-shadow: 2px 2px 5px #000;
}

/* Round Display */
#round-display {
    font-size: 16px;
    margin: 5px 0;
    color: #FFD700;
}

/* Stats Summary */
#round-display-stats {
    font-size: 14px;
    margin: 5px 0;
    color: #ccc;
    padding: 3px 10px;
    background: #222;
    border-radius: 8px;
    border: 1px solid #444;
}

/* Timer & Word Counter Styling */
#timer, #word-counter {
    font-size: 18px;
    margin: 5px 0;
    font-weight: bold;
    color: #fff; /* Keep prominent */
}

/* Center the entire game area */
#game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 350px;
    max-height: calc(100vh - 40px); /* Adjust max height for padding/margins */
    overflow-y: auto; /* Enable vertical scrolling */
    margin: 20px auto; /* Center-align */
    padding: 10px 5px; /* Reduced padding */
    box-sizing: border-box;
}

.guess-row {
    display: grid;
    grid-template-columns: repeat(5, 60px);
    grid-gap: 1px;
    justify-content: center;
}

.guess-box {
    width: 45px;
    height: 45px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    background-color: #222;
    color: #fff;
}

/* Colors for feedback */
.correct-position {
    background-color: #6aaa64; /* Green */
}

.wrong-position {
    background-color: #c9b458; /* Yellow */
}

.incorrect-letter {
    background-color: #555; /* Dark Gray */
    color: #000; /* Black font color */
}

/* Center the keyboard under grid */
#keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 20px;
    width: 100%;
    max-width: 450px; /* Set max-width for better fit on desktop */
    padding: 0; /* Remove padding for better centering */
    align-self: center;
    box-sizing: border-box;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 3px; /* Reduced gap between keys */
}

/* Define a more intense shake keyframes */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-15px); }
    20%, 40%, 60%, 80% { transform: translateX(15px); }
}

/* Shake effect class */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97); /* Longer duration, more intense */
    animation-iteration-count: 1; /* Shake only once */
}

.key {
    margin: 0; /* Remove margins to avoid extra spacing */
    padding: 10px 12px; /* Balanced padding for fit */
    border: none;
    background-color: #787c7e; /* Light Gray */
    font-size: 18px; /* Increase font size slightly */
    cursor: pointer;
    text-transform: uppercase;
    border-radius: 5px;
    flex: 1; /* Ensure keys expand evenly */
    color: #fff; /* White text */
}

/* Adjust "ENTER" and "DELETE" button sizes */
.key[data-key="ENTER"], .key[data-key="←"] {
    flex: 1.3; /* Slightly wider */
}

/* Keyboard Feedback Colors */
.key.correct-position {
    background-color: #6aaa64; /* Green */
    color: #fff;
}

.key.wrong-position {
    background-color: #c9b458; /* Yellow */
    color: #fff;
}

.key.incorrect-letter {
    background-color: #444; /* Dark Gray */
    color: #000; /* Black font color */
}

/* Center elements and style them */
#game-mode-selection, #game-area, #results {
    margin: 20px auto;
    text-align: center;
    width: 100%;
    max-width: 600px; /* Adjust width for proper centering */
}

/* Input field for words */
#word-input {
    text-transform: uppercase;
    font-size: 1.2em;
    padding: 10px;
    width: 200px;
    margin-right: 10px;
}

button#copy-to-clipboard {
    width: 250px; /* Set a fixed width */
    text-align: center; /* Center the text within the button */
}

button#share-your-score {
    width: 250px; /* Set a fixed width */
    text-align: center; /* Center the text within the button */
}

button#new-round {
    width: 250px; /* Set a fixed width */
    text-align: center; /* Center the text within the button */
}

/* Styling for results buttons */
#results button {
    width: 250px;
    padding: 12px 0;
    margin: 10px 0; /* Consistent margin between buttons */
    border-radius: 10px;
    font-size: 1.2em;
    color: #fff;
    background: linear-gradient(145deg, #444, #555); /* Gradient for better look */
    border: 2px solid #FFD700; /* Gold border */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); /* Subtle text shadow */
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3); /* Elevated shadow */
}

#results button:hover {
    width: 250px;
    background: linear-gradient(145deg, #555, #666);
    transform: translateY(-3px); /* Slight lift on hover */
}

#results button:active {
    width: 250px;
    background: linear-gradient(145deg, #333, #444); /* Darker background */
    transform: translateY(1px); /* Pressed down effect */
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5); /* Inset shadow */
}

/* Styling for the New Round button (if you want a distinct style) */
#new-round {
    background: linear-gradient(145deg, #FFD700, #FFC700); /* Vibrant gold color */
    color: #111; /* Dark text color for contrast */
}

#new-round:hover {
    background: linear-gradient(145deg, #FFC700, #FFB700); /* Darker gold on hover */
}

/* Read-only textarea for shareable link */
#shareable-link {
    width: 80%;
    height: 50px;
    font-size: 1em;
    margin-top: 10px;
    resize: none;
    border: 2px solid #555; /* Match border style */
    border-radius: 5px; /* Rounded corners */
    padding: 10px; /* Add padding for better readability */
    background-color: #222; /* Match background color */
    color: #fff; /* White text */
}

/* Styles for word results */
.word-result {
    margin-top: 10px;
    text-align: center;
}

.feedback-blocks {
    display: flex;
    justify-content: center;
    margin-top: 5px;
}

.block {
    width: 20px;
    height: 20px;
    margin: 2px;
    border-radius: 3px;
}

.block.correct-position {
    background-color: #6aaa64; /* Green */
}

.block.wrong-position {
    background-color: #c9b458; /* Yellow */
}

.block.incorrect-letter {
    background-color: #555; /* Dark Gray */
}

/* Media Query for Mobile Devices */
@media (max-width: 768px) {
    #wordle-grid {
        display: grid;
        grid-template-rows: repeat(6, 50px);
        grid-gap: 1px;
        margin-bottom: 21px;
        width: calc(100vw - 20px);
        max-width: 350px;
        padding: 0 5px;
        max-height: none;
        height: auto;
        overflow-y: auto;
    }
    #round-display, #round-display-stats {
        font-size: 12px; /* Smaller font for better spacing */
    }
    .guess-row {
        display: grid;
        grid-template-columns: repeat(5, 50px);
        grid-gap: 0px;
        justify-content: center;
    }
    #keyboard {
        max-width: 100%;
        padding: 0 0px;
    }
    /* Align the game board to the top */
    #game-area {
        padding: 5px; /* Reduce padding for smaller devices */
    }
    .key {
        padding: 8px 5px; /* Slightly reduced padding for mobile */
        font-size: 16px;
    }

    .key[data-key="ENTER"], .key[data-key="←"] {
        flex: 1.5;
    }
}



/* Styling for How to Play page enhancements */
#how-to-play {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    text-align: center;
    background-color: #222;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    line-height: 1.5em;
}

#how-to-play h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #FFD700; /* Same color as logo */
}

#how-to-play h2 {
    font-size: 1.8em;
    margin-top: 20px;
    color: #FFD700; /* Same color as logo */
    border-bottom: 2px solid #FFD700; /* Underline for section headers */
    padding-bottom: 10px;
}

#how-to-play h3 {
    font-size: 1.5em;
    margin-top: 15px;
    color: #FFD700; /* Accent color */
}

#how-to-play p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

#how-to-play ul {
    list-style-type: none;
    padding: 0;
    font-size: 1.2em;
    margin-bottom: 20px;
}

#how-to-play li {
    margin-bottom: 10px;
}

.correct-position {
    color: #fff;
    font-weight: bold;
}

.wrong-position {
    color: #fff;
    font-weight: bold;
}

.incorrect-letter {
    color: #888;
    font-weight: bold;
}

#how-to-play button {
    font-size: 1.2em;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(145deg, #333, #444);
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    text-transform: uppercase;
    margin-top: 20px;
}

#how-to-play button:hover {
    background: linear-gradient(145deg, #444, #555);
    transform: scale(1.05);
}

#how-to-play button:active {
    background: linear-gradient(145deg, #222, #333);
}

#theme-info {
    text-align: center;
    margin-top: 0px;
    margin-bottom: 15px;
    margin-right: 20px;
    margin-left: 20px;
    padding-bottom: 0px;
    background-color: #111;
    border: .1px solid #ddd;
    border-radius: 5px;
    border-color: #FFD700;
}

#theme-name {
    font-size: .7rem;
    color: #fff;
}

#theme-note {
    font-size: .7rem;
    color: #555;
}