/* =========================================
   Quiz Creator Module - Styles
   Caly-Quiz LMS - Modern UI
   ========================================= */

/* Variables */
:root {
    --qc-primary: #f59e0b;
    --qc-primary-dark: #d97706;
    --qc-secondary: #1e3a5f;
    --qc-bg: #f8f9fa;
    --qc-card-bg: #ffffff;
    --qc-text: #1f2937;
    --qc-text-light: #6b7280;
    --qc-border: #e5e7eb;
    --qc-shadow: rgba(0, 0, 0, 0.06);
    --qc-success: #22c55e;
    --qc-danger: #ef4444;
    --qc-info: #3b82f6;
    --qc-radius: 12px;
    --qc-radius-sm: 8px;
}

/* =========================================
   Overlay & Modal
   ========================================= */

.qc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.qc-overlay.active {
    opacity: 1;
    visibility: visible;
}

.qc-modal {
    background: var(--qc-card-bg);
    border-radius: 20px;
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.qc-overlay.active .qc-modal {
    transform: scale(1) translateY(0);
}

.qc-modal-small {
    max-width: 600px;
}

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

.qc-header {
    background: linear-gradient(135deg, var(--qc-primary) 0%, var(--qc-primary-dark) 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qc-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.qc-icon {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qc-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.qc-subtitle {
    margin: 4px 0 0;
    opacity: 0.8;
    font-size: 14px;
}

.qc-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qc-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* =========================================
   Body & Tabs
   ========================================= */

.qc-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--qc-bg);
    min-height: 350px;
}

.qc-tabs {
    display: flex;
    background: var(--qc-card-bg);
    padding: 8px;
    gap: 8px;
    border-bottom: 1px solid var(--qc-border);
}

.qc-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: var(--qc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--qc-text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.qc-tab:hover {
    background: var(--qc-bg);
    color: var(--qc-text);
}

.qc-tab.active {
    background: var(--qc-primary);
    color: white;
}

.qc-tab-icon {
    font-size: 18px;
}

.qc-tab-badge {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    min-width: 24px;
    text-align: center;
}

.qc-tab.active .qc-tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================================
   Content Area
   ========================================= */

.qc-content {
    flex: 1 1 0;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.qc-tab-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.qc-tab-content.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   Search Bar
   ========================================= */

.qc-search-bar {
    position: relative;
    margin-bottom: 20px;
}

.qc-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--qc-text-light);
}

.qc-search-bar input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border: 2px solid var(--qc-border);
    border-radius: var(--qc-radius);
    font-size: 15px;
    background: var(--qc-card-bg);
    transition: all 0.2s ease;
}

.qc-search-bar input:focus {
    outline: none;
    border-color: var(--qc-primary);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

/* =========================================
   Categories Grid
   ========================================= */

.qc-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.qc-category-card {
    background: var(--qc-card-bg);
    border-radius: var(--qc-radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px var(--qc-shadow);
}

.qc-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--qc-primary);
}

.qc-category-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.qc-category-info {
    flex: 1;
}

.qc-category-info h4 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--qc-text);
}

.qc-category-info p {
    margin: 0;
    font-size: 13px;
    color: var(--qc-text-light);
}

.qc-category-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--qc-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--qc-text-light);
    transition: all 0.2s ease;
}

.qc-category-badge.active {
    background: var(--qc-success);
    color: white;
}

/* =========================================
   Courses List
   ========================================= */

.qc-courses-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.qc-course-group {
    background: var(--qc-card-bg);
    border-radius: var(--qc-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--qc-shadow);
}

.qc-course-group-header {
    background: var(--qc-secondary);
    color: white;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.qc-course-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.qc-course-items {
    padding: 10px;
}

.qc-course-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--qc-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.qc-course-item:hover {
    background: var(--qc-bg);
}

.qc-course-item input {
    width: 20px;
    height: 20px;
    accent-color: var(--qc-primary);
}

.qc-course-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qc-course-title {
    font-weight: 500;
    color: var(--qc-text);
}

.qc-course-slides {
    font-size: 12px;
    color: var(--qc-text-light);
}

/* =========================================
   Selection Tab
   ========================================= */

.qc-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--qc-border);
}

.qc-selection-info {
    font-weight: 500;
    color: var(--qc-text);
}

