/* Dark Mode */
body {
    font-family: 'Arial', sans-serif;
    background-color: #121212;
    color: #f4f4f4;
    background-image: url('/wp-content/themes/astra-child/images/back1.jpg') !important; 
    background-size: cover; /* Resize image to cover the entire screen */
    background-position: center; /* Center the image */
    background-repeat: no-repeat; /* Prevent repeating */
    background-attachment: fixed; /* Optional: Keep image fixed while scrolling */
    margin: 0;
    padding: 0;
}

.container {
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
    background: rgba(30, 30, 40, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

@supports not (backdrop-filter: blur(10px)) {
    .container {
        background: rgba(30, 30, 40, 0.95);
    }
}

h1 {
    color: #ad9360;
    margin-bottom: 10px;
    font-size: 30px;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    h1 {
        color: #ad9360;
        margin-bottom: 10px;
        font-size: 24px; /* Slightly smaller on mobile */
    }

    .container {
        padding: 5px;
    }

    #quiz-container {
        padding: 5px;
    }

    .score-display {
        top: 105px;
        left: 10px;
        font-size: 14px; /* Smaller font size */
        padding: 8px 12px; /* Smaller padding */
    }

    #mute-button {
        top: 105px; /* Adjusted for mobile */
        right: 10px;
        font-size: 18px; /* Smaller font size */
        padding: 6px 10px; /* Smaller padding */
    }

    .words-count-display, .score-display-inline {
        font-size: 12px !important;
        padding: 2px 8px !important;
    }

    #welcome-container {
        padding: 15px;
        margin: 10px;
    }
    
    .input-field input,
    #start-quiz {
        padding: 10px 15px;
        font-size: 16px;
    }
    
    .grid-size-option {
        padding: 8px 15px;
        font-size: 14px;
    }
}

#quiz-container {
    background-color: #1e1e1e; /* Dark mode background */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

#welcome-container {
    background: linear-gradient(160deg, rgba(26, 26, 36, 0.95), rgba(30, 30, 40, 0.98));
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(3, 151, 171, 0.15);
    border: 1px solid rgba(173, 147, 96, 0.1);
    backdrop-filter: blur(8px);
    max-width: 400px;
    margin: 0 auto;
}

.input-field {
    margin-bottom: 20px;
}

.input-field input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid rgba(3, 151, 171, 0.3);
    background: rgba(30, 30, 40, 0.6);
    border-radius: 8px;
    font-size: 16px;
    color: #f4f4f4;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    text-align: center;
}

.input-field input:focus {
    border-color: #ad9360;
    outline: none;
    box-shadow: 0 0 15px rgba(173, 147, 96, 0.2);
    background: rgba(30, 30, 40, 0.8);
}

.input-field input::placeholder {
    color: rgba(244, 244, 244, 0.5);
}

.start-button {
    background-color: #ad9360;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

.start-button:hover {
    background-color: #0397AB;
    transform: scale(1.05);
}

#start-quiz {
    background: linear-gradient(135deg, #ad9360, #8b745d);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    width: 100%;
}

#start-quiz:hover {
    background: linear-gradient(135deg, #0397AB, #027a89);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(3, 151, 171, 0.3);
}

#start-quiz:active {
    transform: translateY(1px);
}

.quiz-interface {
    display: none;
    margin-top: 20px;
}

.word {
    display: inline-block;
    padding: 10px;
    margin: 5px;
    border: 2px solid #0397AB;
    border-radius: 5px;
    font-size: 24px;
    transition: transform 0.3s;
}

.word.correct {
    background-color: #ad9360;
    color: white;
}

.word.incorrect {
    background-color: #ff4d4d;
    color: white;
}

.word:hover {
    transform: scale(1.1);
}

/* Prevent text selection */
.grid-cell {
    user-select: none; /* Disable text selection */
    -webkit-user-select: none; /* For Safari */
    -ms-user-select: none; /* For IE */
}

/* Grid styling */
#grid-container {
    display: grid;
    gap: 5px; /* Space between cells */
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    width: 100%; /* Ensure the grid fits within the container */
    max-width: 500px; /* Limit the maximum width */
    aspect-ratio: 1 / 1; /* Maintain a square aspect ratio */
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(1.5rem + (1rem / var(--grid-size, 6))); /* Adjust font size based on grid size */
    font-weight: bold;
    border: 2px solid #0397AB;
    border-radius: 5px;
    background-color: #1e1e1e;
    color: #f4f4f4;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    aspect-ratio: 1 / 1; /* Ensure cells are square */
}

.grid-cell.selected {
    background-color: #ad9360;
    color: white;
    transform: scale(1.1);
}

.grid-cell.correct {
    background-color: #0397AB;
    color: white;
}

.grid-cell.incorrect {
    background-color: #ff4d4d;
    color: white;
}

.grid-size-switcher {
    display: flex;
    justify-content: center;
    margin: 5px 0 20px 0;
    gap: 10px;
    background: rgba(30, 30, 40, 0.6);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(173, 147, 96, 0.1);
}

.grid-size-option {
    flex: 1;
    text-align: center;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    background-color: #1e1e1e;
    color: #f4f4f4;
    cursor: pointer;
    transition: all 0.3s, transform 0.3s;
    position: relative;
    overflow: hidden;
}

