/* General Resets and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f4f8; /* Slightly softer background */
    color: #333;
    line-height: 1.6;
    display: flex; /* Helps with centering the container */
    justify-content: center; /* Centers the container horizontally */
    align-items: flex-start; /* Aligns container to the top */
    min-height: 100vh; /* Full viewport height */
    padding-top: 20px; /* Space at the top */
    padding-bottom: 20px; /* Space at the bottom */
}

.container {
    max-width: 800px;
    width: 95%; /* Responsive width */
    margin: 0 auto; /* Already centered by body flex, but good fallback */
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Screen Styles */
.screen {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    /* justify-content: center; Removed to allow natural flow for content */
    padding: 20px;
    width: 100%; /* Ensure screens take full width of container */
}

.screen.active {
    display: flex; /* Shown when active */
}

/* Utility class for hiding elements */
.hidden {
    display: none !important; /* Important to override other display properties if needed */
}


/* Start Screen */
#start-screen h1 {
    font-size: 2.4rem; /* Slightly adjusted */
    color: #2c3e50;
    margin-bottom: 10px;
    text-align: center;
}

#start-screen h2 {
    font-size: 1.7rem; /* Slightly adjusted */
    color: #3498db;
    margin-bottom: 25px; /* Slightly adjusted */
    text-align: center;
}

#start-screen p {
    font-size: 1.1rem; /* Slightly adjusted */
    margin-bottom: 20px;
    text-align: center;
}

.subtopics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Adjusted minmax for better fit */
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.subtopic-btn { /* This class is used by CLASS_SUBTOPIC_BTN_BIO in JS */
    padding: 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 8px; /* Slightly more rounded */
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtopic-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.subtopic-btn:active {
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.subtopic-btn.all-topics {
    grid-column: 1 / -1; /* Span full width */
    background-color: #2c3e50;
}

.subtopic-btn.all-topics:hover {
    background-color: #1a252f;
}

/* Quiz Screen */
.quiz-header {
    width: 100%;
    margin-bottom: 20px;
}

#quiz-title { /* Targeted ID for consistency */
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.progress-container {
    width: 100%;
    height: 12px; /* Slightly thicker */
    background-color: #e0e0e0; /* Softer gray */
    border-radius: 6px;
    margin-bottom: 15px; /* Adjusted margin */
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #3498db;
    width: 0%; /* Start at 0% */
    border-radius: 6px; /* Match container */
    transition: width 0.4s ease-in-out; /* Smoother transition */
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1rem; /* Adjusted */
    color: #555; /* Darker gray for better readability */
}

#question-container {
    width: 100%;
    margin-bottom: 20px;
    min-height: 60px; /* Ensure some space even if question text is short */
}

#question-text {
    font-size: 1.25rem; /* Slightly adjusted */
    margin-bottom: 25px; /* More space after question */
    color: #2c3e50;
    line-height: 1.5; /* Improved readability for longer questions */
}

.btn-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column for answer buttons */
    gap: 12px; /* Adjusted gap */
    margin-bottom: 20px;
    width: 100%;
}

.answer-btn { /* This class is used by CLASS_ANSWER_BTN_BIO in JS */
    padding: 14px 20px; /* Adjusted padding */
    background-color: #f8f9fa; /* Lighter background for options */
    border: 1px solid #ced4da; /* Softer border */
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
    transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
    text-align: left;
    width: 100%; /* Ensure buttons take full width of their grid cell */
}

.answer-btn:hover:not([disabled]) {
    background-color: #e9ecef;
    border-color: #adb5bd;
}
.answer-btn:active:not([disabled]) {
    transform: scale(0.98);
}

.answer-btn.correct {
    background-color: #2ecc71 !important; /* Ensure override */
    color: white !important;
    border-color: #27ae60 !important;
}

.answer-btn.incorrect { /* Matched to JS: CLASS_WRONG_BIO = 'incorrect' */
    background-color: #e74c3c !important; /* Ensure override */
    color: white !important;
    border-color: #c0392b !important;
}

.answer-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.7;
}

.feedback-container { /* Styles for the feedback box */
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    border-radius: 5px;
    font-size: 0.95rem;
    line-height: 1.5;
}

#feedback-text { /* Specific styling for the text if needed */
    color: #444;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 20px; /* Added margin top */
}

.control-btn {
    padding: 12px 25px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.control-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}
.control-btn:active {
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.control-btn.secondary {
    background-color: #7f8c8d; /* Softer gray */
}

.control-btn.secondary:hover {
    background-color: #6c7a7b; /* Darker shade of the softer gray */
}

#next-btn {
    /* display: none; -- JavaScript will handle this */
}

/* Results Screen */
#results-screen h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
}

.results-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.result-circle {
    width: 160px; /* Slightly larger */
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9); /* Gradient */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    color: white;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.result-score {
    font-size: 3.2rem; /* Slightly larger */
    font-weight: bold;
}

.result-label {
    font-size: 1.1rem; /* Slightly adjusted */
}

.result-message {
    font-size: 1.25rem; /* Slightly adjusted */
    text-align: center;
    color: #2c3e50;
    max-width: 90%; /* Prevent message from being too wide */
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

.control-btn.share {
    background-color: #2ecc71;
}

.control-btn.share:hover {
    background-color: #27ae60;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    body {
        padding-top: 0;
        padding-bottom: 0;
    }
    .container {
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh; /* Ensure it takes full height on mobile */
    }

    #start-screen h1 {
        font-size: 2rem;
    }

    #start-screen h2 {
        font-size: 1.5rem;
    }

    .subtopics-grid {
        grid-template-columns: 1fr; /* Single column for subtopics on small screens */
    }

    #question-text {
        font-size: 1.15rem;
    }

    .answer-btn {
        font-size: 0.95rem;
        padding: 12px 15px;
    }

    .quiz-footer {
        flex-direction: column;
        gap: 10px;
    }

    .control-btn {
        width: 100%; /* Full width buttons in footer on small screens */
        font-size: 0.95rem;
        padding: 14px 20px; /* Slightly larger padding for easier tap */
    }

    .results-actions {
        flex-direction: column; /* Stack action buttons on results screen */
    }

    .result-circle {
        width: 140px;
        height: 140px;
    }
    .result-score {
        font-size: 2.8rem;
    }
}