.qc-selection-actions {
    display: flex;
    gap: 10px;
}

.qc-selection-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.qc-selection-group {
    background: var(--qc-card-bg);
    border-radius: var(--qc-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--qc-shadow);
}

.qc-selection-group-header {
    background: linear-gradient(135deg, var(--qc-secondary) 0%, #2a4a6b 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.qc-selection-group-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.qc-selection-items {
    padding: 8px;
}

.qc-selection-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--qc-radius-sm);
    transition: all 0.2s ease;
}

.qc-selection-item:hover {
    background: var(--qc-bg);
}

.qc-selection-drag {
    color: var(--qc-text-light);
    cursor: grab;
    font-size: 12px;
}

.qc-selection-text {
    flex: 1;
    font-size: 14px;
    color: var(--qc-text);
    line-height: 1.4;
}

.qc-selection-difficulty {
    font-size: 12px;
    color: #92400e;
}

.qc-selection-remove {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--qc-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qc-selection-remove:hover {
    background: var(--qc-danger);
    color: white;
}

/* =========================================
   Empty State
   ========================================= */

.qc-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--qc-text-light);
}

.qc-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.qc-empty-state p {
    margin: 0 0 8px;
    font-size: 16px;
}

.qc-empty-state small {
    font-size: 13px;
}

/* =========================================
   Footer
   ========================================= */

.qc-footer {
    background: var(--qc-card-bg);
    border-top: 1px solid var(--qc-border);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
}

.qc-footer-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.qc-footer-right {
    display: flex;
    gap: 12px;
}

.qc-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qc-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--qc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qc-form-group input,
.qc-form-group select {
    padding: 10px 14px;
    border: 2px solid var(--qc-border);
    border-radius: var(--qc-radius-sm);
    font-size: 14px;
    min-width: 180px;
    transition: all 0.2s ease;
}

.qc-form-group input:focus,
.qc-form-group select:focus {
    outline: none;
    border-color: var(--qc-primary);
}

.qc-number-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--qc-border);
    border-radius: var(--qc-radius-sm);
    overflow: hidden;
}

.qc-number-input button {
    background: var(--qc-bg);
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qc-number-input button:hover {
    background: var(--qc-primary);
    color: white;
}

.qc-number-input input {
    border: none;
    width: 60px;
    text-align: center;
    font-weight: 600;
    min-width: auto;
}

.qc-number-input input:focus {
    outline: none;
}

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

.qc-btn-primary {
    background: linear-gradient(135deg, var(--qc-primary) 0%, var(--qc-primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--qc-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.qc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(245, 158, 11, 0.4);
}

.qc-btn-secondary {
    background: var(--qc-bg);
    color: var(--qc-text);
    border: 2px solid var(--qc-border);
    padding: 10px 18px;
    border-radius: var(--qc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.qc-btn-secondary:hover {
    border-color: var(--qc-primary);
    color: #92400e;
}

.qc-btn-icon {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qc-btn-icon:hover {
    background: var(--qc-bg);
}

.qc-btn-icon.qc-btn-danger:hover {
    background: var(--qc-danger);
    color: white;
}

/* =========================================
   Popup (Questions List)
   ========================================= */

.qc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.qc-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.qc-popup {
    background: var(--qc-card-bg);
    border-radius: var(--qc-radius);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.qc-popup-overlay.active .qc-popup {
    transform: scale(1);
}

.qc-popup-header {
    background: var(--qc-secondary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--qc-radius) var(--qc-radius) 0 0;
}

.qc-popup-header h3 {
    margin: 0;
    font-size: 18px;
}

.qc-popup-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--qc-bg);
    border-bottom: 1px solid var(--qc-border);
}

.qc-checkbox-all {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--qc-text);
}

.qc-checkbox-all input {
    width: 18px;
    height: 18px;
    accent-color: var(--qc-primary);
}

.qc-popup-search input {
    padding: 8px 14px;
    border: 1px solid var(--qc-border);
    border-radius: 20px;
    font-size: 13px;
    width: 200px;
}

.qc-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.qc-popup-question {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--qc-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    margin-bottom: 8px;
    background: var(--qc-bg);
}

.qc-popup-question:hover {
    background: var(--qc-card-bg);
    border-color: var(--qc-border);
}

.qc-popup-question.selected {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--qc-success);
}

.qc-popup-question input {
    width: 20px;
    height: 20px;
    accent-color: var(--qc-success);
    margin-top: 2px;
    flex-shrink: 0;
}

.qc-popup-question-content {
    flex: 1;
}

.qc-popup-question-text {
    font-size: 14px;
    color: var(--qc-text);
    line-height: 1.5;
    margin-bottom: 8px;
}

.qc-popup-question-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.qc-popup-level {
    background: var(--qc-info);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
}

.qc-popup-difficulty {
    color: #92400e;
}

.qc-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--qc-bg);
    border-top: 1px solid var(--qc-border);
    border-radius: 0 0 var(--qc-radius) var(--qc-radius);
}

/* =========================================
   Saved Quizzes List
   ========================================= */

.qc-saved-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.qc-saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    background: var(--qc-bg);
    border-radius: var(--qc-radius-sm);
    transition: all 0.2s ease;
}

