/**
 * Quiz Application v2 Styles
 *
 * Modern, clean design for quiz functionality
 */

/* ============================================
   Base Styles
   ============================================ */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    touch-action: manipulation;
}

body {
    min-height: 100vh;
    background: #f5f7fa;
}

/* ============================================
   Page Layout
   ============================================ */

.quiz-page {
    min-height: 100vh;
    background: #f5f7fa;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ============================================
   Header
   ============================================ */

.quiz-header {
    background: linear-gradient(135deg, #368BC1 0%, #2c6a96 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.quiz-header__logo img {
    display: block;
}

.quiz-header__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
    justify-content: center;
}

.quiz-header__actions {
    display: flex;
    gap: 1rem;
}

/* ============================================
   Main App Container
   ============================================ */

.quiz-wrapper {
    min-height: var(--quiz-wrapper-height, calc(100vh - 70px));
    display: flex;
    flex-direction: column;
}

.quiz-app {
    width: 100%;
    max-width: 100%;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Quiz page header styling */
#quiz-page-header {
    position: relative;
    top: auto;
    padding-top: 1rem;
    margin-bottom: 0;
}

#quiz-page-header .page-header__subtitle {
    padding: 1rem 1.5rem;
}

/* ============================================
   Loading Indicator
   ============================================ */

.loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.loading-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 5rem 6rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: -1;
}

.loading-indicator .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 20px));
}

.loading-indicator p {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 45px));
    margin: 0;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 500;
    white-space: nowrap;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #368BC1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Quiz Setup Section
   ============================================ */

.quiz-setup {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    flex: 1;
}

.quiz-setup-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    padding: 2.5rem;
    max-width: 700px;
    width: 100%;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-setup-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.quiz-setup__header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    margin: -2.5rem -2.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-setup__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #368BC1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quiz-setup__title svg {
    width: 28px;
    height: 28px;
    stroke: #368BC1;
    flex-shrink: 0;
}

.quiz-setup__form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-setup__field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-setup__label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.quiz-setup__select {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
    color: #495057;
}

.quiz-setup__select:hover {
    border-color: #368BC1;
    background: #f8f9fa;
}

.quiz-setup__select:focus {
    outline: none;
    border-color: #368BC1;
    box-shadow: 0 0 0 3px rgba(54, 139, 193, 0.15);
    background: white;
}

.quiz-setup__select option {
    padding: 0.75rem 1rem;
    background: white;
    color: #495057;
    font-size: 1rem;
}

.quiz-setup__select option:disabled {
    color: #adb5bd;
    font-style: italic;
}

.quiz-setup__actions {
    padding-top: 1.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
}

.quiz-setup__start-btn {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quiz-setup__start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(54, 139, 193, 0.3);
}

/* ============================================
   Quiz Container
   ============================================ */

.quiz-active {
    padding: 2rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

#quiz-container {
    background: #fff;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    box-sizing: border-box;
    margin: auto;
    min-width: 900px;
}


.timer {
    font-size: 1.1rem;
    font-weight: 700;
    color: #368BC1;
    font-family: 'Courier New', monospace;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #368BC1;
}

.timer--warning {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   Question Display
   ============================================ */

.quiz-question {
    padding: 1rem;
}

#quiz-answers-content {
    width: 100%;
}

.quiz-question__text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #2d3748;
}

.quiz-question__image {
    margin: 1.5rem 0;
    text-align: center;
}

.quiz-question__image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quiz-question__annex {
    margin: 1rem 0;
}

.quiz-question__annex a {
    color: #368BC1;
    text-decoration: none;
    font-weight: 500;
}

.quiz-question__annex a:hover {
    text-decoration: underline;
}

/* ============================================
   Answers
   ============================================ */

.quiz-question__answers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
    width: 100%;
}

.quiz-answer {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.quiz-answer:hover {
    border-color: #368BC1;
    background: #f8f9fa;
}

.quiz-answer input[type="radio"] {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.quiz-answer__letter {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-right: 0.75rem;
    background: #e9ecef;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    transition: all 0.2s ease;
}

.quiz-answer:hover .quiz-answer__letter {
    background: #368BC1;
    color: #fff;
}

.quiz-answer--selected .quiz-answer__letter {
    background: #368BC1;
    color: #fff;
}

.quiz-answer__text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
}

.quiz-answer--selected {
    border-color: #368BC1;
    background: #e8f4f8;
}

/* ============================================
   Question Navigation
   ============================================ */

.quiz-question__navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
}

.quiz-question__navigation .btn {
    flex: 1;
}

/* ============================================
   Navigation Grid
   ============================================ */

#quiz-overview-content {
    background: white;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.quiz-overview__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
    gap: 1rem;
}

.quiz-overview__title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #368BC1;
}

.quiz-navigation {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    border: 2px solid #dee2e6;
}

