html,
body {
    height: 100%;
    /* Ensure Body Takes Full Height */
    overflow: hidden;
    /* Prevent Scrolling */
}

body {
    background-image: url('../img/background-img.jpg');
    /* Background Image */
    background-size: cover;
    /* Cover the Entire Background */
    background-attachment: fixed;
    /* Fixed Background Attachment */
    background-position: center;
    /* Center the Background Image */
    background-repeat: no-repeat;
    /* Do Not Repeat Background Image */
    position: relative;
    /* Relative Positioning for Absolute Elements */
}

.hidden {
    display: none !important;
    /* Hide Button When Question Isnt Answered */
}

#choices {
    display: grid;
    /* Use Grid Layout for Choices */
    gap: 12px;
    /* Space Between Choices */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Two Columns of Equal Width */
}

.choice-button.score {
    outline: 8px solid #22c55e;
    /* Green Outline for Correct Answers */
    outline-offset: 2px;
    /* Offset for Better Visibility */
}

.choice-button.incorrect {
    outline: 8px solid #ef4444;
    /* Red Outline for Incorrect Answers */
    outline-offset: 2px;
    /* Offset for Better Visibility */
}

.choice-button {
    background-color: #f3f4f6;
    /* Light Background Color */
    color: #1f2937;
    /* Dark Text Color */
    border: none;
    /* No Border */
    padding: 14px 16px;
    /* Padding for Buttons */
    border: 2px solid black;
    /* Black Border for Buttons */
    border-radius: 5px;
    /* Rounded Corners */
    cursor: pointer;
    /* Pointer Cursor on Hover */
    font-size: 16px;
    /* Font Size for Buttons */
    margin: 5px;
    /* Margin Around Buttons */
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
    /* Smooth Transition for Background and Color */
}

@media (max-width: 768px) {

    /* Responsive Styles for Mobile Devices */
    #status {
        flex-direction: column;
        /* Stack Status Elements Vertically */
        align-items: stretch;
        /* Stretch Items to Full Width */
        gap: 6px;
    }

    #status span {
        font-size: 14px;
        /* Smaller Font Size for Status */
    }

    #choices {
        grid-template-columns: 1fr;
        /* Single Column for Choices */
    }

    #questions {
        font-size: 16px;
        /* Smaller Font Size for Questions */
        margin-bottom: 8px;
        /* Reduced Margin for Questions */
    }

    .home-button,
    .rules-button {
        font-size: 20px !important;
        /* Smaller Home Button */
        top: 5px;
        /* Adjusted Position */
    }

    #nextQuestion {
        font-size: 12px;
        /* Smaller Font Size for Next Question Button */
        padding: 5px 20px;
        /* Reduced Padding for Mobile */
        top: 85%;
        /* Adjusted Position for Mobile */
    }
}

#difficulty {
    top: 5px;
    /* Top Position Difficulty Selector */
    right: 10px;
    /* Right Position Difficulty Selector */
    background-color: #f3f4f6;
    /* Light Background Color */
    color: #1f2937;
    /* Dark Text Color */
    padding: 10px 20px;
    /* Padding for Difficulty Selector */
    font-size: 25px;
    /* Font Size for Difficulty Selector */
}

#ontoPage2,
#startQuiz,
#nextQuestion {
    position: absolute;
    /* Position Button to Next Page */
    top: 90%;
    /* Position Near Bottom */
    left: 50%;
    /* Center Horizontally */
    transform: translate(-50%, -50%);
    /* Center the Button */
    text-align: center;
    /* Center Text */
    background-color: #f3f4f6;
    /* Light Background Color */
    color: black;
    /* Dark Text Color */
    margin-top: auto;
    /* Auto Margin Top */
    font-size: 1rem;
    padding: 6px 12px;
    /* Padding for Button */
}

#numberOfQuestions {
    top: 5px;
    /* Top Position Number of Questions Selector */
    right: 10px;
    /* Right Position Number of Questions Selector */
    background-color: #f3f4f6;
    /* Light Background Color */
    color: #1f2937;
    /* Dark Text Color */
    padding: 10px 20px;
    /* Padding for Number of Questions Selector */
    font-size: 25px;
    /* Font Size for Number of Questions Selector */
}

.container {
    max-width: 800px;
    /* Maximum Width for Container */
    margin: 0 auto;
    /* Center Container Horizontally */
    padding: 20px;
    /* Padding for Container */
    background-color: aqua;
    /* Light Background Color for Container */
}

#page1,
#page2,
#quiz,
#rules,
#error-page {
    position: relative;
    /* Relative Positioning for Sections */
    min-height: 60vh;
    /* Minimum Height for Sections */
}