.qc-saved-item:hover {
    background: var(--qc-card-bg);
    box-shadow: 0 2px 10px var(--qc-shadow);
}

.qc-saved-info h4 {
    margin: 0 0 4px;
    font-size: 15px;
    color: var(--qc-text);
}

.qc-saved-info p {
    margin: 0;
    font-size: 13px;
    color: var(--qc-text-light);
}

.qc-saved-actions {
    display: flex;
    gap: 8px;
}

/* =========================================
   Notification
   ========================================= */

.qc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: var(--qc-card-bg);
    border-radius: var(--qc-radius-sm);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10010;
    animation: qcSlideIn 0.3s ease;
}

.qc-notification-success {
    border-left: 4px solid var(--qc-success);
}

.qc-notification-error {
    border-left: 4px solid var(--qc-danger);
}

.qc-notification-info {
    border-left: 4px solid var(--qc-info);
}

.qc-notification button {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--qc-text-light);
}

@keyframes qcSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =========================================
   Mobile Responsive
   ========================================= */

@media (max-width: 768px) {
    .qc-modal {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }

    .qc-header {
        padding: 15px 18px;
    }

    .qc-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .qc-header h2 {
        font-size: 18px;
    }

    .qc-tabs {
        flex-wrap: wrap;
    }

    .qc-tab {
        flex: 1 1 auto;
        min-width: calc(33.33% - 6px);
        padding: 10px;
        font-size: 12px;
    }

    .qc-tab span:not(.qc-tab-icon):not(.qc-tab-badge) {
        display: none;
    }

    .qc-categories-grid {
        grid-template-columns: 1fr;
    }

    .qc-footer {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .qc-footer-left {
        flex-direction: column;
        width: 100%;
    }

    .qc-form-group {
        width: 100%;
    }

    .qc-form-group input,
    .qc-form-group select {
        width: 100%;
        min-width: auto;
    }

    .qc-footer-right {
        width: 100%;
        flex-direction: column;
    }

    .qc-footer-right button {
        width: 100%;
        justify-content: center;
    }

    .qc-popup {
        width: 95%;
        max-height: 85vh;
    }
}

/* =========================================
   Scrollbar
   ========================================= */

.qc-tab-content::-webkit-scrollbar,
.qc-popup-content::-webkit-scrollbar {
    width: 8px;
}

.qc-tab-content::-webkit-scrollbar-track,
.qc-popup-content::-webkit-scrollbar-track {
    background: var(--qc-bg);
}

.qc-tab-content::-webkit-scrollbar-thumb,
.qc-popup-content::-webkit-scrollbar-thumb {
    background: var(--qc-border);
    border-radius: 4px;
}

.qc-tab-content::-webkit-scrollbar-thumb:hover,
.qc-popup-content::-webkit-scrollbar-thumb:hover {
    background: var(--qc-text-light);
}

/* =============================================
   QUIZ RUNNER — Styles de passation et correction
   ============================================= */

/* Variables runner */
:root {
    --qr-primary: #3b82f6;
    --qr-primary-dark: #2563eb;
    --qr-success: #22c55e;
    --qr-danger: #ef4444;
    --qr-warning: #f59e0b;
    --qr-bg: #f0f4f8;
    --qr-card: #ffffff;
    --qr-text: #1e293b;
    --qr-text-light: #64748b;
    --qr-border: #e2e8f0;
    --qr-radius: 14px;
}

/* Overlay */
.qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--qr-bg);
    z-index: 10010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.qr-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container */
