/* 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: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding-top: 20px;
    padding-bottom: 20px;
}

.container {
    max-width: 800px; /* Consistent width for all pages */
    margin: 20px auto; /* Added top/bottom margin */
    padding: 20px 30px; /* Adjusted padding */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* General Header Styles (applies to all pages) */
header {
    margin-bottom: 30px; /* Reduced margin */
    padding-bottom: 20px;
    border-bottom: 1px solid #eeeeee;
    position: relative; /* For absolute positioning of back-link if needed, or flex */
}

header h1 {
    font-size: 2.4rem; /* Slightly smaller for consistency across pages */
    color: #2c3e50;
    margin-bottom: 8px;
    text-align: center;
}

header p { /* Subtitle in header */
    font-size: 1.1rem;
    color: #7f8c8d;
    text-align: center;
    margin-bottom: 15px; /* Space before back-link if it's under this p */
}

/* Back Link in Header for sub-pages */
.back-link {
    display: inline-block; /* Or block with margin auto for centering */
    margin: 10px auto 0; /* Centering the link if it's the only element below p */
    text-decoration: none;
    color: #3498db;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    text-align: center; /* Ensures text and icon are centered if display:block */
    width: 100%; /* Take full width for centering purposes */
}

.back-link i {
    margin-right: 8px;
}

.back-link:hover {
    color: #2980b9;
}


/* === Styles for Main Menu Page (geography-quiz.html) === */
.quiz-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.section-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.section-icon {
    margin-bottom: 15px;
}

.section-icon i {
    font-size: 2.8rem;
    color: #3498db;
}

.section-card h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.section-card p {
    font-size: 0.9rem;
    color: #555555;
    margin-bottom: 20px;
    flex-grow: 1;
}

.section-card .btn { /* Specific to buttons in section cards */
    margin-top: auto; /* Pushes button to the bottom */
}


/* === Styles for Topic Pages (nature-earth.html, etc.) === */

/* Topic Selection Screen */
.topic-selection {
    text-align: center;
    padding: 20px 0;
}

.topic-selection h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 25px;
}

.topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
}

.topic-btn {
    padding: 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.2s;
    text-align: center;
}

.topic-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.option {
    padding: 12px;
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.option:hover {
    background-color: #d5dbdb;
    border-color: #a5b1b1;
}

.option.correct {
    background-color: #2ecc71;
    color: white;
    border-color: #27ae60;
}

.option.incorrect {
    background-color: #e74c3c;
    color: white;
    border-color: #c0392b;
}

.option input[type="radio"] {
    margin-right: 10px;
}

.exit-button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

/* Quiz Container Screen */
.quiz-container { /* This replaces .screen from original CSS */
    display: none; /* Initially hidden, shown by JS */
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 10px 0; /* Reduced padding as container already has padding */
}

.quiz-header {
    width: 100%;
    margin-bottom: 20px;
}

.quiz-header h2#topicTitle { /* Specific styling for quiz topic title */
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1rem; /* Adjusted size */
    color: #7f8c8d;
}

.quiz-content {
    width: 100%;
    margin-bottom: 20px;
}

.question#question { /* Was #question-text */
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: #2c3e50;
    line-height: 1.5;
    text-align: center; /* Center question text */
}

.options#options { /* Was .btn-grid */
    display: grid;
    grid-template-columns: 1fr; /* Single column for options */
    gap: 12px; /* Space between option buttons */
    margin-bottom: 20px;
}

.option-btn { /* Individual answer button, was .answer-btn */
    padding: 15px;
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, border-color 0.3s;
    text-align: left; /* Align text to the left within buttons */
    width: 100%;
}

.option-btn:hover:not([disabled]) {
    background-color: #d5dbdb;
    border-color: #a5b1b1;
}

.option-btn.correct {
    background-color: #2ecc71;
    color: white;
    border-color: #27ae60;
}

.option-btn.incorrect {
    background-color: #e74c3c;
    color: white;
    border-color: #c0392b;
}

.option-btn:disabled { /* Style for buttons after an answer is selected */
    cursor: not-allowed;
}


.quiz-footer {
    display: flex;
    justify-content: flex-end; /* Align next button to the right */
    width: 100%;
    margin-top: 10px;
}

/* Results Screen */
.results { /* This replaces .screen from original CSS */
    display: none; /* Initially hidden, shown by JS */
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    text-align: center;
}

.results h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

.score-container {
    margin-bottom: 30px;
    text-align: center;
}

.score {
    font-size: 3.5rem;
    font-weight: bold;
    color: #3498db;
}

.score-label {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-top: 5px;
}

.result-details {
    width: 100%;
    margin-bottom: 30px;
    text-align: left; /* For list of questions/answers if any */
    font-size: 1rem;
    color: #333;
}
.result-details p {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
}
.result-details .correct-answer-detail {
    background-color: #e8f5e9; /* Light green */
    border-left: 3px solid #2ecc71;
}
.result-details .incorrect-answer-detail {
    background-color: #ffebee; /* Light red */
    border-left: 3px solid #e74c3c;
}


.actions { /* Was .results-actions */
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    justify-content: center;
    gap: 15px;
    width: 100%;
}

/* General Button Style (reusable .btn class) */
.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn.secondary { /* For less prominent actions, e.g., change topic */
    background-color: #95a5a6;
}
.btn.secondary:hover {
    background-color: #7f8c8d;
}


.share-btn { /* Specific style for share button */
    background-color: #2ecc71; /* Green for share */
}
.share-btn i {
    margin-right: 8px;
}
.share-btn:hover {
    background-color: #27ae60;
}

/* Footer Styles (applies to all pages) */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eeeeee;
}

footer p {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 20px 20px; /* Reduced side padding */
        margin: 15px auto;
    }

    header h1 {
        font-size: 2rem;
    }
    header p {
        font-size: 1rem;
    }

    .quiz-sections {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }
    .section-card h2 {
        font-size: 1.3rem;
    }
    .section-card p {
        font-size: 0.85rem;
    }
    .section-icon i {
        font-size: 2.5rem;
    }

    .topics {
        grid-template-columns: 1fr; /* Single column for topic buttons */
    }

    .topic-btn, .option-btn, .btn {
        padding: 12px 20px; /* Slightly smaller padding */
        font-size: 0.95rem;
    }

    .question#question {
        font-size: 1.2rem;
    }
    .score {
        font-size: 3rem;
    }
}

@media (max-width: 480px) { /* Smaller mobile devices */
    body {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .container {
        margin-left: 10px;
        margin-right: 10px;
        padding: 15px;
        width: auto;
        border-radius: 0; /* Full width feel on very small screens */
        box-shadow: none;
    }

    header h1 {
        font-size: 1.8rem;
    }
    header p {
        font-size: 0.9rem;
    }
    .back-link {
        font-size: 0.9rem;
    }

    .quiz-sections {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column; /* Stack action buttons vertically */
    }
    .actions .btn {
        width: 100%; /* Make action buttons full width */
    }

    .quiz-info {
        font-size: 0.9rem;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    .quiz-footer {
        justify-content: center; /* Center the next button */
    }
    .quiz-footer .btn {
        width: 100%;
    }
}