/* Rules To Scroll */
@media (max-width: 1440px) {

    html,
    body {
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #rules {
        min-height: auto !important;
    }

    body.rules-page::after {
        content: "";
        display: block;
        height: 150px;
    }
}

span {
    font-size: 50px;
    /* Font Size for Status Text */
}

.home-button {
    position: absolute;
    /* Position Home Button */
    top: 10px;
    /* Top Position Home Button */
    right: 10px;
    /* Right Position Home Button */
    font-size: 30px;
    /* Font Size for Home Button */
    color: #1f2937;
    /* Dark Text Color for Home Button */
    text-decoration: none;
    /* No Underline for Home Button */
}

.rules-button {
    position: absolute;
    /* Position Rules Button */
    top: 12px;
    /* Top Position Rules Button */
    left: 10px;
    /* Left Position Rules Button */
    font-size: 30px;
    /* Font Size for Rules Button */
    color: #1f2937;
    /* Dark Text Color for Rules Button */
    text-decoration: none;
    /* No Underline for Rules Button */
}

#finalMessage {
    font-size: 20px;
    /* Font Size for Final Message */
    margin-top: 20px;
    /* Margin Top for Final Message */
    text-align: center;
    /* Center Align Final Message */
}

#rightWrong {
    position: fixed;
    /* Fixed Positioning */
    bottom: 20px;
    /* 20px from Bottom */
    left: 50%;
    /* Center Horizontally */
    transform: translateX(-50%);
    /* Center the Element */
    font-size: 100px;
    /* Large Font Size */
    font-weight: bolder;
    /* Bold Font Weight */
    padding: 12px 24px;
    /* Padding Around Text */
    border-radius: 8px;
    /* Rounded Corners */
    text-align: center;
    /* Center Text */
    min-width: 200px;
    /* Minimum Width */
    z-index: 999;
    /* Ensure on Top */
    color: red
        /* Red Color for Wrong */
}

@media (max-width: 1440px) {
    #choices button {
        font-size: 1rem;
        /* Slightly Smaller Font Size */
        padding: 8px 12px;
        /* Reduced Padding */
        line-height: 1.2;
        /* Adjusted Line Height */
    }
}

@media (max-width: 600px) {
    #choices button {
        font-size: 0.9rem;
        /* Smaller Font Size for Small Screens */
        padding: 6px 10px;
        /* Further Reduced Padding */
        line-height: 1.1;
        /* Adjusted Line Height */
    }

    #rightWrong {
        font-size: 80px;
        /* Smaller Font Size for Small Screens */
    }
}

@media (orientation: landscape) and (max-width: 850px),
(orientation: landscape) and (max-height: 650px) {

    #page1.container,
    #page2.container,
    #quiz.container {
        max-width: 100% !important;
        /* Full Width on Small Screens */
        width: 100% !important;
        /* Full Width on Small Screens */
        padding-left: 12px;
        /* Padding for Small Screens */
        padding-right: 12px;
        /* Padding for Small Screens */
    }

    #page1,
    #page2,
    #quiz {
        position: relative;
        /* Relative Positioning */
        display: flex;
        /* ensure flex so flex-direction works */
        flex-direction: column;
        /* Full Viewport Height */
        overflow: visible;
        /* Allow Overflow */
        padding-bottom: 2rem;
        /* Padding for Bottom */
        margin-bottom: 6rem;
        /* Space for Fixed Elements */
    }

    #score,
    #incorrect {
        font-size: 12px !important;
        /* Smaller Font Size for Score and Incorrect */

    }

    #questionNumber {
        flex: 1;
        text-align: center;
        font-size: 20px !important;
        /* Smaller Font Size for Question Number */
    }

    #rightWrong {
        position: absolute;
        /* Absolute Positioning */
        left: 50%;
        /* Center Horizontally */
        transform: translateX(-50%);
        /* Center The Element */
        bottom: -7rem;
        /* Position Below Content */
        margin: 0;
        /* No Margin */
        line-height: 1.1;
        /* Adjusted Line Height */
        pointer-events: none;
        /* Ignore Pointer Events */
        white-space: nowrap;
        /* Prevent Text Wrapping */
        text-align: center;
        /* Center Text */
        font-size: 75px;
    }
}

@media (orientation: landscape) and (max-height: 570px) {
    /* Landscape cleanup */

    #score,
    #incorrect {
        font-size: 12px !important;
    }

    #questionNumber {
        flex: 1;
        /* Take Remaining Space */
        text-align: center;
        /* Center Text */
        font-size: 16px !important;
        /* Smaller Font Size for Question Number */
    }

    #rightWrong {
        font-size: 75px;
        /* Smaller Font Size */
    }
}