.qr-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 960px;
    margin: 0 auto;
}

/* Header */
.qr-header {
    background: linear-gradient(135deg, var(--qr-primary) 0%, var(--qr-primary-dark) 100%);
    color: white;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.qr-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qr-quiz-icon {
    font-size: 28px;
    background: rgba(255, 255, 255, 0.2);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-quiz-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.qr-quiz-meta {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: 0.8;
}

.qr-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.qr-timer {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.qr-home-btn {
    background: rgba(34, 197, 94, 0.25);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 6px;
}

.qr-home-btn:hover {
    background: rgba(34, 197, 94, 0.5);
}

.qr-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qr-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Progress bar */
.qr-progress-bar {
    height: 4px;
    background: var(--qr-border);
    flex-shrink: 0;
}

.qr-progress-fill {
    height: 100%;
    background: var(--qr-success);
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

/* Nav pills */
.qr-nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    background: var(--qr-card);
    border-bottom: 1px solid var(--qr-border);
    flex-shrink: 0;
    max-height: 80px;
    overflow-y: auto;
    justify-content: center;
}

.qr-pill {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--qr-bg);
    color: var(--qr-text-light);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.qr-pill:hover {
    background: var(--qr-primary);
    color: white;
}

.qr-pill.current {
    border-color: var(--qr-primary);
    color: var(--qr-primary);
    font-weight: 700;
}

.qr-pill.answered {
    background: var(--qr-primary);
    color: white;
}

.qr-pill.current.answered {
    background: var(--qr-primary);
    color: white;
    border-color: var(--qr-primary-dark);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.qr-pills-summary {
    font-size: 14px;
    color: var(--qr-text-light);
    padding: 4px 0;
}

/* Question area */
.qr-question-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

.qr-question-card {
    background: var(--qr-card);
    border-radius: var(--qr-radius);
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.qr-question-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.qr-question-badge {
    background: var(--qr-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.qr-question-domain {
    background: var(--qr-bg);
    color: var(--qr-text-light);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.qr-question-diff {
    font-size: 13px;
    color: #d97706;
}

.qr-question-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--qr-text);
    margin: 0 0 20px;
}

.qr-multi-hint {
    font-size: 13px;
    color: var(--qr-primary);
    font-style: italic;
    margin: -12px 0 16px;
}

/* Options */
.qr-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qr-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--qr-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--qr-card);
}

.qr-option:hover {
    border-color: var(--qr-primary);
    background: rgba(59, 130, 246, 0.04);
    transform: translateX(4px);
}

.qr-option.selected {
    border-color: var(--qr-primary);
    background: rgba(59, 130, 246, 0.08);
}

.qr-option-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--qr-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--qr-text-light);
    flex-shrink: 0;
    transition: all 0.2s;
}

.qr-option.selected .qr-option-marker {
    background: var(--qr-primary);
    color: white;
}

.qr-option-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.4;
    color: var(--qr-text);
}

.qr-option-check {
    font-size: 18px;
    color: var(--qr-primary);
    width: 24px;
    text-align: center;
}

/* Footer */
.qr-footer {
    background: var(--qr-card);
    border-top: 1px solid var(--qr-border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.qr-counter {
    font-size: 15px;
    font-weight: 600;
    color: var(--qr-text-light);
}

.qr-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.qr-btn-primary {
    background: var(--qr-primary);
    color: white;
}

.qr-btn-primary:hover:not(:disabled) {
    background: var(--qr-primary-dark);
    transform: translateY(-1px);
}

.qr-btn-outline {
    background: var(--qr-bg);
    color: var(--qr-text);
    border: 2px solid var(--qr-border);
}

.qr-btn-outline:hover:not(:disabled) {
    border-color: var(--qr-primary);
    color: var(--qr-primary);
}

.qr-btn-success {
    background: var(--qr-success);
    color: white;
}

.qr-btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

/* =============================================
   RESULTS
   ============================================= */

.qr-results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--qr-bg);
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}

.qr-results-container {
    width: 100%;
    max-width: 800px;
    padding: 30px 20px 60px;
}

/* Score header */
.qr-score-header {
    background: var(--qr-card);
    border-radius: var(--qr-radius);
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.qr-score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.qr-score-circle svg {
    width: 100%;
    height: 100%;
}

.qr-score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 800;
    color: var(--grade-color, var(--qr-primary));
}

.qr-score-info {
    flex: 1;
}

.qr-grade {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.qr-score-detail {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: 8px;
}

.qr-score-correct {
    color: var(--qr-success);
    font-weight: 600;
}

.qr-score-wrong {
    color: var(--qr-danger);
    font-weight: 600;
}

.qr-score-skip {
    color: var(--qr-text-light);
}

.qr-score-time {
    font-size: 13px;
    color: var(--qr-text-light);
}

/* Domain stats */
.qr-domain-stats {
    background: var(--qr-card);
    border-radius: var(--qr-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.qr-domain-stats h4 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--qr-text);
}

.qr-domain-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qr-domain-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qr-domain-name {
    width: 180px;
    font-size: 13px;
    color: var(--qr-text);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.qr-domain-bar {
    flex: 1;
    height: 8px;
    background: var(--qr-bg);
    border-radius: 4px;
    overflow: hidden;
}

.qr-domain-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.qr-domain-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--qr-text-light);
    width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Correction */
.qr-correction {
    background: var(--qr-card);
    border-radius: var(--qr-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.qr-correction h4 {
    margin: 0 0 18px;
    font-size: 16px;
    color: var(--qr-text);
}

.qr-correction-item {
    border: 2px solid var(--qr-border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
    transition: all 0.2s;
}

.qr-correction-item.correct {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.03);
}

.qr-correction-item.wrong {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.03);
}

.qr-correction-item.skipped {
    border-color: rgba(100, 116, 139, 0.2);
    background: rgba(100, 116, 139, 0.03);
}

.qr-correction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.qr-correction-num {
    font-weight: 700;
    font-size: 14px;
    color: var(--qr-primary);
}

.qr-correction-status {
    font-size: 13px;
    font-weight: 600;
}

.qr-correction-item.correct .qr-correction-status {
    color: var(--qr-success);
}

.qr-correction-item.wrong .qr-correction-status {
    color: var(--qr-danger);
}

.qr-correction-item.skipped .qr-correction-status {
    color: var(--qr-text-light);
}

.qr-correction-question {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--qr-text);
}

.qr-correction-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.qr-correction-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    background: var(--qr-bg);
}

.qr-correction-opt.opt-correct {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    font-weight: 500;
}

.qr-correction-opt.opt-wrong {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
    text-decoration: line-through;
}

.qr-correction-opt.opt-missed {
    background: rgba(245, 158, 11, 0.12);
    border: 1px dashed var(--qr-warning);
    color: #92400e;
}

.qr-opt-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.qr-opt-text {
    flex: 1;
    line-height: 1.4;
}

.qr-opt-badge {
    font-size: 14px;
    font-weight: 700;
}

.qr-opt-badge.correct-badge {
    color: var(--qr-success);
}

.qr-opt-badge.wrong-badge {
    color: var(--qr-danger);
}

.qr-correction-explanation {
    font-size: 13px;
    line-height: 1.5;
    color: var(--qr-text-light);
    background: rgba(59, 130, 246, 0.06);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--qr-primary);
}