.grid-size-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(3, 151, 171, 0.1), rgba(173, 147, 96, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-size-option:hover::before {
    opacity: 1;
}

.grid-size-option.active {
    background: linear-gradient(135deg, #0397AB, #027a89);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(3, 151, 171, 0.3);
}

.grid-size-option:hover {
    background-color: #ad9360;
    color: white;
    transform: scale(1.05);
}

#result-message {
    font-size: 18px;
    margin-top: 20px;
    color: #f4f4f4;
}

/* Celebration animation */
.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ad9360;
    color: white;
    padding: 20px 40px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    animation: fadeOut 2s ease-in-out;
    z-index: 1000;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* How to Play Button */
.how-to-play {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #0397AB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.3s;
    z-index: 9999; /* Ensure it's above other elements */
}

.how-to-play:hover {
    transform: scale(1.1);
}

.how-to-play-icon {
    font-size: 24px;
    color: white;
}

.how-to-play-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1e1e1e;
    color: #f4f4f4;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    width: 90%; /* Make it responsive */
    max-width: 600px; /* Limit the maximum width */
    max-height: 70%; /* Limit the height to make it scrollable */
    overflow-y: auto; /* Enable vertical scrolling */
    font-family: 'Arial', sans-serif;
    text-align: left;
    scrollbar-width: thin; /* For modern browsers */
    scrollbar-color: #0397AB #1e1e1e; /* Custom scrollbar colors */
}

/* Custom scrollbar for WebKit browsers */
.how-to-play-modal::-webkit-scrollbar {
    width: 8px;
}

.how-to-play-modal::-webkit-scrollbar-thumb {
    background-color: #0397AB;
    border-radius: 4px;
}

.how-to-play-modal::-webkit-scrollbar-track {
    background-color: #1e1e1e;
}

.how-to-play-modal h2 {
    font-size: 24px;
    color: #ad9360;
    margin-bottom: 15px;
    text-align: center;
}

.how-to-play-modal p,
.how-to-play-modal li {
    line-height: 1.6;
    font-size: 16px;
    margin-bottom: 10px;
}

.how-to-play-modal ol,
.how-to-play-modal ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.how-to-play-modal li {
    margin-bottom: 8px;
}

.how-to-play-modal ul li::marker {
    color: #0397AB;
}

.how-to-play-modal ol li::marker {
    color: #ad9360;
}

.how-to-play-modal button {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background-color: #0397AB;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

.how-to-play-modal button:hover {
    background-color: #ad9360;
    transform: scale(1.05);
}

/* Timer */
#timer {
    display: none;
}

/* Give Up button */
#give-up {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#give-up:hover {
    background-color: #d43f3f;
}

/* Result popup */
#result-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1e1e1e;
    color: #f4f4f4;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 1000;
}

#result-popup h2 {
    color: #ad9360;
}

.share-buttons button {
    margin: 10px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background-color: #0397AB;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.share-buttons button:hover {
    background-color: #ad9360;
}

.hype-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #0397AB;
    color: white;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 1000;
    text-align: center;
    pointer-events: none; /* Prevent interaction */
}

.hype-popup.fade-out {
    opacity: 0;
    transform: translate(-50%, -60%);
}

.score-display {
    display: none; /* Hide the floating score display */
    position: absolute;
    top: 120px; /* Default for desktop */
    left: 20px;
    padding: 10px 16px;
    border-radius: 10px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Softer shadow */
    font-family: 'Arial', sans-serif;
    font-size: 1px;
    font-weight: 600;
    color: #f4f4f4; /* Light text for dark mode */
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
    transition: all 0.3s ease; /* Smooth transitions for hover effects */
}

#mute-button {
    position: fixed;
    top: 130px;                     
    right: 20px;
    background: rgba(32, 32, 32, 0.9); /* Darker background for dark mode */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
    font-size: 20px;
    color: #f4f4f4; /* Light text for dark mode */
    padding: 8px 12px;
    border-radius: 50%; /* Circular button */
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Softer shadow */
    transition: all 0.3s ease; /* Smooth transitions for hover effects */
}

#mute-button:hover {
    background: rgba(50, 50, 50, 0.9); /* Slightly lighter on hover */
    transform: scale(1.1); /* Subtle zoom effect */
}

.result-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(32, 32, 32, 0.95); /* Dark background for modern look */
    color: #f4f4f4; /* Light text for contrast */
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 1000;
    width: 90%;
    max-width: 500px;
}

.result-content h1.congrats-message {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #ffcc00; /* Gold color for celebration */
}

.result-content p.final-score {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #ffffff;
}

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px; /* Add spacing between buttons and share section */
}

.modern-button {
    background: linear-gradient(135deg, #6a11cb, #2575fc); /* Gradient for modern look */
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modern-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.modern-button:active {
    transform: scale(0.95);
}

.modern-button svg {
    width: 20px;
    height: 20px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4267B2, #3b5998); /* Default for Facebook */
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.share-button i {
    font-size: 20px;
}

.share-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#share-facebook {
    background: linear-gradient(135deg, #4267B2, #3b5998); /* Facebook colors */
}

#share-reddit {
    background: linear-gradient(135deg, #FF4500, #FF5700); /* Reddit colors */
}

/* Words to Find Display */
.words-to-find {
    margin: 5px auto;
    padding: 15px;
    background: rgba(32, 32, 32, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    max-width: 500px;
}

.words-to-find-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ad9360;
    font-size: 16px;
    margin-bottom: 10px;
    padding: 0 15px;
}

.words-count-display, .score-display-inline {
    background: rgba(3, 151, 171, 0.15);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    color: #f4f4f4;
    border: 1px solid rgba(3, 151, 171, 0.3);
}

.score-display-inline {
    background: rgba(173, 147, 96, 0.15);
    border-color: rgba(173, 147, 96, 0.3);
}

.words-count-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hidden-words-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(173, 147, 96, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(173, 147, 96, 0.2);
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.word-item {
    background: #1e1e1e;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    color: #f4f4f4;
    transition: all 0.3s ease;
}

.word-item.found {
    background: #0397AB;
    text-decoration: line-through;
    opacity: 0.7;
}