.quiz-navigation__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-navigation__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.25rem;
    justify-items: center;
    padding: 1rem 1.5rem;
    background: white;
}

.quiz-nav-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #495057;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.quiz-nav-btn:hover {
    border-color: #368BC1;
    background: #f8f9fa;
}

.quiz-nav-btn--answered {
    background: #e8f4fc;
    border-color: #368BC1;
    color: #2c6a96;
}

.quiz-nav-btn--current {
    background: #368BC1;
    border-color: #368BC1;
    color: white;
}

/* ============================================
   Results Screen
   ============================================ */

.quiz-results {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    width: 100%;
}

.quiz-results-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.quiz-results__time-expired-banner {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.quiz-results__title {
    margin: 0 0 2rem 0;
    font-size: 2rem;
    color: #2d3748;
    font-weight: 600;
}

.quiz-results__score {
    margin: 2rem 0;
    padding: 2rem;
    border-radius: 12px;
}

.quiz-results__score--passed {
    background: #d4edda;
    border: 3px solid #28a745;
}

.quiz-results__score--failed {
    background: #f8d7da;
    border: 3px solid #dc3545;
}

.quiz-results__percentage {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.quiz-results__score--passed .quiz-results__percentage {
    color: #28a745;
}

.quiz-results__score--failed .quiz-results__percentage {
    color: #dc3545;
}

.quiz-results__status {
    font-size: 1.5rem;
    font-weight: 600;
}

.quiz-results__score--passed .quiz-results__status {
    color: #155724;
}

.quiz-results__score--failed .quiz-results__status {
    color: #721c24;
}

.quiz-results__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.quiz-results__stat {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.quiz-results__stat--correct {
    background: #d4edda;
    border: 2px solid #28a745;
}

.quiz-results__stat--correct .quiz-results__stat-value {
    color: #28a745;
}

.quiz-results__stat--incorrect {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

.quiz-results__stat--incorrect .quiz-results__stat-value {
    color: #dc3545;
}

.quiz-results__stat--total {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
}

.quiz-results__stat--total .quiz-results__stat-value {
    color: #6c757d;
}

.quiz-results__stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #368BC1;
    margin-bottom: 0.5rem;
}

.quiz-results__stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-results__actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.quiz-results__actions .btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    height: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    line-height: 1.5;
    text-decoration: none;
}

/* Quiz Results Breakdown */
.quiz-results__breakdown {
    margin-top: 2rem;
    padding-top: 0;
    border-top: 2px solid #dee2e6;
}

.quiz-results__breakdown-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.quiz-results__breakdown-grid {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 0;
    margin: 0;
}

.quiz-result-grid {
    display: grid;
    grid-template-columns: 50px 1fr 150px 150px;
    border-bottom: 1px solid #dee2e6;
    margin: 0;
}

.quiz-result-grid:last-child {
    border-bottom: none;
}

.quiz-result-grid--unanswered {
    background-color: #f8f9fa;
}

.quiz-result-grid--unanswered .quiz-result-row {
    opacity: 0.85;
}

.quiz-result-grid:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    overflow: hidden;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.quiz-result-grid:has(.quiz-result-row-header) {
    top: 10px;
}

.quiz-result-row-header {
    padding: 0.75rem 1rem 0.75rem 1rem;
    font-weight: 700;
    color: #2d3748;
    background: #f7fafc;
    border-bottom: 2px solid #dee2e6;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0;
}

.quiz-result-grid:first-child .quiz-result-row-header {
    padding-top: 0;
    line-height: 1.5;
}

.quiz-result-grid:first-child .quiz-result-row-header:first-child {
    border-top-left-radius: 6px;
}

.quiz-result-grid:first-child .quiz-result-row-header:last-child {
    border-top-right-radius: 6px;
}

.quiz-result-row {
    padding: 1rem;
    color: #495057;
    word-wrap: break-word;
    text-align: left;
}

.quiz-result-row--question {
    font-weight: 500;
}

.quiz-result-grid:hover {
    background: #f7fafc;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.95rem;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast--show {
    opacity: 1;
    transform: translateX(0);
}

.toast--success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.toast--error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.toast--info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--primary {
    background: #368BC1;
    color: white;
}

.btn--primary:hover:not(:disabled) {
    background: #2c6a96;
}

.btn--secondary {
    background: #6c757d;
    color: white;
}

.btn--secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn--outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn--outline:hover {
    background: white;
    color: #368BC1;
}

.btn--danger {
    background: #dc3545;
    color: white;
}

.btn--danger:hover:not(:disabled) {
    background: #c82333;
}

.btn--success {
    background: #28a745;
    color: white;
}

.btn--success:hover:not(:disabled) {
    background: #218838;
}

/* ============================================
   Dialog / Confirmation Modal
   ============================================ */

.quiz-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.quiz-dialog-backdrop--visible {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.quiz-dialog-backdrop--closing {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.quiz-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.3s ease;
}

.quiz-dialog--visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.quiz-dialog--closing {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
}

.quiz-dialog__header {
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quiz-dialog__header svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.quiz-dialog--info .quiz-dialog__header {
    color: #368BC1;
}

.quiz-dialog--warning .quiz-dialog__header {
    color: #f59e0b;
}

.quiz-dialog--danger .quiz-dialog__header {
    color: #dc3545;
}

.quiz-dialog--success .quiz-dialog__header {
    color: #28a745;
}

.quiz-dialog__body {
    padding: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #495057;
}

.quiz-dialog__footer {
    padding: 1.5rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    border-top: 1px solid #dee2e6;
}

.quiz-dialog__footer .btn {
    min-width: 100px;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet: Ensure quiz setup card is centered */
@media (min-width: 768px) and (max-width: 1024px) {
    .quiz-setup {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 2rem;
    }

    .quiz-setup-card {
        margin: 0 auto;
        max-width: 600px;
        width: 100%;
        position: relative;
        left: -2rem;
    }

    #quiz-container {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        padding: 1.5rem;
        margin: 0 auto;
    }

    .quiz-active {
        padding: 1rem;
        width: 100%;
    }

    .quiz-results {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .quiz-results-card {
        max-width: calc(100% - 2rem);
        width: 100%;
        padding: 1.5rem;
        margin: 0 auto;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .quiz-results__breakdown-grid {
        max-width: 100%;
        overflow-x: auto;
    }

    .quiz-results__stats {
        gap: 1rem;
    }

    .quiz-result-grid {
        grid-template-columns: 40px 1fr 120px 120px;
    }
}

@media (max-width: 768px) {
    .quiz-app {
        padding: 1rem;
        margin: 0;
        width: 100%;
    }

    .quiz-header {
        padding: 1rem;
    }

    .quiz-header__title {
        font-size: 1.2rem;
    }

    .quiz-header__actions {
        gap: 0.25rem;
    }

    .quiz-header__actions .btn {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.75rem !important;
        min-height: auto !important;
        height: auto !important;
    }

    .quiz-setup-card {
        padding: 1.5rem;
        margin: 0 auto;
    }

    #quiz-container {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .quiz-results-card {
        padding: 1.5rem;
        max-width: 100%;
        margin: 0 auto;
    }

    .quiz-dialog {
        width: 95%;
    }

    .quiz-dialog__header {
        padding: 1rem 1.5rem;
        font-size: 1.3rem;
    }

    .quiz-dialog__body {
        padding: 1.5rem;
        font-size: 1rem;
    }

    .quiz-dialog__footer {
        padding: 1rem 1.5rem;
        flex-direction: column-reverse;
    }

    .quiz-dialog__footer .btn {
        width: 100%;
    }

    /* Ensure all buttons have minimum 44px height for touch targets */
    .btn,
    .quiz-setup__button,
    .quiz-timer__button,
    button {
        min-height: 44px;
        padding: 0.875rem 1.5rem;
    }

    .quiz-setup__select {
        min-height: 44px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .quiz-question {
        padding: 1.5rem;
    }

    .quiz-question__text {
        font-size: 1.1rem;
    }

    .quiz-results__percentage {
        font-size: 3rem;
    }

    .quiz-results__stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .quiz-results__stat {
        padding: 0.75rem 0.5rem;
        text-align: center;
    }

    .quiz-results__stat-value {
        font-size: 1.25rem;
    }

    .quiz-results__stat-label {
        font-size: 0.7rem;
    }

    .quiz-result-grid {
        grid-template-columns: 8% 30% 30% 30%;
        font-size: 0.9rem;
    }

    .quiz-result-row,
    .quiz-result-row-header {
        padding: 0.75rem 0.5rem;
    }

    .quiz-question__navigation {
        flex-direction: column;
    }

    .toast-container {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }

    .toast {
        min-width: auto;
    }
}


@media (max-width: 640px) {
    html, body, .quiz-page {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }

    .quiz-header {
        width: 100%;
        box-sizing: border-box;
        padding: 0.75rem 1rem;
    }

    .quiz-header__actions {
        gap: 0.25rem;
    }

    .quiz-header__actions .btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
        min-height: auto;
    }

    /* Hide prev/next buttons on mobile - use swipe instead */
    .btn--nav-prev,
    .btn--nav-next {
        display: none !important;
    }

    /* Swipeable elements */
    #quiz-question,
    #quiz-answers-content {
        transition: transform 0.3s ease, opacity 0.3s ease;
        will-change: transform, opacity;
    }

    #quiz-container {
        overflow: hidden;
    }

    .quiz-app {
        padding: 0;
        margin: 0;
        min-height: auto;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .quiz-setup-card {
        margin: 0 auto;
        width: calc(100% - 1rem);
        max-width: calc(100vw - 1rem);
        padding: 1rem;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .quiz-setup {
        min-height: auto;
        width: 100%;
        max-width: 100vw;
        padding: 0.5rem;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .quiz-setup__actions {
        margin-top: 0.5rem;
    }

    .quiz-setup__form {
        width: 100%;
        max-width: 100%;
    }

    .quiz-setup__field {
        width: 100%;
        max-width: 100%;
    }

    .quiz-setup__select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quiz-setup__start-btn {
        width: 100%;
        max-width: 100%;
    }

    .quiz-active {
        padding: 1rem;
    }

    .quiz-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    #quiz-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: hidden;
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
    }
    
    .content {
        padding: 5rem 0 0;
    }

    .quiz-nav-btn {
        width: 30px;
        height: 30px;
        min-height: auto;
        padding: 0.5rem 1rem;
    }

    .quiz-navigation__grid {
        padding: 0.5rem 0 0.5rem 0;
    }

    #quiz-overview-content {
        margin-bottom: 0px;
    }

    .quiz-question {
        padding: 1rem 0 1rem 0;
    }

    .quiz-question__navigation {
        display: flex;
        justify-content: center;
        gap: 1rem;
    }

    .quiz-question__answers {
        margin: 0;
        width: 100%;
    }

    .quiz-dialog__footer {
        flex-direction: row;
    }

    .quiz-results-card {
        width:auto;
    }

    .quiz-results__status {
        font-size: 1rem;
    }

    .quiz-results__percentage {
        font-size: 2rem;
    }

    .quiz-results__score {
        padding: 1rem;
    }

    .quiz-results__actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .quiz-results__actions .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .quiz-result-grid:has(.quiz-result-row-header) {
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: white;
        display: grid;
        grid-template-columns: 8% 30% 30% 30%;
    }

    .quiz-result-row-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 101 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0rem 1rem 0rem 0rem;
    }

    .quiz-results__breakdown-grid {
        position: relative;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Annex button mobile styles */
    .quiz-question__annex {
        margin: 1rem 0;
    }

    .question__annex-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .question__annex-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Annex modal mobile styles */
    .annex-modal {
        width: 95vw;
        height: 90vh;
        margin: 5vh auto;
    }

    .annex-modal-header {
        padding: 0.75rem 1rem;
    }

    .annex-modal-question-text {
        font-size: 0.85rem;
    }

    .annex-modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
}

/* Annex Button Styles */
.quiz-question__annex {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.question__annex-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Annex Modal Styles */
.annex-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.annex-modal-overlay--visible {
    opacity: 1;
}

.annex-modal {
    background: white;
    border-radius: 12px;
    max-width: 1200px;
    width: 95%;
    height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.annex-modal-overlay--visible .annex-modal {
    transform: scale(1);
}

.annex-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: white;
}

.annex-modal-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.annex-modal-title svg {
    width: 24px;
    height: 24px;
    stroke: #368BC1;
    flex-shrink: 0;
}

.annex-modal-question {
    flex: 1;
    min-width: 0;
}

.annex-modal-question-text {
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.annex-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.75rem;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 1rem;
}

.annex-modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.annex-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(90vh - 80px);
}

.annex-modal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.annex-modal-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #368BC1;
    border-radius: 50%;
    animation: annex-spin 1s linear infinite;
}

@keyframes annex-spin {
    to { transform: rotate(360deg); }
}

.annex-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================================================
   DARK MODE STYLES
   ============================================================================ */

/* Force dark mode */

/* Base / Page Layout */
html.dark-mode body {
    background: #13161b !important;
}

html.dark-mode .quiz-page {
    background: #13161b !important;
}

/* Header */
html.dark-mode .quiz-header {
    background: linear-gradient(135deg, #2a5a7e 0%, #1e4662 100%) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Loading Indicator */
html.dark-mode .loading-indicator::before {
    background: #1a1d23 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

html.dark-mode .loading-indicator p {
    color: #f3f4f6 !important;
}

html.dark-mode .spinner {
    border-color: #363c47 !important;
    border-top-color: #4a9ed4 !important;
}

/* Quiz Setup Section */
html.dark-mode .quiz-setup-card {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .quiz-setup-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

html.dark-mode .quiz-setup__header {
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-setup__title {
    color: #4a9ed4 !important;
}

html.dark-mode .quiz-setup__title svg {
    stroke: #4a9ed4 !important;
}

html.dark-mode .quiz-setup__label {
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-setup__select {
    background: #22262e !important;
    border-color: #363c47 !important;
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-setup__select:hover {
    border-color: #4a9ed4 !important;
    background: #2a2f38 !important;
}

html.dark-mode .quiz-setup__select:focus {
    border-color: #4a9ed4 !important;
    box-shadow: 0 0 0 3px rgba(74, 158, 212, 0.2) !important;
    background: #22262e !important;
}

html.dark-mode .quiz-setup__select option {
    background: #1a1d23 !important;
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-setup__select option:disabled {
    color: #6b7280 !important;
}

html.dark-mode .quiz-setup__actions {
    border-top-color: #363c47 !important;
}

html.dark-mode .quiz-setup__start-btn {
    background: #4a9ed4 !important;
}

html.dark-mode .quiz-setup__start-btn:hover {
    background: #5aa8dc !important;
    box-shadow: 0 4px 12px rgba(74, 158, 212, 0.3) !important;
}

/* Quiz Container */
html.dark-mode #quiz-container {
    background: #1a1d23 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

/* Timer */
html.dark-mode .timer {
    color: #4a9ed4 !important;
    border-color: #4a9ed4 !important;
    background: transparent !important;
}

html.dark-mode .timer--warning {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

/* Question Display */
html.dark-mode .quiz-question__text {
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-question__image img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .quiz-question__annex a {
    color: #4a9ed4 !important;
}

/* Answers */
html.dark-mode .quiz-answer {
    background: #22262e !important;
    border-color: #363c47 !important;
}

html.dark-mode .quiz-answer:hover {
    border-color: #4a9ed4 !important;
    background: #2a2f38 !important;
}

html.dark-mode .quiz-answer__text {
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-answer--selected {
    border-color: #4a9ed4 !important;
    background: rgba(74, 158, 212, 0.15) !important;
}

html.dark-mode .quiz-answer__letter {
    background: #363c47 !important;
    color: #9ca3af !important;
}

html.dark-mode .quiz-answer:hover .quiz-answer__letter {
    background: #4a9ed4 !important;
    color: #fff !important;
}

html.dark-mode .quiz-answer--selected .quiz-answer__letter {
    background: #4a9ed4 !important;
    color: #fff !important;
}

/* Question Navigation */
html.dark-mode .quiz-question__navigation {
    border-top-color: #363c47 !important;
}

/* Navigation Grid / Overview */
html.dark-mode #quiz-overview-content {
    background: #1a1d23 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-overview__header {
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-overview__title {
    color: #4a9ed4 !important;
}

html.dark-mode .quiz-navigation {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .quiz-navigation__title {
    color: #f3f4f6 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-navigation__grid {
    background: #1a1d23 !important;
}

html.dark-mode .quiz-nav-btn {
    background: #22262e !important;
    border-color: #363c47 !important;
    color: #9ca3af !important;
}

html.dark-mode .quiz-nav-btn:hover {
    border-color: #4a9ed4 !important;
    background: #2a2f38 !important;
}

html.dark-mode .quiz-nav-btn--answered {
    background: rgba(74, 158, 212, 0.15) !important;
    border-color: #4a9ed4 !important;
    color: #4a9ed4 !important;
}

html.dark-mode .quiz-nav-btn--current {
    background: #4a9ed4 !important;
    border-color: #4a9ed4 !important;
    color: white !important;
}

/* Results Screen */
html.dark-mode .quiz-results-card {
    background: #1a1d23 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .quiz-results__time-expired-banner {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

html.dark-mode .quiz-results__title {
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-results__score--passed {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: #22c55e !important;
}

html.dark-mode .quiz-results__score--passed .quiz-results__percentage {
    color: #4ade80 !important;
}

html.dark-mode .quiz-results__score--passed .quiz-results__status {
    color: #4ade80 !important;
}

html.dark-mode .quiz-results__score--failed {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
}

html.dark-mode .quiz-results__score--failed .quiz-results__percentage {
    color: #f87171 !important;
}

html.dark-mode .quiz-results__score--failed .quiz-results__status {
    color: #f87171 !important;
}

html.dark-mode .quiz-results__stat {
    background: #22262e !important;
}

html.dark-mode .quiz-results__stat-label {
    color: #9ca3af !important;
}

html.dark-mode .quiz-results__stat-value {
    color: #4a9ed4 !important;
}

html.dark-mode .quiz-results__stat--correct {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: #22c55e !important;
}

html.dark-mode .quiz-results__stat--correct .quiz-results__stat-value {
    color: #4ade80 !important;
}

html.dark-mode .quiz-results__stat--incorrect {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
}

html.dark-mode .quiz-results__stat--incorrect .quiz-results__stat-value {
    color: #f87171 !important;
}

html.dark-mode .quiz-results__stat--total {
    background: #22262e !important;
    border-color: #363c47 !important;
}

html.dark-mode .quiz-results__stat--total .quiz-results__stat-value {
    color: #9ca3af !important;
}

/* Results Breakdown */
html.dark-mode .quiz-results__breakdown {
    border-top-color: #363c47 !important;
}

html.dark-mode .quiz-results__breakdown-title {
    color: #f3f4f6 !important;
}

html.dark-mode .quiz-results__breakdown-grid {
    border-color: #363c47 !important;
}

html.dark-mode .quiz-result-grid {
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-result-grid:hover {
    background: #22262e !important;
}

html.dark-mode .quiz-result-grid--unanswered {
    background-color: #1a1d23 !important;
}

html.dark-mode .quiz-result-row-header {
    background: #22262e !important;
    color: #f3f4f6 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-result-row {
    color: #d1d5db !important;
}

/* Toast Notifications */
html.dark-mode .toast {
    background: #1a1d23 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

html.dark-mode .toast--success {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border-left-color: #22c55e !important;
}

html.dark-mode .toast--error {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border-left-color: #ef4444 !important;
}

html.dark-mode .toast--info {
    background: rgba(74, 158, 212, 0.15) !important;
    color: #4a9ed4 !important;
    border-left-color: #4a9ed4 !important;
}

/* Buttons */
html.dark-mode .btn--primary {
    background: #4a9ed4 !important;
}

html.dark-mode .btn--primary:hover:not(:disabled) {
    background: #5aa8dc !important;
}

html.dark-mode .btn--secondary {
    background: #4b5563 !important;
}

html.dark-mode .btn--secondary:hover:not(:disabled) {
    background: #6b7280 !important;
}

html.dark-mode .btn--outline {
    border-color: #f3f4f6 !important;
    color: #f3f4f6 !important;
}

html.dark-mode .btn--outline:hover {
    background: #f3f4f6 !important;
    color: #1a1d23 !important;
}

/* Dialog / Confirmation Modal */
html.dark-mode .quiz-dialog {
    background: #1a1d23 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

html.dark-mode .quiz-dialog__header {
    color: #f3f4f6 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .quiz-dialog--info .quiz-dialog__header {
    color: #4a9ed4 !important;
}

html.dark-mode .quiz-dialog--warning .quiz-dialog__header {
    color: #fbbf24 !important;
}

html.dark-mode .quiz-dialog--danger .quiz-dialog__header {
    color: #f87171 !important;
}

html.dark-mode .quiz-dialog--success .quiz-dialog__header {
    color: #4ade80 !important;
}

html.dark-mode .quiz-dialog__body {
    color: #d1d5db !important;
}

html.dark-mode .quiz-dialog__footer {
    border-top-color: #363c47 !important;
}

/* Annex Button */
html.dark-mode .question__annex-btn {
    background: #22262e !important;
    border-color: #363c47 !important;
    color: #4a9ed4 !important;
}

html.dark-mode .question__annex-btn:hover {
    background: #2a2f38 !important;
    border-color: #4a9ed4 !important;
}

/* Annex Modal */
html.dark-mode .annex-modal {
    background: #1a1d23 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

html.dark-mode .annex-modal-header {
    background: #1a1d23 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .annex-modal-title svg {
    stroke: #4a9ed4 !important;
}

html.dark-mode .annex-modal-question-text {
    color: #d1d5db !important;
}

html.dark-mode .annex-modal-close {
    background: #22262e !important;
    color: #9ca3af !important;
}

html.dark-mode .annex-modal-close:hover {
    background: #2a2f38 !important;
    color: #f3f4f6 !important;
}

html.dark-mode .annex-modal-spinner {
    border-color: #363c47 !important;
    border-top-color: #4a9ed4 !important;
}

/* Page Header (if used on quiz page) */
html.dark-mode #quiz-page-header .page-header__card {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
}

html.dark-mode #quiz-page-header .page-header__title {
    color: #4a9ed4 !important;
}

html.dark-mode #quiz-page-header .page-header__subtitle {
    color: #9ca3af !important;
}

/* Mobile sticky header fix */
@media (max-width: 640px) {
    html.dark-mode .quiz-result-grid:has(.quiz-result-row-header) {
        background: #1a1d23 !important;
    }
}

/* ============================================================================
   AUTO DARK MODE (System Preference)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    /* Base / Page Layout */
    html.dark-mode-auto body {
        background: #13161b !important;
    }

    html.dark-mode-auto .quiz-page {
        background: #13161b !important;
    }

    /* Header */
    html.dark-mode-auto .quiz-header {
        background: linear-gradient(135deg, #2a5a7e 0%, #1e4662 100%) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    /* Loading Indicator */
    html.dark-mode-auto .loading-indicator::before {
        background: #1a1d23 !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    }

    html.dark-mode-auto .loading-indicator p {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .spinner {
        border-color: #363c47 !important;
        border-top-color: #4a9ed4 !important;
    }

    /* Quiz Setup Section */
    html.dark-mode-auto .quiz-setup-card {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .quiz-setup-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    }

    html.dark-mode-auto .quiz-setup__header {
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-setup__title {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-setup__title svg {
        stroke: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-setup__label {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-setup__select {
        background: #22262e !important;
        border-color: #363c47 !important;
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-setup__select:hover {
        border-color: #4a9ed4 !important;
        background: #2a2f38 !important;
    }

    html.dark-mode-auto .quiz-setup__select:focus {
        border-color: #4a9ed4 !important;
        box-shadow: 0 0 0 3px rgba(74, 158, 212, 0.2) !important;
        background: #22262e !important;
    }

    html.dark-mode-auto .quiz-setup__select option {
        background: #1a1d23 !important;
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-setup__select option:disabled {
        color: #6b7280 !important;
    }

    html.dark-mode-auto .quiz-setup__actions {
        border-top-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-setup__start-btn {
        background: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-setup__start-btn:hover {
        background: #5aa8dc !important;
        box-shadow: 0 4px 12px rgba(74, 158, 212, 0.3) !important;
    }

    /* Quiz Container */
    html.dark-mode-auto #quiz-container {
        background: #1a1d23 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    }

    /* Timer */
    html.dark-mode-auto .timer {
        color: #4a9ed4 !important;
        border-color: #4a9ed4 !important;
        background: transparent !important;
    }

    html.dark-mode-auto .timer--warning {
        background: #dc3545 !important;
        color: white !important;
        border-color: #dc3545 !important;
    }

    /* Question Display */
    html.dark-mode-auto .quiz-question__text {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-question__image img {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .quiz-question__annex a {
        color: #4a9ed4 !important;
    }

    /* Answers */
    html.dark-mode-auto .quiz-answer {
        background: #22262e !important;
        border-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-answer:hover {
        border-color: #4a9ed4 !important;
        background: #2a2f38 !important;
    }

    html.dark-mode-auto .quiz-answer__text {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-answer--selected {
        border-color: #4a9ed4 !important;
        background: rgba(74, 158, 212, 0.15) !important;
    }

    html.dark-mode-auto .quiz-answer__letter {
        background: #363c47 !important;
        color: #9ca3af !important;
    }

    html.dark-mode-auto .quiz-answer:hover .quiz-answer__letter {
        background: #4a9ed4 !important;
        color: #fff !important;
    }

    html.dark-mode-auto .quiz-answer--selected .quiz-answer__letter {
        background: #4a9ed4 !important;
        color: #fff !important;
    }

    /* Question Navigation */
    html.dark-mode-auto .quiz-question__navigation {
        border-top-color: #363c47 !important;
    }

    /* Navigation Grid / Overview */
    html.dark-mode-auto #quiz-overview-content {
        background: #1a1d23 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-overview__header {
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-overview__title {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-navigation {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .quiz-navigation__title {
        color: #f3f4f6 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-navigation__grid {
        background: #1a1d23 !important;
    }

    html.dark-mode-auto .quiz-nav-btn {
        background: #22262e !important;
        border-color: #363c47 !important;
        color: #9ca3af !important;
    }

    html.dark-mode-auto .quiz-nav-btn:hover {
        border-color: #4a9ed4 !important;
        background: #2a2f38 !important;
    }

    html.dark-mode-auto .quiz-nav-btn--answered {
        background: rgba(74, 158, 212, 0.15) !important;
        border-color: #4a9ed4 !important;
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-nav-btn--current {
        background: #4a9ed4 !important;
        border-color: #4a9ed4 !important;
        color: white !important;
    }

    /* Results Screen */
    html.dark-mode-auto .quiz-results-card {
        background: #1a1d23 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .quiz-results__title {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-results__score--passed {
        background: rgba(34, 197, 94, 0.15) !important;
        border-color: #22c55e !important;
    }

    html.dark-mode-auto .quiz-results__score--passed .quiz-results__percentage {
        color: #4ade80 !important;
    }

    html.dark-mode-auto .quiz-results__score--passed .quiz-results__status {
        color: #4ade80 !important;
    }

    html.dark-mode-auto .quiz-results__score--failed {
        background: rgba(239, 68, 68, 0.15) !important;
        border-color: #ef4444 !important;
    }

    html.dark-mode-auto .quiz-results__score--failed .quiz-results__percentage {
        color: #f87171 !important;
    }

    html.dark-mode-auto .quiz-results__score--failed .quiz-results__status {
        color: #f87171 !important;
    }

    html.dark-mode-auto .quiz-results__stat {
        background: #22262e !important;
    }

    html.dark-mode-auto .quiz-results__stat-label {
        color: #9ca3af !important;
    }

    html.dark-mode-auto .quiz-results__stat-value {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-results__stat--correct {
        background: rgba(34, 197, 94, 0.15) !important;
        border-color: #22c55e !important;
    }

    html.dark-mode-auto .quiz-results__stat--correct .quiz-results__stat-value {
        color: #4ade80 !important;
    }

    html.dark-mode-auto .quiz-results__stat--incorrect {
        background: rgba(239, 68, 68, 0.15) !important;
        border-color: #ef4444 !important;
    }

    html.dark-mode-auto .quiz-results__stat--incorrect .quiz-results__stat-value {
        color: #f87171 !important;
    }

    html.dark-mode-auto .quiz-results__stat--total {
        background: #22262e !important;
        border-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-results__stat--total .quiz-results__stat-value {
        color: #9ca3af !important;
    }

    /* Results Breakdown */
    html.dark-mode-auto .quiz-results__breakdown {
        border-top-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-results__breakdown-title {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .quiz-results__breakdown-grid {
        border-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-result-grid {
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-result-grid:hover {
        background: #22262e !important;
    }

    html.dark-mode-auto .quiz-result-grid--unanswered {
        background-color: #1a1d23 !important;
    }

    html.dark-mode-auto .quiz-result-row-header {
        background: #22262e !important;
        color: #f3f4f6 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-result-row {
        color: #d1d5db !important;
    }

    /* Toast Notifications */
    html.dark-mode-auto .toast {
        background: #1a1d23 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    }

    html.dark-mode-auto .toast--success {
        background: rgba(34, 197, 94, 0.15) !important;
        color: #4ade80 !important;
        border-left-color: #22c55e !important;
    }

    html.dark-mode-auto .toast--error {
        background: rgba(239, 68, 68, 0.15) !important;
        color: #f87171 !important;
        border-left-color: #ef4444 !important;
    }

    html.dark-mode-auto .toast--info {
        background: rgba(74, 158, 212, 0.15) !important;
        color: #4a9ed4 !important;
        border-left-color: #4a9ed4 !important;
    }

    /* Buttons */
    html.dark-mode-auto .btn--primary {
        background: #4a9ed4 !important;
    }

    html.dark-mode-auto .btn--primary:hover:not(:disabled) {
        background: #5aa8dc !important;
    }

    html.dark-mode-auto .btn--secondary {
        background: #4b5563 !important;
    }

    html.dark-mode-auto .btn--secondary:hover:not(:disabled) {
        background: #6b7280 !important;
    }

    html.dark-mode-auto .btn--outline {
        border-color: #f3f4f6 !important;
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .btn--outline:hover {
        background: #f3f4f6 !important;
        color: #1a1d23 !important;
    }

    /* Dialog / Confirmation Modal */
    html.dark-mode-auto .quiz-dialog {
        background: #1a1d23 !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    }

    html.dark-mode-auto .quiz-dialog__header {
        color: #f3f4f6 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .quiz-dialog--info .quiz-dialog__header {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .quiz-dialog--warning .quiz-dialog__header {
        color: #fbbf24 !important;
    }

    html.dark-mode-auto .quiz-dialog--danger .quiz-dialog__header {
        color: #f87171 !important;
    }

    html.dark-mode-auto .quiz-dialog--success .quiz-dialog__header {
        color: #4ade80 !important;
    }

    html.dark-mode-auto .quiz-dialog__body {
        color: #d1d5db !important;
    }

    html.dark-mode-auto .quiz-dialog__footer {
        border-top-color: #363c47 !important;
    }

    /* Annex Button */
    html.dark-mode-auto .question__annex-btn {
        background: #22262e !important;
        border-color: #363c47 !important;
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .question__annex-btn:hover {
        background: #2a2f38 !important;
        border-color: #4a9ed4 !important;
    }

    /* Annex Modal */
    html.dark-mode-auto .annex-modal {
        background: #1a1d23 !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    }

    html.dark-mode-auto .annex-modal-header {
        background: #1a1d23 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .annex-modal-title svg {
        stroke: #4a9ed4 !important;
    }

    html.dark-mode-auto .annex-modal-question-text {
        color: #d1d5db !important;
    }

    html.dark-mode-auto .annex-modal-close {
        background: #22262e !important;
        color: #9ca3af !important;
    }

    html.dark-mode-auto .annex-modal-close:hover {
        background: #2a2f38 !important;
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .annex-modal-spinner {
        border-color: #363c47 !important;
        border-top-color: #4a9ed4 !important;
    }

    /* Page Header (if used on quiz page) */
    html.dark-mode-auto #quiz-page-header .page-header__card {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
    }

    html.dark-mode-auto #quiz-page-header .page-header__title {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto #quiz-page-header .page-header__subtitle {
        color: #9ca3af !important;
    }

    /* Mobile sticky header fix */
    @media (max-width: 640px) {
        html.dark-mode-auto .quiz-result-grid:has(.quiz-result-row-header) {
            background: #1a1d23 !important;
        }
    }
}