/* Actions */
.qr-results-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

/* =============================================
   LIVE SCORE — Header score en direct
   ============================================= */

.qr-live-score {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(59, 130, 246, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.qr-live-correct {
    color: #22c55e;
}

.qr-live-sep {
    color: #94a3b8;
    margin: 0 2px;
}

.qr-live-total {
    color: var(--qr-primary);
}

/* =============================================
   BOUTON VALIDER
   ============================================= */

.qr-btn-validate {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: qr-pulse-validate 1.5s ease-in-out infinite;
}

.qr-btn-validate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}

@keyframes qr-pulse-validate {
    0%, 100% { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5); }
}

/* =============================================
   VALIDATION INSTANTANEE — Feedback par question
   ============================================= */

/* Bandeau de resultat */
.qr-validation-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    margin: 12px 0;
    animation: qr-slide-in 0.3s ease;
}

@keyframes qr-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.qr-validation-banner.correct {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 2px solid rgba(34, 197, 94, 0.3);
}

.qr-validation-banner.wrong {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.qr-validation-icon {
    font-size: 22px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-validation-banner.correct .qr-validation-icon {
    background: rgba(34, 197, 94, 0.2);
}

.qr-validation-banner.wrong .qr-validation-icon {
    background: rgba(239, 68, 68, 0.2);
}

/* Options verrouillees apres validation */
.qr-option.locked {
    cursor: default;
    pointer-events: none;
    opacity: 0.7;
}

.qr-option.locked.correct-opt {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    opacity: 1;
}

.qr-option.locked.correct-opt .qr-option-marker {
    background: #22c55e;
    color: #fff;
}

.qr-option.locked.correct-opt .qr-option-check {
    color: #22c55e;
    font-weight: 700;
    font-size: 18px;
}

.qr-option.locked.wrong-opt {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    opacity: 1;
}

.qr-option.locked.wrong-opt .qr-option-marker {
    background: #ef4444;
    color: #fff;
}

.qr-option.locked.wrong-opt .qr-option-text {
    text-decoration: line-through;
    color: #94a3b8;
}

.qr-option.locked.wrong-opt .qr-option-check {
    color: #ef4444;
    font-weight: 700;
    font-size: 18px;
}

.qr-option.locked.missed-opt {
    background: rgba(245, 158, 11, 0.08);
    border: 2px dashed #f59e0b;
    opacity: 1;
}

.qr-option.locked.missed-opt .qr-option-marker {
    background: #f59e0b;
    color: #fff;
}

.qr-option.locked.missed-opt .qr-option-check {
    color: #f59e0b;
    font-size: 14px;
}

.qr-option.locked.missed-opt::after {
    content: 'Bonne reponse';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #f59e0b;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.qr-option.locked.missed-opt {
    position: relative;
}

/* Bloc explication pedagogique */
.qr-explanation {
    margin-top: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(99, 102, 241, 0.06));
    border-radius: 12px;
    border-left: 4px solid var(--qr-primary);
    animation: qr-slide-in 0.4s ease 0.15s both;
}

.qr-explanation.no-explanation {
    border-left-color: #94a3b8;
    background: rgba(148, 163, 184, 0.06);
}

.qr-explanation-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--qr-primary);
    margin-bottom: 8px;
}

