body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px; /* Add padding for small screens */
}

.quiz-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    text-align: center;
}

h1 {
    color: #007bff;
    margin-bottom: 20px;
}

#question-area {
    text-align: left;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

#question {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.options-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.option-button {
    width: 100%;
    padding: 12px;
    background-color: #e9ecef;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
    font-size: 1em;
}

.option-button:hover:not(.disabled) {
    background-color: #d8dadc;
}

/* Feedback Styles */
.correct {
    background-color: #28a745 !important; /* Green */
    color: white;
    border-color: #28a745;
}

.incorrect {
    background-color: #dc3545 !important; /* Red */
    color: white;
    border-color: #dc3545;
}

.feedback-text {
    margin-top: 15px;
    font-weight: bold;
    min-height: 20px;
}

/* --- DETAILED FEEDBACK STYLES (Existing) --- */
#detailed-feedback {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-align: left;
    animation: fadeIn 0.3s ease-in-out;
}

.feedback-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}

.feedback-label {
    font-size: 0.85em;
    font-weight: bold;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.code-snippet {
    background-color: #eef;
    padding: 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    border-left: 4px solid #007bff;
    overflow-x: auto;
}

.console-output {
    background-color: #2d2d2d;
    color: #4af626; /* Terminal green */
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.render-preview {
    background-color: #fff;
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    font-style: italic;
    color: #555;
}

.explanation-block {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    line-height: 1.5;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ------------------------------------- */

/* --- NEW STYLES FOR NAVIGATION AND RESULTS --- */

/* Question Navigation Grid */
.question-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); /* Responsive grid for numbers */
    gap: 5px;
    margin-bottom: 25px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.nav-number-button {
    padding: 8px 4px;
    font-size: 0.9em;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    transition: all 0.2s;
}

.nav-number-button:hover {
    background-color: #e2e6ea;
}

/* Status colors for the navigation buttons */
.nav-current {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

.nav-answered {
    background-color: #5bc0de; /* Info blue/teal for answered */
    color: white;
}

.nav-correct {
    background-color: #28a745; /* Green */
    color: white;
}

.nav-incorrect {
    background-color: #dc3545; /* Red */
    color: white;
}

/* Control Bar (Prev/Next/Submit) */
.control-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-button {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
    background-color: #007bff;
    color: white;
    flex-grow: 1;
    margin: 0 5px;
}

.nav-button:disabled {
    background-color: #a0c3ff;
    cursor: default;
}

.nav-button:hover:not(:disabled) {
    background-color: #0056b3;
}

#submit-button {
    background-color: #ffc107; /* Yellow/Orange */
    color: #333;
}

#submit-button:hover {
    background-color: #e0a800;
}

/* Results Summary */
.results-summary {
    text-align: left;
    margin: 20px auto;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-width: 400px;
}

.results-summary p {
    margin: 8px 0;
    font-size: 1.1em;
}

.final-percentage {
    font-size: 1.5em !important;
    font-weight: bold;
    color: #007bff;
    padding-top: 10px;
    border-top: 1px dashed #eee;
    margin-top: 10px !important;
}

.correct-text { color: #28a745; }
.incorrect-text { color: #dc3545; }
.unanswered-text { color: #6c757d; }

.restart-button {
    background-color: #6c757d;
    color: white;
    margin-top: 15px;
    padding: 10px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.disabled {
    cursor: default;
    opacity: 0.7;
}

/* Responsive adjustment for small screens */
@media (max-width: 600px) {
    .control-bar {
        flex-direction: column;
    }
    .nav-button {
        margin: 5px 0;
    }
}