.qr-explanation.no-explanation .qr-explanation-title {
    color: #94a3b8;
}

.qr-explanation-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--qr-text);
}

/* Card validee */
.qr-question-card.validated {
    border-color: rgba(59, 130, 246, 0.2);
}

/* Nav pills colores (correct/incorrect) */
.qr-pill.pill-correct {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.qr-pill.pill-wrong {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* Explication dans la correction finale (toujours visible) */
.qr-correction-explanation {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--qr-primary);
    background: rgba(59, 130, 246, 0.06);
    font-size: 13px;
    line-height: 1.5;
    color: var(--qr-text);
}

.qr-correction-explanation.no-explanation {
    border-left-color: #94a3b8;
    background: rgba(148, 163, 184, 0.06);
    font-style: italic;
    color: #94a3b8;
}

/* =============================================
   XP Banner + Recommandations + Revision
   ============================================= */

.qr-xp-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    animation: qr-xp-pop 0.5s ease;
}

@keyframes qr-xp-pop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.qr-xp-icon {
    font-size: 1.5rem;
}

.qr-xp-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.qr-badge-unlock {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: 20px;
}

.qr-recommendations {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 20px;
    margin-bottom: 8px;
}

.qr-recommendations h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #92400e;
    margin: 0 0 12px 0;
}

.qr-weak-domains {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.qr-weak-domain-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #b45309;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 8px;
}

.qr-review-reminder {
    font-size: 0.85rem;
    color: #1e40af;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    margin-top: 8px;
}

.qr-btn-warn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.qr-btn-warn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* =============================================
   RESPONSIVE — Quiz Runner
   ============================================= */

@media (max-width: 768px) {
    .qr-header {
        padding: 10px 16px;
    }

    .qr-quiz-icon {
        display: none;
    }

    .qr-quiz-title {
        font-size: 15px;
    }

    .qr-question-area {
        padding: 16px 12px;
    }

    .qr-question-card {
        padding: 20px 16px;
    }

    .qr-question-text {
        font-size: 16px;
    }

    .qr-option {
        padding: 12px 14px;
    }

    .qr-option-marker {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .qr-footer {
        padding: 10px 16px;
    }

    .qr-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .qr-score-header {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }

    .qr-score-detail {
        justify-content: center;
    }

    .qr-domain-name {
        width: 120px;
        font-size: 12px;
    }

    .qr-nav-pills {
        padding: 8px 12px;
    }

    .qr-pill {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}

/* Scrollbar runner */
.qr-question-area::-webkit-scrollbar,
.qr-results-overlay::-webkit-scrollbar {
    width: 6px;
}

.qr-question-area::-webkit-scrollbar-track,
.qr-results-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.qr-question-area::-webkit-scrollbar-thumb,
.qr-results-overlay::-webkit-scrollbar-thumb {
    background: var(--qr-border);
    border-radius: 3px;
}

.qr-question-area::-webkit-scrollbar-thumb:hover,
.qr-results-overlay::-webkit-scrollbar-thumb:hover {
    background: var(--qr-text-light);
}

/* =========================================
   Quick Start — Écran de sélection rapide
   ========================================= */

#quick-start-screen {
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

#quick-start-screen .qs-themes-grid {
    padding: 14px 16px 8px;
}

.qs-themes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* --- Theme cards with gradient backgrounds --- */
.qs-theme-card {
    background: linear-gradient(135deg, var(--theme-color, var(--qc-primary)), color-mix(in srgb, var(--theme-color, var(--qc-primary)) 70%, #1a1a2e));
    border: 2px solid transparent;
    border-radius: var(--qc-radius);
    padding: 12px 8px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.qs-theme-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.qs-theme-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-color, var(--qc-primary)) 35%, transparent);
}

.qs-theme-card:hover::before {
    opacity: 1;
}

.qs-theme-card.active {
    outline: 2.5px solid white;
    outline-offset: -2px;
    transform: scale(1.03);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-color, var(--qc-primary)) 40%, transparent);
}

.qs-theme-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
    line-height: 1;
}

.qs-theme-name {
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    margin-bottom: 3px;
    line-height: 1.15;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.qs-theme-count {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
    background: rgba(255,255,255,0.18);
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
}

/* Mix theme special card */
.qs-theme-mix {
    grid-column: 1 / -1;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qs-theme-mix .qs-theme-icon { margin-bottom: 0; }
.qs-theme-mix .qs-theme-name { margin-bottom: 0; }

/* --- Skeleton loading cards --- */
.qs-skeleton-card {
    background: linear-gradient(135deg, #2a2a3e, #1e1e30);
    border: 2px solid rgba(255,255,255,0.05);
    border-radius: var(--qc-radius);
    padding: 12px 8px;
    min-height: 70px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* --- Loading progress text & bar --- */
.qs-loading-text {
    text-align: center;
    font-size: 0.82rem;
    color: var(--qc-text-light);
    padding: 0 16px 8px;
    font-weight: 500;
}

.qs-loading-bar {
    height: 3px;
    background: var(--qc-border);
    border-radius: 3px;
    margin: 0 16px 10px;
    overflow: hidden;
}

.qs-loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--qc-primary), var(--qc-primary-dark));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* --- Config section (pill groups) --- */
.qs-config-section {
    padding: 6px 16px 4px;
    border-top: 1px solid var(--qc-border);
    background: var(--qc-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qs-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qs-config-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--qc-text-light);
    min-width: 66px;
    flex-shrink: 0;
}

.qs-pill-group {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid var(--qc-border);
    flex-wrap: wrap;
}

.qs-pill {
    padding: 4px 12px;
    border: none;
    background: var(--qc-card-bg);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--qc-text);
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid var(--qc-border);
    white-space: nowrap;
}

.qs-pill:last-child {
    border-right: none;
}

.qs-pill:hover {
    background: color-mix(in srgb, var(--qc-primary) 10%, white);
    color: var(--qc-primary-dark);
}

.qs-pill.active {
    background: var(--qc-primary);
    color: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

/* Actions — Bouton lancer */
.qs-actions {
    padding: 5px 16px;
    text-align: center;
}

.qs-launch-btn {
    width: 100%;
    padding: 10px 24px;
    border: none;
    border-radius: var(--qc-radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, var(--qc-primary), var(--qc-primary-dark));
    color: white;
    letter-spacing: 0.3px;
    position: relative;
}

.qs-launch-btn:disabled {
    background: var(--qc-border);
    color: var(--qc-text-light);
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

.qs-launch-btn:not(:disabled) {
    animation: launch-pulse 2s ease-in-out infinite;
}

.qs-launch-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45);
    animation: none;
}

@keyframes launch-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25); }
    50% { box-shadow: 0 2px 20px rgba(245, 158, 11, 0.5); }
}

/* --- Stats bar --- */
.qs-stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 6px 16px;
    border-top: 1px solid var(--qc-border);
}

.qs-stats-bar:empty {
    display: none;
}

.qs-stat {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.qs-stat-val {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--qc-primary);
}

.qs-stat-label {
    font-size: 0.65rem;
    color: var(--qc-text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Recent history --- */
.qs-history {
    padding: 0 16px 8px;
}

.qs-history:empty {
    display: none;
}

.qs-history-title {
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--qc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.qs-history-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
}

.qs-history-list::-webkit-scrollbar {
    height: 3px;
}

.qs-history-list::-webkit-scrollbar-thumb {
    background: var(--qc-border);
    border-radius: 3px;
}

.qs-history-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 130px;
    flex-shrink: 0;
    background: var(--qc-card-bg);
    border: 1px solid var(--qc-border);
    border-radius: 6px;
    padding: 5px 10px;
    scroll-snap-align: start;
}

.qs-history-score {
    font-weight: 800;
    font-size: 0.95rem;
    min-width: 32px;
    text-align: center;
}

.qs-history-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.qs-history-theme {
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--qc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qs-history-meta {
    font-size: 0.65rem;
    color: var(--qc-text-light);
}

/* Lien mode avancé */
.qs-advanced-link {
    text-align: center;
    padding: 0 16px 8px;
}

.qs-advanced-btn {
    background: none;
    border: none;
    color: var(--qc-text-light);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s;
}

.qs-advanced-btn:hover {
    color: var(--qc-primary);
}

/* Barre retour Quick Start */
.qs-back-bar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--qc-border);
}

.qs-back-btn {
    background: none;
    border: none;
    color: var(--qc-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--qc-radius-sm);
    transition: background 0.15s;
}

.qs-back-btn:hover {
    background: rgba(245, 158, 11, 0.1);
}

/* =========================================
   QuizRunner — Per-question countdown timer
   ========================================= */

.qr-question-timer-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 2px;
    flex-shrink: 0;
}

.qr-question-timer-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--qc-border);
    border-radius: 3px;
    overflow: hidden;
}

.qr-question-timer-bar {
    height: 100%;
    width: 100%;
    background: var(--qc-primary);
    border-radius: 3px;
    transition: width 1s linear;
}

.qr-question-timer-text {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--qc-text);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Timer warning state (≤ 5s) */
.qr-timer-warning .qr-question-timer-text {
    color: var(--qc-primary);
}

.qr-timer-bar-warn {
    background: var(--qc-primary) !important;
    animation: timer-bar-pulse 0.8s ease-in-out infinite;
}

/* Timer critical state (≤ 3s) */
.qr-timer-critical .qr-question-timer-text {
    color: var(--qc-danger);
    animation: timer-text-pulse 0.5s ease-in-out infinite;
}

.qr-timer-bar-crit {
    background: var(--qc-danger) !important;
    animation: timer-bar-pulse 0.4s ease-in-out infinite;
}

@keyframes timer-bar-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

@keyframes timer-text-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.08); }
}

/* =========================================
   Responsive Quick Start
   ========================================= */
@media (max-width: 640px) {
    .qs-themes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 10px 10px 6px;
    }
    .qs-theme-card {
        padding: 10px 6px 8px;
    }
    .qs-theme-icon { font-size: 1.1rem; }
    .qs-theme-name { font-size: 0.72rem; }
    .qs-config-section { padding: 5px 10px 3px; gap: 3px; }
    .qs-config-row { flex-direction: column; gap: 2px; align-items: stretch; }
    .qs-config-label { min-width: unset; font-size: 0.7rem; }
    .qs-pill { padding: 4px 8px; font-size: 0.72rem; flex: 1; text-align: center; }
    .qs-stats-bar { gap: 14px; padding: 5px 10px; }
    .qs-history { padding: 0 10px 6px; }
}
